feat: 优化 system

This commit is contained in:
xingyu4j
2025-06-24 17:35:43 +08:00
parent 9821f134fc
commit 34730ab1a0
22 changed files with 483 additions and 275 deletions

View File

@@ -1,6 +1,12 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { DescriptionItemSchema } from '#/components/description';
import { h } from 'vue';
import { formatDateTime } from '@vben/utils';
import { DictTag } from '#/components/dict-tag';
import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
/** 列表的搜索表单 */
@@ -135,3 +141,84 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
},
];
}
/** 详情页的字段 */
export function useDetailSchema(): DescriptionItemSchema[] {
return [
{
field: 'id',
label: '编号',
},
{
field: 'userType',
label: '用户类型',
content: (data) => {
return h(DictTag, {
type: DICT_TYPE.USER_TYPE,
value: data?.userType,
});
},
},
{
field: 'userId',
label: '用户编号',
},
{
field: 'templateId',
label: '模版编号',
},
{
field: 'templateCode',
label: '模板编码',
},
{
field: 'templateNickname',
label: '发送人名称',
},
{
field: 'templateContent',
label: '模版内容',
},
{
field: 'templateParams',
label: '模版参数',
content: (data) => {
try {
return JSON.stringify(data?.templateParams);
} catch {
return '';
}
},
},
{
field: 'templateType',
label: '模版类型',
content: (data) => {
return h(DictTag, {
type: DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE,
value: data?.templateType,
});
},
},
{
field: 'readStatus',
label: '是否已读',
content: (data) => {
return h(DictTag, {
type: DICT_TYPE.INFRA_BOOLEAN_STRING,
value: data?.readStatus,
});
},
},
{
field: 'readTime',
label: '阅读时间',
content: (data) => formatDateTime(data?.readTime || '') as string,
},
{
field: 'createTime',
label: '创建时间',
content: (data) => formatDateTime(data?.createTime || '') as string,
},
];
}