Browse Source

物流单bug修复

qymljy 3 months ago
parent
commit
ca8918fca0

+ 10 - 7
src/HDrpManagement/logistics/details/tabs/logisticsBox/add.vue

@@ -30,6 +30,11 @@
               :data="tableData"
               size="small"
               border>
+              <el-table-column
+                  prop="billno"
+                  :label="$t(`发货单号`)"
+                  width="180">
+              </el-table-column>
               <el-table-column
                 prop="itemno"
                 :label="$t(`产品编码`)"
@@ -180,9 +185,7 @@ export default {
         }
       })
       if(res.data.length) {
-        this.tableData.push(...res.data)
-        const res2 = new Map();
-        this.tableData = this.tableData.filter((item) => !res2.has(item['itemno']) && res2.set(item['itemno'], 1));
+        this.tableData = res.data
         this.$refs.logislist.tableData = []
       }
     },
@@ -191,15 +194,15 @@ export default {
     },
     onConfirm (val) {
       this.tableData = [...val,...this.tableData]
-      const res = new Map();
-      this.tableData = this.tableData.filter((item) => !res.has(item['itemno']) && res.set(item['itemno'], 1));
+      // const res = new Map();
+      // this.tableData = this.tableData.filter((item) => !res.has(item['itemno']) && res.set(item['itemno'], 1));
     },
     deleteRow (row) {
       this.tableData = this.tableData.filter(e=>{
-        if (e.itemno !== row.itemno)
+        if (e.sa_dispatch_itemsid !== row.sa_dispatch_itemsid)
         return e
       })
-
+      this.$refs.logislist.listData()
     }
   }
 }

+ 36 - 17
src/HDrpManagement/logistics/details/tabs/logisticsBox/edit.vue

@@ -30,6 +30,11 @@
               :data="tableData"
               size="small"
               border>
+              <el-table-column
+                  prop="billno"
+                  :label="$t(`发货单号`)"
+                  width="180">
+              </el-table-column>
               <el-table-column
                 prop="itemno"
                 :label="$t(`产品编码`)"
@@ -77,7 +82,7 @@
             </el-table>
           </el-col>
           <el-col :span="24 - setcol">
-            <logisticsCanUseProduct ref="logislist" :sa_logistics_boxid="0" @onConfirm="onConfirm">
+            <logisticsCanUseProduct ref="logislist" :sa_logistics_boxid="this.data.sa_logistics_boxid" @onConfirm="onConfirm" :addList="delList" type="edit">
               <el-button class="inline-16" slot="allBtn" type="primary" size="small" @click="handlePullData">{{$t(`一键全选`)}}</el-button>
             </logisticsCanUseProduct>
           </el-col>
