From 8d2d22de50bc1c6fe5c853efeb26654739dea4d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=82=E7=B3=96?= <2178503051@qq.com> Date: Wed, 24 Jun 2026 14:46:33 +0800 Subject: [PATCH] =?UTF-8?q?fix(crm/contract):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E4=BA=A7=E5=93=81=E9=80=89=E6=8B=A9=E7=BB=84=E4=BB=B6=E5=8F=AA?= =?UTF-8?q?=E8=AF=BB=E9=80=BB=E8=BE=91=E5=B9=B6=E4=BC=98=E5=8C=96=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 将产品名称和材质选择框的readonly属性替换为disabled,修复禁用状态下仍可编辑的问题 2. 注释原有硬编码的产品和材质选项,改为通过字典contract_product_material动态获取 3. 新增字典数据转换逻辑,生成动态的产品选项和材质选项列表 4. 新增材质默认空值处理逻辑,避免未赋值时的异常 --- .../contract/components/ProductContent.vue | 69 +++++++++++++------ 1 file changed, 47 insertions(+), 22 deletions(-) diff --git a/klp-ui/src/views/crm/contract/components/ProductContent.vue b/klp-ui/src/views/crm/contract/components/ProductContent.vue index e62428e0..1768a3b3 100644 --- a/klp-ui/src/views/crm/contract/components/ProductContent.vue +++ b/klp-ui/src/views/crm/contract/components/ProductContent.vue @@ -6,7 +6,7 @@
产品名称: - +
@@ -50,7 +50,7 @@
- +
@@ -148,28 +148,31 @@ export default { remark: '', productName: '', previousProductName: '', - productMaterialMap: { - '冷硬钢卷': 'SPCC', - '镀锌钢卷': 'DX51D+Z', - '冷轧钢卷': 'DC01', - '冷轧卷(花纹)': 'DC01-H', - '镀铬钢卷': 'SPCC', - }, - productOptions: [ - { label: '冷硬钢卷', value: '冷硬钢卷' }, - { label: '镀锌钢卷', value: '镀锌钢卷' }, - { label: '冷轧钢卷', value: '冷轧钢卷' }, - { label: '冷轧卷(花纹)', value: '冷轧卷(花纹)' }, - { label: '镀铬钢卷', value: '镀铬钢卷' }, - ], - materialOptions: [ - { label: 'SPCC', value: 'SPCC' }, - { label: 'DX51D+Z', value: 'DX51D+Z' }, - { label: 'DC01', value: 'DC01' }, - { label: 'DC01-H', value: 'DC01-H' } - ] + // productMaterialMap: { + // '冷硬钢卷': 'SPCC', + // '镀锌钢卷': 'DX51D+Z', + // '冷轧钢卷': 'DC01', + // '冷轧卷(花纹)': 'DC01-H', + // '镀铬钢卷': 'SPCC', + // '镀锌管料带钢': 'DX51D+Z' + // }, + // productOptions: [ + // { label: '冷硬钢卷', value: '冷硬钢卷' }, + // { label: '镀锌钢卷', value: '镀锌钢卷' }, + // { label: '冷轧钢卷', value: '冷轧钢卷' }, + // { label: '冷轧卷(花纹)', value: '冷轧卷(花纹)' }, + // { label: '镀铬钢卷', value: '镀铬钢卷' }, + // { label: '镀锌管料带钢', value: '镀锌管料带钢' }, + // ], + // materialOptions: [ + // { label: 'SPCC', value: 'SPCC' }, + // { label: 'DX51D+Z', value: 'DX51D+Z' }, + // { label: 'DC01', value: 'DC01' }, + // { label: 'DC01-H', value: 'DC01-H' } + // ] } }, + dicts: ['contract_product_material'], computed: { // 计算总数量 totalQuantity() { @@ -213,6 +216,27 @@ export default { }; return JSON.stringify(data, null, 2); }, + productMaterialMap() { + const o = {}; + this.dict.type.contract_product_material.forEach(item => { + o[item.label] = item.value; + }); + return o; + }, + productOptions() { + return this.dict.type.contract_product_material.map(item => ({ + label: item.label, + value: item.label + })); + }, + materialOptions() { + // 先去重 + const uniqueMaterials = new Set(this.dict.type.contract_product_material.map(item => item.value)); + return Array.from(uniqueMaterials).map(material => ({ + label: material, + value: material + })); + } }, watch: { // 监听jsonContent变化,触发update事件 @@ -258,6 +282,7 @@ export default { if (item.taxDivisor === undefined || item.taxDivisor === null) { item.taxDivisor = 1.13; } + if (item.material === undefined) item.material = ''; if (item.noTaxPrice === undefined) item.noTaxPrice = 0; if (item.noTaxTotal === undefined) item.noTaxTotal = 0; if (item.taxAmount === undefined) item.taxAmount = 0;