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

156 lines
2.7 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-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-06-19 14:26:08 +08:00
{
2025-06-19 16:55:06 +08:00
title: '序号',
2025-06-19 14:26:08 +08:00
field: 'id',
2025-06-19 16:55:06 +08:00
slots: {
default: ({ rowIndex }) => {
return rowIndex + 1;
},
},
2025-06-19 14:26:08 +08:00
},
{
title: '单位编号',
field: 'unitNumber',
},
{
2025-06-19 16:55:06 +08:00
title: '单位名称',
field: 'name',
},
{
title: '单位类型',
2025-06-19 14:26:08 +08:00
field: 'type',
},
{
title: '联系人',
field: 'contactPerson',
},
{
title: '联系电话',
field: 'phone',
},
{
title: '入驻位置',
field: 'location',
},
{
title: '入驻时间',
field: 'time',
},
{
title: '状态',
field: 'state',
2025-06-19 16:55:06 +08:00
slots: {
default: ({ row }) => {
return renderDict(row.state, 'wy_state');
},
},
2025-06-19 14:26:08 +08:00
},
{
2025-06-19 16:55:06 +08:00
title: '员工数量',
2025-06-19 14:26:08 +08:00
field: 'number',
},
{
title: '备注',
field: 'remark',
},
2025-06-19 16:55:06 +08:00
{
title: '创建时间',
field: 'createTime',
},
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: '操作',
width: 180,
},
];
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-19 16:55:06 +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',
component: 'Input',
2025-06-19 16:55:06 +08:00
rules: 'required',
2025-06-19 14:26:08 +08:00
},
{
label: '联系人',
fieldName: 'contactPerson',
component: 'Input',
rules: 'required',
},
{
label: '联系电话',
fieldName: 'phone',
component: 'Input',
rules: 'required',
},
{
label: '入驻位置',
fieldName: 'location',
2025-06-19 16:55:06 +08:00
component: 'Input',
2025-06-19 14:26:08 +08:00
rules: 'required',
},
{
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
},
];