web,app,后端更改二维码唯一

This commit is contained in:
2025-11-05 22:18:10 +08:00
parent f7dad6a1f4
commit 8117421531
6 changed files with 466 additions and 174 deletions

View File

@@ -139,10 +139,10 @@
<template slot="append"></template>
</el-input>
</el-form-item>
<el-form-item label="目标库区" required>
<el-form-item label="逻辑库区" required>
<el-select
v-model="item.warehouseId"
placeholder="请选择目标库位"
placeholder="请选择逻辑库区"
style="width: 100%"
filterable
:disabled="readonly"
@@ -155,7 +155,7 @@
/>
</el-select>
</el-form-item>
<el-form-item label="展示库区" required>
<el-form-item label="真实库区" required>
<ActualWarehouseSelect
v-model="item.actualWarehouseId"
placeholder="请选择真实库区"
@@ -192,6 +192,7 @@ import { getMaterialCoil, splitMaterialCoil } from '@/api/wms/coil';
import { listWarehouse } from '@/api/wms/warehouse';
import { listRawMaterial } from '@/api/wms/rawMaterial';
import { listProduct } from '@/api/wms/product';
import { completeAction } from '@/api/wms/pendingAction';
import CoilSelector from '@/components/CoilSelector';
import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
import MaterialSelect from "@/components/KLPService/MaterialSelect";
@@ -244,7 +245,9 @@ export default {
productList: [],
itemSearchLoading: false,
// 只读模式
readonly: false
readonly: false,
// 待操作ID
actionId: null
};
},
computed: {
@@ -253,14 +256,20 @@ export default {
// 先加载库区列表
await this.loadWarehouses();
// 从路由参数获取coilId和readonly
// 从路由参数获取coilId、actionId和readonly
const coilId = this.$route.query.coilId;
const actionId = this.$route.query.actionId;
const readonly = this.$route.query.readonly;
if (coilId) {
await this.loadMotherCoil(coilId);
}
// 保存待操作ID
if (actionId) {
this.actionId = actionId;
}
// 设置只读模式
if (readonly === 'true' || readonly === true) {
this.readonly = true;
@@ -272,17 +281,52 @@ export default {
if (itemType === 'raw_material') {
return this.rawMaterialList.map(item => ({
id: item.rawMaterialId,
name: item.rawMaterialName
name: this.formatItemName(item)
}));
} else if (itemType === 'product') {
return this.productList.map(item => ({
id: item.productId,
name: item.productName
name: this.formatItemName(item)
}));
}
return [];
},
// 格式化物品名称添加规格和BOM信息
formatItemName(item) {
if (!item) return '';
// 获取名称(原材料或产品)
const name = item.rawMaterialName || item.productName || '';
if (!name) return '';
let displayName = name;
const specs = [];
// 1. 优先显示规格从对象的specification字段
if (item.specification) {
specs.push(item.specification);
}
// 2. 添加BOM参数最多2个
if (item.bomItems && item.bomItems.length > 0) {
const bomParams = item.bomItems
.filter(bomItem => bomItem.attrKey && bomItem.attrValue)
.slice(0, 2); // 最多2个BOM参数
bomParams.forEach(param => {
specs.push(`${param.attrKey}:${param.attrValue}`);
});
}
// 3. 拼接成最终格式
if (specs.length > 0) {
displayName += `${specs.join(' ')}`;
}
return displayName;
},
// 物品类型变化
handleItemTypeChange(index) {
this.splitList[index].itemId = null;
@@ -296,23 +340,30 @@ export default {
this.$message.warning('请先选择物品类型');
return;
}
if (!query || query.trim() === '') {
this.loadItemListForSplit(itemType);
return;
}
try {
this.itemSearchLoading = true;
if (itemType === 'raw_material') {
const response = await listRawMaterial({
const response = await listRawMaterial({
rawMaterialName: query,
pageNum: 1,
pageSize: 50
pageNum: 1,
pageSize: 50,
withBom: true
});
if (response.code === 200) {
this.rawMaterialList = response.rows || [];
}
} else if (itemType === 'product') {
const response = await listProduct({
const response = await listProduct({
productName: query,
pageNum: 1,
pageSize: 50
pageNum: 1,
pageSize: 50,
withBom: true
});
if (response.code === 200) {
this.productList = response.rows || [];
@@ -328,16 +379,24 @@ export default {
// 加载子卷物品列表
async loadItemListForSplit(itemType) {
if (!itemType) return;
try {
this.itemSearchLoading = true;
if (itemType === 'raw_material') {
const response = await listRawMaterial({ pageNum: 1, pageSize: 100 });
const response = await listRawMaterial({
pageNum: 1,
pageSize: 100,
withBom: true
});
if (response.code === 200) {
this.rawMaterialList = response.rows || [];
}
} else if (itemType === 'product') {
const response = await listProduct({ pageNum: 1, pageSize: 100 });
const response = await listProduct({
pageNum: 1,
pageSize: 100,
withBom: true
});
if (response.code === 200) {
this.productList = response.rows || [];
}
@@ -522,6 +581,12 @@ export default {
const response = await splitMaterialCoil(splitData);
if (response.code === 200) {
this.$message.success('分卷保存成功');
// 如果是从待操作列表进来的,标记操作为完成
if (this.actionId) {
await completeAction(this.actionId);
}
// 延迟返回,让用户看到成功提示
setTimeout(() => {
this.$router.back();