From 81b747241be27abb5366573e95dbae8f9ba05a9d Mon Sep 17 00:00:00 2001 From: "SGK\\17962" <1796293269@qq.com> Date: Thu, 21 Aug 2025 10:35:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AC=E7=A7=AF=E9=87=91=E7=BC=B4=E5=AD=98?= =?UTF-8?q?=E6=98=8E=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../market/modules/market-operate-drawer.vue | 45 +++++++++++++++---- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/cds-fontend-2025.V1/src/views/mps/market/modules/market-operate-drawer.vue b/cds-fontend-2025.V1/src/views/mps/market/modules/market-operate-drawer.vue index b02b27f..f73ba93 100644 --- a/cds-fontend-2025.V1/src/views/mps/market/modules/market-operate-drawer.vue +++ b/cds-fontend-2025.V1/src/views/mps/market/modules/market-operate-drawer.vue @@ -140,23 +140,50 @@ function handleUpdateModelWhenEdit() { } if (props.operateType === 'edit' && props.rowData) { - Object.assign(model, createDefaultModel()); - Object.assign(model, props.rowData); + // 特别处理trafficList中的trafficAmt字段,确保是数字类型 + if (props.rowData.trafficList && Array.isArray(props.rowData.trafficList)) { + props.rowData.trafficList = props.rowData.trafficList.map(item => ({ + ...item, + trafficAmt: item.trafficAmt !== undefined ? Number(item.trafficAmt) : 0 + })); + } + debugger; + Object.assign(model, createDefaultModel(), props.rowData); // 根据是否有营销人员信息决定是否勾选复选框 if (model.yxName || model.yxId) { showMarketingFields.value = true; } else { showMarketingFields.value = false; } + // 特别处理trafficList中的trafficAmt字段,确保是数字类型,并保持响应性 + if (props.rowData.trafficList && Array.isArray(props.rowData.trafficList)) { + const processedTrafficList = props.rowData.trafficList.map(item => ({ + ...item, + trafficAmt: item.trafficAmt !== undefined ? Number(item.trafficAmt) : 0 + })); + // 使用splice方法保持数组的响应性 + model.trafficList.splice(0, model.trafficList.length, ...processedTrafficList); + } + + // 特别处理magneticCardList数组,保持响应性 + if (props.rowData.magneticCardList && Array.isArray(props.rowData.magneticCardList)) { + // 使用splice方法保持数组的响应性 + model.magneticCardList.splice(0, model.magneticCardList.length, ...props.rowData.magneticCardList); + } // 特别处理数组字段,确保它们被正确复制 - if (props.rowData.magneticCardList) { - model.magneticCardList = JSON.parse(JSON.stringify(props.rowData.magneticCardList)); - } - - if (props.rowData.trafficList) { - model.trafficList = JSON.parse(JSON.stringify(props.rowData.trafficList)); - } + // if (props.rowData.magneticCardList) { + // model.magneticCardList = JSON.parse(JSON.stringify(props.rowData.magneticCardList)); + // } + // + // if (props.rowData.trafficList) { + // model.trafficList = JSON.parse(JSON.stringify(props.rowData.trafficList)); + // // 确保trafficAmt是数字类型 + // model.trafficList = model.trafficList.map(item => ({ + // ...item, + // trafficAmt: item.trafficAmt !== undefined ? Number(item.trafficAmt) : 0 + // })); + // } } }