This commit is contained in:
170
apps/web-antd/src/views/sis/deviceManage/data.ts
Normal file
170
apps/web-antd/src/views/sis/deviceManage/data.ts
Normal file
@@ -0,0 +1,170 @@
|
||||
import type { FormSchemaGetter } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import { getPopupContainer } from '@vben/utils';
|
||||
import { getDictOptions } from '#/utils/dict';
|
||||
import { DictEnum } from '@vben/constants';
|
||||
import { accessControlList } from '#/api/sis/accessControl';
|
||||
import type { AccessControlQuery } from '#/api/sis/accessControl/model';
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'deviceName',
|
||||
label: '设备名称',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'deviceIp',
|
||||
label: '设备ip',
|
||||
},
|
||||
{
|
||||
fieldName: 'deviceStatus',
|
||||
label: '在线状态',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
getPopupContainer,
|
||||
options: getDictOptions(DictEnum.sis_device_status),
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||
// export const columns: () => VxeGridProps['columns'] = () => [
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{
|
||||
title: '设备名称',
|
||||
field: 'deviceName',
|
||||
},
|
||||
{
|
||||
title: '设备ip',
|
||||
field: 'deviceIp',
|
||||
},
|
||||
{
|
||||
title: '设备端口',
|
||||
field: 'devicePort',
|
||||
},
|
||||
{
|
||||
title: '设备',
|
||||
field: 'deviceMac',
|
||||
},
|
||||
{
|
||||
title: '在线状态',
|
||||
field: 'deviceStatus',
|
||||
},
|
||||
|
||||
{
|
||||
title: '通道编号',
|
||||
field: 'channelNo',
|
||||
},
|
||||
{
|
||||
title: '录像机ip',
|
||||
field: 'vcrIp',
|
||||
},
|
||||
{
|
||||
title: '录像机端口',
|
||||
field: 'vcrPort',
|
||||
},
|
||||
{
|
||||
title: '门禁id',
|
||||
field: 'accessControlId',
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
fixed: 'right',
|
||||
slots: { default: 'action' },
|
||||
title: '操作',
|
||||
width: 180,
|
||||
},
|
||||
];
|
||||
|
||||
export const modalSchema: FormSchemaGetter = () => [
|
||||
{
|
||||
label: '主键id',
|
||||
fieldName: 'id',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: () => false,
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '设备名称',
|
||||
fieldName: 'deviceName',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '设备ip',
|
||||
fieldName: 'deviceIp',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '设备端口',
|
||||
fieldName: 'devicePort',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '设备账号',
|
||||
fieldName: 'deviceAccount',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '设备密码',
|
||||
fieldName: 'devicePwd',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '设备Mac',
|
||||
fieldName: 'deviceMac',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '通道编号',
|
||||
fieldName: 'channelNo',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '录像机ip',
|
||||
fieldName: 'vcrIp',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '录像机端口',
|
||||
fieldName: 'vcrPort',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '录像机账号',
|
||||
fieldName: 'vcrAccount',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '录像机密码',
|
||||
fieldName: 'vcrPwd',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '绑定门禁',
|
||||
fieldName: 'accessControlId',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
// mode: 'multiple', // 关键属性,启用多选模式
|
||||
resultField: 'list', // 根据API返回结构调整
|
||||
labelField: 'accessName',
|
||||
valueField: 'accessCode',
|
||||
api: async () => {
|
||||
const params: AccessControlQuery = {
|
||||
pageNum: 1,
|
||||
pageSize: 500,
|
||||
};
|
||||
const res = await accessControlList(params);
|
||||
return res.rows;
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
Reference in New Issue
Block a user