|
@@ -411,18 +411,27 @@
|
|
|
</DictSelection>
|
|
</DictSelection>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</template>
|
|
</template>
|
|
|
- <template v-slot:colorKey="{ row, $index }">
|
|
|
|
|
|
|
+ <template v-slot:colorKey="{ row }">
|
|
|
<el-form-item>
|
|
<el-form-item>
|
|
|
- <DictSelection
|
|
|
|
|
- dictName="物品颜色"
|
|
|
|
|
- clearable
|
|
|
|
|
|
|
+ <el-select
|
|
|
v-model="row.colorKey"
|
|
v-model="row.colorKey"
|
|
|
- :isOne="$index === 0"
|
|
|
|
|
|
|
+ style="width: 100%"
|
|
|
|
|
+ clearable
|
|
|
filterable
|
|
filterable
|
|
|
- allow-create
|
|
|
|
|
- default-first-option
|
|
|
|
|
|
|
+ :placeholder="
|
|
|
|
|
+ row.colorOptions && row.colorOptions.length
|
|
|
|
|
+ ? '请选择'
|
|
|
|
|
+ : '主数据未维护颜色'
|
|
|
|
|
+ "
|
|
|
>
|
|
>
|
|
|
- </DictSelection>
|
|
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="color in row.colorOptions"
|
|
|
|
|
+ :key="color"
|
|
|
|
|
+ :label="color"
|
|
|
|
|
+ :value="color"
|
|
|
|
|
+ >
|
|
|
|
|
+ </el-option>
|
|
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -707,16 +716,25 @@
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column label="颜色" prop="colorKey" width="300">
|
|
<el-table-column label="颜色" prop="colorKey" width="300">
|
|
|
<template slot-scope="{ row }">
|
|
<template slot-scope="{ row }">
|
|
|
- <DictSelection
|
|
|
|
|
- dictName="物品颜色"
|
|
|
|
|
- clearable
|
|
|
|
|
|
|
+ <el-select
|
|
|
v-model="row.colorKey"
|
|
v-model="row.colorKey"
|
|
|
- :isOne="false"
|
|
|
|
|
|
|
+ style="width: 100%"
|
|
|
|
|
+ clearable
|
|
|
filterable
|
|
filterable
|
|
|
- allow-create
|
|
|
|
|
- default-first-option
|
|
|
|
|
|
|
+ :placeholder="
|
|
|
|
|
+ row.colorOptions && row.colorOptions.length
|
|
|
|
|
+ ? '请选择'
|
|
|
|
|
+ : '主数据未维护颜色'
|
|
|
|
|
+ "
|
|
|
>
|
|
>
|
|
|
- </DictSelection>
|
|
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="color in row.colorOptions"
|
|
|
|
|
+ :key="color"
|
|
|
|
|
+ :label="color"
|
|
|
|
|
+ :value="color"
|
|
|
|
|
+ >
|
|
|
|
|
+ </el-option>
|
|
|
|
|
+ </el-select>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
|
|
|
|
@@ -1510,6 +1528,7 @@
|
|
|
// 编辑时单位选择消失bug
|
|
// 编辑时单位选择消失bug
|
|
|
};
|
|
};
|
|
|
});
|
|
});
|
|
|
|
|
+ await this.fillColorOptions(this.productList);
|
|
|
// this.$nextTick(() => {
|
|
// this.$nextTick(() => {
|
|
|
// this.listSaveArrs();
|
|
// this.listSaveArrs();
|
|
|
// });
|
|
// });
|
|
@@ -1524,6 +1543,68 @@
|
|
|
changeCount(number) {
|
|
changeCount(number) {
|
|
|
return new BigNumber(number).toString();
|
|
return new BigNumber(number).toString();
|
|
|
},
|
|
},
|
|
|
|
|
+ // 按物品编码批量取主数据维护的颜色(一次请求,供本页所有行共用)
|
|
|
|
|
+ async fetchColorOptionsByCodes(rows) {
|
|
|
|
|
+ const codes = Array.from(
|
|
|
|
|
+ new Set(
|
|
|
|
|
+ (rows || [])
|
|
|
|
|
+ .map((item) => item && item.categoryCode)
|
|
|
|
|
+ .filter((code) => !!code)
|
|
|
|
|
+ )
|
|
|
|
|
+ );
|
|
|
|
|
+ if (!codes.length) return {};
|
|
|
|
|
+ let list = [];
|
|
|
|
|
+ try {
|
|
|
|
|
+ list =
|
|
|
|
|
+ (await outin.getListByNameOrModeType({ codeList: codes })) || [];
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ // 取色失败不阻塞页面初始化(401/网络异常已由 request.js 统一提示)
|
|
|
|
|
+ console.warn('主数据颜色获取失败', error);
|
|
|
|
|
+ return {};
|
|
|
|
|
+ }
|
|
|
|
|
+ const colorMap = {};
|
|
|
|
|
+ list.forEach((item) => {
|
|
|
|
|
+ // 主数据颜色是英文逗号串:去空格、去空值、去重,保持主数据原顺序
|
|
|
|
|
+ colorMap[item.code] = Array.from(
|
|
|
|
|
+ new Set(
|
|
|
|
|
+ String(item.colorKey || '')
|
|
|
|
|
+ .split(',')
|
|
|
|
|
+ .map((color) => color.trim())
|
|
|
|
|
+ .filter((color) => !!color)
|
|
|
|
|
+ )
|
|
|
|
|
+ );
|
|
|
|
|
+ });
|
|
|
|
|
+ return colorMap;
|
|
|
|
|
+ },
|
|
|
|
|
+ // 给产品行挂上主数据颜色选项;历史颜色不在选项内也不清空
|
|
|
|
|
+ async fillColorOptions(rows) {
|
|
|
|
|
+ const list = rows || [];
|
|
|
|
|
+ let colorMap = {};
|
|
|
|
|
+ try {
|
|
|
|
|
+ colorMap = await this.fetchColorOptionsByCodes(list);
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ // 兜底:任何取色异常都只退化为「无颜色选项」,不影响调用方流程
|
|
|
|
|
+ console.warn('主数据颜色填充失败', error);
|
|
|
|
|
+ }
|
|
|
|
|
+ list.forEach((row) => {
|
|
|
|
|
+ if (!row) return;
|
|
|
|
|
+ this.$set(row, 'colorOptions', colorMap[row.categoryCode] || []);
|
|
|
|
|
+ });
|
|
|
|
|
+ return list;
|
|
|
|
|
+ },
|
|
|
|
|
+ // 包装行颜色选项继承对应产品行(按 parentIndex 对应)
|
|
|
|
|
+ fillPackingColorOptions(packingRows, productRows) {
|
|
|
|
|
+ const map = {};
|
|
|
|
|
+ (productRows || []).forEach((row) => {
|
|
|
|
|
+ if (!row) return;
|
|
|
|
|
+ map[String(row.index)] = row.colorOptions || [];
|
|
|
|
|
+ });
|
|
|
|
|
+ (packingRows || []).forEach((row) => {
|
|
|
|
|
+ if (!row) return;
|
|
|
|
|
+ const options = map[String(row.parentIndex)];
|
|
|
|
|
+ this.$set(row, 'colorOptions', options ? options.slice() : []);
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
viewInit() {
|
|
viewInit() {
|
|
|
const _this = this;
|
|
const _this = this;
|
|
|
// 编辑时选单位没有选项bug
|
|
// 编辑时选单位没有选项bug
|
|
@@ -1631,6 +1712,8 @@
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
this.packingList = arr;
|
|
this.packingList = arr;
|
|
|
|
|
+ await this.fillColorOptions(this.productList);
|
|
|
|
|
+ this.fillPackingColorOptions(this.packingList, this.productList);
|
|
|
// 获取物料维度数据
|
|
// 获取物料维度数据
|
|
|
let iArr = [];
|
|
let iArr = [];
|
|
|
arr.forEach((item) => {
|
|
arr.forEach((item) => {
|
|
@@ -2002,6 +2085,13 @@
|
|
|
// }
|
|
// }
|
|
|
return item;
|
|
return item;
|
|
|
});
|
|
});
|
|
|
|
|
+ await this.fillColorOptions(this.productList);
|
|
|
|
|
+ this.productList.forEach((productItem) => {
|
|
|
|
|
+ this.fillPackingColorOptions(
|
|
|
|
|
+ productItem.outInDetailRecordRequestList,
|
|
|
|
|
+ this.productList
|
|
|
|
|
+ );
|
|
|
|
|
+ });
|
|
|
console.log(this.productList, 'productList');
|
|
console.log(this.productList, 'productList');
|
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
|
this.batchSave();
|
|
this.batchSave();
|
|
@@ -2435,6 +2525,7 @@
|
|
|
isUnpack: item.isUnpack // 是否允许拆包
|
|
isUnpack: item.isUnpack // 是否允许拆包
|
|
|
};
|
|
};
|
|
|
});
|
|
});
|
|
|
|
|
+ await this.fillColorOptions(this.productList);
|
|
|
console.log(this.productList);
|
|
console.log(this.productList);
|
|
|
this.handleAvatarSuccess();
|
|
this.handleAvatarSuccess();
|
|
|
loading.close();
|
|
loading.close();
|
|
@@ -2944,6 +3035,7 @@
|
|
|
};
|
|
};
|
|
|
});
|
|
});
|
|
|
this.productList = this.productList.concat(productList);
|
|
this.productList = this.productList.concat(productList);
|
|
|
|
|
+ await this.fillColorOptions(productList);
|
|
|
console.log('this.productList--------', this.productList);
|
|
console.log('this.productList--------', this.productList);
|
|
|
},
|
|
},
|
|
|
// 产品信息行的必填字段(生产入库额外要求生产日期/失效日期)
|
|
// 产品信息行的必填字段(生产入库额外要求生产日期/失效日期)
|
|
@@ -3733,6 +3825,7 @@
|
|
|
);
|
|
);
|
|
|
this.packingList.splice(packingIndex + 1, 0, ...packingList);
|
|
this.packingList.splice(packingIndex + 1, 0, ...packingList);
|
|
|
}
|
|
}
|
|
|
|
|
+ this.fillPackingColorOptions(packingList, [row]);
|
|
|
|
|
|
|
|
const lastIndex = this.packingList.length - 1;
|
|
const lastIndex = this.packingList.length - 1;
|
|
|
|
|
|