Commit d5b341b8 by wangzhihui

修复

1 parent f3b6b629
...@@ -944,12 +944,25 @@ export default { ...@@ -944,12 +944,25 @@ export default {
}, },
deep: true, deep: true,
}, },
serviceItemList: {
handler(list) {
if (!list?.length) {
return;
}
this.syncServiceItemOptionsToFormBlocks(list);
},
},
}, },
async mounted() { async mounted() {
// 先加载服务项目选项,再赋值 formData,避免 filterForm 时 optionList 为空导致编辑回显失败
await this.loadServiceItemList();
this.formData = deepClone(this.originData); this.formData = deepClone(this.originData);
this.normalizeGroundingGoodsServiceItemIds();
this.checkMinPrice(); this.checkMinPrice();
await this.loadServiceItemList(); (this.formData.groundingGoodsList || []).forEach((_, index) => {
this.filterForm(index);
});
}, },
methods: { methods: {
...@@ -963,15 +976,44 @@ export default { ...@@ -963,15 +976,44 @@ export default {
pageSize: 10000, pageSize: 10000,
currentPage: 1, currentPage: 1,
}); });
this.serviceItemList = (serviceItemRes?.list || []).map((item) => ({ this.serviceItemList = (serviceItemRes?.list || []).map((item) => {
...item, const serviceItemId = item.serviceItemId ?? item.id;
serviceItemId: item.serviceItemId ?? item.id, const normalizedId = serviceItemId === "" || serviceItemId === null || serviceItemId === undefined
})); ? ""
: Number(serviceItemId);
return {
...item,
serviceItemId: Number.isNaN(normalizedId) ? serviceItemId : normalizedId,
};
});
} catch (err) { } catch (err) {
console.log(err); console.log(err);
this.serviceItemList = []; this.serviceItemList = [];
} }
}, },
normalizeGroundingGoodsServiceItemIds() {
(this.formData.groundingGoodsList || []).forEach((item, index) => {
if (item.serviceItemId === "" || item.serviceItemId === null || item.serviceItemId === undefined) {
return;
}
const normalizedId = Number(item.serviceItemId);
if (!Number.isNaN(normalizedId)) {
this.$set(this.formData.groundingGoodsList[index], "serviceItemId", normalizedId);
}
});
},
syncServiceItemOptionsToFormBlocks(list = this.serviceItemList) {
(this.formData.groundingGoodsList || []).forEach((_, index) => {
const formBlock = this.formList[2]?.formBlock?.[index];
if (!formBlock) {
return;
}
const serviceField = formBlock.find((v) => v.name === "serviceItemId");
if (serviceField) {
this.$set(serviceField, "optionList", list || []);
}
});
},
getEmptyGroundingGoodsItem() { getEmptyGroundingGoodsItem() {
return { return {
upgradeGoodsId: "", upgradeGoodsId: "",
......
...@@ -299,7 +299,13 @@ export default { ...@@ -299,7 +299,13 @@ export default {
virtualAccountCost: val?.virtualAccountCost, // 虚拟对账成本 virtualAccountCost: val?.virtualAccountCost, // 虚拟对账成本
djCost: val?.djCost, // 嘀加成本 djCost: val?.djCost, // 嘀加成本
thirdPartyCost: val?.thirdPartyCost, // 第三方成本 thirdPartyCost: val?.thirdPartyCost, // 第三方成本
serviceItemId: val?.serviceItemId ?? "", // 服务项目 serviceItemId: (() => {
if (val?.serviceItemId == null || val?.serviceItemId === "") {
return "";
}
const id = Number(val.serviceItemId);
return Number.isNaN(id) ? "" : id;
})(), // 服务项目
productCostType: (() => { productCostType: (() => {
const supplierCode = val?.goodsInfo?.supplierCode; const supplierCode = val?.goodsInfo?.supplierCode;
// 自营延保/权益:编辑回显时 productCostType 固定为 1 // 自营延保/权益:编辑回显时 productCostType 固定为 1
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!