diff --git a/frontend/src/config/workbench.ts b/frontend/src/config/workbench.ts index f9662b8f56..8a64339fb0 100644 --- a/frontend/src/config/workbench.ts +++ b/frontend/src/config/workbench.ts @@ -1,6 +1,7 @@ import { cloneDeep } from 'lodash-es'; import { commonConfig, toolTipConfig } from '@/config/testPlan'; +import { addCommasToNumber } from '@/utils'; import type { ModuleCardItem } from '@/models/workbench/homePage'; import { WorkCardEnum, WorkOverviewEnum, WorkOverviewIconEnum } from '@/enums/workbenchEnum'; @@ -193,7 +194,7 @@ export const defaultValueMap: Record = { [WorkCardEnum.PLAN_LEGACY_BUG]: { legacy: { defaultList: cloneDeep(defaultLegacy), - color: ['#D4D4D8', '#00C261'], + color: ['#00C261', '#D4D4D8'], defaultName: 'workbench.homePage.legacyRate', }, }, @@ -201,7 +202,7 @@ export const defaultValueMap: Record = { [WorkCardEnum.BUG_COUNT]: { legacy: { defaultList: cloneDeep(defaultLegacy), - color: ['#D4D4D8', '#00C261'], + color: ['#00C261', '#D4D4D8'], defaultName: 'workbench.homePage.legacyRate', }, }, @@ -209,7 +210,7 @@ export const defaultValueMap: Record = { [WorkCardEnum.HANDLE_BUG_BY_ME]: { legacy: { defaultList: cloneDeep(defaultLegacy), - color: ['#D4D4D8', '#00C261'], + color: ['#00C261', '#D4D4D8'], defaultName: 'workbench.homePage.legacyRate', }, }, @@ -230,7 +231,7 @@ export const defaultValueMap: Record = { [WorkCardEnum.CREATE_BUG_BY_ME]: { legacy: { defaultList: cloneDeep(defaultLegacy), - color: ['#D4D4D8', '#00C261'], + color: ['#00C261', '#D4D4D8'], defaultName: 'workbench.homePage.legacyRate', }, }, diff --git a/frontend/src/views/workbench/homePage/components/defectCount.vue b/frontend/src/views/workbench/homePage/components/defectCount.vue index 3c455a1d00..2370378baf 100644 --- a/frontend/src/views/workbench/homePage/components/defectCount.vue +++ b/frontend/src/views/workbench/homePage/components/defectCount.vue @@ -133,12 +133,25 @@ countOptions.value = handlePieData(props.item.key, hasPermission.value, statusPercentList); - const { options, valueList } = handleUpdateTabPie( - statusStatisticsMap?.retentionRate || [], - hasPermission.value, - `${props.item.key}-legacy` - ); - legacyValueList.value = valueList; + const [rate, totalBug, legacy] = statusStatisticsMap?.retentionRate || []; + + const unLegacy = totalBug && legacy ? totalBug.count - legacy.count : 0; + + const unLegacyItem = { name: t('workbench.homePage.notLegacyDefectsNumber'), count: unLegacy }; + + const legacyData = [rate, legacy, unLegacyItem]; + + const { options, valueList } = handleUpdateTabPie(legacyData, hasPermission.value, `${props.item.key}-legacy`); + + legacyValueList.value = hasPermission.value + ? (statusStatisticsMap?.retentionRate || []).slice(1).map((item) => { + return { + value: item.count, + label: item.name, + name: item.name, + }; + }) + : valueList; legacyOptions.value = options; } catch (error) { // eslint-disable-next-line no-console diff --git a/frontend/src/views/workbench/homePage/components/overviewMember.vue b/frontend/src/views/workbench/homePage/components/overviewMember.vue index 82377da12e..d3d6fa6dac 100644 --- a/frontend/src/views/workbench/homePage/components/overviewMember.vue +++ b/frontend/src/views/workbench/homePage/components/overviewMember.vue @@ -48,7 +48,7 @@ import MsChart from '@/components/pure/chart/index.vue'; import MsSelect from '@/components/business/ms-select'; - import { getProjectOptions } from '@/api/modules/project-management/projectMember'; + import { getProjectMemberOptions } from '@/api/modules/project-management/projectMember'; import { workMemberViewDetail } from '@/api/modules/workbench'; import { contentTabList } from '@/config/workbench'; import { useI18n } from '@/hooks/useI18n'; @@ -100,43 +100,48 @@ options.value.graphic.style.text = text; options.value.xAxis.data = detail.xaxis.map((e) => characterLimit(e, 10)); - const rawData: number[][] = []; - - detail.projectCountList.forEach((item: any) => { - rawData.push(item.count); - }); - - const totalData: number[] = []; - - for (let i = 0; i < rawData[0].length; ++i) { - let sum = 0; - for (let j = 0; j < rawData.length; ++j) { - sum += rawData[j][i]; - } - totalData.push(sum); - } + let maxAxis = 5; + // 处理data数据 options.value.series = detail.projectCountList.map((item, sid) => { - const dataList = rawData[sid].map((d, did) => (totalData[did] <= 0 ? 0 : d / totalData[did])); - - const data = dataList.map((e, i) => { + const countData: Record[] = item.count.map((e) => { return { - name: t(contentTabList[sid].label), + name: item.name, value: e, - originValue: item.count[i], + originValue: e, }; }); + + const itemMax = Math.max(...item.count); + + maxAxis = Math.max(itemMax, maxAxis); + return { name: t(contentTabList[sid].label), type: 'bar', - stack: 'total', barWidth: 12, + legendHoverLink: true, + large: true, itemStyle: { borderRadius: [2, 2, 0, 0], }, - data, + data: countData, + barMinHeight: ((optionData: Record[]) => { + optionData.forEach((itemValue: any, index: number) => { + if (itemValue.value === 0) optionData[index].value = null; + }); + let hasZero = false; + for (let i = 0; i < optionData.length; i++) { + if (optionData[i].value === 0) { + hasZero = true; + break; + } + } + return hasZero ? 0 : 5; + })(countData), }; }); + options.value.yAxis[0].max = maxAxis < 100 ? 50 : maxAxis + 50; } async function initOverViewMemberDetail() { @@ -162,7 +167,7 @@ async function getMemberOptions() { const [newProjectId] = innerProjectIds.value; - const res = await getProjectOptions(newProjectId); + const res = await getProjectMemberOptions(newProjectId); memberOptions.value = res.map((e: any) => ({ label: e.name, value: e.id, @@ -227,9 +232,7 @@ ); onMounted(() => { - if (appStore.projectList.length) { - getMemberOptions(); - } + getMemberOptions(); initOverViewMemberDetail(); }); diff --git a/frontend/src/views/workbench/homePage/locale/en-US.ts b/frontend/src/views/workbench/homePage/locale/en-US.ts index 8904d99329..98c9bfbd1a 100644 --- a/frontend/src/views/workbench/homePage/locale/en-US.ts +++ b/frontend/src/views/workbench/homePage/locale/en-US.ts @@ -45,6 +45,7 @@ export default { 'workbench.homePage.defectProcessingNumber': 'Statistics of defect handlers', 'workbench.homePage.defectTotal': 'Total defect', 'workbench.homePage.legacyDefectsNumber': 'Legacy defects number', + 'workbench.homePage.notLegacyDefectsNumber': 'Completed defect count', 'workbench.homePage.createdBugByMe': 'My created defects', 'workbench.homePage.remainingBugOfPlan': 'Number of remaining program defects', 'workbench.homePage.apiCount': 'Number of interfaces', diff --git a/frontend/src/views/workbench/homePage/locale/zh-CN.ts b/frontend/src/views/workbench/homePage/locale/zh-CN.ts index 95a769692e..1aa1475077 100644 --- a/frontend/src/views/workbench/homePage/locale/zh-CN.ts +++ b/frontend/src/views/workbench/homePage/locale/zh-CN.ts @@ -45,6 +45,7 @@ export default { 'workbench.homePage.defectProcessingNumber': '缺陷处理人统计', 'workbench.homePage.defectTotal': '缺陷总数', 'workbench.homePage.legacyDefectsNumber': '遗留缺陷数', + 'workbench.homePage.notLegacyDefectsNumber': '已完成缺陷数', 'workbench.homePage.createdBugByMe': '我创建的缺陷', 'workbench.homePage.remainingBugOfPlan': '计划遗留缺陷数', 'workbench.homePage.apiCount': '接口数', diff --git a/frontend/src/views/workbench/homePage/utils.ts b/frontend/src/views/workbench/homePage/utils.ts index 880d895367..1dd8dcbc75 100644 --- a/frontend/src/views/workbench/homePage/utils.ts +++ b/frontend/src/views/workbench/homePage/utils.ts @@ -67,7 +67,7 @@ export const colorMapConfig: Record = { [WorkCardEnum.REVIEW_CASE_COUNT]: ['#D4D4D8', '#3370FF', '#00C261', '#ED0303', '#FFA200'], [WorkCardEnum.TEST_PLAN_COUNT]: ['#9441B1', '#3370FF', '#00C261', '#D4D4D8'], [WorkCardEnum.PLAN_LEGACY_BUG]: ['#9441B1', '#3370FF', '#00C261', '#D4D4D8'], - [WorkCardEnum.BUG_COUNT]: ['#FFA200', '#D4D4D8', '#00C261'], + [WorkCardEnum.BUG_COUNT]: ['#FFA200', '#3370FF', '#D4D4D8', '#00C261', ...getColorScheme(13)], [WorkCardEnum.HANDLE_BUG_BY_ME]: ['#9441B1', '#3370FF', '#00C261', '#D4D4D8'], [WorkCardEnum.CREATE_BY_ME]: ['#9441B1', '#3370FF', '#00C261', '#D4D4D8'], [WorkCardEnum.API_COUNT]: ['#811FA3', '#00C261', '#3370FF', '#FFA1FF', '#EE50A3', '#FF9964', '#F9F871', '#C3DD40'], @@ -86,6 +86,9 @@ export function getCommonBarOptions(hasRoom: boolean, color: string[]): Record e.value === 0) ? [] : lastCountList; options.title.text = countList[0].name ?? ''; options.title.subtext = `${countList[0].count ?? 0}%`;