From 65f6daa4f72fdb73b2fd51c0c9d1e3e130ef780f Mon Sep 17 00:00:00 2001 From: wsm <2746563060@侵权。> Date: Mon, 25 May 2026 14:47:39 +0800 Subject: [PATCH] =?UTF-8?q?refactor(xispeak):=20=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E4=B8=8D=E5=86=8D=E5=8A=A0=E8=BD=BD=E5=85=A8?= =?UTF-8?q?=E9=87=8F=E6=A0=91=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将 loadTreeData 从 edit() 移至 add(),仅新增流程时需要树数据计算展开路径。 Co-Authored-By: Claude Opus 4.6 --- .../bg/xispeak/components/BgXiSpeakForm.vue | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/views/bg/xispeak/components/BgXiSpeakForm.vue b/src/views/bg/xispeak/components/BgXiSpeakForm.vue index 5637de1..4eefbc1 100644 --- a/src/views/bg/xispeak/components/BgXiSpeakForm.vue +++ b/src/views/bg/xispeak/components/BgXiSpeakForm.vue @@ -286,7 +286,8 @@ return false; }); - function add(obj = {}) { + async function add(obj = {}) { + treeData.value = await loadTreeData({ async: false, pcode: '' }); edit(obj); } @@ -294,12 +295,22 @@ nextTick(async () => { resetFields(); expandedRowKeys.value = []; - treeData.value = await loadTreeData({ async: false, pcode: '' }); + + // 非BPM模式且有ID时,从API查询完整数据,避免列表行数据不完整导致字段不显示 + let data = record; + if (record.id && !props.formBpm) { + try { + const res = await defHttp.get({ url: queryByIdUrl, params: { id: record.id } }); + data = res || record; + } catch { + data = record; + } + } const tmpData = {}; Object.keys(formData).forEach((key) => { - if (record.hasOwnProperty(key)) { - tmpData[key] = record[key] === null ? (key === 'needSdwApproval' ? 0 : '') : record[key]; + if (data.hasOwnProperty(key)) { + tmpData[key] = data[key] === null ? (key === 'needSdwApproval' ? 0 : '') : data[key]; } });