From a2479398ebab060e637afb03bd22d4a69533fcdd Mon Sep 17 00:00:00 2001 From: "xinxin.wu" Date: Thu, 20 Jun 2024 20:00:48 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E5=85=B3?= =?UTF-8?q?=E8=81=94=E7=94=A8=E4=BE=8B=E5=88=87=E6=8D=A2=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E5=85=A8=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/ms-associate-case/caseTable.vue | 25 ++++-------------- .../business/ms-associate-case/caseTree.vue | 11 +++++--- .../business/ms-associate-case/index.vue | 3 +-- .../ms-associate-case/scenarioCaseTable.vue | 26 ++++--------------- 4 files changed, 19 insertions(+), 46 deletions(-) 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,