From 5080a29bd65ad7235b848d3a18bc4def4675d56a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=82=E7=B3=96?= Date: Fri, 14 Nov 2025 18:16:16 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E4=BA=A7=E5=93=81/=E5=8E=9F=E6=9D=90?= =?UTF-8?q?=E6=96=99):=20=E9=87=8D=E6=9E=84=E4=BA=A7=E5=93=81=E5=8F=8A?= =?UTF-8?q?=E5=8E=9F=E6=9D=90=E6=96=99=E4=BF=A1=E6=81=AF=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E4=B8=8E=E5=AD=98=E5=82=A8=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 移除BOM相关依赖,将材质、表面处理等属性直接存储在实体中 优化信息展示格式,统一使用方括号表示规格 调整表单字段,简化查询条件 --- .../KLPService/ProductSelect/index.vue | 45 ++- .../KLPService/RawMaterialSelect/index.vue | 46 ++- .../KLPService/Renderer/ProductInfo.vue | 21 +- .../KLPService/Renderer/RawMaterialInfo.vue | 16 +- klp-ui/src/store/modules/category.js | 8 +- klp-ui/src/views/wms/coil/panels/base.vue | 12 +- klp-ui/src/views/wms/coil/split.vue | 8 +- klp-ui/src/views/wms/product/index.vue | 281 +++++------------- klp-ui/src/views/wms/rawMaterial/index.vue | 209 +++---------- 9 files changed, 205 insertions(+), 441 deletions(-) diff --git a/klp-ui/src/components/KLPService/ProductSelect/index.vue b/klp-ui/src/components/KLPService/ProductSelect/index.vue index bc9cd1e5..490cd422 100644 --- a/klp-ui/src/components/KLPService/ProductSelect/index.vue +++ b/klp-ui/src/components/KLPService/ProductSelect/index.vue @@ -147,39 +147,32 @@ export default { }, getLabel(item) { // 产品名称[规格](参数),如果有则写,没有则省略 - if (!item.specification) { - return `${item.productName}(${this.getSku(item)})` + const sku = this.getSku(item); + let str = item.productName; + if (item.specification) { + str += `[${item.specification}]` } - return `${item.productName}[${item.specification}](${this.getSku(item)})` + + if (sku) { + str += `(${sku})` + } + return str; }, getSku(item) { - const boms = item.bomItems || []; - console.log(boms, '产品参数'); - if (!boms.length) { - return '暂无参数信息'; - } - // 查找attrKey为'规格'的attrvalue - const specification = boms.find(p => p.attrKey === '规格'); - - // 查找attrKey为'表面处理'的attrvalue - const factory = boms.find(p => p.attrKey === '表面处理'); - - // 查找attrKey为'材质'的attrvalue - const material = boms.find(p => p.attrKey === '材质'); - - - // 组合sku: + // 查询item的材质(material),表面处理(surfaceTreatmentDesc),厂家(manufacturer),锌层(zincLayer),如果有则添加到sku字符串中 let sku = ''; - if (specification) { - sku += '规格:' + specification.attrValue + ';'; + if (item.material) { + sku += '材质:' + item.material + ';'; } - if (factory) { - sku += '表面处理:' + factory.attrValue + ';'; + if (item.surfaceTreatmentDesc) { + sku += '表面处理:' + item.surfaceTreatmentDesc + ';'; } - if (material) { - sku += '材质:' + material.attrValue + ';'; + if (item.manufacturer) { + sku += '厂家:' + item.manufacturer + ';'; + } + if (item.zincLayer) { + sku += '锌层:' + item.zincLayer + ';'; } - console.log(sku, item, boms, '产品参数'); return sku; }, onChange(val) { diff --git a/klp-ui/src/components/KLPService/RawMaterialSelect/index.vue b/klp-ui/src/components/KLPService/RawMaterialSelect/index.vue index ff16ada7..d08e288b 100644 --- a/klp-ui/src/components/KLPService/RawMaterialSelect/index.vue +++ b/klp-ui/src/components/KLPService/RawMaterialSelect/index.vue @@ -151,38 +151,34 @@ export default { }, getLabel(item) { // 原材料名称[规格](参数),如果有则写,没有则省略 - if (!item.specification) { - return `${item.rawMaterialName}(${this.getSku(item)})` + + // 如果有sku拼接(sku), 有规格则拼接[规格], 否则只拼接原材料名称 + const sku = this.getSku(item); + let str = item.rawMaterialName; + if (item.specification) { + str += `[${item.specification}]` } - return `${item.rawMaterialName}[${item.specification}](${this.getSku(item)})` + + if (sku) { + str += `(${sku})` + } + return str; }, getSku(item) { - const boms = item.bomItems; - if (!boms || boms.length === 0) { - return '暂无参数信息'; - } - // 查找attrKey为'规格'的attrvalue - const specification = boms.find(p => p.attrKey === '规格'); - - // 查找attrKey为'厂家'的attrvalue - const factory = boms.find(p => p.attrKey === '厂家'); - - // 查找attrKey为'材质'的attrvalue - const material = boms.find(p => p.attrKey === '材质'); - - console.log(boms, item, '查找bomItems'); - // 组合sku: + // 查询item的材质(material),表面处理(surfaceTreatmentDesc),厂家(manufacturer),锌层(zincLayer),如果有则添加到sku字符串中 let sku = ''; - if (specification) { - sku += '规格:' + specification.attrValue + ';'; + if (item.material) { + sku += '材质:' + item.material + ';'; } - if (factory) { - sku += '厂家:' + factory.attrValue + ';'; + if (item.surfaceTreatmentDesc) { + sku += '表面处理:' + item.surfaceTreatmentDesc + ';'; } - if (material) { - sku += '材质:' + material.attrValue; + if (item.manufacturer) { + sku += '厂家:' + item.manufacturer + ';'; + } + if (item.zincLayer) { + sku += '锌层:' + item.zincLayer + ';'; } - console.log(sku, '组合sku'); return sku; }, add() { diff --git a/klp-ui/src/components/KLPService/Renderer/ProductInfo.vue b/klp-ui/src/components/KLPService/Renderer/ProductInfo.vue index 9caa53e1..307d3b28 100644 --- a/klp-ui/src/components/KLPService/Renderer/ProductInfo.vue +++ b/klp-ui/src/components/KLPService/Renderer/ProductInfo.vue @@ -13,9 +13,9 @@ append-to-body > - + {{ product.productName || '--' }} @@ -25,8 +25,23 @@ {{ product.specification || '--' }} + + {{ product.material || '--' }} + + + {{ product.surfaceTreatment || '--' }} + + + + {{ product.zincLayer || '--' }} + + + + {{ product.manufacturer || '--' }} + + - + diff --git a/klp-ui/src/components/KLPService/Renderer/RawMaterialInfo.vue b/klp-ui/src/components/KLPService/Renderer/RawMaterialInfo.vue index fae21e1a..4b77c576 100644 --- a/klp-ui/src/components/KLPService/Renderer/RawMaterialInfo.vue +++ b/klp-ui/src/components/KLPService/Renderer/RawMaterialInfo.vue @@ -13,8 +13,22 @@ {{ material.rawMaterialName }} {{ material.rawMaterialCode }} {{ material.specification }} + + {{ material.material || '--' }} + + + {{ material.surfaceTreatment || '--' }} + + + + {{ material.zincLayer || '--' }} + + + + {{ material.manufacturer || '--' }} + - + diff --git a/klp-ui/src/store/modules/category.js b/klp-ui/src/store/modules/category.js index f7a0cdfa..94061017 100644 --- a/klp-ui/src/store/modules/category.js +++ b/klp-ui/src/store/modules/category.js @@ -1,6 +1,6 @@ import { listCategory } from '@/api/wms/category'; -import { listProductWithBom } from '@/api/wms/product'; -import { listRawMaterialWithBom } from '@/api/wms/rawMaterial'; +import { listProduct } from '@/api/wms/product'; +import { listRawMaterial } from '@/api/wms/rawMaterial'; import { listBomItem } from '@/api/wms/bomItem'; // 目前存在一个问题,当新增或删除,修改分类、产品、物料时,需要刷新整个页面,才能看到最新的数据 @@ -51,7 +51,7 @@ const actions = { if (Object.keys(state.productMap).length > 0) { return Promise.resolve(state.productMap); } - return listProductWithBom({ pageNum: 1, pageSize: 10000 }).then(res => { + return listProduct({ pageNum: 1, pageSize: 10000 }).then(res => { const map = {}; res.rows.forEach(item => { map[item.productId] = item; @@ -65,7 +65,7 @@ const actions = { if (Object.keys(state.rawMaterialMap).length > 0) { return Promise.resolve(state.rawMaterialMap); } - return listRawMaterialWithBom({ pageNum: 1, pageSize: 10000 }).then(res => { + return listRawMaterial({ pageNum: 1, pageSize: 10000 }).then(res => { const map = {}; res.rows.forEach(item => { map[item.rawMaterialId] = item; diff --git a/klp-ui/src/views/wms/coil/panels/base.vue b/klp-ui/src/views/wms/coil/panels/base.vue index 1ad202d5..f6884f95 100644 --- a/klp-ui/src/views/wms/coil/panels/base.vue +++ b/klp-ui/src/views/wms/coil/panels/base.vue @@ -86,12 +86,12 @@ @@ -181,7 +181,7 @@ - + @@ -199,20 +199,20 @@ - + diff --git a/klp-ui/src/views/wms/coil/split.vue b/klp-ui/src/views/wms/coil/split.vue index e137d172..eb3ce070 100644 --- a/klp-ui/src/views/wms/coil/split.vue +++ b/klp-ui/src/views/wms/coil/split.vue @@ -120,25 +120,25 @@ - + - + - + - + diff --git a/klp-ui/src/views/wms/product/index.vue b/klp-ui/src/views/wms/product/index.vue index f7113047..fc91a26f 100644 --- a/klp-ui/src/views/wms/product/index.vue +++ b/klp-ui/src/views/wms/product/index.vue @@ -2,20 +2,10 @@
- + - + @@ -23,28 +13,18 @@ - 搜索 重置 @@ -53,43 +33,18 @@ - 新增 + 新增 - 修改 + 修改 - 删除 + 删除 - 导出 + 导出 @@ -100,163 +55,72 @@ - + + + + - + - + - - - - - - - - - - - - - - - - - + + + - - - - + + + - - +
@@ -275,8 +140,8 @@ import { listProduct, getProduct, delProduct, addProduct, updateProduct, addProd import CategorySelect from '@/components/KLPService/CategorySelect'; import CategoryRenderer from '@/components/KLPService/Renderer/CategoryRenderer.vue'; import UserSelect from '@/components/KLPService/UserSelect'; -import BomPanel from '../bom/components/BomPanel.vue'; -import BomInfoMini from '@/components/KLPService/Renderer/BomInfoMini.vue'; +// import BomPanel from '../bom/components/BomPanel.vue'; +// import BomInfoMini from '@/components/KLPService/Renderer/BomInfoMini.vue'; export default { name: "Product", @@ -284,8 +149,8 @@ export default { CategorySelect, CategoryRenderer, UserSelect, - BomPanel, - BomInfoMini + // BomPanel, + // BomInfoMini }, dicts: ['common_swicth'], data() { @@ -327,6 +192,10 @@ export default { innerDiameter: undefined, specification: undefined, isEnabled: undefined, + material: undefined, + manufacturer: undefined, + surfaceTreatmentDesc: undefined, + zincLayer: undefined, }, // 表单参数 form: {}, @@ -392,6 +261,10 @@ export default { updateBy: undefined, type: undefined, specification: undefined, + material: undefined, + manufacturer: undefined, + surfaceTreatmentDesc: undefined, + zincLayer: undefined, }; this.resetForm("form"); }, @@ -422,7 +295,7 @@ export default { // 多选框选中数据 handleSelectionChange(selection) { this.ids = selection.map(item => item.productId) - this.single = selection.length!==1 + this.single = selection.length !== 1 this.multiple = !selection.length }, /** 新增按钮操作 */ diff --git a/klp-ui/src/views/wms/rawMaterial/index.vue b/klp-ui/src/views/wms/rawMaterial/index.vue index 848ef694..baaadae4 100644 --- a/klp-ui/src/views/wms/rawMaterial/index.vue +++ b/klp-ui/src/views/wms/rawMaterial/index.vue @@ -20,47 +20,17 @@ - - - - - + + 搜索 @@ -118,33 +88,19 @@ - - - + + + + + @@ -190,92 +140,21 @@ - - - - - + + + - + + + + + + +
- - - {{ paramRow.thickness || '--' }} - {{ paramRow.thicknessDeviation || '--' }} - {{ paramRow.width || '--' }} - {{ paramRow.targetColdWidth || '--' }} - {{ paramRow.targetColdThickness || '--' }} - {{ paramRow.crown || '--' }} - {{ paramRow.coilWeight || '--' }} - {{ paramRow.surfaceQuality || '--' }} - - - - - + @@ -307,16 +172,16 @@ import { listRawMaterial, getRawMaterial, delRawMaterial, addRawMaterial, updateRawMaterial, addRawMaterialWithBom } from "@/api/wms/rawMaterial"; import CategorySelect from "@/components/KLPService/CategorySelect/index.vue"; import CategoryRenderer from '@/components/KLPService/Renderer/CategoryRenderer.vue'; -import BomPanel from '@/views/wms/bom/components/BomPanel.vue'; -import BomInfoMini from '@/components/KLPService/Renderer/BomInfoMini.vue'; +// import BomPanel from '@/views/wms/bom/components/BomPanel.vue'; +// import BomInfoMini from '@/components/KLPService/Renderer/BomInfoMini.vue'; export default { name: "RawMaterial", components: { CategorySelect, CategoryRenderer, - BomPanel, - BomInfoMini + // BomPanel, + // BomInfoMini }, dicts: ['common_swicth'], data() { @@ -369,6 +234,10 @@ export default { isEnabled: undefined, unit: undefined, specification: undefined, + material: undefined, + manufacturer: undefined, + surfaceTreatmentDesc: undefined, + zincLayer: undefined, }, // 表单参数 form: {}, @@ -452,6 +321,10 @@ export default { updateBy: undefined, specification: undefined, unit: '卷', + material: undefined, + manufacturer: undefined, + surfaceTreatmentDesc: undefined, + zincLayer: undefined, }; this.resetForm("form"); },