fix: 调整首页等问题

This commit is contained in:
caiyuchao
2025-08-12 19:04:36 +08:00
parent d158a43fb4
commit c401195986
9 changed files with 49 additions and 20 deletions

View File

@@ -4,12 +4,6 @@ import type { AnalysisOverviewItem, WorkbenchTrendItem } from '@vben/common-ui';
import { onMounted, shallowRef } from 'vue';
import { AnalysisOverview, WorkbenchTrends } from '@vben/common-ui';
import {
SvgBellIcon,
SvgCakeIcon,
SvgCardIcon,
SvgDownloadIcon,
} from '@vben/icons';
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
@@ -17,6 +11,8 @@ import relativeTime from 'dayjs/plugin/relativeTime';
import { getLatestCommentList } from '#/api/license/comment';
import { dashboard } from '#/api/license/customer';
import { getLicenseExpiry } from '#/api/license/license';
// import { DictTag } from '#/components/dict-tag';
import { DICT_TYPE, getDictObj } from '#/utils';
const overviewItems = shallowRef<AnalysisOverviewItem[]>([]);
const trendItems = shallowRef<WorkbenchTrendItem[]>([]);
@@ -28,28 +24,35 @@ onMounted(async () => {
overviewItems.value = [
{
icon: SvgCardIcon,
icon: 'icon-[streamline-plump-color--user-pin-flat] size-8 flex-shrink-0',
title: '用户量',
totalTitle: '总用户量',
totalValue: data.userCount || 0,
value: data.userCount || 0,
},
{
icon: SvgCakeIcon,
icon: 'icon-[streamline-color--information-desk-customer] size-8 flex-shrink-0',
title: '客户量',
totalTitle: '总客户量',
totalValue: data?.customerCount || 0,
value: data?.customerCount || 0,
},
{
icon: SvgBellIcon,
icon: 'icon-[streamline-sharp-color--laptop-project-screen-flat] size-8 flex-shrink-0',
title: '项目量',
totalTitle: '总项目量',
totalValue: data?.projectCount || 0,
value: data?.projectCount || 0,
},
{
icon: SvgDownloadIcon,
icon: 'icon-[material-icon-theme--folder-contract-open] size-8 flex-shrink-0',
title: '合同量',
totalTitle: '总合同量',
totalValue: data?.contractCount || 0,
value: data?.contractCount || 0,
},
{
icon: 'icon-[streamline-color--key-flat] size-8 flex-shrink-0',
title: 'License量',
totalTitle: '总License量',
totalValue: data?.licenseCount || 0,
@@ -64,16 +67,35 @@ onMounted(async () => {
content: `客户【<b>${item.customerName}</b>】项目【<b>${item.projectName}</b>】的License即将在 <b>${dayjs(item.expiryDate).fromNow(true)}</b> 后到期`,
date: dayjs(item.expiryDate).format('YYYY-MM-DD HH:mm:ss') || '',
title: item.serialNo || '',
status: '',
info: '',
};
});
const comments = await getLatestCommentList();
projectProgressItems.value = comments.map((item) => {
// 获取字典对象
const dict = getDictObj(DICT_TYPE.LIC_PROJECT_STATUS, String(item.status));
let dataContent = item.content || '';
if (dataContent) {
const position = dataContent.indexOf('>') + 1;
const originalString = dataContent;
const stringToInsert = `<span style="font-size: 12px; color: #32363973">${item.author}</span>`;
dataContent =
originalString.slice(0, position) +
stringToInsert +
originalString.slice(position);
}
return {
avatar: '',
content: item.content || '',
content: dataContent,
date: dayjs(item.updateTime).format('YYYY-MM-DD HH:mm:ss') || '',
title: item.projectName || '',
title: `${item.projectName ?? ''} `,
status: dict,
info: `${item.serialNo ?? ''}&nbsp;&nbsp;${item.businessOwner ?? ''}&nbsp;&nbsp;${item.technicalOwnerA ?? ''}`,
};
});
});