|
@@ -381,10 +381,10 @@
|
|
|
|
|
|
|
|
<template v-slot:factoriesId="{ row, $index }">
|
|
<template v-slot:factoriesId="{ row, $index }">
|
|
|
<el-select
|
|
<el-select
|
|
|
|
|
+ v-if="!factoriesId"
|
|
|
v-model="row.factoriesId"
|
|
v-model="row.factoriesId"
|
|
|
:key="row.factoriesId"
|
|
:key="row.factoriesId"
|
|
|
@change="(e) => selectFactory(e, row)"
|
|
@change="(e) => selectFactory(e, row)"
|
|
|
- :disabled="!!factoriesId"
|
|
|
|
|
>
|
|
>
|
|
|
<el-option
|
|
<el-option
|
|
|
v-for="item of factoryList"
|
|
v-for="item of factoryList"
|
|
@@ -393,6 +393,12 @@
|
|
|
:value="item.id"
|
|
:value="item.id"
|
|
|
></el-option>
|
|
></el-option>
|
|
|
</el-select>
|
|
</el-select>
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-else
|
|
|
|
|
+ :value="factoryLabel(row)"
|
|
|
|
|
+ style="width: 100%"
|
|
|
|
|
+ disabled
|
|
|
|
|
+ ></el-input>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<!-- <el-table-column label="所属工厂" width="140" align="center" prop="factoriesId">
|
|
<!-- <el-table-column label="所属工厂" width="140" align="center" prop="factoriesId">
|
|
@@ -937,6 +943,47 @@
|
|
|
this.$set(row, 'factoriesName', data.name);
|
|
this.$set(row, 'factoriesName', data.name);
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
+ // 所属工厂展示名称,避免下拉匹配不到时露出原始ID
|
|
|
|
|
+ factoryLabel(row) {
|
|
|
|
|
+ if (row.factoriesName) {
|
|
|
|
|
+ return row.factoriesName;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 行上没名字时,从工艺路线列表里取(bomRoutingList 会带回工厂名)
|
|
|
|
|
+ const routing = (row.routingList || []).find(
|
|
|
|
|
+ (item) => String(item.id) === String(row.produceRoutingId)
|
|
|
|
|
+ );
|
|
|
|
|
+ if (
|
|
|
|
|
+ routing &&
|
|
|
|
|
+ routing.factoriesName &&
|
|
|
|
|
+ (!row.factoriesId ||
|
|
|
|
|
+ String(row.factoriesId) === String(routing.factoriesId))
|
|
|
|
|
+ ) {
|
|
|
|
|
+ return routing.factoriesName;
|
|
|
|
|
+ }
|
|
|
|
|
+ const hit = this.factoryList.find(
|
|
|
|
|
+ (item) => String(item.id) === String(row.factoriesId)
|
|
|
|
|
+ );
|
|
|
|
|
+ return hit ? hit.name : row.factoriesId || '';
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ // 工艺路线接口(bomRoutingList)会带回 factoriesId/factoriesName,用它补全所属工厂名称
|
|
|
|
|
+ applyRoutingFactoryName(row, routing) {
|
|
|
|
|
+ if (!row || !routing || !routing.factoriesName) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (row.factoriesName) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 行的工厂与工艺路线上的工厂一致时才补,避免显示成别的工厂
|
|
|
|
|
+ if (
|
|
|
|
|
+ row.factoriesId &&
|
|
|
|
|
+ String(row.factoriesId) !== String(routing.factoriesId)
|
|
|
|
|
+ ) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$set(row, 'factoriesName', routing.factoriesName);
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
async getPlannedReleaseRequire(code) {
|
|
async getPlannedReleaseRequire(code) {
|
|
|
parameterGetByCode({ code }).then((res) => {
|
|
parameterGetByCode({ code }).then((res) => {
|
|
|
if (res) {
|
|
if (res) {
|
|
@@ -961,6 +1008,7 @@
|
|
|
this.$set(data, 'productType', '');
|
|
this.$set(data, 'productType', '');
|
|
|
this.$set(data, 'produceRoutingName', item.name);
|
|
this.$set(data, 'produceRoutingName', item.name);
|
|
|
this.$set(data, 'produceRoutingId', item.id);
|
|
this.$set(data, 'produceRoutingId', item.id);
|
|
|
|
|
+ this.applyRoutingFactoryName(data, item);
|
|
|
this.$set(data, 'selectionRowShow', true);
|
|
this.$set(data, 'selectionRowShow', true);
|
|
|
// this.selectionRowShow = true;
|
|
// this.selectionRowShow = true;
|
|
|
},
|
|
},
|
|
@@ -1102,7 +1150,10 @@
|
|
|
this.$set(
|
|
this.$set(
|
|
|
productList[index],
|
|
productList[index],
|
|
|
'factoriesName',
|
|
'factoriesName',
|
|
|
- this.factoryList?.find((f) => f.id === this.factoriesId)?.name
|
|
|
|
|
|
|
+ productList[index].factoriesName ||
|
|
|
|
|
+ this.factoryList?.find(
|
|
|
|
|
+ (f) => String(f.id) === String(this.factoriesId)
|
|
|
|
|
+ )?.name
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
this.$set(productList[index], 'producedList', list);
|
|
this.$set(productList[index], 'producedList', list);
|
|
@@ -1333,6 +1384,11 @@
|
|
|
if (arr.length == 0) {
|
|
if (arr.length == 0) {
|
|
|
row.produceRoutingId = '';
|
|
row.produceRoutingId = '';
|
|
|
}
|
|
}
|
|
|
|
|
+ // 编辑回显时后台不会返回所属工厂名称,用工艺路线上的工厂信息补全
|
|
|
|
|
+ const hit = arr.find(
|
|
|
|
|
+ (item) => String(item.id) === String(row.produceRoutingId)
|
|
|
|
|
+ );
|
|
|
|
|
+ this.applyRoutingFactoryName(row, hit);
|
|
|
resolve(arr);
|
|
resolve(arr);
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -1353,6 +1409,7 @@
|
|
|
row.produceVersionName = arr[0].version;
|
|
row.produceVersionName = arr[0].version;
|
|
|
row.produceRoutingId = arr[0].id;
|
|
row.produceRoutingId = arr[0].id;
|
|
|
row.routingList = arr;
|
|
row.routingList = arr;
|
|
|
|
|
+ this.applyRoutingFactoryName(row, arr[0]);
|
|
|
if (typeChange) {
|
|
if (typeChange) {
|
|
|
this.$set(this.form.productInfoList[index], 'routingList', arr);
|
|
this.$set(this.form.productInfoList[index], 'routingList', arr);
|
|
|
this.$set(
|
|
this.$set(
|