From eec743e3d82df7d2c946355d6ba5ba76ece16a1e Mon Sep 17 00:00:00 2001 From: buaixuexideshitongxue <2936013465@qq.com> Date: Thu, 29 Oct 2026 16:58:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=88=91=E7=9A=84?= =?UTF-8?q?=E5=BE=85=E5=8A=9E=E7=AB=8B=E5=8D=B3=E5=A4=84=E7=90=86=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/negative/dialog.vue | 53 +++++++++++++++++++----------- src/components/negative/verify.vue | 3 +- 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/src/components/negative/dialog.vue b/src/components/negative/dialog.vue index ff3db5f..e745bf8 100644 --- a/src/components/negative/dialog.vue +++ b/src/components/negative/dialog.vue @@ -512,32 +512,40 @@ const visible = computed({ set: (val) => emit('update:modelValue', val) }); +let detailsRequestId = 0; watch( - () => props.id, - () => { - if (visible.value) { - getDetails(); - verifyEditFlag.value = false; - formData.value = {}; - currentComplaintStage.value = STAGE_COMPLETION; - } - } -); - -// 新增:监听弹窗打开,强制刷新数据 -watch(visible, (newVal) => { - if (newVal) { - getDetails(); + [visible, () => props.id], + ([isVisible, id]) => { verifyEditFlag.value = false; formData.value = {}; currentComplaintStage.value = STAGE_COMPLETION; + if (isVisible && id) { + getDetails(); + } else { + // 关闭时使尚未返回的详情请求失效。 + detailsRequestId++; + components.value = []; + loading.value = false; + } } -}); +); const confirmationCompletionFlag = ref(false); -function getDetails() { +async function getDetails() { + const requestId = ++detailsRequestId; + const negativeId = props.id; loading.value = true; - getNegativeDetails(props.id, work?.value.workId).then((data) => { + components.value = []; + flowActions.value = []; + try { + const data = await getNegativeDetails(negativeId, work?.value.workId); + if ( + requestId !== detailsRequestId || + !visible.value || + negativeId !== props.id + ) { + return; + } negative.value = { ...data.negative, remainingDuration: data.remainingDuration, @@ -560,8 +568,13 @@ function getDetails() { // 是否认定办结 confirmationCompletionFlag.value = data.confirmationCompletionFlag; - loading.value = false; - }); + } catch (error) { + // 请求层负责错误提示;失败时保持办理模块隐藏。 + } finally { + if (requestId === detailsRequestId) { + loading.value = false; + } + } } /** * 获取附件 diff --git a/src/components/negative/verify.vue b/src/components/negative/verify.vue index ac22ef4..d2a73fa 100644 --- a/src/components/negative/verify.vue +++ b/src/components/negative/verify.vue @@ -1665,7 +1665,8 @@ const problemIsTrue = computed(() => { return form.value.checkStatusCode === '1' || form.value.checkStatusCode === '2' || form.value.checkStatusCode === '3'; }); -getFormData(); +// 详情对象更新时重新初始化,避免复用组件时残留上一条核查信息。 +watch(negative, getFormData, { immediate: true }); async function getFormData() { form.value = {