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

295 lines
5.3 KiB
TypeScript
Raw Normal View History

2025-06-19 14:26:08 +08:00
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
2025-06-23 09:39:53 +08:00
import {getDictOptions} from "#/utils/dict";
2025-06-27 17:56:05 +08:00
import {renderDict} from "#/utils/render";
import {resident_unitList} from "#/api/property/resident/unit";
2025-06-19 14:26:08 +08:00
export const querySchema: FormSchemaGetter = () => [
2025-06-27 17:56:05 +08:00
{
component: 'ApiSelect',
fieldName: 'unitId',
label: '所属单位',
componentProps: {
api: getUnitList,
resultField: 'data',
labelField: 'label',
valueField: 'value',
immediate: true,
debounceTime: 500,
allowClear: true,
placeholder: '请选择所属单位',
2025-06-30 14:45:06 +08:00
filterOption:true
2025-06-27 17:56:05 +08:00
},
},
2025-06-19 14:26:08 +08:00
{
component: 'Input',
2025-06-23 09:39:53 +08:00
fieldName: 'userName',
label: '员工名称',
2025-06-19 14:26:08 +08:00
},
{
2025-06-23 09:39:53 +08:00
component: 'Select',
2025-06-19 14:26:08 +08:00
componentProps: {
2025-06-27 17:56:05 +08:00
options: getDictOptions('wy_rzryzt'),
2025-06-19 14:26:08 +08:00
},
fieldName: 'state',
label: '状态',
},
];
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
2025-07-02 18:00:26 +08:00
// {
// title: '序号',
// field: 'id',
// slots: {
// default: ({ rowIndex }) => {
// return (rowIndex + 1).toString();
// },
// },
// },
2025-06-19 14:26:08 +08:00
{
2025-06-23 09:39:53 +08:00
title: '员工编号',
2025-06-19 14:26:08 +08:00
field: 'userId',
2025-06-30 14:45:06 +08:00
width: 100
2025-06-19 14:26:08 +08:00
},
{
2025-06-23 09:39:53 +08:00
title: '员工名称',
2025-06-19 14:26:08 +08:00
field: 'userName',
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
},
{
title: '性别',
field: 'gender',
2025-06-27 17:56:05 +08:00
slots:{
default: ({row})=>{
2025-06-30 14:45:06 +08:00
return renderDict(row.gender,'sys_user_sex')
2025-06-27 17:56:05 +08:00
}
2025-06-30 14:45:06 +08:00
},
width: 100
2025-06-19 14:26:08 +08:00
},
{
field: 'img',
2025-06-23 09:39:53 +08:00
title: '人脸图片',
slots: { default: 'img' },
minWidth: 80,
2025-06-19 14:26:08 +08:00
},
{
2025-06-23 09:39:53 +08:00
title: '所属单位',
2025-06-19 14:26:08 +08:00
field: 'unitName',
2025-06-30 14:45:06 +08:00
width: 100
2025-06-19 14:26:08 +08:00
},
2025-06-30 14:45:06 +08:00
// {
// title: '入驻位置',
// field: 'locathon',
// },
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: 'carNumber',
2025-06-30 14:45:06 +08:00
width: 100
2025-06-19 14:26:08 +08:00
},
{
title: '状态',
field: 'state',
2025-06-27 17:56:05 +08:00
slots:{
default: ({row})=>{
return renderDict(row.state,'wy_rzryzt')
}
2025-06-30 14:45:06 +08:00
},
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
},
{
field: 'action',
fixed: 'right',
slots: { default: 'action' },
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-23 09:39:53 +08:00
label: '入住员工',
2025-06-19 14:26:08 +08:00
fieldName: 'userId',
2025-06-23 09:39:53 +08:00
component: "Select",
rules: 'selectRequired',
formItemClass: 'col-span-2'
2025-06-19 14:26:08 +08:00
},
{
2025-06-23 09:39:53 +08:00
label: '所属单位',
fieldName: 'unitId',
component: 'Select',
formItemClass: 'col-span-2',
rules:'selectRequired',
2025-06-19 14:26:08 +08:00
},
2025-06-27 17:56:05 +08:00
// {
// label: '入驻位置',
// fieldName: 'locathon',
// component: 'Input',
// rules:'required',
// 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',
},
2025-06-30 14:45:06 +08:00
rules:"required"
2025-06-19 14:26:08 +08:00
},
{
label: '车牌号码',
fieldName: 'carNumber',
component: 'Input',
},
2025-06-30 18:11:49 +08:00
{
label: '人脸图片',
fieldName: 'img',
component: 'ImageUpload',
componentProps: {
// accept: 'image/*', // 可选拓展名或者mime类型 ,拼接
maxCount: 1, // 最大上传文件数 默认为1 为1会绑定为string而非string[]类型
},
formItemClass: 'col-span-2',
},
2025-06-27 17:56:05 +08:00
{
label: '人员状态',
fieldName: 'state',
component: 'Select',
componentProps: {
options: getDictOptions('wy_rzryzt'),
},
2025-06-30 14:45:06 +08:00
rules:'selectRequired'
2025-06-27 17:56:05 +08:00
},
2025-06-19 14:26:08 +08:00
{
label: '备注',
fieldName: 'remark',
component: 'Textarea',
2025-06-23 09:39:53 +08:00
formItemClass: 'col-span-2',
},
];
//门禁记录
export const accessControlColumns: VxeGridProps['columns'] = [
{
title: '序号',
field: 'id',
},
{
title: '通过时间',
field: 'userId',
},
{
title: '进出类型',
field: 'userName',
},
{
title: '位置',
field: 'phone',
},
{
title: '设备名称',
field: 'gender',
},
{
title: '门禁类型',
field: 'img',
},
{
title: '识别类型',
field: 'unitName',
},
{
title: '状态',
field: 'locathon',
},
];
//车辆记录
export const carColumns: VxeGridProps['columns'] = [
{
title: '序号',
field: 'id',
},
{
title: '通过时间',
field: 'userId',
},
{
title: '进出类型',
field: 'userName',
},
{
title: '位置',
field: 'phone',
},
{
title: '设备名称',
field: 'gender',
},
{
title: '进出方式',
field: 'img',
},
{
title: '停车类型',
field: 'unitName',
},
{
title: '费用(元)',
field: 'locathon',
},
{
title: '状态',
field: 'state',
},
{
title: '备注',
field: 'remark',
2025-06-19 14:26:08 +08:00
},
];
2025-06-27 17:56:05 +08:00
export async function getUnitList(): Promise<{ value: number; label: string }[]> {
const queryParam = {
pageNum: 1000,
pageSize: 1,
};
const res = await resident_unitList(queryParam);
const data: { value: number; label: string }[] = [];
res.rows.forEach((r: any) => {
data.push({
2025-06-30 14:45:06 +08:00
value: r.id,
label: r.name,
2025-06-27 17:56:05 +08:00
});
});
return data;
}