list.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  1. <template>
  2. <div>
  3. <a-card size="small" :bordered="false" class="searchBoxNormal">
  4. <!-- 搜索条件 -->
  5. <div ref="tableSearch" class="table-page-search-wrapper">
  6. <a-form layout="inline">
  7. <a-row :gutter="15">
  8. <a-col :md="6" :sm="24">
  9. <a-form-item label="创建时间">
  10. <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="24">
  14. <a-form-item label="客户名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
  15. <a-input id="sendOut-customeName" v-model.trim="queryParam.customeName" allowClear placeholder="请输入客户名称"/>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="发货单号">
  20. <a-input id="sendOut-sendBillNo" v-model.trim="queryParam.sendBillNo" allowClear placeholder="请输入发货单号"/>
  21. </a-form-item>
  22. </a-col>
  23. <template v-if="advanced">
  24. <a-col :md="6" :sm="24">
  25. <a-form-item label="收货状态">
  26. <v-select
  27. v-model="queryParam.receiveFlag"
  28. ref="receiveFlag"
  29. id="sendOut-receiveFlag"
  30. code="RECEIVE_FLAG"
  31. placeholder="请选择收货状态"
  32. allowClear></v-select>
  33. </a-form-item>
  34. </a-col>
  35. <a-col :md="6" :sm="24">
  36. <a-form-item label="托运日期">
  37. <rangeDate ref="sendDate" :value="sendtime" @change="sendDateChange" />
  38. </a-form-item>
  39. </a-col>
  40. <a-col :md="6" :sm="24">
  41. <a-form-item label="物流情况">
  42. <v-select
  43. v-model="queryParam.transportState"
  44. ref="transportState"
  45. id="sendOut-transportState"
  46. code="TRANSPORT_STATE"
  47. placeholder="请选择物流情况"
  48. allowClear></v-select>
  49. </a-form-item>
  50. </a-col>
  51. <a-col :md="6" :sm="24">
  52. <a-form-item label="关联业务单号">
  53. <a-input id="sendOut-bizNos" v-model.trim="queryParam.bizNos" allowClear placeholder="请输入备货或调拨单号"/>
  54. </a-form-item>
  55. </a-col>
  56. <a-col :md="6" :sm="24">
  57. <a-form-model-item label="所在区域">
  58. <subarea id="sendOut-subarea" ref="subarea" @change="subareaChange"></subarea>
  59. </a-form-model-item>
  60. </a-col>
  61. <a-col :md="6" :sm="24">
  62. <a-form-model-item label="地区" >
  63. <Area id="sendOut-provinceSn" v-model="queryParam.provinceSn" placeholder="请选择省"></Area>
  64. </a-form-model-item>
  65. </a-col>
  66. <a-col :md="6" :sm="24">
  67. <a-form-model-item label="仓库">
  68. <chooseWarehouse ref="warehouse" @load="warehouseLoad" v-model="queryParam.warehouseSn" :isPermission="true"></chooseWarehouse>
  69. </a-form-model-item>
  70. </a-col>
  71. <a-col :md="6" :sm="24" v-show="isShowCustomerSearch">
  72. <a-form-item label="客服">
  73. <customerService ref="customerName" v-model="queryParam.bizUserSn"></customerService>
  74. </a-form-item>
  75. </a-col>
  76. </template>
  77. <a-col :md="6" :sm="24">
  78. <span class="table-page-search-submitButtons">
  79. <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
  80. <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
  81. <a-button
  82. style="margin-left: 10px"
  83. type="primary"
  84. class="button-warning"
  85. @click="handleExport"
  86. :disabled="disabled"
  87. :loading="exportLoading"
  88. v-if="$hasPermissions('B_sendOutExport')"
  89. id="sendOut-export">导出</a-button>
  90. <a @click="advanced=!advanced" style="margin-left: 8px">
  91. {{ advanced ? '收起' : '展开' }}
  92. <a-icon :type="advanced ? 'up' : 'down'"/>
  93. </a>
  94. </span>
  95. </a-col>
  96. </a-row>
  97. </a-form>
  98. </div>
  99. </a-card>
  100. <a-card size="small" :bordered="false" class="sendOut-wrap">
  101. <a-spin :spinning="spinning" tip="Loading...">
  102. <!-- 操作按钮 -->
  103. <div v-if="isShowImport">
  104. <a-button type="primary" class="button-error" v-if="$hasPermissions('B_sendOutPlImport')" @click="openGuideModal=true">批量导入</a-button>
  105. </div>
  106. <!-- 列表 -->
  107. <s-table
  108. class="sTable fixPagination"
  109. ref="table"
  110. :style="{ height: tableHeight+70+'px' }"
  111. size="small"
  112. :rowKey="(record) => record.id"
  113. :columns="columns"
  114. :data="loadData"
  115. :scroll="{ y:tableHeight }"
  116. :defaultLoadData="false"
  117. bordered>
  118. <!-- 发货单号 -->
  119. <template slot="sendBillNo" slot-scope="text, record">
  120. <span class="link-bule" v-if="$hasPermissions('B_SooDetail')" @click="handleDetail(record,1)">{{ record.sendBillNo }}</span>
  121. <span v-else>{{ record.sendBillNo }}</span>
  122. </template>
  123. <!-- 操作 -->
  124. <template slot="action" slot-scope="text, record">
  125. <a-button
  126. size="small"
  127. type="link"
  128. class="button-warning"
  129. v-if="record.receiveFlag == 0&&$hasPermissions('B_SooEdit')"
  130. @click="handleEdit(record)"
  131. >编辑</a-button>
  132. <a-button
  133. size="small"
  134. type="link"
  135. class="button-warning"
  136. v-if="record.receiveFlag == 0&&$hasPermissions('B_WLGZ')"
  137. @click="handleDetail(record,0)"
  138. >物流跟踪</a-button>
  139. <span v-if="record.receiveFlag == 1">--</span>
  140. </template>
  141. </s-table>
  142. </a-spin>
  143. <!-- 发货单详情 -->
  144. <detailModal v-drag ref="detailModal" :openModal="showTipModal" @cancel="showTipModal=false" @ok="sendSuccess"></detailModal>
  145. <!-- 编辑发货单 -->
  146. <sendGoodModal
  147. v-drag
  148. ref="sendGoodModal"
  149. modalTit="编辑发货单"
  150. :openModal="showSendGoodModal"
  151. @ok="sendSuccess"
  152. @cancel="showSendGoodModal=false"></sendGoodModal>
  153. <!-- 导入发货单 -->
  154. <importGuideModal v-drag :openModal="openGuideModal" @close="openGuideModal=false" @ok="resetSearchForm" />
  155. </a-card>
  156. </div>
  157. </template>
  158. <script>
  159. import { commonMixin } from '@/utils/mixin'
  160. import rangeDate from '@/views/common/rangeDate.vue'
  161. import { hdExportExcel } from '@/libs/exportExcel'
  162. import { STable, VSelect } from '@/components'
  163. import detailModal from './detailModal.vue'
  164. import sendGoodModal from '../outboundOrder/sendGoodModal.vue'
  165. import Area from '@/views/common/area.js'
  166. import subarea from '@/views/common/subarea.js'
  167. import ImportGuideModal from './importGuideModal.vue'
  168. import chooseWarehouse from '@/views/common/chooseWarehouse'
  169. import customerService from '@/views/common/customerService'
  170. import { sendBillQueryPageList, sendBillExcel } from '@/api/sendBill'
  171. export default {
  172. name: 'SendOutOrderList',
  173. mixins: [commonMixin],
  174. components: { STable, VSelect, rangeDate, detailModal, sendGoodModal, Area, subarea, ImportGuideModal, chooseWarehouse, customerService },
  175. data () {
  176. return {
  177. spinning: false,
  178. exportLoading: false,
  179. advanced: true, // 高级搜索 展开/关闭
  180. disabled: false, // 查询、重置按钮是否可操作
  181. openGuideModal: false,
  182. tableHeight: 0,
  183. time: [],
  184. sendtime: [],
  185. // 查询参数
  186. queryParam: {
  187. beginDate: '',
  188. endDate: '',
  189. sendBeginDate: '',
  190. sendEndDate: '',
  191. customeName: undefined, // 客户名称
  192. sendBillNo: '', // 发货单号
  193. bizNos: '', // 业务单号
  194. transportState: undefined, // 物流状态
  195. receiveFlag: undefined, // 收货状态
  196. subareaArea: {
  197. subareaSn: undefined,
  198. subareaAreaSn: undefined
  199. },
  200. provinceSn: undefined,
  201. warehouseSn: undefined,
  202. bizUserSn: undefined
  203. },
  204. totalData: {
  205. totalAmount: 0,
  206. totalQty: 0,
  207. totalRecord: 0
  208. },
  209. showTipModal: false,
  210. showSendGoodModal: false,
  211. isShowImport: false,
  212. // 加载数据方法 必须为 Promise 对象
  213. loadData: parameter => {
  214. this.disabled = true
  215. this.spinning = true
  216. return sendBillQueryPageList(Object.assign(parameter, this.queryParam)).then(res => {
  217. let data
  218. if (res.status == 200) {
  219. data = res.data
  220. const no = (data.pageNo - 1) * data.pageSize
  221. for (var i = 0; i < data.list.length; i++) {
  222. data.list[i].no = no + i + 1
  223. }
  224. this.disabled = false
  225. }
  226. this.spinning = false
  227. return data
  228. })
  229. }
  230. }
  231. },
  232. computed: {
  233. columns () {
  234. const _this = this
  235. const arr = [
  236. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  237. { title: '创建时间', dataIndex: 'createDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  238. { title: '发货单号', scopedSlots: { customRender: 'sendBillNo' }, width: '12%', align: 'center' },
  239. { title: '区域', dataIndex: 'subareaArea.subareaName', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  240. { title: '分区', dataIndex: 'subareaArea.subareaAreaName', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  241. { title: '地区', dataIndex: 'provinceName', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  242. { title: '客户名称', dataIndex: 'customeName', width: '12%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  243. // { title: '仓库', dataIndex: 'warehouseName', width: '10%', align: 'left', customRender: function (text) { return text || '--' } },
  244. { title: '托运日期', dataIndex: 'sendDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  245. { title: '收货人', dataIndex: 'customerCacateName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  246. { title: '物流电话', dataIndex: 'transportTele', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  247. { title: '物流单号', dataIndex: 'transportNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  248. { title: '总件数', dataIndex: 'totalQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  249. { title: '运费合计', dataIndex: 'totalSendAmount', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  250. { title: '收货状态', dataIndex: 'receiveFlagDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  251. { title: '收款时间', dataIndex: 'settleTime', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  252. { title: '收货时间', dataIndex: 'receiveDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  253. { title: '物流情况', dataIndex: 'transportStateDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  254. { title: '备注', dataIndex: 'transportRemark', width: '8%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  255. { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
  256. ]
  257. if (this.isShowWarehouse) {
  258. arr.splice(7, 0, { title: '仓库', dataIndex: 'warehouseName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } })
  259. }
  260. return arr
  261. }
  262. },
  263. methods: {
  264. // 时间 change
  265. dateChange (date) {
  266. this.queryParam.beginDate = date[0]
  267. this.queryParam.endDate = date[1]
  268. },
  269. sendDateChange (date) {
  270. this.queryParam.sendBeginDate = date[0]
  271. this.queryParam.sendEndDate = date[1]
  272. },
  273. warehouseLoad (def, data) {
  274. this.isShowImport = data.length == 1
  275. },
  276. // 详情
  277. handleDetail (row, type) {
  278. this.showTipModal = true
  279. this.$refs.detailModal.getDetail(row, type, type ? '发货单详情' : '物流跟踪')
  280. },
  281. // 编辑
  282. handleEdit (row) {
  283. this.showSendGoodModal = true
  284. this.$refs.sendGoodModal.getDetail(row)
  285. },
  286. sendSuccess () {
  287. this.showSendGoodModal = false
  288. this.showTipModal = false
  289. this.$refs.table.refresh()
  290. },
  291. // 导出
  292. handleExport () {
  293. const _this = this
  294. _this.exportLoading = true
  295. _this.spinning = true
  296. hdExportExcel(sendBillExcel, _this.queryParam, '发货单列表', function () {
  297. _this.exportLoading = false
  298. _this.spinning = false
  299. })
  300. },
  301. subareaChange (val) {
  302. this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
  303. this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
  304. },
  305. // 重置
  306. resetSearchForm () {
  307. this.time = []
  308. this.$refs.rangeDate.resetDate(this.time)
  309. this.queryParam.beginDate = ''
  310. this.queryParam.endDate = ''
  311. this.sendtime = []
  312. this.$refs.sendDate.resetDate(this.sendtime)
  313. this.queryParam.sendBeginDate = ''
  314. this.queryParam.sendEndDate = ''
  315. this.queryParam.customeName = undefined
  316. this.queryParam.sendBillNo = ''
  317. this.queryParam.bizNos = ''
  318. this.queryParam.transportState = undefined
  319. this.queryParam.receiveFlag = undefined
  320. this.queryParam.subareaArea.subareaSn = undefined
  321. this.queryParam.subareaArea.subareaAreaSn = undefined
  322. this.queryParam.provinceSn = undefined
  323. this.queryParam.warehouseSn = undefined
  324. this.queryParam.bizUserSn = undefined
  325. if (this.advanced) {
  326. this.$refs.subarea.clearData()
  327. }
  328. this.$refs.table.refresh(true)
  329. },
  330. pageInit () {
  331. const _this = this
  332. this.$nextTick(() => { // 页面渲染完成后的回调
  333. _this.setTableH()
  334. })
  335. },
  336. setTableH () {
  337. const tableSearchH = this.$refs.tableSearch.offsetHeight
  338. this.tableHeight = window.innerHeight - tableSearchH - 210 - (this.isShowImport ? 30 : 0)
  339. }
  340. },
  341. watch: {
  342. advanced (newValue, oldValue) {
  343. const _this = this
  344. this.$nextTick(() => { // 页面渲染完成后的回调
  345. _this.setTableH()
  346. })
  347. },
  348. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  349. this.setTableH()
  350. }
  351. },
  352. mounted () {
  353. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  354. this.pageInit()
  355. this.resetSearchForm()
  356. }
  357. },
  358. activated () {
  359. // 如果是新页签打开,则重置当前页面
  360. if (this.$store.state.app.isNewTab) {
  361. this.pageInit()
  362. this.resetSearchForm()
  363. }
  364. // 仅刷新列表,不重置页面
  365. if (this.$store.state.app.updateList) {
  366. this.pageInit()
  367. this.$refs.table.refresh()
  368. }
  369. },
  370. beforeRouteEnter (to, from, next) {
  371. next(vm => {})
  372. }
  373. }
  374. </script>
  375. <style lang="less">
  376. .sendOut-wrap{
  377. .sTable{
  378. margin-top: 10px;
  379. }
  380. }
  381. </style>