From 18cdf76a9597483f9a864941c192b01cba447967 Mon Sep 17 00:00:00 2001 From: "xinxin.wu" Date: Wed, 27 Nov 2024 12:48:17 +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=E7=B3=BB=E7=BB=9F=E5=8D=A1?= =?UTF-8?q?=E7=89=87=E4=BA=BA=E5=91=98bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../homePage/components/defectMemberBar.vue | 47 +++++++------- .../homePage/components/overview.vue | 41 +++++++----- .../homePage/components/overviewMember.vue | 62 +++++++++---------- .../src/views/workbench/homePage/index.vue | 2 +- 4 files changed, 80 insertions(+), 72 deletions(-) diff --git a/frontend/src/views/workbench/homePage/components/defectMemberBar.vue b/frontend/src/views/workbench/homePage/components/defectMemberBar.vue index d07bc64f19..34fa65035a 100644 --- a/frontend/src/views/workbench/homePage/components/defectMemberBar.vue +++ b/frontend/src/views/workbench/homePage/components/defectMemberBar.vue @@ -29,8 +29,7 @@ :prefix="t('workbench.homePage.staff')" :multiple="true" :has-all-select="true" - :default-all-select="innerHandleUsers.length === 0" - @change="changeMember" + @popup-visible-change="popupVisibleChange" > @@ -60,7 +59,6 @@ import type { OverViewOfProject, SelectedCardItem, TimeFormParams } from '@/models/workbench/homePage'; import { getColorScheme, getCommonBarOptions, handleNoDataDisplay } from '../utils'; - import type { SelectOptionData } from '@arco-design/web-vue'; const { t } = useI18n(); const appStore = useAppStore(); @@ -92,7 +90,7 @@ }) ); - const memberOptions = ref([]); + const memberOptions = ref<{ label: string; value: string }[]>([]); const options = ref>({}); @@ -178,23 +176,29 @@ label: e.text, value: e.value, })); - innerHandleUsers.value = innerHandleUsers.value.filter((id: string) => - memberOptions.value.some((member) => member.value === id) - ); + innerHandleUsers.value = memberOptions.value.map((e) => e.value); } - function changeProject() { - innerHandleUsers.value = []; - nextTick(() => { - emit('change'); - }); + async function handleProjectChange(isRefreshKey: boolean = false) { + await nextTick(); + if (!isRefreshKey) { + await getMemberOptions(); + } + await getDefectMemberDetail(); } - function changeMember() { - nextTick(() => { - getDefectMemberDetail(); - emit('change'); - }); + async function changeProject() { + await handleProjectChange(false); + emit('change'); + } + + function popupVisibleChange(val: boolean) { + if (!val) { + nextTick(() => { + getDefectMemberDetail(); + emit('change'); + }); + } } watch( @@ -230,15 +234,12 @@ } ); - watch([() => props.refreshKey, () => projectId.value], async () => { - await nextTick(); - getMemberOptions(); - getDefectMemberDetail(); + watch([() => props.refreshKey, () => projectId.value], ([refreshKey]) => { + handleProjectChange(!!refreshKey); }); onMounted(() => { - getMemberOptions(); - getDefectMemberDetail(); + handleProjectChange(false); }); diff --git a/frontend/src/views/workbench/homePage/components/overview.vue b/frontend/src/views/workbench/homePage/components/overview.vue index 79cd3e1208..782011bf8b 100644 --- a/frontend/src/views/workbench/homePage/components/overview.vue +++ b/frontend/src/views/workbench/homePage/components/overview.vue @@ -1,7 +1,7 @@