@@ -100,7 +105,8 @@ export default {
       drawer:false,
       form:{},
       setcol:24,
-      tableData:[]
+      tableData:[],
+      delList:[]
     }
   },
   components:{
@@ -109,9 +115,23 @@ export default {
   methods:{
     onShow () {
       this.form = Object.assign({},this.form,this.data)
+      console.log(this.data,'data22222')
+      this.delList = []
       this.listData()
     },
     async onSubmit (){
+      let delID = []
+      delID = this.delList.map(item=>item.sa_logistics_boxmxid)
+      const res1 = await this.$api.requested({
+        "id": "20230109155504",
+        "content": {
+          "sa_logisticsid":this.data.sa_logisticsid,
+          "sa_logistics_boxmxids":delID
+        }
+      })
+      if (res1.code == 0){
+        this.tool.showMessage(res,()=>{})
+      }
       const res = await this.$api.requested({
         "id": "20230109155104",
         "content": {
@@ -139,21 +159,19 @@ export default {
     },
     onConfirm (val) {
       this.tableData = [...val,...this.tableData]
-      const res = new Map();
-      this.tableData = this.tableData.filter((item) => !res.has(item['itemno']) && res.set(item['itemno'], 1));
+      // const res = new Map();
+      // this.tableData = this.tableData.filter((item) => !res.has(item['itemno']) && res.set(item['itemno'], 1));
     },
     async deleteRow (row) {
-      const res = await this.$api.requested({
-        "id": "20230109155504",
-        "content": {
-            "sa_logisticsid":this.data.sa_logisticsid,
-            "sa_logistics_boxmxids":[row.sa_logistics_boxmxid]
-        }
-      })
-      this.tool.showMessage(res,()=>{
-        this.$emit('onSuccess')
-        this.listData()
+      this.tableData = this.tableData.filter(e=>{
+        if (e.sa_dispatch_itemsid !== row.sa_dispatch_itemsid)
+          return e
       })
+      console.log(row,'row删除')
+      let delNew = []
+      delNew[0] = row
+      this.delList = [...this.delList,...delNew]
+      this.$refs.logislist.listData()
     },
     async handlePullData () {
       let res = await this.$api.requested({
@@ -169,9 +187,10 @@ export default {
         }
       })
       if(res.data.length) {
-        this.tableData.push(...res.data)
-        const res2 = new Map();
-        this.tableData = this.tableData.filter((item) => !res2.has(item['itemno']) && res2.set(item['itemno'], 1));
+        this.tableData = res.data
+        // this.tableData.push(...res.data)
+        // const res2 = new Map();
+        // this.tableData = this.tableData.filter((item) => !res2.has(item['itemno']) && res2.set(item['itemno'], 1));
         this.$refs.logislist.tableData = []
       }
     },

+ 2 - 1
src/HDrpManagement/logistics/details/tabs/logisticsBox/logisticsBoxmx.vue

@@ -69,11 +69,12 @@ export default {
   data () {
     return {
       params:{
-        "id": 20230109155304,
+        "id": 2025073110370102,
         "content": {
           "pageNumber": 1,
           "pageSize": 20,
           "sa_logistics_boxid":0,
+          "sa_logisticsid":this.$route.query.id,
           "where": {
             "condition": ""
           }

+ 6 - 2
src/HDrpManagement/logistics/modules/add.vue

@@ -65,10 +65,10 @@
         </div>
         <el-row :gutter="10">
           <el-col :span="setcol">
-            <dispatch-table type="add" ref="dislist" status="新建"></dispatch-table>
+            <dispatch-table type="add" ref="dislist" status="新建" @delSuccess="delSuccess"></dispatch-table>
           </el-col>
           <el-col :span="24 - setcol">
-            <add-disbill v-if="drawer" ref="addbill" :data="enterpriseInfo" :paytype="form.paytype" @onConfirm="onConfirm" :addList="selectList"></add-disbill>
+            <addDisbill v-if="drawer" ref="addbill" :data="enterpriseInfo" :paytype="form.paytype" @onConfirm="onConfirm" :addList="selectList"></addDisbill>
           </el-col>
         </el-row>
       </div>
@@ -204,6 +204,10 @@ export default {
       this.isCorrelate = 0
       this.$refs.dislist.tableData = []
       this.enterpriseInfo = null
+    },
+    delSuccess(data){
+      this.selectList = data
+      this.$refs.addbill.listData()
     }
   }
 }

+ 1 - 1
src/HDrpManagement/logistics/modules/dispatchTable.vue

@@ -56,7 +56,7 @@
           this.tableData = this.tableData.filter(e=>{
             return e.sa_dispatchid !== row.sa_dispatchid
           })
-
+          this.$emit('delSuccess',this.tableData,row)
         }
       },
       async listData(val){

+ 41 - 21
src/HDrpManagement/logistics/modules/edit.vue

@@ -69,7 +69,7 @@ ed<template>
             <dispatch-table type="edit" :needQuery="false" ref="dislist" @isCorrelation="isCorrelation" @delSuccess="delSuccess" :status="data.status"></dispatch-table>
           </el-col>
           <el-col :span="24 - setcol">
-            <add-disbill ref="addbill" :data="enterpriseInfo" @onConfirm="onConfirm" :addList="selectList"></add-disbill>
+            <addDisbill ref="addbill" :data="enterpriseInfo" @onConfirm="onConfirm" :addList="selectList"></addDisbill>
           </el-col>
         </el-row>
       </div>
@@ -118,6 +118,7 @@ export default {
       setcol:24,
       isCorrelate:0,
       selectList:[],
+      delList:[],
       form:{
        "freightamount": "",
         "logisticno": "",
@@ -145,6 +146,7 @@ export default {
     onShow () {
       this.form = Object.assign({},this.form,this.data)
       this.enterpriseInfo = this.data
+      this.delList = []
       this.$nextTick(()=>{
         this.$refs['ent'].form.enterprisename = this.data.enterprisename
         this.$refs['logis'].form.abbreviation = this.data.logiscomp_enterprisename
@@ -154,7 +156,11 @@ export default {
       })
 
     },
-    delSuccess(){
+    delSuccess(data,row){
+      this.selectList = data
+      const delNew = []
+      delNew[0] = row
+      this.delList = [...this.delList,...delNew]
       this.$refs['addbill'].listData()
     },
     isCorrelation(val,data){
@@ -195,25 +201,39 @@ export default {
         "id": "202212004124804",
         "content": this.form
       })
-      this.tool.showMessage(res,()=>{
-        this.drawer = false
-        this.$emit('onSuccess')
-        this.form = {
-          "freightamount": "",
-          "logisticno": "",
-          "paytype": "",
-          "remarks": "",
-          "sa_dispatchids": [],
-          "sa_logiscompid": 0,
-          "sa_logisticsid": 0,
-          "sys_enterpriseid": '',
-          "carnum":"",
-          "logisphone":"",
-          "logiscontact":"",
-          "rec_contactsid":'',
-          "billdate":''
-        }
-      })
+      if (res.code == 0){
+        this.tool.showMessage(res,()=>{})
+      }else {
+        let delId = []
+        console.log(this.delList,'99999999%%%')
+        delId = this.delList.map(item=>item.sa_logistics_itemsid)
+        const res1 = await this.$api.requested({
+          "id": "20221122133404",
+          "content": {
+            "sa_logisticsid":this.$route.query.id,
+            "sa_logistics_itemsids":delId
+          }
+        })
+        this.tool.showMessage(res1,()=>{
+          this.drawer = false
+          this.$emit('onSuccess')
+          this.form = {
+            "freightamount": "",
+            "logisticno": "",
+            "paytype": "",
+            "remarks": "",
+            "sa_dispatchids": [],
+            "sa_logiscompid": 0,
+            "sa_logisticsid": 0,
+            "sys_enterpriseid": '',
+            "carnum":"",
+            "logisphone":"",
+            "logiscontact":"",
+            "rec_contactsid":'',
+            "billdate":''
+          }
+        })
+      }
     },
     onClose () {
       this.$refs['ent'].form = this.$refs['logis'].form = {}

+ 32 - 25
src/template/logisticsCanUseProduct/index.vue

@@ -79,7 +79,7 @@
 
 <script>
 export default {
-  props:['sa_logistics_boxid','addList'],
+  props:['sa_logistics_boxid','addList','type'],
   data () {
     return {
       params:{
@@ -103,33 +103,40 @@ export default {
   },
   methods:{
     async listData () {
-      console.log(this.addList)
       this.params.content.sa_logisticsid = this.$route.query.id
       this.params.content.sa_logistics_boxid = this.sa_logistics_boxid
       const res = await this.$api.requested(this.params)
       res.data.forEach(e => {
         e.remarks = ''
       });
-      if (this.addList && this.addList.length > 0){
-        let indexof = 0
-        let dataNew = []
-        res.data.forEach((t,indexs)=>{
-          let float = 0
-          this.addList.forEach((i,index)=>{
-            if (t.itemid == i.itemid){
-              float = 1
+      if (this.type == 'edit'){
+        this.tableData = res.data
+        if (this.addList && this.addList.length > 0){
+          this.tableData = [...this.tableData,...this.addList]
+        }
+      }else {
+        if (this.addList && this.addList.length > 0){
+          let indexof = 0
+          let dataNew = []
+          res.data.forEach((t,indexs)=>{
+            let float = 0
+            this.addList.forEach((i,index)=>{
+              if (t.sa_dispatch_itemsid == i.sa_dispatch_itemsid){
+                float = 1
+              }
+            })
+            if (float != 1){
+              dataNew[indexof] = res.data[indexs]
+              indexof = indexof + 1
             }
           })
-          if (float != 1){
-            dataNew[indexof] = res.data[indexs]
-            indexof = indexof + 1
-          }
-        })
-        this.tableData = dataNew
+          this.tableData = dataNew
 
-      }else {
-        this.tableData = res.data
+        }else {
+          this.tableData = res.data
+        }
       }
+
       // this.tableData = res.data
       // this.total = res.total
       // this.currentPage = res.pageNumber
@@ -148,13 +155,13 @@ export default {
       this.tableSelectData = val
     },
     onConfirm () {
-      this.tableSelectData.forEach((item,index) => {
-        this.tableData.forEach((item2,indexs) => {
-          if (item.itemid == item2.itemid) {
-            this.tableData.splice(indexs,1)
-          }
-        })
-      })
+      // this.tableSelectData.forEach((item,index) => {
+      //   this.tableData.forEach((item2,indexs) => {
+      //     if (item.itemid == item2.itemid) {
+      //       this.tableData.splice(indexs,1)
+      //     }
+      //   })
+      // })
       this.$emit('onConfirm',this.tableSelectData)
     },
   }