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