feat: use new desc comp

This commit is contained in:
xingyu4j
2025-10-21 11:40:42 +08:00
parent 284c47b721
commit de4ca0a5a4
50 changed files with 421 additions and 586 deletions

View File

@@ -17,18 +17,18 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'totalPrice',
label: '合同金额(元)',
content: (data) =>
erpPriceInputFormatter(data?.contract?.totalPrice ?? data.totalPrice),
render: (val, data) =>
erpPriceInputFormatter(val ?? data?.contract?.totalPrice ?? 0),
},
{
field: 'returnTime',
label: '回款日期',
content: (data) => formatDateTime(data?.returnTime) as string,
render: (val) => formatDateTime(val) as string,
},
{
field: 'price',
label: '回款金额(元)',
content: (data) => erpPriceInputFormatter(data.price),
render: (val) => erpPriceInputFormatter(val),
},
{
field: 'ownerUserName',
@@ -51,25 +51,26 @@ export function useDetailBaseSchema(): DescriptionItemSchema[] {
{
field: 'contract',
label: '合同编号',
content: (data) => data?.contract?.no,
render: (val, data) =>
val && data?.contract?.no ? data?.contract?.no : '',
},
{
field: 'returnTime',
label: '回款日期',
content: (data) => formatDateTime(data?.returnTime) as string,
render: (val) => formatDateTime(val) as string,
},
{
field: 'price',
label: '回款金额',
content: (data) => erpPriceInputFormatter(data.price),
render: (val) => erpPriceInputFormatter(val),
},
{
field: 'returnType',
label: '回款方式',
content: (data) =>
render: (val) =>
h(DictTag, {
type: DICT_TYPE.CRM_RECEIVABLE_RETURN_TYPE,
value: data?.returnType,
value: val,
}),
},
{
@@ -93,12 +94,12 @@ export function useDetailSystemSchema(): DescriptionItemSchema[] {
{
field: 'createTime',
label: '创建时间',
content: (data) => formatDateTime(data?.createTime) as string,
render: (val) => formatDateTime(val) as string,
},
{
field: 'updateTime',
label: '更新时间',
content: (data) => formatDateTime(data?.updateTime) as string,
render: (val) => formatDateTime(val) as string,
},
];
}

View File

@@ -38,11 +38,9 @@ const logList = ref<SystemOperateLogApi.OperateLog[]>([]); // 操作日志
const permissionListRef = ref<InstanceType<typeof PermissionList>>(); // 团队成员列表 Ref
const [Descriptions] = useDescription({
componentProps: {
bordered: false,
column: 4,
class: 'mx-4',
},
bordered: false,
column: 4,
class: 'mx-4',
schema: useDetailSchema(),
});

View File

@@ -12,22 +12,18 @@ defineProps<{
}>();
const [BaseDescriptions] = useDescription({
componentProps: {
title: '基本信息',
bordered: false,
column: 4,
class: 'mx-4',
},
title: '基本信息',
bordered: false,
column: 4,
class: 'mx-4',
schema: useDetailBaseSchema(),
});
const [SystemDescriptions] = useDescription({
componentProps: {
title: '系统信息',
bordered: false,
column: 3,
class: 'mx-4',
},
title: '系统信息',
bordered: false,
column: 3,
class: 'mx-4',
schema: useDetailSystemSchema(),
});
</script>

View File

@@ -21,17 +21,17 @@ export function useDetailSchema(): DescriptionItemSchema[] {
{
field: 'price',
label: '计划回款金额',
content: (data) => erpPriceInputFormatter(data.price),
render: (val) => erpPriceInputFormatter(val),
},
{
field: 'returnTime',
label: '计划回款日期',
content: (data) => formatDateTime(data?.returnTime) as string,
render: (val) => formatDateTime(val) as string,
},
{
field: 'receivable',
label: '实际回款金额',
content: (data) => erpPriceInputFormatter(data?.receivable?.price ?? 0),
render: (val) => erpPriceInputFormatter(val?.price ?? 0),
},
];
}
@@ -54,20 +54,20 @@ export function useDetailBaseSchema(): DescriptionItemSchema[] {
{
field: 'returnTime',
label: '计划回款日期',
content: (data) => formatDateTime(data?.returnTime) as string,
render: (val) => formatDateTime(val) as string,
},
{
field: 'price',
label: '计划回款金额',
content: (data) => erpPriceInputFormatter(data.price),
render: (val) => erpPriceInputFormatter(val),
},
{
field: 'returnType',
label: '计划回款方式',
content: (data) =>
render: (val) =>
h(DictTag, {
type: DICT_TYPE.CRM_RECEIVABLE_RETURN_TYPE,
value: data?.returnType,
value: val,
}),
},
{
@@ -77,20 +77,20 @@ export function useDetailBaseSchema(): DescriptionItemSchema[] {
{
field: 'receivable',
label: '实际回款金额',
content: (data) => erpPriceInputFormatter(data?.receivable?.price ?? 0),
render: (val) => erpPriceInputFormatter(val ?? 0),
},
{
field: 'receivableRemain',
label: '未回款金额',
content: (data) => {
render: (val, data) => {
const paid = data?.receivable?.price ?? 0;
return erpPriceInputFormatter(Math.max(data.price - paid, 0));
return erpPriceInputFormatter(Math.max(val - paid, 0));
},
},
{
field: 'receivable.returnTime',
label: '实际回款日期',
content: (data) => formatDateTime(data?.receivable?.returnTime) as string,
render: (val) => formatDateTime(val) as string,
},
{
field: 'remark',
@@ -113,12 +113,12 @@ export function useDetailSystemSchema(): DescriptionItemSchema[] {
{
field: 'createTime',
label: '创建时间',
content: (data) => formatDateTime(data?.createTime) as string,
render: (val) => formatDateTime(val) as string,
},
{
field: 'updateTime',
label: '更新时间',
content: (data) => formatDateTime(data?.updateTime) as string,
render: (val) => formatDateTime(val) as string,
},
];
}

View File

@@ -39,11 +39,9 @@ const permissionListRef = ref<InstanceType<typeof PermissionList>>(); // 团队
const validateWrite = () => permissionListRef.value?.validateWrite;
const [Descriptions] = useDescription({
componentProps: {
bordered: false,
column: 4,
class: 'mx-4',
},
bordered: false,
column: 4,
class: 'mx-4',
schema: useDetailSchema(),
});

View File

@@ -12,22 +12,18 @@ defineProps<{
}>();
const [BaseDescriptions] = useDescription({
componentProps: {
title: '基本信息',
bordered: false,
column: 4,
class: 'mx-4',
},
title: '基本信息',
bordered: false,
column: 4,
class: 'mx-4',
schema: useDetailBaseSchema(),
});
const [SystemDescriptions] = useDescription({
componentProps: {
title: '系统信息',
bordered: false,
column: 3,
class: 'mx-4',
},
title: '系统信息',
bordered: false,
column: 3,
class: 'mx-4',
schema: useDetailSystemSchema(),
});
</script>