Files
admin-vben5/apps/web-antd/src/views/property/resident/unit/data.ts

180 lines
3.4 KiB
TypeScript
Raw Normal View History

2025-06-19 16:55:06 +08:00
import type {FormSchemaGetter} from '#/adapter/form';
import type {VxeGridProps} from '#/adapter/vxe-table';
import {getDictOptions} from "#/utils/dict";
import {renderDict} from "#/utils/render";
2025-06-24 14:52:45 +08:00
import {z} from "#/adapter/form";
2025-06-23 09:39:53 +08:00
2025-06-19 14:26:08 +08:00
export const querySchema: FormSchemaGetter = () => [
{
component: 'Input',
fieldName: 'name',
2025-06-19 16:55:06 +08:00
label: '单位名称',
2025-06-19 14:26:08 +08:00
},
{
component: 'Input',
fieldName: 'contactPerson',
label: '联系人',
},
{
2025-06-19 16:55:06 +08:00
component: 'Select',
2025-06-19 14:26:08 +08:00
componentProps: {
2025-06-19 16:55:06 +08:00
options: getDictOptions('wy_state'),
2025-06-19 14:26:08 +08:00
},
fieldName: 'state',
label: '状态',
},
];
export const columns: VxeGridProps['columns'] = [
2025-06-19 16:55:06 +08:00
{type: 'checkbox', width: 60},
2025-07-02 18:00:26 +08:00
// {
// title: '序号',
// field: 'id',
// slots: {
// default: ({ rowIndex }) => {
// return (rowIndex + 1).toString();
// },
// },
// width: 60
// },
2025-06-19 14:26:08 +08:00
{
title: '单位编号',
field: 'unitNumber',
2025-06-23 09:39:53 +08:00
slots:{
default: ({ row }) => {
return row.id;
2025-06-30 14:45:06 +08:00
}},
width: 100
2025-06-19 14:26:08 +08:00
},
{
2025-06-19 16:55:06 +08:00
title: '单位名称',
field: 'name',
2025-06-30 14:45:06 +08:00
width: 100
2025-06-19 16:55:06 +08:00
},
{
title: '单位类型',
2025-06-19 14:26:08 +08:00
field: 'type',
2025-06-23 09:27:28 +08:00
slots: {
default: ({ row }) => {
2025-06-23 09:39:53 +08:00
return renderDict(row.type, 'wy_qylx');
2025-06-23 09:27:28 +08:00
},
},
2025-06-30 14:45:06 +08:00
width: 100
2025-06-19 14:26:08 +08:00
},
{
title: '联系人',
field: 'contactPerson',
2025-06-30 14:45:06 +08:00
width: 100
2025-06-19 14:26:08 +08:00
},
{
title: '联系电话',
field: 'phone',
2025-06-30 14:45:06 +08:00
width: 100
2025-06-19 14:26:08 +08:00
},
2025-07-02 18:00:26 +08:00
// {
// title: '入驻位置',
// field: 'location',
// width: 100,
// },
2025-06-19 14:26:08 +08:00
{
title: '入驻时间',
field: 'time',
2025-06-30 14:45:06 +08:00
width: 100,
2025-06-19 14:26:08 +08:00
},
{
title: '状态',
field: 'state',
2025-06-30 14:45:06 +08:00
slots: {default: 'state'},
width: 100,
2025-06-19 14:26:08 +08:00
},
2025-07-02 18:00:26 +08:00
// {
// title: '员工数量',
// field: 'number',
// width: 100,
// },
2025-06-19 14:26:08 +08:00
{
title: '备注',
field: 'remark',
2025-06-30 14:45:06 +08:00
width: 100,
2025-06-19 14:26:08 +08:00
},
2025-06-19 16:55:06 +08:00
{
title: '创建时间',
field: 'createTime',
2025-06-30 14:45:06 +08:00
width: 100,
2025-06-19 16:55:06 +08:00
},
2025-06-19 14:26:08 +08:00
{
field: 'action',
fixed: 'right',
2025-06-19 16:55:06 +08:00
slots: {default: 'action'},
2025-06-19 14:26:08 +08:00
title: '操作',
2025-06-30 14:45:06 +08:00
minWidth: 180,
2025-06-19 14:26:08 +08:00
},
];
export const modalSchema: FormSchemaGetter = () => [
{
label: 'id',
fieldName: 'id',
component: 'Input',
dependencies: {
show: () => false,
triggerFields: [''],
},
},
{
2025-06-19 16:55:06 +08:00
label: '单位名称',
2025-06-19 14:26:08 +08:00
fieldName: 'name',
component: 'Input',
rules: 'required',
2025-06-23 09:39:53 +08:00
2025-06-19 14:26:08 +08:00
},
{
2025-06-19 16:55:06 +08:00
label: '单位类型',
2025-06-19 14:26:08 +08:00
fieldName: 'type',
2025-06-23 09:27:28 +08:00
component: 'Select',
componentProps: {
2025-06-23 09:39:53 +08:00
options: getDictOptions('wy_qylx'),
2025-06-23 09:27:28 +08:00
},
2025-06-23 09:39:53 +08:00
rules: 'required',
2025-06-19 14:26:08 +08:00
},
{
label: '联系人',
fieldName: 'contactPerson',
component: 'Input',
rules: 'required',
},
{
label: '联系电话',
fieldName: 'phone',
component: 'Input',
2025-07-22 19:11:52 +08:00
rules:z.union([
z.string().regex(/^1[3-9]\d{9}$/, { message: '手机号格式错误' }),
z.number().int().min(1000000000).max(19999999999, { message: '手机号格式错误' })
]).transform(val => val.toString()),
2025-06-19 14:26:08 +08:00
},
{
label: '入驻位置',
fieldName: 'location',
2025-06-30 14:45:06 +08:00
component: 'TreeSelect',
rules: 'selectRequired',
2025-06-23 09:39:53 +08:00
formItemClass: 'col-span-2'
2025-06-19 14:26:08 +08:00
},
{
label: '入驻时间',
fieldName: 'time',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
rules: 'required',
},
{
label: '备注',
fieldName: 'remark',
component: 'Textarea',
2025-06-19 16:55:06 +08:00
formItemClass: 'col-span-2'
2025-06-19 14:26:08 +08:00
},
];