Browse Source

fix: 修复我的待办立即处理缓存问题

master
parent
commit
eec743e3d8
  1. 47
      src/components/negative/dialog.vue
  2. 3
      src/components/negative/verify.vue

47
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();
[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;
}
}
);
// 新增:监听弹窗打开,强制刷新数据
watch(visible, (newVal) => {
if (newVal) {
getDetails();
verifyEditFlag.value = false;
formData.value = {};
currentComplaintStage.value = STAGE_COMPLETION;
}
});
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;
} catch (error) {
// 请求层负责错误提示;失败时保持办理模块隐藏。
} finally {
if (requestId === detailsRequestId) {
loading.value = false;
});
}
}
}
/**
* 获取附件

3
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 = {

Loading…
Cancel
Save