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();