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

@@ -18,6 +18,10 @@ export namespace CommentApi {
content?: string; // 评论内容 content?: string; // 评论内容
children?: Comment[]; // 子评论 children?: Comment[]; // 子评论
projectName?: string; // 项目名称 projectName?: string; // 项目名称
status?: string;
serialNo?: string;
businessOwner?: string;
technicalOwnerA?: string;
} }
} }

View File

@@ -22,6 +22,7 @@ export namespace CustomerApi {
projectCount: number; projectCount: number;
licenseCount: number; licenseCount: number;
userCount: number; userCount: number;
contractCount: number;
} }
} }

View File

@@ -20,7 +20,7 @@
"name": "Project Name", "name": "Project Name",
"envInfoFile": "Environment Info Attachment", "envInfoFile": "Environment Info Attachment",
"list": "Project List", "list": "Project List",
"progress": "Progress", "progress": "Comment",
"updateTime": "Last Modified Time", "updateTime": "Last Modified Time",
"commentNum": "Comment Count" "commentNum": "Comment Count"
} }

View File

@@ -2,7 +2,7 @@
"project": "项目", "project": "项目",
"operation": "操作", "operation": "操作",
"creationTime": "创建时间", "creationTime": "创建时间",
"remarks": "备注", "remarks": "软件版本信息",
"envInfo": "环境信息", "envInfo": "环境信息",
"status": "项目状态", "status": "项目状态",
"endTime": "项目结束时间", "endTime": "项目结束时间",
@@ -20,7 +20,7 @@
"name": "项目名称", "name": "项目名称",
"envInfoFile": "环境信息附件", "envInfoFile": "环境信息附件",
"list": "项目列表", "list": "项目列表",
"progress": "进展", "progress": "评论",
"updateTime": "最后修改时间", "updateTime": "最后修改时间",
"commentNum": "评论数" "commentNum": "评论数"
} }

View File

@@ -4,12 +4,6 @@ import type { AnalysisOverviewItem, WorkbenchTrendItem } from '@vben/common-ui';
import { onMounted, shallowRef } from 'vue'; import { onMounted, shallowRef } from 'vue';
import { AnalysisOverview, WorkbenchTrends } from '@vben/common-ui'; import { AnalysisOverview, WorkbenchTrends } from '@vben/common-ui';
import {
SvgBellIcon,
SvgCakeIcon,
SvgCardIcon,
SvgDownloadIcon,
} from '@vben/icons';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime'; import relativeTime from 'dayjs/plugin/relativeTime';
@@ -17,6 +11,8 @@ import relativeTime from 'dayjs/plugin/relativeTime';
import { getLatestCommentList } from '#/api/license/comment'; import { getLatestCommentList } from '#/api/license/comment';
import { dashboard } from '#/api/license/customer'; import { dashboard } from '#/api/license/customer';
import { getLicenseExpiry } from '#/api/license/license'; import { getLicenseExpiry } from '#/api/license/license';
// import { DictTag } from '#/components/dict-tag';
import { DICT_TYPE, getDictObj } from '#/utils';
const overviewItems = shallowRef<AnalysisOverviewItem[]>([]); const overviewItems = shallowRef<AnalysisOverviewItem[]>([]);
const trendItems = shallowRef<WorkbenchTrendItem[]>([]); const trendItems = shallowRef<WorkbenchTrendItem[]>([]);
@@ -28,28 +24,35 @@ onMounted(async () => {
overviewItems.value = [ overviewItems.value = [
{ {
icon: SvgCardIcon, icon: 'icon-[streamline-plump-color--user-pin-flat] size-8 flex-shrink-0',
title: '用户量', title: '用户量',
totalTitle: '总用户量', totalTitle: '总用户量',
totalValue: data.userCount || 0, totalValue: data.userCount || 0,
value: data.userCount || 0, value: data.userCount || 0,
}, },
{ {
icon: SvgCakeIcon, icon: 'icon-[streamline-color--information-desk-customer] size-8 flex-shrink-0',
title: '客户量', title: '客户量',
totalTitle: '总客户量', totalTitle: '总客户量',
totalValue: data?.customerCount || 0, totalValue: data?.customerCount || 0,
value: data?.customerCount || 0, value: data?.customerCount || 0,
}, },
{ {
icon: SvgBellIcon, icon: 'icon-[streamline-sharp-color--laptop-project-screen-flat] size-8 flex-shrink-0',
title: '项目量', title: '项目量',
totalTitle: '总项目量', totalTitle: '总项目量',
totalValue: data?.projectCount || 0, totalValue: data?.projectCount || 0,
value: 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量', title: 'License量',
totalTitle: '总License量', totalTitle: '总License量',
totalValue: data?.licenseCount || 0, 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> 后到期`, 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') || '', date: dayjs(item.expiryDate).format('YYYY-MM-DD HH:mm:ss') || '',
title: item.serialNo || '', title: item.serialNo || '',
status: '',
info: '',
}; };
}); });
const comments = await getLatestCommentList(); const comments = await getLatestCommentList();
projectProgressItems.value = comments.map((item) => { 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 { return {
avatar: '', avatar: '',
content: item.content || '', content: dataContent,
date: dayjs(item.updateTime).format('YYYY-MM-DD HH:mm:ss') || '', 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 ?? ''}`,
}; };
}); });
}); });

View File

@@ -94,7 +94,7 @@ const [Modal, modalApi] = useVbenModal({
</script> </script>
<template> <template>
<Modal :title="getTitle" class="w-[800px]"> <Modal :title="getTitle" class="w-1/2">
<Form class="mx-4" /> <Form class="mx-4" />
</Modal> </Modal>
</template> </template>

View File

@@ -83,8 +83,8 @@ const formatContent = computed(() => {
</a-avatar> </a-avatar>
</template> </template>
<template #datetime> <template #datetime>
<a-tooltip :title="dayjs(data.updateTime).format('YYYY-MM-DD HH:mm:ss')"> <a-tooltip :title="dayjs(data.updateTime)">
<span>{{ dayjs(data.updateTime).fromNow() }}</span> <span>{{ dayjs(data.updateTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
</a-tooltip> </a-tooltip>
</template> </template>
<template #content> <template #content>

View File

@@ -102,6 +102,7 @@ export function useFormSchema(): VbenFormSchema[] {
label: $t('project.contractCode'), label: $t('project.contractCode'),
rules: 'required', rules: 'required',
component: 'Input', component: 'Input',
help: '没有合同的项目请填0',
}, },
{ {
fieldName: 'businessStatus', fieldName: 'businessStatus',
@@ -183,6 +184,7 @@ export function useFormSchema(): VbenFormSchema[] {
fieldName: 'remark', fieldName: 'remark',
label: $t('project.remarks'), label: $t('project.remarks'),
component: 'Textarea', component: 'Textarea',
rules: 'required',
formItemClass: 'col-span-2', formItemClass: 'col-span-2',
}, },
]; ];

View File

@@ -31,7 +31,7 @@ const [Form, formApi] = useVbenForm({
class: 'w-full', class: 'w-full',
}, },
// formItemClass: 'col-span-2', // formItemClass: 'col-span-2',
labelWidth: 80, labelWidth: 100,
}, },
layout: 'horizontal', layout: 'horizontal',
schema: useFormSchema(), schema: useFormSchema(),
@@ -90,7 +90,7 @@ const [Modal, modalApi] = useVbenModal({
</script> </script>
<template> <template>
<Modal :title="getTitle" class="w-[800px]"> <Modal :title="getTitle" class="w-1/2">
<Form class="mx-4" /> <Form class="mx-4" />
</Modal> </Modal>
</template> </template>