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 + // })); + // } } }