lilei 3 tahun lalu
induk
melakukan
36d72c757d
1 mengubah file dengan 27 tambahan dan 10 penghapusan
  1. 27 10
      src/views/salesManagement/outboundOrder/list.vue

+ 27 - 10
src/views/salesManagement/outboundOrder/list.vue

@@ -73,7 +73,7 @@
               </a-col>
             </template>
             <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
-              <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="outboundOrderList-refresh">查询</a-button>
+              <a-button type="primary" @click="searchTable" :disabled="disabled" id="outboundOrderList-refresh">查询</a-button>
               <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="outboundOrderList-reset">重置</a-button>
               <a @click="advanced=!advanced" style="margin-left: 5px">
                 {{ advanced ? '收起' : '展开' }}
@@ -259,6 +259,10 @@ export default {
       this.queryParam.beginDate = date[0]
       this.queryParam.endDate = date[1]
     },
+    searchTable () {
+      this.$refs.table.clearSelected() // 清空表格选中项
+      this.$refs.table.refresh(true)
+    },
     //  重置
     resetSearchForm () {
       this.$refs.rangeDate.resetDate(this.time)
@@ -309,7 +313,8 @@ export default {
         }]
       } else { //  批量出库
         content = '确认要批量出库吗?'
-        if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1)) {
+        const selectKeys = this.rowSelectionInfo ? this.rowSelectionInfo.selectedRowKeys : []
+        if (!this.rowSelectionInfo || (selectKeys.length < 1)) {
           this.$message.warning('请在列表勾选后再进行批量操作!')
           return
         }
@@ -325,7 +330,13 @@ export default {
           return
         }
         params = []
-        this.rowSelectionInfo && this.rowSelectionInfo.selectedRows.map(item => {
+        // 根据审核时间排序
+        list.sort(function (a, b) {
+          const t1 = new Date(a.auditTime).getTime()
+          const t2 = new Date(b.auditTime).getTime()
+          return t2 - t1
+        })
+        list.map(item => {
           params.push({
             stockOutSn: item.stockOutSn,
             outBizSn: item.outBizSn,
@@ -378,22 +389,28 @@ export default {
         stockOutSnList = [row.stockOutSn]
         this.getCustome([row], stockOutSnList)
       } else { //  批量发货
-        const slen = _this.rowSelectionInfo.selectedRowKeys.length
+        const list = _this.rowSelectionInfo ? _this.rowSelectionInfo.selectedRows : []
+        const slen = list.length
         if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && slen < 1)) {
           _this.$message.warning('请在列表勾选后再进行批量操作!')
           return
         }
-
+        // 根据审核时间排序
+        list.sort(function (a, b) {
+          const t1 = new Date(a.auditTime).getTime()
+          const t2 = new Date(b.auditTime).getTime()
+          return t2 - t1
+        })
         // 判断是否选择相同的客户
-        const demanderName = _this.rowSelectionInfo.selectedRows[0].demanderName
-        const haseq = _this.rowSelectionInfo.selectedRows.filter(item => item.demanderName == demanderName)
-        const hasSend = _this.rowSelectionInfo.selectedRows.find(item => item.sendFlag == 1)
+        const demanderName = list[0].demanderName
+        const haseq = list.filter(item => item.demanderName == demanderName)
+        const hasSend = list.find(item => item.sendFlag == 1)
         if (haseq.length == slen && !hasSend) {
           // 获取客户信息
-          _this.rowSelectionInfo.selectedRows.map(item => {
+          list.map(item => {
             stockOutSnList.push(item.stockOutSn)
           })
-          _this.getCustome(_this.rowSelectionInfo.selectedRows, stockOutSnList)
+          _this.getCustome(list, stockOutSnList)
         } else {
           this.$info({
             title: '操作提示',