Fix Bug #529: [住院医生工作站-检验申请] 点击修改打开编辑弹窗后原已选中的项目未回显

根因:时序竞态——editData watch (immediate: true) 在 applicationListAll 加载完成前触发,
匹配不到数据导致 transferValue 被置空。新增 watch 监听 applicationListAll 加载完成后重新回显。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-18 11:02:49 +08:00
committed by zhaoyun
parent b37033d87e
commit 56cd024949

View File

@@ -380,6 +380,28 @@ watch(
}, },
{ immediate: true } { immediate: true }
); );
// 编辑模式下applicationListAll 加载完成后重新回显已选项目
watch(
() => applicationListAll.value,
() => {
if (!props.editData?.requestFormId) return;
if (!props.editData.requestFormDetailList?.length) return;
if (!applicationListAll.value.length) return;
const selectedIds = [];
props.editData.requestFormDetailList.forEach((detail) => {
const matched = applicationListAll.value.find(
(item) => item.adviceName === detail.adviceName
);
if (matched) {
selectedIds.push(matched.adviceDefinitionId);
}
});
transferValue.value = selectedIds;
}
);
const submit = () => { const submit = () => {
if (transferValue.value.length == 0) { if (transferValue.value.length == 0) {
return proxy.$message.error('请选择申请单'); return proxy.$message.error('请选择申请单');