yusheng 11 сар өмнө
parent
commit
b7db7b90b1

+ 4 - 1
src/views/purchasingManage/inquiryManage/components/inventoryTable.vue

@@ -185,7 +185,10 @@
             columnKey: 'selection',
             align: 'center',
             fixed: 'left',
-            show: this.isSupplier
+            show: this.isSupplier,
+            selectable: (row, index) => {
+              return row.isInquiry != 2;
+            }
           },
           {
             minWidth: 180,

+ 30 - 16
src/views/purchasingManage/purchasePlanManage/components/splitDialog.vue

@@ -429,7 +429,12 @@
             prop: 'totalCount',
             label: '数量',
             slot: 'totalCount',
-            align: 'center'
+            align: 'center',
+            filters: [
+              { value: 1, text: '未拆完' },
+              { value: 2, text: '已全部拆完' }
+            ],
+            filterMethod: this.isTotalCountFn
           },
           {
             width: 150,
@@ -583,10 +588,10 @@
           let remainCount = maxCount - usedCount;
           let availableCount = remainCount + row.totalCount;
           // +this.form.detailList[index].splitTotalCount
-          let splitTotalCount=row.oldTotalCount-remainCount
-    
-          console.log(maxCount,'splitTotalCount')
-          this.setFormCount(row.id, remainCount,splitTotalCount);
+          let splitTotalCount = row.oldTotalCount - remainCount;
+
+          console.log(maxCount, 'splitTotalCount');
+          this.setFormCount(row.id, remainCount, splitTotalCount);
           return availableCount;
         };
       }
@@ -600,10 +605,10 @@
         const data = await getplanDetail(id);
         this.loading = false;
         if (data) {
-          data.detailList.forEach(item=>{
-            item['oldTotalCount']=item.totalCount
-            item.totalCount=item.totalCount-item.splitTotalCount
-          })
+          data.detailList.forEach((item) => {
+            item['oldTotalCount'] = item.totalCount;
+            item.totalCount = item.totalCount - item.splitTotalCount;
+          });
           this.form = data;
           this.historyForm = deepClone(this.form);
           if (data.files && data.files.length > 0) {
@@ -613,7 +618,7 @@
           }
         }
       },
-      setFormCount(id, num,usedCount) {
+      setFormCount(id, num, usedCount) {
         let index = this.form.detailList.findIndex((item) => item.id == id);
         this.$set(this.form.detailList[index], 'totalCount', num);
         this.$set(this.form.detailList[index], 'splitTotalCount', usedCount);
@@ -636,7 +641,7 @@
         form.detailList = form.detailList.filter((item) =>
           this.selection.map((item) => item.id).includes(item.id)
         );
-        this.openStaffSelection(this.splitFormList.length)
+        this.openStaffSelection(this.splitFormList.length);
 
         this.splitFormList.push(form);
       },
@@ -674,7 +679,7 @@
         // console.log(this.selection[index], 'this.selection[index]');
       },
       openStaffSelection(index) {
-        console.log(index,'index')
+        console.log(index, 'index');
         this.$refs.staffSelection.open(
           this.splitFormList[index]?.responsibleName
             ? [
@@ -688,8 +693,8 @@
         this.currentIndex = index;
       },
       confirmStaffSelection(data) {
-        console.log(data,'data')
-          
+        console.log(data, 'data');
+
         this.$set(
           this.splitFormList[this.currentIndex],
           'responsibleId',
@@ -726,6 +731,15 @@
           );
         }
       },
+
+      isTotalCountFn(val, row) {
+        if (
+          (val == 1 && row.totalCount > 0) ||
+          (val == 2 && row.totalCount == 0)
+        ) {
+          return row;
+        }
+      },
       async save() {
         let copyList = deepClone(this.splitFormList);
         let isArrivalBatch = false;
@@ -744,11 +758,11 @@
           item.id = '';
         });
         copyList = copyList.filter((item) => item.detailList.length);
-        console.log([this.form,...copyList],'copyList')
+        console.log([this.form, ...copyList], 'copyList');
         // return
         if (isArrivalBatch)
           return this.$message.warning('因数量变化请重新设置分批到货时间');
-        await savePurchasePlanCutAPI([deepClone(this.form),...copyList]);
+        await savePurchasePlanCutAPI([deepClone(this.form), ...copyList]);
         this.$message.success('操作成功');
         this.$emit('done');
         this.cancel();