diff --git a/frontend/src/models/workbench/homePage.ts b/frontend/src/models/workbench/homePage.ts index 431665ea00..64511b0847 100644 --- a/frontend/src/models/workbench/homePage.ts +++ b/frontend/src/models/workbench/homePage.ts @@ -72,6 +72,7 @@ export interface OverViewOfProject { count: number[]; }[]; // 项目列表 xaxis: string[]; // 横坐标 + errorCode: number; } export interface ModuleCardItem { diff --git a/frontend/src/views/workbench/components/notData.vue b/frontend/src/views/workbench/components/notData.vue index edad7ea7ba..364510ebc5 100644 --- a/frontend/src/views/workbench/components/notData.vue +++ b/frontend/src/views/workbench/components/notData.vue @@ -31,7 +31,7 @@
- {{ t('workbench.homePage.noDataTemporarily') }} + {{ props.noPermissionText || t('workbench.homePage.noDataTemporarily') }}
@@ -47,6 +47,7 @@ isDashboard?: boolean; // 是否仪表盘 noResPermission?: boolean; // 无资源权限 height?: string; + noPermissionText?: string; }>(); const { t } = useI18n(); diff --git a/frontend/src/views/workbench/homePage/components/defectMemberBar.vue b/frontend/src/views/workbench/homePage/components/defectMemberBar.vue index 77e8118736..d4caa28d12 100644 --- a/frontend/src/views/workbench/homePage/components/defectMemberBar.vue +++ b/frontend/src/views/workbench/homePage/components/defectMemberBar.vue @@ -91,28 +91,56 @@ const options = ref>({}); const defectStatusColor = ['#811FA3', '#FFA200', '#3370FF', '#F24F4F']; + const hasPermission = ref(false); function handleData(detail: OverViewOfProject) { options.value = getCommonBarOptions(detail.xaxis.length >= 7, [ ...defectStatusColor, ...getColorScheme(detail.xaxis.length), ]); - const { invisible, text } = handleNoDataDisplay(detail.xaxis, detail.projectCountList); + const { invisible, text } = handleNoDataDisplay(detail.xaxis, hasPermission.value); options.value.graphic.invisible = invisible; options.value.graphic.style.text = text; options.value.xAxis.data = detail.xaxis.map((e) => characterLimit(e, 10)); + + let maxAxis = 5; options.value.series = detail.projectCountList.map((item) => { + const countData: Record[] = item.count.map((e) => { + return { + name: item.name, + value: e, + originValue: e, + }; + }); + + const itemMax = Math.max(...item.count); + + maxAxis = Math.max(itemMax, maxAxis); return { name: item.name, type: 'bar', stack: 'bugMember', barWidth: 12, - data: item.count, + data: countData, itemStyle: { borderRadius: [2, 2, 0, 0], }, + 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 getDefectMemberDetail() { @@ -128,6 +156,8 @@ organizationId: appStore.currentOrgId, handleUsers: innerHandleUsers.value, }); + hasPermission.value = detail.errorCode !== 109001; + handleData(detail); } catch (error) { console.log(error); @@ -145,8 +175,8 @@ function changeProject() { memberIds.value = []; - getMemberOptions(); nextTick(() => { + getMemberOptions(); getDefectMemberDetail(); emit('change'); }); diff --git a/frontend/src/views/workbench/homePage/components/overview.vue b/frontend/src/views/workbench/homePage/components/overview.vue index 1f71176dea..00a52d4507 100644 --- a/frontend/src/views/workbench/homePage/components/overview.vue +++ b/frontend/src/views/workbench/homePage/components/overview.vue @@ -23,7 +23,10 @@
- +
@@ -98,6 +101,8 @@ const options = ref>({}); + const hasPermission = ref(false); + const cardModuleList = ref([]); function handleData(detail: OverViewOfProject) { @@ -113,7 +118,7 @@ cardModuleList.value = tempAxisData as ModuleCardItem[]; options.value = getCommonBarOptions(hasRoom.value, getColorScheme(detail.projectCountList.length)); - const { invisible, text } = handleNoDataDisplay(detail.xaxis, detail.projectCountList); + const { invisible, text } = handleNoDataDisplay(detail.xaxis, hasPermission.value); options.value.graphic.invisible = invisible; options.value.graphic.style.text = text; // x轴 @@ -202,6 +207,7 @@ } else { detail = await workMyCreatedDetail(params); } + hasPermission.value = detail.errorCode !== 109001; handleData(detail); } catch (error) { diff --git a/frontend/src/views/workbench/homePage/components/overviewMember.vue b/frontend/src/views/workbench/homePage/components/overviewMember.vue index d3d6fa6dac..4d3f116ab2 100644 --- a/frontend/src/views/workbench/homePage/components/overviewMember.vue +++ b/frontend/src/views/workbench/homePage/components/overviewMember.vue @@ -89,13 +89,15 @@ endTime: 0, }) ); + const hasPermission = ref(false); const memberOptions = ref<{ label: string; value: string }[]>([]); const options = ref>({}); const color = ['#811FA3', '#FFCA59', '#00C261', '#FFA1FF', '#F9F871', '#3370FF', '#F24F4F']; + function handleData(detail: OverViewOfProject) { options.value = getCommonBarOptions(detail.xaxis.length >= 7, color); - const { invisible, text } = handleNoDataDisplay(detail.xaxis, detail.projectCountList); + const { invisible, text } = handleNoDataDisplay(detail.xaxis, hasPermission.value); options.value.graphic.invisible = invisible; options.value.graphic.style.text = text; options.value.xAxis.data = detail.xaxis.map((e) => characterLimit(e, 10)); @@ -158,6 +160,7 @@ handleUsers: innerHandleUsers.value, }; const detail = await workMemberViewDetail(params); + hasPermission.value = detail.errorCode !== 109001; handleData(detail); } catch (error) { // eslint-disable-next-line no-console diff --git a/frontend/src/views/workbench/homePage/components/tabCard.vue b/frontend/src/views/workbench/homePage/components/tabCard.vue index 0efde35486..b14dd955df 100644 --- a/frontend/src/views/workbench/homePage/components/tabCard.vue +++ b/frontend/src/views/workbench/homePage/components/tabCard.vue @@ -17,7 +17,7 @@ - +
@@ -41,6 +41,7 @@ minWidth?: string; notHasPadding?: boolean; hiddenBorder?: boolean; + noPermissionText?: string; }>(); const width = ref(); diff --git a/frontend/src/views/workbench/homePage/utils.ts b/frontend/src/views/workbench/homePage/utils.ts index 1dd8dcbc75..4693fba650 100644 --- a/frontend/src/views/workbench/homePage/utils.ts +++ b/frontend/src/views/workbench/homePage/utils.ts @@ -170,7 +170,7 @@ export function getCommonBarOptions(hasRoom: boolean, color: string[]): Record - item.count.every((e) => e === 0 || e === null || e === undefined) - ); - - if (isEmptyData) { + if (!xAxis.length) { return { invisible: false, text: t('workbench.homePage.notHasData'),