Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
364 lines
6.9 KiB
TypeScript
364 lines
6.9 KiB
TypeScript
import type { FormSchemaGetter } from '#/adapter/form'
|
|
import type { VxeGridProps } from '#/adapter/vxe-table'
|
|
import { getDictOptions } from "#/utils/dict"
|
|
import { renderDict } from "#/utils/render"
|
|
import { resident_unitList } from "#/api/property/resident/unit"
|
|
import { authGroupList } from '#/api/sis/authGroup'
|
|
import type { AuthGroupVO, AuthGroupQuery } from '#/api/sis/authGroup/model'
|
|
|
|
|
|
export const querySchema: FormSchemaGetter = () => [
|
|
{
|
|
component: 'ApiSelect',
|
|
fieldName: 'unitId',
|
|
label: '所属单位',
|
|
componentProps: {
|
|
api: getUnitList,
|
|
resultField: 'data',
|
|
labelField: 'label',
|
|
valueField: 'value',
|
|
immediate: true,
|
|
debounceTime: 500,
|
|
allowClear: true,
|
|
placeholder: '请选择所属单位',
|
|
filterOption: true
|
|
},
|
|
},
|
|
{
|
|
component: 'Input',
|
|
fieldName: 'userName',
|
|
label: '员工名称',
|
|
},
|
|
{
|
|
component: 'Select',
|
|
componentProps: {
|
|
options: getDictOptions('wy_rzryzt'),
|
|
},
|
|
fieldName: 'state',
|
|
label: '状态',
|
|
},
|
|
]
|
|
|
|
export const columns: VxeGridProps['columns'] = [
|
|
{ type: 'checkbox', width: 60 },
|
|
// {
|
|
// title: '序号',
|
|
// field: 'id',
|
|
// slots: {
|
|
// default: ({ rowIndex }) => {
|
|
// return (rowIndex + 1).toString();
|
|
// },
|
|
// },
|
|
// },
|
|
{
|
|
title: '员工编号',
|
|
field: 'userId',
|
|
width: 100
|
|
},
|
|
{
|
|
title: '员工名称',
|
|
field: 'userName',
|
|
width: 100
|
|
},
|
|
{
|
|
title: '联系电话',
|
|
field: 'phone',
|
|
width: 100
|
|
},
|
|
{
|
|
title: '性别',
|
|
field: 'gender',
|
|
slots: {
|
|
default: ({ row }) => {
|
|
return renderDict(row.gender, 'sys_user_sex')
|
|
}
|
|
},
|
|
width: 100
|
|
},
|
|
{
|
|
field: 'img',
|
|
title: '人脸图片',
|
|
slots: { default: 'img' },
|
|
minWidth: 80,
|
|
},
|
|
{
|
|
title: '所属单位',
|
|
field: 'unitName',
|
|
width: 100
|
|
},
|
|
// {
|
|
// title: '入驻位置',
|
|
// field: 'locathon',
|
|
// },
|
|
{
|
|
title: '入驻时间',
|
|
field: 'time',
|
|
width: 100
|
|
},
|
|
{
|
|
title: '车牌号码',
|
|
field: 'carNumber',
|
|
width: 100
|
|
},
|
|
{
|
|
title: '状态',
|
|
field: 'state',
|
|
slots: {
|
|
default: ({ row }) => {
|
|
return renderDict(row.state, 'wy_rzryzt')
|
|
}
|
|
},
|
|
width: 100
|
|
},
|
|
{
|
|
title: '备注',
|
|
field: 'remark',
|
|
width: 100
|
|
},
|
|
{
|
|
field: 'action',
|
|
fixed: 'right',
|
|
slots: { default: 'action' },
|
|
title: '操作',
|
|
minWidth: 180,
|
|
},
|
|
]
|
|
|
|
let authGroupArr: AuthGroupVO[] = []
|
|
export const modalSchema: FormSchemaGetter = () => [
|
|
{
|
|
label: '主键id',
|
|
fieldName: 'id',
|
|
component: 'Input',
|
|
dependencies: {
|
|
show: () => false,
|
|
triggerFields: [''],
|
|
},
|
|
},
|
|
{
|
|
label: '员工名称',
|
|
fieldName: 'userName',
|
|
component: "Input",
|
|
rules: 'required',
|
|
},
|
|
{
|
|
label: '联系电话',
|
|
fieldName: 'phone',
|
|
component: "Input",
|
|
rules: 'required',
|
|
},
|
|
{
|
|
label: '性别',
|
|
fieldName: 'gender',
|
|
component: "Select",
|
|
componentProps:{
|
|
options: getDictOptions('sys_user_sex')
|
|
},
|
|
rules: 'required',
|
|
},
|
|
{
|
|
label: '身份证号',
|
|
fieldName: 'idCard',
|
|
component: "Input",
|
|
},
|
|
{
|
|
label: '邮箱',
|
|
fieldName: 'email',
|
|
component: "Input",
|
|
},
|
|
{
|
|
label: '人员状态',
|
|
fieldName: 'state',
|
|
component: 'Select',
|
|
componentProps: {
|
|
options: getDictOptions('wy_rzryzt'),
|
|
},
|
|
rules: 'selectRequired'
|
|
},
|
|
// {
|
|
// label: '入住员工',
|
|
// fieldName: 'userId',
|
|
// component: "Select",
|
|
// rules: 'selectRequired',
|
|
// formItemClass: 'col-span-2'
|
|
// },
|
|
{
|
|
label: '所属单位',
|
|
fieldName: 'unitId',
|
|
component: 'Select',
|
|
formItemClass: 'col-span-2',
|
|
rules: 'selectRequired',
|
|
},
|
|
// {
|
|
// label: '入驻位置',
|
|
// fieldName: 'locathon',
|
|
// component: 'Input',
|
|
// rules:'required',
|
|
// formItemClass: 'col-span-2',
|
|
// },
|
|
{
|
|
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: 'carNumber',
|
|
component: 'Input',
|
|
},
|
|
{
|
|
label: '授权期限',
|
|
fieldName: 'authTime',
|
|
component: 'RangePicker',
|
|
componentProps: {
|
|
showTime: true,
|
|
format: 'YYYY-MM-DD HH:mm:ss',
|
|
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
},
|
|
rules: 'required',
|
|
},
|
|
{
|
|
label: '通行权限组',
|
|
fieldName: 'authGroupId',
|
|
component: 'ApiSelect',
|
|
componentProps: {
|
|
resultField: 'list', // 根据API返回结构调整
|
|
labelField: 'name',
|
|
valueField: 'id',
|
|
// immediate: true,
|
|
api: async () => {
|
|
if (!authGroupArr || authGroupArr.length == 0) {
|
|
const params: AuthGroupQuery = {
|
|
groupType: 2,
|
|
pageNum: 1,
|
|
pageSize: 500,
|
|
}
|
|
const res = await authGroupList(params)
|
|
authGroupArr = res.rows
|
|
}
|
|
return authGroupArr
|
|
},
|
|
},
|
|
rules: 'required',
|
|
},
|
|
{
|
|
label: '人脸图片',
|
|
fieldName: 'img',
|
|
component: 'ImageUpload',
|
|
componentProps: {
|
|
// accept: 'image/*', // 可选拓展名或者mime类型 ,拼接
|
|
maxCount: 1, // 最大上传文件数 默认为1 为1会绑定为string而非string[]类型
|
|
},
|
|
formItemClass: 'col-span-2',
|
|
},
|
|
{
|
|
label: '备注',
|
|
fieldName: 'remark',
|
|
component: 'Textarea',
|
|
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',
|
|
},
|
|
]
|
|
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({
|
|
value: r.id,
|
|
label: r.name,
|
|
})
|
|
})
|
|
return data
|
|
}
|