Commit 8734d750 by sunhaiwei

修改过程质检单页面质检明细的回显

parent 13b212c8
......@@ -54,11 +54,18 @@
deep: true,
},
);
// 1. 定义初始化标记(默认不执行)
let isInitialized = false;
// 质检方案联动:根据方案id从接口获取明细,并整体替换当前明细列表
let zjfaReqSeq = 0;
async function handleZjfaChange(zjfaId: string) {
const seq = ++zjfaReqSeq;
// 2. 初始化阶段直接返回(不执行后续逻辑)
if (!isInitialized) {
// 可选:初始化完成后开启开关(如果需要后续操作生效)
isInitialized = true;
return;
}
try {
const resp = await axios.get(
import.meta.env.VITE_GLOB_API_URL + '/magic-api/zlgl/zjjcsj/getFaById',
......@@ -103,6 +110,8 @@
if (!newZjfaId) {
state.formModel = { ...(state.formModel as any), mesQualityInspectionDetailList: [] };
systemFormRef.value?.setFieldsValue?.({ mesQualityInspectionDetailList: [] });
//没有值将初始化标识改为true
isInitialized = true;
return;
}
await handleZjfaChange(newZjfaId);
......@@ -171,12 +180,12 @@
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:获取表单数据
// 打开编辑弹窗时:用当前方案id刷新明细(放在 getFormDataEvent 后,避免被其覆盖)
await nextTick();
const zjfaId = (state.formModel as any)?.zjfa;
if (zjfaId) {
await handleZjfaChange(zjfaId);
}
const nextModel = {
...(state.formModel as any),
mesQualityInspectionDetailList: record["mesQualityInspectionDetailList"],
};
state.formModel = nextModel;
} catch (error) {
}
......@@ -285,4 +294,3 @@
});
</script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment