|
@@ -69,8 +69,8 @@
|
|
|
<headerTitle title="产品信息"> </headerTitle>
|
|
<headerTitle title="产品信息"> </headerTitle>
|
|
|
|
|
|
|
|
<el-row :gutter="24">
|
|
<el-row :gutter="24">
|
|
|
- <ele-pro-table ref="tableRef" :columns="columns" row-key="code" :cache-key="`ProductionPlanTable`" :datasource="form.productInfoList"
|
|
|
|
|
- border height="40vh" key="id">
|
|
|
|
|
|
|
+ <ele-pro-table ref="tableRef" :columns="columns" row-key="code" :cache-key="`ProductionPlanTable`"
|
|
|
|
|
+ :datasource="form.productInfoList" border height="40vh" key="id">
|
|
|
|
|
|
|
|
|
|
|
|
|
<template v-slot:requiredFormingNum="{ row, $index }">
|
|
<template v-slot:requiredFormingNum="{ row, $index }">
|
|
@@ -261,32 +261,25 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
watch: {
|
|
watch: {
|
|
|
- factoryObj: {
|
|
|
|
|
- immediate: true,
|
|
|
|
|
- deep: true,
|
|
|
|
|
- handler(val) {
|
|
|
|
|
|
|
+ // factoryObj: {
|
|
|
|
|
+ // immediate: true,
|
|
|
|
|
+ // deep: true,
|
|
|
|
|
+ // handler(val) {
|
|
|
|
|
|
|
|
|
|
|
|
|
- // this.type = val;
|
|
|
|
|
- this.title = !val.id ? '新增临时生产计划' : '编辑临时生产计划';
|
|
|
|
|
- // this.form = this.factoryObj;
|
|
|
|
|
|
|
+ // // 修改
|
|
|
|
|
+ // // this.$nextTick(() => {
|
|
|
|
|
+ // // if (val.id) {
|
|
|
|
|
+ // // this.bomListVersion();
|
|
|
|
|
+ // // if (val.bomCategoryId) {
|
|
|
|
|
+ // // this.getPlanRouting();
|
|
|
|
|
+ // // }
|
|
|
|
|
|
|
|
- this.getFactoryList();
|
|
|
|
|
|
|
+ // // }
|
|
|
|
|
+ // // });
|
|
|
|
|
|
|
|
- this.form = val;
|
|
|
|
|
- // 修改
|
|
|
|
|
- this.$nextTick(() => {
|
|
|
|
|
- if (val.id) {
|
|
|
|
|
- this.bomListVersion();
|
|
|
|
|
- if (val.bomCategoryId) {
|
|
|
|
|
- this.getPlanRouting();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
|
clientEnvironmentId() {
|
|
clientEnvironmentId() {
|
|
@@ -576,17 +569,52 @@ export default {
|
|
|
async getFactoryList() {
|
|
async getFactoryList() {
|
|
|
this.factoryList = await getFactoryList();
|
|
this.factoryList = await getFactoryList();
|
|
|
},
|
|
},
|
|
|
- open() {
|
|
|
|
|
|
|
+ open(val) {
|
|
|
|
|
+ if (val) {
|
|
|
|
|
+ this.title = !val.id ? '新增临时生产计划' : '编辑临时生产计划';
|
|
|
|
|
+
|
|
|
|
|
+ this.getFactoryList();
|
|
|
|
|
+ this.form = val;
|
|
|
|
|
+ // 修改
|
|
|
|
|
+ if (val.id) {
|
|
|
|
|
|
|
|
|
|
+ if (Array.isArray(val.productInfoList) && val.productInfoList.length) {
|
|
|
|
|
+
|
|
|
|
|
+ this.form.productInfoList.map(async (v, index) => {
|
|
|
|
|
+ if (v.productType) {
|
|
|
|
|
+ this.$set(this.form.productInfoList[index], 'bomVersionList', await this.bomListVersionFn(v.productType, v.categoryId))
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ if (v.bomCategoryId) {
|
|
|
|
|
+ this.$set(this.form.productInfoList[index], 'routingList', await this.changeBomIdFn(v.bomCategoryId))
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ this.$forceUpdate()
|
|
|
|
|
+ }
|
|
|
this.visible = true;
|
|
this.visible = true;
|
|
|
- this.initForm();
|
|
|
|
|
- console.log('this.form123', this.form);
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // this.$nextTick(async () => {
|
|
|
|
|
+ // console.log(val.productInfoList);
|
|
|
|
|
+ // this.$set(this.form, 'productInfoList', val.productInfoList);
|
|
|
|
|
+ // this.$set(this.form, 'routingList', val.routingList);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ // });
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
//this.clientEnvironmentId 环境判断 宝悦环境
|
|
//this.clientEnvironmentId 环境判断 宝悦环境
|
|
|
- if (this.clientEnvironmentId == 4) {
|
|
|
|
|
- this.getPlanRoutingNew();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // if (this.clientEnvironmentId == 4) {
|
|
|
|
|
+ // this.getPlanRoutingNew();
|
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
// this.getPlanRoutingNew();
|
|
// this.getPlanRoutingNew();
|
|
|
},
|
|
},
|
|
@@ -688,6 +716,7 @@ export default {
|
|
|
this.bomListVersion();
|
|
this.bomListVersion();
|
|
|
|
|
|
|
|
},
|
|
},
|
|
|
|
|
+
|
|
|
changeLineNumber() {
|
|
changeLineNumber() {
|
|
|
this.form.productInfoList.map((item, index) => {
|
|
this.form.productInfoList.map((item, index) => {
|
|
|
item.lineNumber = 10 * (index + 1);
|
|
item.lineNumber = 10 * (index + 1);
|
|
@@ -697,7 +726,7 @@ export default {
|
|
|
this.$confirm('确定删除当前数据?', '提示')
|
|
this.$confirm('确定删除当前数据?', '提示')
|
|
|
.then(() => {
|
|
.then(() => {
|
|
|
const newArray = this.form.productInfoList.filter((item, i) => i !== index)
|
|
const newArray = this.form.productInfoList.filter((item, i) => i !== index)
|
|
|
- this.form.productInfoList =newArray
|
|
|
|
|
|
|
+ this.form.productInfoList = newArray
|
|
|
this.$refs.tableRef.setData(newArray);
|
|
this.$refs.tableRef.setData(newArray);
|
|
|
})
|
|
})
|
|
|
.catch(() => { });
|
|
.catch(() => { });
|
|
@@ -735,8 +764,23 @@ export default {
|
|
|
// console.log(this.$refs);
|
|
// console.log(this.$refs);
|
|
|
// this.$refs.tableRef.setData([]);
|
|
// this.$refs.tableRef.setData([]);
|
|
|
},
|
|
},
|
|
|
|
|
+ changeBomIdFn(bomCategoryId) {
|
|
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
|
|
+ bomRoutingList(bomCategoryId).then((res) => {
|
|
|
|
|
+ let arr = res || [];
|
|
|
|
|
+ if (arr.length == 0) {
|
|
|
|
|
+ row.produceRoutingId = '';
|
|
|
|
|
+ }
|
|
|
|
|
+ resolve(arr)
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
changeBomId(row, index) {
|
|
changeBomId(row, index) {
|
|
|
|
|
|
|
|
|
|
+ row.routingList = []
|
|
|
|
|
+
|
|
|
bomRoutingList(row.bomCategoryId).then((res) => {
|
|
bomRoutingList(row.bomCategoryId).then((res) => {
|
|
|
let arr = res || [];
|
|
let arr = res || [];
|
|
|
if (arr.length == 0) {
|
|
if (arr.length == 0) {
|
|
@@ -747,24 +791,29 @@ export default {
|
|
|
this.$forceUpdate()
|
|
this.$forceUpdate()
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
|
|
+
|
|
|
changeProductType(row, index) {
|
|
changeProductType(row, index) {
|
|
|
let param = {
|
|
let param = {
|
|
|
bomType: row.productType,
|
|
bomType: row.productType,
|
|
|
categoryId: row.categoryId
|
|
categoryId: row.categoryId
|
|
|
}
|
|
}
|
|
|
bomListByPlan(param).then(res => {
|
|
bomListByPlan(param).then(res => {
|
|
|
- let arr = res || [];
|
|
|
|
|
|
|
|
|
|
|
|
+ let arr = res || [];
|
|
|
|
|
+ console.log(arr, 'arr');
|
|
|
if (arr.length == 0) {
|
|
if (arr.length == 0) {
|
|
|
row.bomCategoryId = '';
|
|
row.bomCategoryId = '';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
|
- row.bomVersionList = arr;
|
|
|
|
|
- this.form.productInfoList[index].bomVersionList = arr;
|
|
|
|
|
- let arrAll = JSON.parse(JSON.stringify(this.form));
|
|
|
|
|
- this.$set(this, 'form', arrAll);
|
|
|
|
|
-
|
|
|
|
|
|
|
+ if (arr.length) {
|
|
|
|
|
+ row.bomVersionList = arr;
|
|
|
|
|
+ this.form.productInfoList[index].bomVersionList = arr;
|
|
|
|
|
+ let arrAll = JSON.parse(JSON.stringify(this.form));
|
|
|
|
|
+ this.$set(this, 'form', arrAll);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.form.productInfoList[index].bomVersionList = [];
|
|
|
|
|
+ }
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
@@ -783,9 +832,14 @@ export default {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ console.log(this.form);
|
|
|
|
|
+ this.form.productInfoList.forEach(v => {
|
|
|
|
|
+ if (!v.produceRoutingId) {
|
|
|
|
|
+ return this.$message.error('请选择工艺路线');
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
if (!this.form.id) {
|
|
if (!this.form.id) {
|
|
|
-
|
|
|
|
|
if (this.form.productInfoList.length) {
|
|
if (this.form.productInfoList.length) {
|
|
|
this.form.productInfoList.map((item, index) => {
|
|
this.form.productInfoList.map((item, index) => {
|
|
|
if (item.bomVersionList && item.bomVersionList.length) {
|
|
if (item.bomVersionList && item.bomVersionList.length) {
|
|
@@ -793,7 +847,6 @@ export default {
|
|
|
item.bomCategoryVersions = item.bomVersionList[0].versions;
|
|
item.bomCategoryVersions = item.bomVersionList[0].versions;
|
|
|
item.produceRoutingName = item.routingList[0].name;
|
|
item.produceRoutingName = item.routingList[0].name;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -828,6 +881,21 @@ export default {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
+ bomListVersionFn(produceType, categoryId) {
|
|
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
|
|
+ let param = {
|
|
|
|
|
+ bomType: produceType,
|
|
|
|
|
+ categoryId: categoryId
|
|
|
|
|
+ };
|
|
|
|
|
+ bomListByPlan(param).then((res) => {
|
|
|
|
|
+
|
|
|
|
|
+ this.bomVersionList = res || [];
|
|
|
|
|
+ resolve(res || [])
|
|
|
|
|
+
|
|
|
|
|
+ });
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
|
|
|
bomListVersion() {
|
|
bomListVersion() {
|
|
|
let param = {
|
|
let param = {
|
|
@@ -835,7 +903,11 @@ export default {
|
|
|
categoryId: this.form.categoryId
|
|
categoryId: this.form.categoryId
|
|
|
};
|
|
};
|
|
|
bomListByPlan(param).then((res) => {
|
|
bomListByPlan(param).then((res) => {
|
|
|
- this.bomVersionList = res || [];
|
|
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
|
+ this.bomVersionList = res || [];
|
|
|
|
|
+
|
|
|
|
|
+ console.log(this.bomVersionList);
|
|
|
|
|
+ })
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
|