feat: use desc comp

This commit is contained in:
xingyu4j
2025-10-21 16:39:35 +08:00
parent bb9cb64c64
commit 985ce257e0
22 changed files with 128 additions and 211 deletions

View File

@@ -1,6 +1,5 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { InfraApiAccessLogApi } from '#/api/infra/api-access-log';
import type { DescriptionItemSchema } from '#/components/description';
import { h } from 'vue';
@@ -181,10 +180,10 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'userType',
label: '用户类型',
content: (data: InfraApiAccessLogApi.ApiAccessLog) => {
render: (val) => {
return h(DictTag, {
type: DICT_TYPE.USER_TYPE,
value: data.userType,
value: val,
});
},
},
@@ -197,10 +196,11 @@ export function useDetailSchema(): DescriptionItemSchema[] {
label: '用户 UA',
},
{
field: 'requestMethod',
label: '请求信息',
content: (data: InfraApiAccessLogApi.ApiAccessLog) => {
if (data?.requestMethod && data?.requestUrl) {
return `${data.requestMethod} ${data.requestUrl}`;
render: (val, data) => {
if (val && data?.requestUrl) {
return `${val} ${data.requestUrl}`;
}
return '';
},
@@ -208,10 +208,10 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'requestParams',
label: '请求参数',
content: (data: InfraApiAccessLogApi.ApiAccessLog) => {
if (data.requestParams) {
render: (val) => {
if (val) {
return h(JsonViewer, {
value: JSON.parse(data.requestParams),
value: JSON.parse(val),
previewMode: true,
});
}
@@ -224,26 +224,29 @@ export function useDetailSchema(): DescriptionItemSchema[] {
},
{
label: '请求时间',
content: (data: InfraApiAccessLogApi.ApiAccessLog) => {
if (data?.beginTime && data?.endTime) {
return `${formatDateTime(data.beginTime)} ~ ${formatDateTime(data.endTime)}`;
field: 'beginTime',
render: (val, data) => {
if (val && data?.endTime) {
return `${formatDateTime(val)} ~ ${formatDateTime(data.endTime)}`;
}
return '';
},
},
{
label: '请求耗时',
content: (data: InfraApiAccessLogApi.ApiAccessLog) => {
return data?.duration ? `${data.duration} ms` : '';
field: 'duration',
render: (val) => {
return val ? `${val} ms` : '';
},
},
{
label: '操作结果',
content: (data: InfraApiAccessLogApi.ApiAccessLog) => {
if (data?.resultCode === 0) {
field: 'resultCode',
render: (val, data) => {
if (val === 0) {
return '正常';
} else if (data && data.resultCode > 0) {
return `失败 | ${data.resultCode} | ${data.resultMsg}`;
} else if (val > 0 && data?.resultMsg) {
return `失败 | ${val} | ${data.resultMsg}`;
}
return '';
},
@@ -259,10 +262,10 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'operateType',
label: '操作类型',
content: (data: InfraApiAccessLogApi.ApiAccessLog) => {
render: (val) => {
return h(DictTag, {
type: DICT_TYPE.INFRA_OPERATE_TYPE,
value: data?.operateType,
value: val,
});
},
},

View File

@@ -12,11 +12,7 @@ import { useDetailSchema } from '../data';
const formData = ref<InfraApiAccessLogApi.ApiAccessLog>();
const [Descriptions] = useDescription({
componentProps: {
bordered: true,
column: 1,
contentClass: 'mx-4',
},
column: 1,
schema: useDetailSchema(),
});

View File

@@ -1,6 +1,5 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { InfraApiErrorLogApi } from '#/api/infra/api-error-log';
import type { DescriptionItemSchema } from '#/components/description';
import { h } from 'vue';
@@ -158,10 +157,10 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'userType',
label: '用户类型',
content: (data: InfraApiErrorLogApi.ApiErrorLog) => {
render: (val) => {
return h(DictTag, {
type: DICT_TYPE.USER_TYPE,
value: data.userType,
value: val,
});
},
},
@@ -176,9 +175,9 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'requestMethod',
label: '请求信息',
content: (data: InfraApiErrorLogApi.ApiErrorLog) => {
if (data?.requestMethod && data?.requestUrl) {
return `${data.requestMethod} ${data.requestUrl}`;
render: (val, data) => {
if (val && data?.requestUrl) {
return `${val} ${data.requestUrl}`;
}
return '';
},
@@ -186,10 +185,10 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'requestParams',
label: '请求参数',
content: (data: InfraApiErrorLogApi.ApiErrorLog) => {
if (data.requestParams) {
render: (val) => {
if (val) {
return h(JsonViewer, {
value: JSON.parse(data.requestParams),
value: JSON.parse(val),
previewMode: true,
});
}
@@ -199,8 +198,8 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'exceptionTime',
label: '异常时间',
content: (data: InfraApiErrorLogApi.ApiErrorLog) => {
return formatDateTime(data?.exceptionTime || '') as string;
render: (val) => {
return formatDateTime(val) as string;
},
},
{
@@ -210,12 +209,11 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'exceptionStackTrace',
label: '异常堆栈',
hidden: (data: InfraApiErrorLogApi.ApiErrorLog) =>
!data?.exceptionStackTrace,
content: (data: InfraApiErrorLogApi.ApiErrorLog) => {
if (data?.exceptionStackTrace) {
show: (val) => !val,
render: (val) => {
if (val) {
return h('textarea', {
value: data.exceptionStackTrace,
value: val,
style:
'width: 100%; min-height: 200px; max-height: 400px; resize: vertical;',
readonly: true,
@@ -227,24 +225,24 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'processStatus',
label: '处理状态',
content: (data: InfraApiErrorLogApi.ApiErrorLog) => {
render: (val) => {
return h(DictTag, {
type: DICT_TYPE.INFRA_API_ERROR_LOG_PROCESS_STATUS,
value: data?.processStatus,
value: val,
});
},
},
{
field: 'processUserId',
label: '处理人',
hidden: (data: InfraApiErrorLogApi.ApiErrorLog) => !data?.processUserId,
show: (val) => !val,
},
{
field: 'processTime',
label: '处理时间',
hidden: (data: InfraApiErrorLogApi.ApiErrorLog) => !data?.processTime,
content: (data: InfraApiErrorLogApi.ApiErrorLog) => {
return formatDateTime(data?.processTime || '') as string;
show: (val) => !val,
render: (val) => {
return formatDateTime(val) as string;
},
},
];

View File

@@ -12,11 +12,7 @@ import { useDetailSchema } from '../data';
const formData = ref<InfraApiErrorLogApi.ApiErrorLog>();
const [Descriptions] = useDescription({
componentProps: {
bordered: true,
column: 1,
contentClass: 'mx-4',
},
column: 1,
schema: useDetailSchema(),
});

View File

@@ -1,6 +1,5 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { InfraJobApi } from '#/api/infra/job';
import type { DescriptionItemSchema } from '#/components/description';
import { h, markRaw } from 'vue';
@@ -191,10 +190,10 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'status',
label: '任务状态',
content: (data: InfraJobApi.Job) => {
render: (val) => {
return h(DictTag, {
type: DICT_TYPE.INFRA_JOB_STATUS,
value: data?.status,
value: val,
});
},
},
@@ -216,27 +215,27 @@ export function useDetailSchema(): DescriptionItemSchema[] {
},
{
label: '重试间隔',
content: (data: InfraJobApi.Job) => {
return data?.retryInterval ? `${data.retryInterval} 毫秒` : '无间隔';
field: 'retryInterval',
render: (val) => {
return val ? `${val} 毫秒` : '无间隔';
},
},
{
label: '监控超时时间',
content: (data: InfraJobApi.Job) => {
return data?.monitorTimeout && data.monitorTimeout > 0
? `${data.monitorTimeout} 毫秒`
: '未开启';
field: 'monitorTimeout',
render: (val) => {
return val && val > 0 ? `${val} 毫秒` : '未开启';
},
},
{
field: 'nextTimes',
label: '后续执行时间',
content: (data: InfraJobApi.Job) => {
if (!data?.nextTimes || data.nextTimes.length === 0) {
render: (val) => {
if (!val || val.length === 0) {
return '无后续执行时间';
}
return h(NTimeline, {}, () =>
data.nextTimes?.map((time: Date) =>
val?.map((time: Date) =>
h(NTimelineItem, {}, () => formatDateTime(time)),
),
);

View File

@@ -1,6 +1,5 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { InfraJobLogApi } from '#/api/infra/job-log';
import type { DescriptionItemSchema } from '#/components/description';
import { h } from 'vue';
@@ -148,9 +147,9 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'beginTime',
label: '执行时间',
content: (data: InfraJobLogApi.JobLog) => {
if (data?.beginTime && data?.endTime) {
return `${formatDateTime(data.beginTime)} ~ ${formatDateTime(data.endTime)}`;
render: (val, data) => {
if (val && data?.endTime) {
return `${formatDateTime(val)} ~ ${formatDateTime(data.endTime)}`;
}
return '';
},
@@ -158,17 +157,15 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'duration',
label: '执行时长',
content: (data: InfraJobLogApi.JobLog) => {
return data?.duration ? `${data.duration} 毫秒` : '';
},
render: (val) => (val ? `${val} 毫秒` : ''),
},
{
field: 'status',
label: '任务状态',
content: (data: InfraJobLogApi.JobLog) => {
render: (val) => {
return h(DictTag, {
type: DICT_TYPE.INFRA_JOB_LOG_STATUS,
value: data?.status,
value: val,
});
},
},

View File

@@ -13,11 +13,7 @@ import { useDetailSchema } from '../data';
const formData = ref<InfraJobLogApi.JobLog>();
const [Descriptions] = useDescription({
componentProps: {
bordered: true,
column: 1,
contentClass: 'mx-4',
},
column: 1,
schema: useDetailSchema(),
});

View File

@@ -14,11 +14,7 @@ const formData = ref<InfraJobApi.Job>(); // 任务详情
const nextTimes = ref<Date[]>([]); // 下一次执行时间
const [Descriptions] = useDescription({
componentProps: {
bordered: true,
column: 1,
contentClass: 'mx-4',
},
column: 1,
schema: useDetailSchema(),
});

View File

@@ -1,6 +1,5 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { SystemLoginLogApi } from '#/api/system/login-log';
import type { DescriptionItemSchema } from '#/components/description';
import { h } from 'vue';
@@ -110,10 +109,10 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'logType',
label: '操作类型',
content: (data: SystemLoginLogApi.LoginLog) => {
render: (val) => {
return h(DictTag, {
type: DICT_TYPE.SYSTEM_LOGIN_TYPE,
value: data?.logType,
value: val,
});
},
},
@@ -132,19 +131,17 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'result',
label: '登录结果',
content: (data: SystemLoginLogApi.LoginLog) => {
render: (val) => {
return h(DictTag, {
type: DICT_TYPE.SYSTEM_LOGIN_RESULT,
value: data?.result,
value: val,
});
},
},
{
field: 'createTime',
label: '登录日期',
content: (data: SystemLoginLogApi.LoginLog) => {
return formatDateTime(data?.createTime || '') as string;
},
render: (val) => formatDateTime(val) as string,
},
];
}

View File

@@ -12,11 +12,7 @@ import { useDetailSchema } from '../data';
const formData = ref<SystemLoginLogApi.LoginLog>();
const [Descriptions] = useDescription({
componentProps: {
bordered: true,
column: 1,
contentClass: 'mx-4',
},
column: 1,
schema: useDetailSchema(),
});

View File

@@ -1,6 +1,5 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { SystemMailLogApi } from '#/api/system/mail/log';
import type { DescriptionItemSchema } from '#/components/description';
import { h } from 'vue';
@@ -164,9 +163,7 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'createTime',
label: '创建时间',
content: (data: SystemMailLogApi.MailLog) => {
return formatDateTime(data?.createTime || '') as string;
},
render: (val) => formatDateTime(val) as string,
},
{
field: 'fromMail',
@@ -175,12 +172,12 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'userId',
label: '接收用户',
content: (data: SystemMailLogApi.MailLog) => {
if (data?.userType && data?.userId) {
render: (val, data) => {
if (val && data?.userId) {
return h('div', [
h(DictTag, {
type: DICT_TYPE.USER_TYPE,
value: data.userType,
value: val,
}),
` (${data.userId})`,
]);
@@ -191,10 +188,10 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'toMails',
label: '接收信息',
content: (data: SystemMailLogApi.MailLog) => {
render: (val, data) => {
const lines: string[] = [];
if (data?.toMails && data.toMails.length > 0) {
lines.push(`收件:${data.toMails.join('、')}`);
if (val && val.length > 0) {
lines.push(`收件:${val.join('、')}`);
}
if (data?.ccMails && data.ccMails.length > 0) {
lines.push(`抄送:${data.ccMails.join('、')}`);
@@ -227,28 +224,22 @@ export function useDetailSchema(): DescriptionItemSchema[] {
field: 'templateContent',
label: '邮件内容',
span: 2,
content: (data: SystemMailLogApi.MailLog) => {
return h('div', {
innerHTML: data?.templateContent || '',
});
},
render: (val) => h('div', { innerHTML: val || '' }),
},
{
field: 'sendStatus',
label: '发送状态',
content: (data: SystemMailLogApi.MailLog) => {
render: (val) => {
return h(DictTag, {
type: DICT_TYPE.SYSTEM_MAIL_SEND_STATUS,
value: data?.sendStatus,
value: val,
});
},
},
{
field: 'sendTime',
label: '发送时间',
content: (data: SystemMailLogApi.MailLog) => {
return formatDateTime(data?.sendTime || '') as string;
},
render: (val) => formatDateTime(val) as string,
},
{
field: 'sendMessageId',

View File

@@ -12,11 +12,7 @@ import { useDetailSchema } from '../data';
const formData = ref<SystemMailLogApi.MailLog>();
const [Descriptions] = useDescription({
componentProps: {
bordered: true,
column: 2,
contentClass: 'mx-4',
},
column: 2,
schema: useDetailSchema(),
});

View File

@@ -1,6 +1,5 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { SystemNotifyMessageApi } from '#/api/system/notify/message';
import type { DescriptionItemSchema } from '#/components/description';
import { h } from 'vue';
@@ -166,10 +165,10 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'userType',
label: '用户类型',
content: (data: SystemNotifyMessageApi.NotifyMessage) => {
render: (val) => {
return h(DictTag, {
type: DICT_TYPE.USER_TYPE,
value: data?.userType,
value: val,
});
},
},
@@ -196,9 +195,9 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'templateParams',
label: '模版参数',
content: (data: SystemNotifyMessageApi.NotifyMessage) => {
render: (val) => {
try {
return JSON.stringify(data?.templateParams);
return JSON.stringify(val);
} catch {
return '';
}
@@ -207,36 +206,32 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'templateType',
label: '模版类型',
content: (data: SystemNotifyMessageApi.NotifyMessage) => {
render: (val) => {
return h(DictTag, {
type: DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE,
value: data?.templateType,
value: val,
});
},
},
{
field: 'readStatus',
label: '是否已读',
content: (data: SystemNotifyMessageApi.NotifyMessage) => {
render: (val) => {
return h(DictTag, {
type: DICT_TYPE.INFRA_BOOLEAN_STRING,
value: data?.readStatus,
value: val,
});
},
},
{
field: 'readTime',
label: '阅读时间',
content: (data: SystemNotifyMessageApi.NotifyMessage) => {
return formatDateTime(data?.readTime || '') as string;
},
render: (val) => formatDateTime(val) as string,
},
{
field: 'createTime',
label: '创建时间',
content: (data: SystemNotifyMessageApi.NotifyMessage) => {
return formatDateTime(data?.createTime || '') as string;
},
render: (val) => formatDateTime(val) as string,
},
];
}

View File

@@ -12,11 +12,7 @@ import { useDetailSchema } from '../data';
const formData = ref<SystemNotifyMessageApi.NotifyMessage>();
const [Descriptions] = useDescription({
componentProps: {
bordered: true,
column: 1,
contentClass: 'mx-4',
},
column: 1,
schema: useDetailSchema(),
});

View File

@@ -1,6 +1,5 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { SystemNotifyMessageApi } from '#/api/system/notify/message';
import type { DescriptionItemSchema } from '#/components/description';
import { h } from 'vue';
@@ -103,36 +102,32 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'createTime',
label: '发送时间',
content: (data: SystemNotifyMessageApi.NotifyMessage) => {
return formatDateTime(data?.createTime || '') as string;
},
render: (val) => formatDateTime(val) as string,
},
{
field: 'templateType',
label: '消息类型',
content: (data: SystemNotifyMessageApi.NotifyMessage) => {
render: (val) => {
return h(DictTag, {
type: DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE,
value: data?.templateType,
value: val,
});
},
},
{
field: 'readStatus',
label: '是否已读',
content: (data: SystemNotifyMessageApi.NotifyMessage) => {
render: (val) => {
return h(DictTag, {
type: DICT_TYPE.INFRA_BOOLEAN_STRING,
value: data?.readStatus,
value: val,
});
},
},
{
field: 'readTime',
label: '阅读时间',
content: (data: SystemNotifyMessageApi.NotifyMessage) => {
return formatDateTime(data?.readTime || '') as string;
},
render: (val) => formatDateTime(val) as string,
},
{
field: 'templateContent',

View File

@@ -12,11 +12,7 @@ import { useDetailSchema } from '../data';
const formData = ref<SystemNotifyMessageApi.NotifyMessage>();
const [Descriptions] = useDescription({
componentProps: {
bordered: true,
column: 1,
contentClass: 'mx-4',
},
column: 1,
schema: useDetailSchema(),
});

View File

@@ -1,6 +1,5 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { SystemOperateLogApi } from '#/api/system/operate-log';
import type { DescriptionItemSchema } from '#/components/description';
import { formatDateTime } from '@vben/utils';
@@ -134,7 +133,7 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'traceId',
label: '链路追踪',
hidden: (data: SystemOperateLogApi.OperateLog) => !data?.traceId,
show: (val) => !val,
},
{
field: 'userId',
@@ -167,13 +166,14 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'extra',
label: '操作拓展参数',
hidden: (data: SystemOperateLogApi.OperateLog) => !data?.extra,
show: (val) => !val,
},
{
field: 'requestUrl',
label: '请求 URL',
content: (data: SystemOperateLogApi.OperateLog) => {
if (data?.requestMethod && data?.requestUrl) {
return `${data.requestMethod} ${data.requestUrl}`;
render: (val, data) => {
if (data?.requestMethod && val) {
return `${data.requestMethod} ${val}`;
}
return '';
},
@@ -181,9 +181,7 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'createTime',
label: '操作时间',
content: (data: SystemOperateLogApi.OperateLog) => {
return formatDateTime(data?.createTime || '') as string;
},
render: (val) => formatDateTime(val) as string,
},
{
field: 'bizId',

View File

@@ -12,11 +12,7 @@ import { useDetailSchema } from '../data';
const formData = ref<SystemOperateLogApi.OperateLog>();
const [Descriptions] = useDescription({
componentProps: {
bordered: true,
column: 1,
contentClass: 'mx-4',
},
column: 1,
schema: useDetailSchema(),
});

View File

@@ -1,6 +1,5 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { SystemSmsLogApi } from '#/api/system/sms/log';
import type { DescriptionItemSchema } from '#/components/description';
import { h } from 'vue';
@@ -179,9 +178,7 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'createTime',
label: '创建时间',
content: (data: SystemSmsLogApi.SmsLog) => {
return formatDateTime(data?.createTime || '') as string;
},
render: (val) => formatDateTime(val) as string,
},
{
field: 'mobile',
@@ -198,10 +195,10 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'templateType',
label: '模板类型',
content: (data: SystemSmsLogApi.SmsLog) => {
render: (val) => {
return h(DictTag, {
type: DICT_TYPE.SYSTEM_SMS_TEMPLATE_TYPE,
value: data?.templateType,
value: val,
});
},
},
@@ -212,19 +209,17 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'sendStatus',
label: '发送状态',
content: (data: SystemSmsLogApi.SmsLog) => {
render: (val) => {
return h(DictTag, {
type: DICT_TYPE.SYSTEM_SMS_SEND_STATUS,
value: data?.sendStatus,
value: val,
});
},
},
{
field: 'sendTime',
label: '发送时间',
content: (data: SystemSmsLogApi.SmsLog) => {
return formatDateTime(data?.sendTime || '') as string;
},
render: (val) => formatDateTime(val) as string,
},
{
field: 'apiSendCode',
@@ -237,19 +232,17 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'receiveStatus',
label: '接收状态',
content: (data: SystemSmsLogApi.SmsLog) => {
render: (val) => {
return h(DictTag, {
type: DICT_TYPE.SYSTEM_SMS_RECEIVE_STATUS,
value: data?.receiveStatus,
value: val,
});
},
},
{
field: 'receiveTime',
label: '接收时间',
content: (data: SystemSmsLogApi.SmsLog) => {
return formatDateTime(data?.receiveTime || '') as string;
},
render: (val) => formatDateTime(val) as string,
},
{
field: 'apiReceiveCode',

View File

@@ -12,11 +12,7 @@ import { useDetailSchema } from '../data';
const formData = ref<SystemSmsLogApi.SmsLog>();
const [Descriptions] = useDescription({
componentProps: {
bordered: true,
column: 2,
contentClass: 'mx-4',
},
column: 2,
schema: useDetailSchema(),
});

View File

@@ -1,6 +1,5 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { SystemSocialUserApi } from '#/api/system/social/user';
import type { DescriptionItemSchema } from '#/components/description';
import { h } from 'vue';
@@ -8,6 +7,8 @@ import { h } from 'vue';
import { DICT_TYPE } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
import { NImage } from 'naive-ui';
import { DictTag } from '#/components/dict-tag';
import { getRangePickerDefaultProps } from '#/utils';
@@ -111,10 +112,10 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'type',
label: '社交平台',
content: (data: SystemSocialUserApi.SocialUser) => {
render: (val) => {
return h(DictTag, {
type: DICT_TYPE.SYSTEM_SOCIAL_TYPE,
value: data?.type,
value: val,
});
},
},
@@ -125,16 +126,11 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'avatar',
label: '用户头像',
// TODO @芋艿:使用 antd 的 Image 组件
content: (data: SystemSocialUserApi.SocialUser) => {
if (data?.avatar) {
return h('img', {
src: data.avatar,
render: (val) => {
if (val) {
return h(NImage, {
src: val,
style: 'width: 30px; height: 30px; cursor: pointer;',
onClick: () => {
// 可以添加图片预览功能
window.open(data.avatar, '_blank');
},
});
}
return '无';

View File

@@ -14,13 +14,8 @@ import { useDetailSchema } from '../data';
const formData = ref<SystemSocialUserApi.SocialUser>();
const [Descriptions] = useDescription({
componentProps: {
bordered: true,
column: 1,
size: 'middle',
class: 'mx-4',
labelStyle: { width: '185px' },
},
column: 1,
size: 'medium',
schema: useDetailSchema(),
});