diff --git a/frontend/src/components/business/ms-associate-case/caseTable.vue b/frontend/src/components/business/ms-associate-case/caseTable.vue index b4c6d4329f..67434a86dc 100644 --- a/frontend/src/components/business/ms-associate-case/caseTable.vue +++ b/frontend/src/components/business/ms-associate-case/caseTable.vue @@ -305,18 +305,6 @@ }); } - watch( - () => props.currentProject, - () => { - setPagination({ - current: 1, - }); - resetSelector(); - resetFilterParams(); - emit('refresh'); - } - ); - const selectIds = computed(() => { return [...propsRes.value.selectedKeys]; }); @@ -328,14 +316,11 @@ } ); - watch( - () => props.activeModule, - () => { - resetSelector(); - resetFilterParams(); - loadCaseList(); - } - ); + watch([() => props.currentProject, () => props.activeModule], () => { + resetSelector(); + resetFilterParams(); + loadCaseList(); + }); onMounted(() => { loadCaseList(); diff --git a/frontend/src/components/business/ms-associate-case/caseTree.vue b/frontend/src/components/business/ms-associate-case/caseTree.vue index 31ab7bd42e..4f900d2f2a 100644 --- a/frontend/src/components/business/ms-associate-case/caseTree.vue +++ b/frontend/src/components/business/ms-associate-case/caseTree.vue @@ -132,7 +132,7 @@ /** * 初始化模块树 */ - async function initModules() { + async function initModules(setDefault = false) { try { moduleLoading.value = true; const getModuleParams = { @@ -149,6 +149,9 @@ count: props.modulesCount?.[node.id] || 0, }; }); + if (setDefault) { + setActiveFolder('all'); + } emit('init', caseTree.value, selectedProtocols.value); } catch (error) { // eslint-disable-next-line no-console @@ -190,8 +193,10 @@ watch( () => props.currentProject, - () => { - initModules(); + (val) => { + if (val) { + initModules(true); + } } ); diff --git a/frontend/src/components/business/ms-associate-case/index.vue b/frontend/src/components/business/ms-associate-case/index.vue index 10b917f1f7..ec2959363c 100644 --- a/frontend/src/components/business/ms-associate-case/index.vue +++ b/frontend/src/components/business/ms-associate-case/index.vue @@ -471,8 +471,6 @@ selectedProtocols.value = _protocols || []; if (props.associatedType === CaseLinkEnum.API) { loadCaseList(); - } else { - activeFolder.value = 'all'; } } @@ -514,6 +512,7 @@ (val) => { if (val) { associationType.value = props.associatedType; + activeFolder.value = 'all'; initProjectList(); } selectPopVisible.value = false; diff --git a/frontend/src/components/business/ms-associate-case/scenarioCaseTable.vue b/frontend/src/components/business/ms-associate-case/scenarioCaseTable.vue index 6991ce89e7..9507f521a9 100644 --- a/frontend/src/components/business/ms-associate-case/scenarioCaseTable.vue +++ b/frontend/src/components/business/ms-associate-case/scenarioCaseTable.vue @@ -268,18 +268,6 @@ } ); - watch( - () => props.currentProject, - () => { - setPagination({ - current: 1, - }); - resetSelector(); - resetFilterParams(); - emit('refresh'); - } - ); - function getScenarioSaveParams() { const { excludeKeys, selectedKeys, selectorStatus } = propsRes.value; const tableParams = getTableParams(); @@ -298,20 +286,16 @@ pId: record.projectId, }); } + watch([() => props.currentProject, () => props.activeModule], () => { + resetSelector(); + resetFilterParams(); + loadScenarioList(); + }); onMounted(() => { loadScenarioList(); }); - watch( - () => props.activeModule, - () => { - resetSelector(); - resetFilterParams(); - loadScenarioList(); - } - ); - defineExpose({ getScenarioSaveParams, loadScenarioList,