From 36f6a412888bfc0c1d9ad67d7914f3c49490950c Mon Sep 17 00:00:00 2001 From: "xinxin.wu" Date: Mon, 25 Nov 2024 19:23:08 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=B7=A5=E4=BD=9C=E5=8F=B0):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=B7=A5=E4=BD=9C=E5=8F=B0=E9=A1=B9=E7=9B=AE=E6=A6=82?= =?UTF-8?q?=E8=A7=88=E9=BB=98=E8=AE=A4=E9=80=89=E4=B8=AD=E5=85=A8=E9=83=A8?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/business/ms-select/index.tsx | 9 ++++++++ .../homePage/components/overview.vue | 22 ++++--------------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/frontend/src/components/business/ms-select/index.tsx b/frontend/src/components/business/ms-select/index.tsx index 05e4c32198..80b325927e 100644 --- a/frontend/src/components/business/ms-select/index.tsx +++ b/frontend/src/components/business/ms-select/index.tsx @@ -349,6 +349,15 @@ export default defineComponent( } }); + watch( + () => props.defaultAllSelect, + (val) => { + if (val) { + handleSelectAllChange(true); + } + } + ); + // 检测全选状态变化,全选时需要覆盖选择器的输入框内容,展示文本 ‘全部’;非全选时则移除文本 ‘全部’ watchEffect(() => { const innerDom = selectRef.value?.$el.nextElementSibling.querySelector('.arco-select-view-inner') as HTMLElement; diff --git a/frontend/src/views/workbench/homePage/components/overview.vue b/frontend/src/views/workbench/homePage/components/overview.vue index 7b516a579a..ea19de20df 100644 --- a/frontend/src/views/workbench/homePage/components/overview.vue +++ b/frontend/src/views/workbench/homePage/components/overview.vue @@ -19,7 +19,7 @@ :prefix="t('workbench.homePage.project')" :multiple="true" :has-all-select="true" - :default-all-select="innerSelectAll" + :default-all-select="props.item.selectAll" :at-least-one="true" @change="changeProject" > @@ -195,6 +195,7 @@ options.value.yAxis[0].max = maxAxis < 100 ? 100 : maxAxis + 50; } const showSkeleton = ref(false); + const selectAll = computed(() => appStore.projectList.length === innerProjectIds.value.length); async function initOverViewDetail() { try { @@ -210,7 +211,7 @@ projectIds: innerProjectIds.value, organizationId: appStore.currentOrgId, handleUsers: [], - selectAll: innerSelectAll.value, + selectAll: selectAll.value, }; let detail; if (props.item.key === WorkCardEnum.PROJECT_VIEW) { @@ -232,6 +233,7 @@ function changeProject() { if (isInit.value) return; nextTick(() => { + innerSelectAll.value = selectAll.value; emit('change'); }); } @@ -241,13 +243,6 @@ initOverViewDetail(); }); - watch( - () => innerProjectIds.value, - (val) => { - innerSelectAll.value = val.length === appStore.projectList.length; - } - ); - watch( () => timeForm.value, (val) => { @@ -260,15 +255,6 @@ } ); - watch( - () => props.refreshKey, - (val) => { - if (val) { - initOverViewDetail(); - } - } - ); - watch([() => props.refreshKey, () => innerProjectIds.value], async () => { await nextTick(); initOverViewDetail();