perf: detail 字段与 list form分开
This commit is contained in:
@@ -1,17 +1,10 @@
|
||||
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 { getContractSimpleList } from '#/api/crm/contract';
|
||||
import { getCustomerSimpleList } from '#/api/crm/customer';
|
||||
import { getReceivablePlanSimpleList } from '#/api/crm/receivable/plan';
|
||||
import { getSimpleUserList } from '#/api/system/user';
|
||||
import { DictTag } from '#/components/dict-tag';
|
||||
import { erpPriceInputFormatter } from '#/utils';
|
||||
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
|
||||
|
||||
/** 新增/修改的表单 */
|
||||
@@ -274,144 +267,3 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 详情页的字段 */
|
||||
export function useDetailSchema(): DescriptionItemSchema[] {
|
||||
return [
|
||||
{
|
||||
field: 'customerName',
|
||||
label: '客户名称',
|
||||
},
|
||||
{
|
||||
field: 'totalPrice',
|
||||
label: '合同金额',
|
||||
content: (data) => erpPriceInputFormatter(data.totalPrice),
|
||||
},
|
||||
{
|
||||
field: 'returnTime',
|
||||
label: '回款日期',
|
||||
content: (data) => formatDateTime(data?.returnTime) as string,
|
||||
},
|
||||
{
|
||||
field: 'price',
|
||||
label: '回款金额',
|
||||
content: (data) => erpPriceInputFormatter(data.price),
|
||||
},
|
||||
{
|
||||
field: 'ownerUserName',
|
||||
label: '负责人',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 详情页的基础字段 */
|
||||
export function useDetailBaseSchema(): DescriptionItemSchema[] {
|
||||
return [
|
||||
{
|
||||
field: 'no',
|
||||
label: '回款编号',
|
||||
},
|
||||
{
|
||||
field: 'customerName',
|
||||
label: '客户名称',
|
||||
},
|
||||
{
|
||||
field: 'contract',
|
||||
label: '合同编号',
|
||||
content: (data) => data?.contract?.no,
|
||||
},
|
||||
{
|
||||
field: 'returnTime',
|
||||
label: '回款日期',
|
||||
content: (data) => formatDateTime(data?.returnTime) as string,
|
||||
},
|
||||
{
|
||||
field: 'price',
|
||||
label: '回款金额',
|
||||
content: (data) => erpPriceInputFormatter(data.price),
|
||||
},
|
||||
{
|
||||
field: 'returnType',
|
||||
label: '回款方式',
|
||||
content: (data) =>
|
||||
h(DictTag, {
|
||||
type: DICT_TYPE.CRM_RECEIVABLE_RETURN_TYPE,
|
||||
value: data?.returnType,
|
||||
}),
|
||||
},
|
||||
{
|
||||
field: 'remark',
|
||||
label: '备注',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 详情列表的字段 */
|
||||
export function useDetailListColumns(): VxeTableGridOptions['columns'] {
|
||||
return [
|
||||
{
|
||||
title: '回款编号',
|
||||
field: 'no',
|
||||
minWidth: 150,
|
||||
fixed: 'left',
|
||||
},
|
||||
{
|
||||
title: '客户名称',
|
||||
field: 'customerName',
|
||||
minWidth: 150,
|
||||
},
|
||||
{
|
||||
title: '合同编号',
|
||||
field: 'contract.no',
|
||||
minWidth: 150,
|
||||
},
|
||||
{
|
||||
title: '回款日期',
|
||||
field: 'returnTime',
|
||||
minWidth: 150,
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
{
|
||||
title: '回款金额(元)',
|
||||
field: 'price',
|
||||
minWidth: 150,
|
||||
formatter: 'formatNumber',
|
||||
},
|
||||
{
|
||||
title: '回款方式',
|
||||
field: 'returnType',
|
||||
minWidth: 150,
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.CRM_RECEIVABLE_RETURN_TYPE },
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '负责人',
|
||||
field: 'ownerUserName',
|
||||
minWidth: 150,
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
field: 'remark',
|
||||
minWidth: 150,
|
||||
},
|
||||
{
|
||||
title: '回款状态',
|
||||
field: 'auditStatus',
|
||||
minWidth: 100,
|
||||
fixed: 'right',
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.CRM_AUDIT_STATUS },
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
field: 'actions',
|
||||
width: 130,
|
||||
fixed: 'right',
|
||||
slots: { default: 'actions' },
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user