feat:【antd】【crm】客户的列表的重构

This commit is contained in:
YunaiV
2025-09-27 16:36:18 +08:00
parent 06633c336e
commit 09abc9cead
12 changed files with 174 additions and 593 deletions

View File

@@ -1,6 +1,7 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import { z } from '@vben/common-ui';
import { DICT_TYPE } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
import { useUserStore } from '@vben/stores';
@@ -37,8 +38,9 @@ export function useFormSchema(): VbenFormSchema[] {
component: 'Select',
componentProps: {
options: getDictOptions(DICT_TYPE.CRM_CUSTOMER_SOURCE, 'number'),
placeholder: '请选择客户来源',
allowClear: true,
},
rules: 'required',
},
{
fieldName: 'mobile',
@@ -201,13 +203,53 @@ export function useGridFormSchema(): VbenFormSchema[] {
component: 'RangePicker',
componentProps: {
...getRangePickerDefaultProps(),
placeholder: '请选择创建时间',
placeholder: ['开始日期', '结束日期'],
allowClear: true,
},
},
];
}
/** 导入客户的表单 */
export function useImportFormSchema(): VbenFormSchema[] {
return [
{
fieldName: 'ownerUserId',
label: '负责人',
component: 'ApiSelect',
componentProps: {
api: () => getSimpleUserList(),
fieldNames: {
label: 'nickname',
value: 'id',
},
placeholder: '请选择负责人',
allowClear: true,
class: 'w-full',
},
rules: 'required',
},
{
fieldName: 'file',
label: '客户数据',
component: 'Upload',
rules: 'required',
help: '仅允许导入 xls、xlsx 格式文件',
},
{
fieldName: 'updateSupport',
label: '是否覆盖',
component: 'Switch',
componentProps: {
checkedChildren: '是',
unCheckedChildren: '否',
},
rules: z.boolean().default(false),
help: '是否更新已经存在的客户数据',
},
];
}
/** 列表的字段 */
export function useGridColumns(): VxeTableGridOptions['columns'] {
return [
@@ -215,11 +257,8 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
field: 'name',
title: '客户名称',
fixed: 'left',
align: 'left',
minWidth: 280,
slots: {
default: 'name',
},
minWidth: 160,
slots: { default: 'name' },
},
{
field: 'source',
@@ -233,83 +272,118 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{
field: 'mobile',
title: '手机',
minWidth: 100,
minWidth: 120,
},
{
field: 'telephone',
title: '电话',
minWidth: 100,
minWidth: 130,
},
{
field: 'email',
title: '邮箱',
minWidth: 100,
},
{
field: 'areaName',
title: '地址',
minWidth: 140,
},
{
field: 'detailAddress',
title: '地址',
minWidth: 140,
},
{
field: 'industryId',
title: '客户行业',
minWidth: 80,
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.CRM_CUSTOMER_INDUSTRY },
},
minWidth: 180,
},
{
field: 'level',
title: '客户级别',
minWidth: 120,
minWidth: 135,
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.CRM_CUSTOMER_LEVEL },
},
},
{
field: 'industryId',
title: '客户行业',
minWidth: 100,
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.CRM_CUSTOMER_INDUSTRY },
},
},
{
field: 'contactNextTime',
title: '下次联系时间',
formatter: 'formatDateTime',
minWidth: 180,
},
{
field: 'remark',
title: '备注',
minWidth: 200,
},
{
field: 'lockStatus',
title: '锁定状态',
minWidth: 120,
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.INFRA_BOOLEAN_STRING },
},
},
{
field: 'dealStatus',
title: '成交状态',
minWidth: 120,
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.INFRA_BOOLEAN_STRING },
},
},
{
field: 'contactLastTime',
title: '最后跟进时间',
formatter: 'formatDateTime',
minWidth: 180,
},
{
field: 'contactLastContent',
title: '最后跟进记录',
minWidth: 200,
},
{
field: 'detailAddress',
title: '地址',
minWidth: 180,
},
{
field: 'poolDay',
title: '距离进入公海天数',
minWidth: 140,
formatter: ({ cellValue }) =>
cellValue == null ? '-' : `${cellValue}`,
},
{
field: 'ownerUserName',
title: '负责人',
minWidth: 80,
minWidth: 100,
},
{
field: 'ownerUserDeptName',
title: '所属部门',
minWidth: 100,
},
{
field: 'contactNextTime',
title: '下次联系时间',
formatter: 'formatDateTime',
minWidth: 160,
},
{
field: 'contactLastTime',
title: '最后跟进时间',
formatter: 'formatDateTime',
minWidth: 160,
},
{
field: 'updateTime',
title: '更新时间',
formatter: 'formatDateTime',
minWidth: 160,
minWidth: 180,
},
{
field: 'createTime',
title: '创建时间',
formatter: 'formatDateTime',
minWidth: 160,
minWidth: 180,
},
{
field: 'creatorName',
title: '创建人',
minWidth: 100,
},
{
title: '操作',
width: 180,
width: 130,
fixed: 'right',
slots: { default: 'actions' },
},