From 9bd017a8005c7f06a360069d39f5b2ce4d5f1109 Mon Sep 17 00:00:00 2001 From: "xinxin.wu" Date: Thu, 14 Nov 2024 19:36:59 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=B7=A5=E4=BD=9C=E5=8F=B0):=20=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E5=8F=B0=E9=A6=96=E9=A1=B5=E8=81=94=E8=B0=83=E5=8D=A1?= =?UTF-8?q?=E7=89=87&=E6=9F=B1=E7=8A=B6=E5=9B=BE=E9=A5=BC=E5=9B=BE?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/modules/workbench.ts | 56 ++++++++-- frontend/src/api/requrls/workbench.ts | 7 ++ frontend/src/components/pure/chart/index.vue | 3 +- frontend/src/models/workbench/homePage.ts | 8 +- .../components/apiAndScenarioCase.vue | 105 +++++++++++++++--- .../homePage/components/apiChangeList.vue | 26 ++++- .../homePage/components/apiCount.vue | 61 +++++----- .../homePage/components/caseCount.vue | 10 +- .../homePage/components/caseReviewedCount.vue | 9 +- .../homePage/components/defectCount.vue | 65 ++++++----- .../homePage/components/defectMemberBar.vue | 35 ++++-- .../homePage/components/overview.vue | 39 ++++++- .../homePage/components/overviewMember.vue | 18 ++- .../homePage/components/ratioPie.vue | 91 +++++++++++---- .../homePage/components/relatedCaseCount.vue | 9 +- .../homePage/components/testPlanCount.vue | 14 ++- .../homePage/components/waitReviewList.vue | 40 ++++++- .../src/views/workbench/homePage/index.vue | 68 ++++++++++-- .../views/workbench/homePage/locale/en-US.ts | 1 + .../views/workbench/homePage/locale/zh-CN.ts | 1 + .../src/views/workbench/homePage/utils.ts | 40 +++---- 21 files changed, 542 insertions(+), 164 deletions(-) diff --git a/frontend/src/api/modules/workbench.ts b/frontend/src/api/modules/workbench.ts index 3bc4a2504c..deca52b2fa 100644 --- a/frontend/src/api/modules/workbench.ts +++ b/frontend/src/api/modules/workbench.ts @@ -17,7 +17,9 @@ import type { import { EditDashboardLayoutUrl, GetDashboardLayoutUrl, + WorkApiCaseCountDetailUrl, WorkApiChangeListUrl, + WorkApiCountDetailUrl, WorkAssociateCaseDetailUrl, WorkbenchApiCaseListUrl, WorkbenchBugListUrl, @@ -26,13 +28,18 @@ import { WorkbenchScenarioListUrl, WorkbenchTestPlanListUrl, WorkbenchTestPlanStatisticUrl, + WorkBugByMeCreatedUrl, + WorkBugCountDetailUrl, + WorkBugHandleByMeUrl, WorkBugHandlerDetailUrl, WorkCaseCountDetailUrl, WorkCaseReviewDetailUrl, + WorkHandleUserOptionsUrl, WorkMemberViewDetailUrl, WorkMyCreatedDetailUrl, WorkProOverviewDetailUrl, WorkReviewListUrl, + WorkScenarioCaseCountDetailUrl, WorkTodoBugListUrl, WorkTodoPlanListUrl, WorkTodoReviewListUrl, @@ -75,15 +82,15 @@ export function workbenchApiCaseList(data: TableQueryParams) { // 工作台首页概览 export function workProOverviewDetail(data: WorkHomePageDetail) { - return MSR.post({ url: WorkProOverviewDetailUrl, data }); + return MSR.post({ url: WorkProOverviewDetailUrl, data }, { ignoreCancelToken: true }); } // 我创建的 export function workMyCreatedDetail(data: WorkHomePageDetail) { - return MSR.post({ url: WorkMyCreatedDetailUrl, data }); + return MSR.post({ url: WorkMyCreatedDetailUrl, data }, { ignoreCancelToken: true }); } // 人员概览 export function workMemberViewDetail(data: WorkHomePageDetail) { - return MSR.post({ url: WorkMemberViewDetailUrl, data }); + return MSR.post({ url: WorkMemberViewDetailUrl, data }, { ignoreCancelToken: true }); } // 获取用户布局 export function getDashboardLayout(orgId: string) { @@ -97,21 +104,21 @@ export function editDashboardLayout(data: SelectedCardItem[], orgId: string) { // 工作台-首页-用例数 export function workCaseCountDetail(data: WorkHomePageDetail) { - return MSR.post({ url: WorkCaseCountDetailUrl, data }); + return MSR.post({ url: WorkCaseCountDetailUrl, data }, { ignoreCancelToken: true }); } // 工作台-首页-关联用例数 export function workAssociateCaseDetail(data: WorkHomePageDetail) { - return MSR.post({ url: WorkAssociateCaseDetailUrl, data }); + return MSR.post({ url: WorkAssociateCaseDetailUrl, data }, { ignoreCancelToken: true }); } // 工作台-首页-用例评审数 export function workCaseReviewDetail(data: WorkHomePageDetail) { - return MSR.post({ url: WorkCaseReviewDetailUrl, data }); + return MSR.post({ url: WorkCaseReviewDetailUrl, data }, { ignoreCancelToken: true }); } // 工作台-首页-缺陷处理人 export function workBugHandlerDetail(data: WorkHomePageDetail) { - return MSR.post({ url: WorkBugHandlerDetailUrl, data }); + return MSR.post({ url: WorkBugHandlerDetailUrl, data }, { ignoreCancelToken: true }); } // 工作台-首页-接口变更 @@ -130,6 +137,41 @@ export function workReviewList(data: WorkHomePageDetail) { ); } +// 工作台-首页-缺陷数量 +export function workBugCountDetail(data: WorkHomePageDetail) { + return MSR.post({ url: WorkBugCountDetailUrl, data }, { ignoreCancelToken: true }); +} + +// 工作台-首页-我创建的缺陷 +export function workBugByMeCreated(data: WorkHomePageDetail) { + return MSR.post({ url: WorkBugByMeCreatedUrl, data }, { ignoreCancelToken: true }); +} + +// 工作台-首页-待我处理的缺陷 +export function workBugHandleByMe(data: WorkHomePageDetail) { + return MSR.post({ url: WorkBugHandleByMeUrl, data }, { ignoreCancelToken: true }); +} + +// 工作台-首页-接口数量 +export function workApiCountDetail(data: WorkHomePageDetail) { + return MSR.post({ url: WorkApiCountDetailUrl, data }, { ignoreCancelToken: true }); +} + +// 工作台-首页-接口用例数量 +export function workApiCaseCountDetail(data: WorkHomePageDetail) { + return MSR.post({ url: WorkApiCaseCountDetailUrl, data }, { ignoreCancelToken: true }); +} + +// 工作台-首页-场景用例数量 +export function workScenarioCaseCountDetail(data: WorkHomePageDetail) { + return MSR.post({ url: WorkScenarioCaseCountDetailUrl, data }, { ignoreCancelToken: true }); +} + +// 工作台-首页-缺陷处理人列表 +export function workHandleUserOptions(projectId: string) { + return MSR.get({ url: WorkHandleUserOptionsUrl, params: projectId }, { ignoreCancelToken: true }); +} + // 待办-用例评审列表 export function workbenchTodoReviewList(data: TableQueryParams) { return MSR.post>({ url: WorkTodoReviewListUrl, data }); diff --git a/frontend/src/api/requrls/workbench.ts b/frontend/src/api/requrls/workbench.ts index 7f2d104b25..dbc6f7fce3 100644 --- a/frontend/src/api/requrls/workbench.ts +++ b/frontend/src/api/requrls/workbench.ts @@ -19,3 +19,10 @@ export const WorkBugHandlerDetailUrl = '/dashboard/bug_handle_user'; // 工作 export const WorkApiChangeListUrl = '/dashboard/api_change'; // 工作台-首页-接口变更 export const WorkCaseReviewDetailUrl = '/dashboard/review_case_count'; // 工作台-首页-用例评审数 export const WorkReviewListUrl = '/dashboard/reviewing_by_me'; // 工作台-首页-待我评审 +export const WorkApiCountDetailUrl = '/dashboard/api_count'; // 工作台-首页-接口数量 +export const WorkApiCaseCountDetailUrl = '/dashboard/api_case_count'; // 工作台-首页-接口用例数量 +export const WorkScenarioCaseCountDetailUrl = '/dashboard/scenario_count'; // 工作台-首页-场景用例数量 +export const WorkHandleUserOptionsUrl = '/dashboard/bug_handle_user/list'; // 工作台-首页-缺陷处理人列表 +export const WorkBugCountDetailUrl = '/dashboard/bug_count'; // 工作台-首页-缺陷数量 +export const WorkBugByMeCreatedUrl = '/dashboard/create_bug_by_me'; // 工作台-首页-我创建的缺陷 +export const WorkBugHandleByMeUrl = '/dashboard/handle_bug_by_me'; // 工作台-首页-待我处理的缺陷 diff --git a/frontend/src/components/pure/chart/index.vue b/frontend/src/components/pure/chart/index.vue index c95be0c3c0..3e2d92fe27 100644 --- a/frontend/src/components/pure/chart/index.vue +++ b/frontend/src/components/pure/chart/index.vue @@ -5,7 +5,7 @@ - + diff --git a/frontend/src/views/workbench/homePage/components/overview.vue b/frontend/src/views/workbench/homePage/components/overview.vue index dfb582902e..d13825cda3 100644 --- a/frontend/src/views/workbench/homePage/components/overview.vue +++ b/frontend/src/views/workbench/homePage/components/overview.vue @@ -17,6 +17,7 @@ :has-all-select="true" :default-all-select="!(props.item.projectIds || []).length" :at-least-one="true" + @change="changeProject" > @@ -45,6 +46,7 @@ import { contentTabList } from '@/config/workbench'; import { useI18n } from '@/hooks/useI18n'; import useAppStore from '@/store/modules/app'; + import { addCommasToNumber } from '@/utils'; import type { ModuleCardItem, @@ -62,6 +64,10 @@ item: SelectedCardItem; }>(); + const emit = defineEmits<{ + (e: 'change'): void; + }>(); + const appStore = useAppStore(); const innerProjectIds = defineModel('projectIds', { @@ -111,14 +117,41 @@ // 处理data数据 options.value.series = detail.projectCountList.map((item) => { + const countData = item.count.map((e) => { + return { + name: item.name, + value: e !== 0 ? e : undefined, + tooltip: { + show: true, + trigger: 'item', + enterable: true, + formatter(params: any) { + const html = ` +
+
+
+
${params.name}
+
+
${addCommasToNumber(params.value)}
+
+ `; + return html; + }, + }, + }; + }); return { name: item.name, type: 'bar', barWidth: 12, + legendHoverLink: true, + large: true, itemStyle: { borderRadius: [2, 2, 0, 0], // 上边圆角 }, - data: item.count, + data: countData, }; }); } @@ -149,6 +182,10 @@ } } + function changeProject() { + emit('change'); + } + onMounted(() => { initOverViewDetail(); }); diff --git a/frontend/src/views/workbench/homePage/components/overviewMember.vue b/frontend/src/views/workbench/homePage/components/overviewMember.vue index db05bfda72..18ea4c46d5 100644 --- a/frontend/src/views/workbench/homePage/components/overviewMember.vue +++ b/frontend/src/views/workbench/homePage/components/overviewMember.vue @@ -27,6 +27,7 @@ :multiple="true" :has-all-select="true" :default-all-select="true" + @change="changeMember" > @@ -64,6 +65,10 @@ item: SelectedCardItem; }>(); + const emit = defineEmits<{ + (e: 'change'): void; + }>(); + const innerProjectIds = defineModel('projectIds', { required: true, }); @@ -138,8 +143,19 @@ } function changeProject() { + memberIds.value = []; getMemberOptions(); - initOverViewMemberDetail(); + nextTick(() => { + initOverViewMemberDetail(); + emit('change'); + }); + } + + function changeMember() { + nextTick(() => { + initOverViewMemberDetail(); + emit('change'); + }); } watch( diff --git a/frontend/src/views/workbench/homePage/components/ratioPie.vue b/frontend/src/views/workbench/homePage/components/ratioPie.vue index f03ba183e8..f342f88f6d 100644 --- a/frontend/src/views/workbench/homePage/components/ratioPie.vue +++ b/frontend/src/views/workbench/homePage/components/ratioPie.vue @@ -1,6 +1,16 @@ @@ -10,18 +20,22 @@ import MsChart from '@/components/pure/chart/index.vue'; import { toolTipConfig } from '@/config/testPlan'; + import { useI18n } from '@/hooks/useI18n'; import { addCommasToNumber } from '@/utils'; + const { t } = useI18n(); + const props = defineProps<{ data: { name: string; value: number }[]; + hasPermission: boolean; rateConfig: { name: string; - count: string; color: string[]; + tooltipText: string; }; }>(); - const commonOptionConfig = ref({ + const options = ref>({ title: { show: true, text: '', @@ -47,6 +61,7 @@ }, tooltip: { ...toolTipConfig, + show: !!props.hasPermission, }, legend: { orient: 'vertical', @@ -103,26 +118,54 @@ }, data: [], }, + graphic: { + type: 'text', + left: 'center', + bottom: 10, + style: { + text: t('workbench.homePage.notHasResPermission'), + fontSize: 14, + fill: '#959598', + backgroundColor: '#F9F9FE', + padding: [6, 16, 6, 16], + borderRadius: 4, + }, + invisible: false, + }, }); - const options = ref({}); function initOptions() { - const { name, count, color } = props.rateConfig; - options.value = { - ...commonOptionConfig.value, - title: { - ...commonOptionConfig.value.title, - text: name, - subtext: count, - }, - series: { - ...commonOptionConfig.value.series, - data: [...props.data], - color, - }, - }; + const { name, color } = props.rateConfig; + + if (props.hasPermission) { + options.value.series.data = props.data.slice(1); + + options.value.legend.formatter = (seriousName: string) => { + const item = props.data.find((e) => e.name === seriousName); + return `{a|${seriousName}} {b|${addCommasToNumber(item?.value || 0)}}`; + }; + + options.value.title.subtext = `${props.data[0].value ?? 0}%`; + } else { + options.value.series.data = []; + options.value.title.subtext = `-%`; + } + options.value.graphic.invisible = !!props.hasPermission; + options.value.tooltip.show = !!props.hasPermission; + options.value.title.text = name; + + options.value.series.color = color; } + watch( + () => props.data, + (val) => { + if (val) { + initOptions(); + } + } + ); + onMounted(() => { initOptions(); }); @@ -130,6 +173,14 @@ diff --git a/frontend/src/views/workbench/homePage/components/relatedCaseCount.vue b/frontend/src/views/workbench/homePage/components/relatedCaseCount.vue index 23bf08386e..029ce387ec 100644 --- a/frontend/src/views/workbench/homePage/components/relatedCaseCount.vue +++ b/frontend/src/views/workbench/homePage/components/relatedCaseCount.vue @@ -57,6 +57,10 @@ item: SelectedCardItem; }>(); + const emit = defineEmits<{ + (e: 'change'): void; + }>(); + const innerProjectIds = defineModel('projectIds', { required: true, }); @@ -120,7 +124,10 @@ } function changeProject() { - getRelatedCaseCount(); + nextTick(() => { + getRelatedCaseCount(); + emit('change'); + }); } onMounted(() => { diff --git a/frontend/src/views/workbench/homePage/components/testPlanCount.vue b/frontend/src/views/workbench/homePage/components/testPlanCount.vue index a61f870f40..c4b2b35a29 100644 --- a/frontend/src/views/workbench/homePage/components/testPlanCount.vue +++ b/frontend/src/views/workbench/homePage/components/testPlanCount.vue @@ -57,12 +57,16 @@ import { handlePieData, handleUpdateTabPie } from '../utils'; + const { t } = useI18n(); + const appStore = useAppStore(); + const props = defineProps<{ item: SelectedCardItem; }>(); - const { t } = useI18n(); - const appStore = useAppStore(); + const emit = defineEmits<{ + (e: 'change'): void; + }>(); const innerProjectIds = defineModel('projectIds', { required: true, @@ -190,12 +194,16 @@ passOptions.value = passedOptions; completeOptions.value = comOptions; } catch (error) { + // eslint-disable-next-line no-console console.log(error); } } function changeProject() { - initTestPlanCount(); + nextTick(() => { + initTestPlanCount(); + emit('change'); + }); } onMounted(() => { diff --git a/frontend/src/views/workbench/homePage/components/waitReviewList.vue b/frontend/src/views/workbench/homePage/components/waitReviewList.vue index 17c88e3117..23f5ee6b12 100644 --- a/frontend/src/views/workbench/homePage/components/waitReviewList.vue +++ b/frontend/src/views/workbench/homePage/components/waitReviewList.vue @@ -27,6 +27,13 @@ class="mt-[16px]" v-on="propsEvent" > + +