diff --git a/frontend/src/components/business/ms-select/index.tsx b/frontend/src/components/business/ms-select/index.tsx index dd50cad99b..e55f50373b 100644 --- a/frontend/src/components/business/ms-select/index.tsx +++ b/frontend/src/components/business/ms-select/index.tsx @@ -239,9 +239,11 @@ export default defineComponent( ? [...filterOptions.value] : filterOptions.value.map((e) => e[props.valueKey || 'value']); emit('update:modelValue', innerValue.value); + emit('change', innerValue.value); } else { innerValue.value = []; emit('update:modelValue', []); + emit('change', []); } } diff --git a/frontend/src/views/workbench/homePage/components/apiAndScenarioCase.vue b/frontend/src/views/workbench/homePage/components/apiAndScenarioCase.vue index d04bd509d0..2300221dae 100644 --- a/frontend/src/views/workbench/homePage/components/apiAndScenarioCase.vue +++ b/frontend/src/views/workbench/homePage/components/apiAndScenarioCase.vue @@ -78,6 +78,7 @@ const props = defineProps<{ item: SelectedCardItem; + refreshKey: number; status?: boolean; cover?: ApiCoverageData; }>(); @@ -211,7 +212,8 @@ const unCoverWithCase = props.item.key === WorkCardEnum.API_CASE_COUNT ? unCoverWithApiCase : unCoverWithApiScenario; - const coverWithCase = WorkCardEnum.API_CASE_COUNT ? coverWithApiCase : coverWithApiScenario; + const coverWithCase = props.item.key === WorkCardEnum.API_CASE_COUNT ? coverWithApiCase : coverWithApiScenario; + coverData.value = cloneDeep(initCoverRate); coverData.value = [ { @@ -355,6 +357,15 @@ deep: true, } ); + + watch( + () => props.refreshKey, + (val) => { + if (val) { + initApiOrScenarioCount(); + } + } + ); diff --git a/frontend/src/views/workbench/homePage/components/apiCount.vue b/frontend/src/views/workbench/homePage/components/apiCount.vue index 7378961195..abaeff0c9a 100644 --- a/frontend/src/views/workbench/homePage/components/apiCount.vue +++ b/frontend/src/views/workbench/homePage/components/apiCount.vue @@ -65,6 +65,7 @@ const props = defineProps<{ item: SelectedCardItem; + refreshKey: number; projectIds: string[]; status?: boolean; cover?: ApiCoverageData; @@ -261,6 +262,15 @@ deep: true, } ); + + watch( + () => props.refreshKey, + (val) => { + if (val) { + initApiCount(); + } + } + ); diff --git a/frontend/src/views/workbench/homePage/components/caseReviewedCount.vue b/frontend/src/views/workbench/homePage/components/caseReviewedCount.vue index ae9706d24b..2f5f321215 100644 --- a/frontend/src/views/workbench/homePage/components/caseReviewedCount.vue +++ b/frontend/src/views/workbench/homePage/components/caseReviewedCount.vue @@ -61,6 +61,7 @@ const props = defineProps<{ item: SelectedCardItem; + refreshKey: number; }>(); const emit = defineEmits<{ @@ -100,7 +101,7 @@ const caseReviewCountOptions = ref>({}); const hasPermission = ref(false); - async function initApiCount() { + async function initReviewCount() { const { startTime, endTime, dayNumber } = timeForm.value; const params = { current: 1, @@ -134,13 +135,13 @@ function changeProject() { nextTick(() => { - initApiCount(); + initReviewCount(); emit('change'); }); } onMounted(() => { - initApiCount(); + initReviewCount(); }); watch( @@ -166,13 +167,22 @@ () => timeForm.value, (val) => { if (val) { - initApiCount(); + initReviewCount(); } }, { deep: true, } ); + + watch( + () => props.refreshKey, + (val) => { + if (val) { + initReviewCount(); + } + } + ); diff --git a/frontend/src/views/workbench/homePage/components/defectCount.vue b/frontend/src/views/workbench/homePage/components/defectCount.vue index 34039d953d..80c9ed507a 100644 --- a/frontend/src/views/workbench/homePage/components/defectCount.vue +++ b/frontend/src/views/workbench/homePage/components/defectCount.vue @@ -73,6 +73,7 @@ const props = defineProps<{ item: SelectedCardItem; + refreshKey: number; }>(); const emit = defineEmits<{ @@ -208,6 +209,15 @@ deep: true, } ); + + watch( + () => props.refreshKey, + (val) => { + if (val) { + initCount(); + } + } + ); diff --git a/frontend/src/views/workbench/homePage/components/defectMemberBar.vue b/frontend/src/views/workbench/homePage/components/defectMemberBar.vue index 8df740bd8f..c9e56e5351 100644 --- a/frontend/src/views/workbench/homePage/components/defectMemberBar.vue +++ b/frontend/src/views/workbench/homePage/components/defectMemberBar.vue @@ -62,6 +62,7 @@ const appStore = useAppStore(); const props = defineProps<{ item: SelectedCardItem; + refreshKey: number; }>(); const emit = defineEmits<{ @@ -232,6 +233,16 @@ } ); + watch( + () => props.refreshKey, + (val) => { + if (val) { + getMemberOptions(); + getDefectMemberDetail(); + } + } + ); + onMounted(() => { getMemberOptions(); getDefectMemberDetail(); diff --git a/frontend/src/views/workbench/homePage/components/overview.vue b/frontend/src/views/workbench/homePage/components/overview.vue index 2672bdd861..71cabf594d 100644 --- a/frontend/src/views/workbench/homePage/components/overview.vue +++ b/frontend/src/views/workbench/homePage/components/overview.vue @@ -67,6 +67,7 @@ const props = defineProps<{ item: SelectedCardItem; + refreshKey: number; }>(); const emit = defineEmits<{ @@ -141,16 +142,16 @@ enterable: true, formatter(params: any) { const html = ` -
-
-
+
+
-
${params.name}
-
-
${addCommasToNumber(params.value)}
-
- `; +
${params.name}
+
+
${addCommasToNumber(params.value)}
+
+ `; return html; }, }, @@ -170,6 +171,7 @@ itemStyle: { borderRadius: [2, 2, 0, 0], // 上边圆角 }, + z: 10, data: countData, barMinHeight: ((optionData: Record[]) => { optionData.forEach((itemValue: any, index: number) => { @@ -217,13 +219,15 @@ console.log(error); } } - + const isInit = ref(true); function changeProject() { + if (isInit.value) { + isInit.value = false; + return; + } nextTick(() => { - if (innerProjectIds.value.length && innerProjectIds.value.length !== appStore.projectList.length) { - initOverViewDetail(); - emit('change'); - } + initOverViewDetail(); + emit('change'); }); } @@ -234,12 +238,6 @@ watch( () => innerProjectIds.value, (val) => { - if (val.length === appStore.projectList.length || val.length === 0) { - nextTick(() => { - initOverViewDetail(); - emit('change'); - }); - } innerSelectAll.value = val.length === appStore.projectList.length; } ); @@ -255,6 +253,15 @@ deep: true, } ); + + watch( + () => props.refreshKey, + (val) => { + if (val) { + initOverViewDetail(); + } + } + ); diff --git a/frontend/src/views/workbench/homePage/components/relatedCaseCount.vue b/frontend/src/views/workbench/homePage/components/relatedCaseCount.vue index ebd3afefe2..a419e62ada 100644 --- a/frontend/src/views/workbench/homePage/components/relatedCaseCount.vue +++ b/frontend/src/views/workbench/homePage/components/relatedCaseCount.vue @@ -57,6 +57,7 @@ const props = defineProps<{ item: SelectedCardItem; + refreshKey: number; }>(); const emit = defineEmits<{ @@ -166,6 +167,15 @@ deep: true, } ); + + watch( + () => props.refreshKey, + (val) => { + if (val) { + getRelatedCaseCount(); + } + } + ); diff --git a/frontend/src/views/workbench/homePage/components/testPlanCount.vue b/frontend/src/views/workbench/homePage/components/testPlanCount.vue index 624e0927e7..f866b38870 100644 --- a/frontend/src/views/workbench/homePage/components/testPlanCount.vue +++ b/frontend/src/views/workbench/homePage/components/testPlanCount.vue @@ -68,6 +68,7 @@ const props = defineProps<{ item: SelectedCardItem; + refreshKey: number; }>(); const emit = defineEmits<{ @@ -288,6 +289,15 @@ deep: true, } ); + + watch( + () => props.refreshKey, + (val) => { + if (val) { + initTestPlanCount(); + } + } + ); diff --git a/frontend/src/views/workbench/homePage/index.vue b/frontend/src/views/workbench/homePage/index.vue index 3a0dc84999..6396655d79 100644 --- a/frontend/src/views/workbench/homePage/index.vue +++ b/frontend/src/views/workbench/homePage/index.vue @@ -59,6 +59,7 @@ v-model:projectIds="item.projectIds" v-model:selectAll="item.selectAll" :item="item" + :refresh-key="refreshKey" @change="changeHandler" /> @@ -133,6 +144,7 @@ v-else-if="item.key === WorkCardEnum.TEST_PLAN_COUNT" v-model:projectIds="item.projectIds" :item="item" + :refresh-key="refreshKey" @change="changeHandler" /> @@ -306,9 +318,12 @@ } } + const refreshKey = ref(0); + // 刷新 async function handleRefresh() { initDefaultList(); + refreshKey.value = Date.now(); } onMounted(() => {