|
|
@@ -895,8 +895,10 @@
|
|
|
);
|
|
|
}
|
|
|
item.lackNum = null;
|
|
|
- if(item.bomVersionList?.length&&item.productType){
|
|
|
- item.bomVersionList=item.bomVersionList.filter(el=>el.bomType==item.productType)
|
|
|
+ if (item.bomVersionList?.length && item.productType) {
|
|
|
+ item.bomVersionList = item.bomVersionList.filter(
|
|
|
+ (el) => el.bomType == item.productType
|
|
|
+ );
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@@ -907,11 +909,6 @@
|
|
|
promiselist.push(this.getBomInfo(el));
|
|
|
});
|
|
|
await Promise.all(promiselist);
|
|
|
-
|
|
|
- console.log(this.disabledList, '3333');
|
|
|
- // let ids = res.productInfoList.map((item) => item.categoryId);
|
|
|
- // const data = await findBomCategoryByCategoryIds(ids);
|
|
|
- // this.handleResult(res.productInfoList, data, 'init');
|
|
|
}
|
|
|
|
|
|
this.disabledList = res.productInfoList;
|
|
|
@@ -919,9 +916,9 @@
|
|
|
const promiseProduct = [];
|
|
|
this.form.productInfoList.forEach(async (el, index) => {
|
|
|
let lis = el.producedList;
|
|
|
- if (!el.bomCategoryId && lis && lis.length > 0) {
|
|
|
- el.productType = el.producedList[0].code;
|
|
|
- promiseProduct.push(this.changeProductType(el, index));
|
|
|
+ if (lis && lis.length > 0) {
|
|
|
+ el.productType = el.productType || el.producedList[0].code;
|
|
|
+ promiseProduct.push(this.changeProductType(el, index, 'init'));
|
|
|
}
|
|
|
});
|
|
|
await Promise.all(promiseProduct);
|
|
|
@@ -1383,20 +1380,36 @@
|
|
|
},
|
|
|
|
|
|
// 选择生产类型
|
|
|
- async changeProductType(row, index) {
|
|
|
+ async changeProductType(row, index, type) {
|
|
|
let param = {
|
|
|
bomType: row.productType,
|
|
|
categoryId: row.categoryId
|
|
|
};
|
|
|
- this.wipeData(index);
|
|
|
+ if (type != 'init') {
|
|
|
+ this.wipeData(index);
|
|
|
+ }
|
|
|
const res = await bomListByPlan(param);
|
|
|
console.log(res, 'res 3333');
|
|
|
let arr = res || [];
|
|
|
- let data = this.form.productInfoList[index];
|
|
|
+ // let data = this.form.productInfoList[index];
|
|
|
if (arr.length) {
|
|
|
- this.form.productInfoList[index].bomVersionList = arr;
|
|
|
- row.bomCategoryId = arr[0].id;
|
|
|
- await this.changeBomId(row, index);
|
|
|
+ this.$set(this.form.productInfoList[index], 'bomVersionList', arr);
|
|
|
+
|
|
|
+ if (type == 'init') {
|
|
|
+ this.$set(
|
|
|
+ this.form.productInfoList[index],
|
|
|
+ 'bomCategoryId',
|
|
|
+ row.bomCategoryId || arr[0].id
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ this.$set(
|
|
|
+ this.form.productInfoList[index],
|
|
|
+ 'bomCategoryId',
|
|
|
+ arr[0].id
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ await this.changeBomId(row, index, type);
|
|
|
let arrAll = JSON.parse(JSON.stringify(this.form));
|
|
|
this.$set(this, 'form', arrAll);
|
|
|
}
|
|
|
@@ -1414,22 +1427,37 @@
|
|
|
},
|
|
|
|
|
|
// 选择BOM
|
|
|
- async changeBomId(row, index) {
|
|
|
- console.log(row, '这里看看吧');
|
|
|
+ async changeBomId(row, index, type) {
|
|
|
const res = await bomRoutingList(row.bomCategoryId);
|
|
|
let arr = res || [];
|
|
|
// if (arr.length == 0) {
|
|
|
// row.produceRoutingId = '';
|
|
|
// }
|
|
|
- console.log(arr, 'arr');
|
|
|
+ this.$set(this.form.productInfoList[index], 'routingList', arr);
|
|
|
if (arr.length > 0) {
|
|
|
- this.$set(this.form.productInfoList[index], 'routingList', arr);
|
|
|
- row.produceRoutingName = arr[0].name;
|
|
|
- this.$set(
|
|
|
- this.form.productInfoList[index],
|
|
|
- 'produceRoutingId',
|
|
|
- arr[0].id
|
|
|
- );
|
|
|
+ if (type == 'init') {
|
|
|
+ this.$set(
|
|
|
+ this.form.productInfoList[index],
|
|
|
+ 'produceRoutingName',
|
|
|
+ row.produceRoutingName || arr[0].name
|
|
|
+ );
|
|
|
+ this.$set(
|
|
|
+ this.form.productInfoList[index],
|
|
|
+ 'produceRoutingId',
|
|
|
+ row.produceRoutingId || arr[0].id
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ this.$set(
|
|
|
+ this.form.productInfoList[index],
|
|
|
+ 'produceRoutingName',
|
|
|
+ arr[0].name
|
|
|
+ );
|
|
|
+ this.$set(
|
|
|
+ this.form.productInfoList[index],
|
|
|
+ 'produceRoutingId',
|
|
|
+ arr[0].id
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|
|
|
this.$forceUpdate();
|
|
|
},
|