feat: ele use desc comp

This commit is contained in:
xingyu4j
2025-10-21 15:33:32 +08:00
parent 18ef9031ca
commit d368582a90
32 changed files with 266 additions and 408 deletions

View File

@@ -30,6 +30,7 @@ const props = {
},
title: { default: '', type: String },
useCard: { default: true, type: Boolean },
direction: { default: 'horizontal', type: String },
};
function getSlot(slots: Slots, slot: string, data?: any) {

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,
});
},
},
@@ -198,9 +197,10 @@ export function useDetailSchema(): DescriptionItemSchema[] {
},
{
label: '请求信息',
content: (data: InfraApiAccessLogApi.ApiAccessLog) => {
field: 'requestMethod',
render: (val, data) => {
if (data?.requestMethod && data?.requestUrl) {
return `${data.requestMethod} ${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) => {
field: 'beginTime',
render: (val, data) => {
if (data?.beginTime && data?.endTime) {
return `${formatDateTime(data.beginTime)} ~ ${formatDateTime(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}`;
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,14 +12,8 @@ import { useDetailSchema } from '../data';
const formData = ref<InfraApiAccessLogApi.ApiAccessLog>();
const [Descriptions] = useDescription({
componentProps: {
border: true,
column: 1,
direction: 'horizontal',
labelWidth: 110,
title: '',
extra: '',
},
column: 1,
labelWidth: 110,
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) => {
render: (val, data) => {
if (data?.requestMethod && data?.requestUrl) {
return `${data.requestMethod} ${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,9 +198,7 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'exceptionTime',
label: '异常时间',
content: (data: InfraApiErrorLogApi.ApiErrorLog) => {
return formatDateTime(data?.exceptionTime || '') as string;
},
render: (val) => formatDateTime(val) as string,
},
{
field: 'exceptionName',
@@ -210,12 +207,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,25 +223,23 @@ 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) => formatDateTime(val) as string,
},
];
}

View File

@@ -12,14 +12,8 @@ import { useDetailSchema } from '../data';
const formData = ref<InfraApiErrorLogApi.ApiErrorLog>();
const [Descriptions] = useDescription({
componentProps: {
border: true,
column: 1,
direction: 'horizontal',
labelWidth: 110,
title: '',
extra: '',
},
column: 1,
labelWidth: 110,
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';
@@ -197,10 +196,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,
});
},
},
@@ -222,27 +221,23 @@ export function useDetailSchema(): DescriptionItemSchema[] {
},
{
label: '重试间隔',
content: (data: InfraJobApi.Job) => {
return data?.retryInterval ? `${data.retryInterval} 毫秒` : '无间隔';
},
field: 'retryInterval',
render: (val) => (val ? `${val} 毫秒` : '无间隔'),
},
{
label: '监控超时时间',
content: (data: InfraJobApi.Job) => {
return data?.monitorTimeout && data.monitorTimeout > 0
? `${data.monitorTimeout} 毫秒`
: '未开启';
},
field: 'monitorTimeout',
render: (val) => (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(ElTimeline, {}, () =>
data.nextTimes?.map((time: Date) =>
val?.map((time: Date) =>
h(ElTimelineItem, {}, () => 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';
@@ -154,9 +153,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 '';
},
@@ -164,17 +163,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,14 +13,8 @@ import { useDetailSchema } from '../data';
const formData = ref<InfraJobLogApi.JobLog>();
const [Descriptions] = useDescription({
componentProps: {
border: true,
column: 1,
direction: 'horizontal',
labelWidth: 140,
title: '',
extra: '',
},
column: 1,
labelWidth: 140,
schema: useDetailSchema(),
});

View File

@@ -14,14 +14,8 @@ const formData = ref<InfraJobApi.Job>(); // 任务详情
const nextTimes = ref<Date[]>([]); // 下一次执行时间
const [Descriptions] = useDescription({
componentProps: {
border: true,
column: 1,
direction: 'horizontal',
labelWidth: 140,
title: '',
extra: '',
},
column: 1,
labelWidth: 140,
schema: useDetailSchema(),
});

View File

@@ -1,55 +1,73 @@
<script lang="ts" setup>
import type { InfraRedisApi } from '#/api/infra/redis';
import { ElDescriptions, ElDescriptionsItem } from 'element-plus';
import { useDescription } from '#/components/description';
defineProps<{
redisData?: InfraRedisApi.RedisMonitorInfo;
}>();
const [Descriptions] = useDescription({
bordered: false,
column: 6,
schema: [
{
field: 'info.redis_version',
label: 'Redis 版本',
},
{
field: 'info.redis_mode',
label: '运行模式',
render: (val) => (val === 'standalone' ? '单机' : '集群'),
},
{
field: 'info.tcp_port',
label: '端口',
},
{
field: 'info.connected_clients',
label: '客户端数',
},
{
field: 'info.uptime_in_days',
label: '运行时间(天)',
},
{
field: 'info.used_memory_human',
label: '使用内存',
},
{
field: 'info.used_cpu_user_children',
label: '使用 CPU',
render: (val) => Number.parseFloat(val).toFixed(2),
},
{
field: 'info.maxmemory_human',
label: '内存配置',
},
{
field: 'info.aof_enabled',
label: 'AOF 是否开启',
render: (val) => (val === '0' ? '否' : '是'),
},
{
field: 'info.rdb_last_bgsave_status',
label: 'RDB 是否成功',
},
{
field: 'dbSize',
label: 'Key 数量',
},
{
field: 'info.instantaneous_input_kbps',
label: '网络入口/出口',
render: (val, data) =>
`${val}kps / ${data?.info?.instantaneous_output_kbps}kps`,
},
],
});
</script>
<template>
<ElDescriptions :column="6" border size="default" :label-width="138">
<ElDescriptionsItem label="Redis 版本">
{{ redisData?.info?.redis_version }}
</ElDescriptionsItem>
<ElDescriptionsItem label="运行模式">
{{ redisData?.info?.redis_mode === 'standalone' ? '单机' : '集群' }}
</ElDescriptionsItem>
<ElDescriptionsItem label="端口">
{{ redisData?.info?.tcp_port }}
</ElDescriptionsItem>
<ElDescriptionsItem label="客户端数">
{{ redisData?.info?.connected_clients }}
</ElDescriptionsItem>
<ElDescriptionsItem label="运行时间(天)">
{{ redisData?.info?.uptime_in_days }}
</ElDescriptionsItem>
<ElDescriptionsItem label="使用内存">
{{ redisData?.info?.used_memory_human }}
</ElDescriptionsItem>
<ElDescriptionsItem label="使用 CPU">
{{
redisData?.info
? parseFloat(redisData?.info?.used_cpu_user_children).toFixed(2)
: ''
}}
</ElDescriptionsItem>
<ElDescriptionsItem label="内存配置">
{{ redisData?.info?.maxmemory_human }}
</ElDescriptionsItem>
<ElDescriptionsItem label="AOF 是否开启">
{{ redisData?.info?.aof_enabled === '0' ? '否' : '是' }}
</ElDescriptionsItem>
<ElDescriptionsItem label="RDB 是否成功">
{{ redisData?.info?.rdb_last_bgsave_status }}
</ElDescriptionsItem>
<ElDescriptionsItem label="Key 数量">
{{ redisData?.dbSize }}
</ElDescriptionsItem>
<ElDescriptionsItem label="网络入口/出口">
{{ redisData?.info?.instantaneous_input_kbps }}kps /
{{ redisData?.info?.instantaneous_output_kbps }}kps
</ElDescriptionsItem>
</ElDescriptions>
<Descriptions :data="redisData" />
</template>

View File

@@ -8,7 +8,7 @@ import { ElCard } from 'element-plus';
import { useDescription } from '#/components/description';
withDefaults(
const props = withDefaults(
defineProps<{
mode?: 'kefu' | 'member';
user: MemberUserApi.User;
@@ -20,49 +20,44 @@ withDefaults(
);
const [Descriptions] = useDescription({
componentProps: {
border: false,
column: 2,
direction: 'horizontal',
labelWidth: 140,
title: '',
extra: '',
},
border: false,
column: props.mode === 'member' ? 2 : 1,
labelWidth: 140,
schema: [
{
field: 'levelName',
label: '等级',
content: (data) => data.levelName || '-',
render: (val) => val || '-',
},
{
field: 'experience',
label: '成长值',
content: (data) => data.experience || 0,
render: (val) => val || 0,
},
{
field: 'point',
label: '当前积分',
content: (data) => data.point || 0,
render: (val) => val || 0,
},
{
field: 'totalPoint',
label: '总积分',
content: (data) => data.totalPoint || 0,
render: (val) => val || 0,
},
{
field: 'balance',
label: '当前余额',
content: (data) => fenToYuan(data.balance || 0),
render: (val) => fenToYuan(val || 0),
},
{
field: 'totalExpense',
label: '支出金额',
content: (data) => fenToYuan(data.totalExpense || 0),
render: (val) => fenToYuan(val || 0),
},
{
field: 'totalRecharge',
label: '充值金额',
content: (data) => fenToYuan(data.totalRecharge || 0),
render: (val) => fenToYuan(val || 0),
},
],
});
@@ -77,7 +72,6 @@ const [Descriptions] = useDescription({
<slot name="extra"></slot>
</template>
<Descriptions
:column="mode === 'member' ? 2 : 1"
:data="{
...user,
...wallet,

View File

@@ -11,7 +11,7 @@ import { ElAvatar, ElCard, ElCol, ElRow } from 'element-plus';
import { useDescription } from '#/components/description';
import { DictTag } from '#/components/dict-tag';
withDefaults(
const props = withDefaults(
defineProps<{ mode?: 'kefu' | 'member'; user: MemberUserApi.User }>(),
{
mode: 'member',
@@ -19,14 +19,9 @@ withDefaults(
);
const [Descriptions] = useDescription({
componentProps: {
border: false,
column: 2,
direction: 'horizontal',
labelWidth: 140,
title: '',
extra: '',
},
border: false,
column: props.mode === 'member' ? 2 : 1,
labelWidth: 140,
schema: [
{
field: 'name',
@@ -43,10 +38,10 @@ const [Descriptions] = useDescription({
{
field: 'sex',
label: '性别',
content: (data) =>
render: (val) =>
h(DictTag, {
type: DICT_TYPE.SYSTEM_USER_SEX,
value: data.sex,
value: val,
}),
},
{
@@ -60,17 +55,17 @@ const [Descriptions] = useDescription({
{
field: 'birthday',
label: '生日',
content: (data) => formatDate(data.birthday)?.toString() || '-',
render: (val) => formatDate(val)?.toString() || '-',
},
{
field: 'createTime',
label: '注册时间',
content: (data) => formatDate(data.createTime)?.toString() || '-',
render: (val) => formatDate(val)?.toString() || '-',
},
{
field: 'loginDate',
label: '最后登录时间',
content: (data) => formatDate(data.loginDate)?.toString() || '-',
render: (val) => formatDate(val)?.toString() || '-',
},
],
});
@@ -89,12 +84,12 @@ const [Descriptions] = useDescription({
<ElAvatar :size="180" shape="square" :src="user.avatar" />
</ElCol>
<ElCol :span="18">
<Descriptions :column="2" :data="user" />
<Descriptions :data="user" />
</ElCol>
</ElRow>
<template v-else-if="mode === 'kefu'">
<ElAvatar :size="140" shape="square" :src="user.avatar" />
<Descriptions :column="1" :data="user" />
<Descriptions :data="user" />
</template>
</ElCard>
</template>

View File

@@ -1,6 +1,5 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { PayOrderApi } from '#/api/pay/order';
import type { DescriptionItemSchema } from '#/components/description';
import { h } from 'vue';
@@ -184,53 +183,46 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'status',
label: '支付状态',
content: (data: any) =>
render: (val) =>
h(DictTag, {
type: DICT_TYPE.PAY_ORDER_STATUS,
value: data?.status,
value: val,
}),
},
{
field: 'price',
label: '支付金额',
content: (data: PayOrderApi.Order) =>
`${erpPriceInputFormatter(data?.price)}`,
render: (val) => `${erpPriceInputFormatter(val)}`,
},
{
field: 'channelFeePrice',
label: '手续费',
content: (data: PayOrderApi.Order) =>
`${erpPriceInputFormatter(data?.channelFeePrice)}`,
render: (val) => `${erpPriceInputFormatter(val)}`,
},
{
field: 'channelFeeRate',
label: '手续费比例',
content: (data: PayOrderApi.Order) =>
`${erpPriceInputFormatter(data?.channelFeeRate)}%`,
render: (val) => `${erpPriceInputFormatter(val)}%`,
},
{
field: 'successTime',
label: '支付时间',
content: (data: PayOrderApi.Order) =>
formatDateTime(data?.successTime) as string,
render: (val) => formatDateTime(val) as string,
},
{
field: 'expireTime',
label: '失效时间',
content: (data: PayOrderApi.Order) =>
formatDateTime(data?.expireTime) as string,
render: (val) => formatDateTime(val) as string,
},
{
field: 'createTime',
label: '创建时间',
content: (data: PayOrderApi.Order) =>
formatDateTime(data?.createTime) as string,
render: (val) => formatDateTime(val) as string,
},
{
field: 'updateTime',
label: '更新时间',
content: (data: PayOrderApi.Order) =>
formatDateTime(data?.updateTime) as string,
render: (val) => formatDateTime(val) as string,
},
{
field: 'subject',
@@ -243,10 +235,10 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'channelCode',
label: '支付渠道',
content: (data: PayOrderApi.Order) =>
render: (val) =>
h(DictTag, {
type: DICT_TYPE.PAY_CHANNEL_CODE,
value: data?.channelCode,
value: val,
}),
},
{
@@ -256,10 +248,7 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'channelOrderNo',
label: '渠道单号',
content: (data: PayOrderApi.Order) =>
data?.channelOrderNo
? h(ElTag, { color: 'green' }, () => data.channelOrderNo)
: '',
render: (val) => (val ? h(ElTag, { color: 'green' }, () => val) : ''),
},
{
field: 'channelUserId',
@@ -268,8 +257,7 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'refundPrice',
label: '退款金额',
content: (data: PayOrderApi.Order) =>
`${erpPriceInputFormatter(data?.refundPrice)}`,
render: (val) => `${erpPriceInputFormatter(val)}`,
},
{
field: 'notifyUrl',

View File

@@ -13,14 +13,8 @@ import { useDetailSchema } from '../data';
const formData = ref<PayOrderApi.Order>();
const [Descriptions] = useDescription({
componentProps: {
border: true,
column: 2,
direction: 'horizontal',
labelWidth: 140,
title: '',
extra: '',
},
column: 2,
labelWidth: 140,
schema: useDetailSchema(),
});

View File

@@ -1,6 +1,5 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { PayRefundApi } from '#/api/pay/refund';
import type { DescriptionItemSchema } from '#/components/description';
import { h } from 'vue';
@@ -173,26 +172,22 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'merchantRefundId',
label: '商户退款单号',
content: (data: PayRefundApi.Refund) =>
h(ElTag, {}, () => data?.merchantRefundId || '-'),
render: (val) => h(ElTag, {}, () => val || '-'),
},
{
field: 'channelRefundNo',
label: '渠道退款单号',
content: (data: PayRefundApi.Refund) =>
h(ElTag, { type: 'success' }, () => data?.channelRefundNo || '-'),
render: (val) => h(ElTag, { type: 'success' }, () => val || '-'),
},
{
field: 'merchantOrderId',
label: '商户支付单号',
content: (data: PayRefundApi.Refund) =>
h(ElTag, {}, () => data?.merchantOrderId || '-'),
render: (val) => h(ElTag, {}, () => val || '-'),
},
{
field: 'channelOrderNo',
label: '渠道支付单号',
content: (data: PayRefundApi.Refund) =>
h(ElTag, { type: 'success' }, () => data?.channelOrderNo || '-'),
render: (val) => h(ElTag, { type: 'success' }, () => val || '-'),
},
{
field: 'appId',
@@ -205,58 +200,55 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'payPrice',
label: '支付金额',
content: (data: PayRefundApi.Refund) =>
render: (val) =>
h(
ElTag,
{ type: 'success' },
() => `${erpPriceInputFormatter(data?.payPrice || 0)}`,
() => `${erpPriceInputFormatter(val || 0)}`,
),
},
{
field: 'refundPrice',
label: '退款金额',
content: (data: PayRefundApi.Refund) =>
render: (val) =>
h(
ElTag,
{ type: 'danger' },
() => `${erpPriceInputFormatter(data?.refundPrice || 0)}`,
() => `${erpPriceInputFormatter(val || 0)}`,
),
},
{
field: 'status',
label: '退款状态',
content: (data: any) =>
render: (val) =>
h(DictTag, {
type: DICT_TYPE.PAY_REFUND_STATUS,
value: data?.status,
value: val,
}),
},
{
field: 'successTime',
label: '退款时间',
content: (data: PayRefundApi.Refund) =>
formatDateTime(data?.successTime) as string,
render: (val) => formatDateTime(val) as string,
},
{
field: 'createTime',
label: '创建时间',
content: (data: PayRefundApi.Refund) =>
formatDateTime(data?.createTime) as string,
render: (val) => formatDateTime(val) as string,
},
{
field: 'updateTime',
label: '更新时间',
content: (data: PayRefundApi.Refund) =>
formatDateTime(data?.updateTime) as string,
render: (val) => formatDateTime(val) as string,
},
// 渠道信息部分
{
field: 'channelCode',
label: '退款渠道',
content: (data: PayRefundApi.Refund) =>
render: (val) =>
h(DictTag, {
type: DICT_TYPE.PAY_CHANNEL_CODE,
value: data?.channelCode,
value: val,
}),
},
{

View File

@@ -13,14 +13,8 @@ import { useDetailSchema } from '../data';
const formData = ref<PayRefundApi.Refund>();
const [Descriptions] = useDescription({
componentProps: {
border: true,
column: 2,
direction: 'horizontal',
labelWidth: 140,
title: '',
extra: '',
},
column: 2,
labelWidth: 140,
schema: useDetailSchema(),
});

View File

@@ -1,6 +1,5 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { PayTransferApi } from '#/api/pay/transfer';
import type { DescriptionItemSchema } from '#/components/description';
import { h } from 'vue';
@@ -191,14 +190,12 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'merchantTransferId',
label: '商户单号',
content: (data: PayTransferApi.Transfer) =>
h(ElTag, {}, () => data?.merchantTransferId),
render: (val) => h(ElTag, {}, () => val),
},
{
field: 'no',
label: '转账单号',
content: (data: PayTransferApi.Transfer) =>
h(ElTag, { color: 'orange' }, () => data?.no),
render: (val) => h(ElTag, { color: 'orange' }, () => val),
},
{
field: 'appId',
@@ -207,33 +204,31 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'status',
label: '转账状态',
content: (data: any) =>
render: (val) =>
h(DictTag, {
type: DICT_TYPE.PAY_TRANSFER_STATUS,
value: data?.status,
value: val,
}),
},
{
field: 'price',
label: '转账金额',
content: (data: PayTransferApi.Transfer) =>
render: (val) =>
h(
ElTag,
{ color: 'success' },
() => `${erpPriceInputFormatter(data?.price || 0)}`,
() => `${erpPriceInputFormatter(val || 0)}`,
),
},
{
field: 'successTime',
label: '转账时间',
content: (data: PayTransferApi.Transfer) =>
formatDateTime(data?.successTime) as string,
render: (val) => formatDateTime(val) as string,
},
{
field: 'createTime',
label: '创建时间',
content: (data: PayTransferApi.Transfer) =>
formatDateTime(data?.createTime) as string,
render: (val) => formatDateTime(val) as string,
},
{
field: 'userName',
@@ -246,10 +241,10 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'channelCode',
label: '支付渠道',
content: (data: PayTransferApi.Transfer) =>
render: (val) =>
h(DictTag, {
type: DICT_TYPE.PAY_CHANNEL_CODE,
value: data?.channelCode,
value: val,
}),
},
{
@@ -259,10 +254,7 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'channelTransferNo',
label: '渠道单号',
content: (data: PayTransferApi.Transfer) =>
data?.channelTransferNo
? h(ElTag, { color: 'success' }, () => data.channelTransferNo)
: '',
render: (val) => (val ? h(ElTag, { color: 'success' }, () => val) : ''),
},
{
field: 'notifyUrl',

View File

@@ -13,14 +13,8 @@ import { useDetailSchema } from '../data';
const formData = ref<PayTransferApi.Transfer>();
const [Descriptions] = useDescription({
componentProps: {
border: true,
column: 2,
direction: 'horizontal',
labelWidth: 140,
title: '',
extra: '',
},
column: 2,
labelWidth: 140,
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,14 +12,8 @@ import { useDetailSchema } from '../data';
const formData = ref<SystemLoginLogApi.LoginLog>();
const [Descriptions] = useDescription({
componentProps: {
border: true,
column: 1,
direction: 'horizontal',
labelWidth: 110,
title: '',
extra: '',
},
column: 1,
labelWidth: 110,
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,14 +172,14 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'userId',
label: '接收用户',
content: (data: SystemMailLogApi.MailLog) => {
if (data?.userType && data?.userId) {
render: (val, data) => {
if (data?.userType && val) {
return h('div', [
h(DictTag, {
type: DICT_TYPE.USER_TYPE,
value: data.userType,
}),
` (${data.userId})`,
` (${val})`,
]);
}
return '无';
@@ -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,26 @@ export function useDetailSchema(): DescriptionItemSchema[] {
field: 'templateContent',
label: '邮件内容',
span: 2,
content: (data: SystemMailLogApi.MailLog) => {
render: (val) => {
return h('div', {
innerHTML: data?.templateContent || '',
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,14 +12,8 @@ import { useDetailSchema } from '../data';
const formData = ref<SystemMailLogApi.MailLog>();
const [Descriptions] = useDescription({
componentProps: {
border: true,
column: 2,
direction: 'horizontal',
labelWidth: 140,
title: '',
extra: '',
},
column: 2,
labelWidth: 140,
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,14 +12,8 @@ import { useDetailSchema } from '../data';
const formData = ref<SystemNotifyMessageApi.NotifyMessage>();
const [Descriptions] = useDescription({
componentProps: {
border: true,
column: 1,
direction: 'horizontal',
labelWidth: 140,
title: '',
extra: '',
},
column: 1,
labelWidth: 140,
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,14 +12,8 @@ import { useDetailSchema } from '../data';
const formData = ref<SystemNotifyMessageApi.NotifyMessage>();
const [Descriptions] = useDescription({
componentProps: {
border: true,
column: 1,
direction: 'horizontal',
labelWidth: 140,
title: '',
extra: '',
},
column: 1,
labelWidth: 140,
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,
},
{
label: '请求 URL',
content: (data: SystemOperateLogApi.OperateLog) => {
if (data?.requestMethod && data?.requestUrl) {
return `${data.requestMethod} ${data.requestUrl}`;
field: '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,14 +12,9 @@ import { useDetailSchema } from '../data';
const formData = ref<SystemOperateLogApi.OperateLog>();
const [Descriptions] = useDescription({
componentProps: {
border: true,
column: 1,
direction: 'horizontal',
labelWidth: 110,
title: '',
extra: '',
},
column: 1,
direction: 'horizontal',
labelWidth: 110,
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,14 +12,9 @@ import { useDetailSchema } from '../data';
const formData = ref<SystemSmsLogApi.SmsLog>();
const [Descriptions] = useDescription({
componentProps: {
border: true,
column: 2,
direction: 'horizontal',
labelWidth: 140,
title: '',
extra: '',
},
column: 2,
direction: 'horizontal',
labelWidth: 140,
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 { ElImage } from 'element-plus';
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,13 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'avatar',
label: '用户头像',
// TODO @芋艿:使用 antd 的 Image 组件
content: (data: SystemSocialUserApi.SocialUser) => {
if (data?.avatar) {
return h('img', {
src: data.avatar,
style: 'width: 30px; height: 30px; cursor: pointer;',
onClick: () => {
// 可以添加图片预览功能
window.open(data.avatar, '_blank');
},
render: (val) => {
if (val) {
return h(ElImage, {
src: val,
previewSrcList: [val],
class: 'w-10 h-10 cursor-pointer',
previewTeleported: true,
});
}
return '无';

View File

@@ -14,14 +14,8 @@ import { useDetailSchema } from '../data';
const formData = ref<SystemSocialUserApi.SocialUser>();
const [Descriptions] = useDescription({
componentProps: {
border: true,
column: 1,
direction: 'horizontal',
title: '',
extra: '',
labelWidth: 185,
},
column: 1,
labelWidth: 185,
schema: useDetailSchema(),
});