|
@@ -481,6 +481,8 @@
|
|
|
this.getplanData(data.id, 'change');
|
|
this.getplanData(data.id, 'change');
|
|
|
},
|
|
},
|
|
|
async supplierSelect(row) {
|
|
async supplierSelect(row) {
|
|
|
|
|
+ console.log(row);
|
|
|
|
|
+
|
|
|
if (!row) {
|
|
if (!row) {
|
|
|
this.$message.warning('请选择供应商');
|
|
this.$message.warning('请选择供应商');
|
|
|
return;
|
|
return;
|
|
@@ -502,15 +504,15 @@
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- setIsInquiry() {
|
|
|
|
|
- let supplierList = [];
|
|
|
|
|
|
|
+ setIsInquiry(supplierList) {
|
|
|
|
|
+
|
|
|
|
|
|
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
|
- this.supplierList.forEach((item) => {
|
|
|
|
|
- supplierList.push(
|
|
|
|
|
- this.$refs['inquiryTable' + item.supplierId][0].getTableValue()
|
|
|
|
|
- );
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ // this.supplierList.forEach((item) => {
|
|
|
|
|
+ // supplierList.push(
|
|
|
|
|
+ // this.$refs['inquiryTable' + item.supplierId][0].getTableValue()
|
|
|
|
|
+ // );
|
|
|
|
|
+ // });
|
|
|
this.$refs.inventoryTable.setIsInquiry(supplierList);
|
|
this.$refs.inventoryTable.setIsInquiry(supplierList);
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
@@ -538,26 +540,27 @@
|
|
|
};
|
|
};
|
|
|
let supplierIds = this.supplierList.map((item) => item.supplierId);
|
|
let supplierIds = this.supplierList.map((item) => item.supplierId);
|
|
|
let supplierIndex = supplierIds.indexOf(data.base.id);
|
|
let supplierIndex = supplierIds.indexOf(data.base.id);
|
|
|
|
|
+ console.log(supplierIndex);
|
|
|
if (supplierIndex == -1) {
|
|
if (supplierIndex == -1) {
|
|
|
this.supplierList.push(params);
|
|
this.supplierList.push(params);
|
|
|
} else {
|
|
} else {
|
|
|
- let isHave = this.supplierList[supplierIndex].resultList.some(
|
|
|
|
|
- (item) => item.productCode == obj.productCode
|
|
|
|
|
- );
|
|
|
|
|
- if (!isHave) {
|
|
|
|
|
- // putTableValue
|
|
|
|
|
- //this.supplierList[supplierIndex].resultList.push(obj)
|
|
|
|
|
- this.$set(this.supplierList[supplierIndex], 'resultList', [
|
|
|
|
|
- ...this.supplierList[supplierIndex].resultList,
|
|
|
|
|
- obj
|
|
|
|
|
- ]);
|
|
|
|
|
- this.$nextTick(() => {
|
|
|
|
|
- this.$refs['inquiryTable' + data.base.id][0]?.putTableValue(
|
|
|
|
|
- this.supplierList[supplierIndex].resultList
|
|
|
|
|
- );
|
|
|
|
|
- this.$refs['inquiryTable' + data.base.id][0]?.getSpanArr();
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // let isHave = this.supplierList[supplierIndex].resultList.some(
|
|
|
|
|
+ // (item) => item.productCode == obj.productCode
|
|
|
|
|
+ // );
|
|
|
|
|
+ // if (!isHave) {
|
|
|
|
|
+ // putTableValue
|
|
|
|
|
+ //this.supplierList[supplierIndex].resultList.push(obj)
|
|
|
|
|
+ this.$set(this.supplierList[supplierIndex], 'resultList', [
|
|
|
|
|
+ ...this.supplierList[supplierIndex].resultList,
|
|
|
|
|
+ obj
|
|
|
|
|
+ ]);
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
|
+ this.$refs['inquiryTable' + data.base.id][0]?.putTableValue(
|
|
|
|
|
+ this.supplierList[supplierIndex].resultList
|
|
|
|
|
+ );
|
|
|
|
|
+ this.$refs['inquiryTable' + data.base.id][0]?.getSpanArr();
|
|
|
|
|
+ });
|
|
|
|
|
+ // }
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
//供应商回调
|
|
//供应商回调
|
|
@@ -591,7 +594,7 @@
|
|
|
(i) => i.productCode == val.productCode
|
|
(i) => i.productCode == val.productCode
|
|
|
);
|
|
);
|
|
|
console.log(isHave, supplierIndex);
|
|
console.log(isHave, supplierIndex);
|
|
|
- if (!isHave) {
|
|
|
|
|
|
|
+ // if (!isHave) {
|
|
|
this.$set(this.supplierList[supplierIndex], 'resultList', [
|
|
this.$set(this.supplierList[supplierIndex], 'resultList', [
|
|
|
...this.supplierList[supplierIndex].resultList,
|
|
...this.supplierList[supplierIndex].resultList,
|
|
|
val
|
|
val
|
|
@@ -602,41 +605,41 @@
|
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
|
this.$refs['inquiryTable' + item.id][0]?.getSpanArr();
|
|
this.$refs['inquiryTable' + item.id][0]?.getSpanArr();
|
|
|
});
|
|
});
|
|
|
- }
|
|
|
|
|
|
|
+ // }
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
async save(type) {
|
|
async save(type) {
|
|
|
- let supplierList = [];
|
|
|
|
|
- this.setIsInquiry();
|
|
|
|
|
- // return
|
|
|
|
|
-
|
|
|
|
|
- this.supplierList.forEach((item) => {
|
|
|
|
|
- supplierList.push(
|
|
|
|
|
- this.$refs['inquiryTable' + item.supplierId][0].getTableValue()
|
|
|
|
|
- );
|
|
|
|
|
- });
|
|
|
|
|
- let is=false
|
|
|
|
|
- supplierList.forEach((item) => {
|
|
|
|
|
- item.resultList.forEach((val) => {
|
|
|
|
|
- val['technicalDrawings'] = [];
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ await this.getValidate();
|
|
|
|
|
+
|
|
|
|
|
+ let supplierList = [];
|
|
|
|
|
|
|
|
- if(val.minimumOrderQuantity>val.totalCount){
|
|
|
|
|
- is=true
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ this.supplierList.forEach((item) => {
|
|
|
|
|
+ supplierList.push(
|
|
|
|
|
+ this.$refs['inquiryTable' + item.supplierId][0].getTableValue()
|
|
|
|
|
+ );
|
|
|
});
|
|
});
|
|
|
- });
|
|
|
|
|
- if(is){
|
|
|
|
|
- this.$message.warning('购买数量不能小于最低订购量!');
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ this.setIsInquiry(supplierList);
|
|
|
|
|
+ let is = false;
|
|
|
|
|
+ supplierList.forEach((item) => {
|
|
|
|
|
+ item.resultList.forEach((val) => {
|
|
|
|
|
+ val['technicalDrawings'] = [];
|
|
|
|
|
+
|
|
|
|
|
+ if (val.minimumOrderQuantity > val.totalCount) {
|
|
|
|
|
+ is = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+ if (is) {
|
|
|
|
|
+ this.$message.warning('购买数量不能小于最低订购量!');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- this.form.detailList = this.list;
|
|
|
|
|
- this.form.supplierList = supplierList;
|
|
|
|
|
- try {
|
|
|
|
|
- await this.getValidate();
|
|
|
|
|
|
|
+ this.form.detailList = this.list;
|
|
|
|
|
+ this.form.supplierList = supplierList;
|
|
|
// let arr = this.form.supplierList.map(item => item.resultList).flat(2);
|
|
// let arr = this.form.supplierList.map(item => item.resultList).flat(2);
|
|
|
// console.log(arr);
|
|
// console.log(arr);
|
|
|
// let a = _.groupBy(arr,'productName')
|
|
// let a = _.groupBy(arr,'productName')
|