93 lines
2.0 KiB
TypeScript
93 lines
2.0 KiB
TypeScript
import type { FormSchemaGetter } from '#/adapter/form';
|
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
|
import { deviceManageList } from '#/api/sis/deviceManage';
|
|
export const querySchema: FormSchemaGetter = () => [
|
|
{
|
|
component: 'Input',
|
|
fieldName: 'area',
|
|
label: '区域',
|
|
},
|
|
];
|
|
|
|
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
|
// export const columns: () => VxeGridProps['columns'] = () => [
|
|
export const columns: VxeGridProps['columns'] = [
|
|
{ type: 'checkbox', width: 60 },
|
|
{
|
|
title: '区域',
|
|
field: 'area',
|
|
width: 'auto',
|
|
},
|
|
{
|
|
title: '摄像机',
|
|
field: 'areaDevice',
|
|
minWidth: 300,
|
|
slots: {
|
|
default: ({ row }: { row: any }) => {
|
|
if (!row.areaDevice || !Array.isArray(row.areaDevice)) {
|
|
return '';
|
|
}
|
|
return row.areaDevice
|
|
.map((device: any) => device.remoteSisDeviceManage?.deviceName || '')
|
|
.filter((deviceName: string) => deviceName)
|
|
.join(', ');
|
|
},
|
|
},
|
|
},
|
|
|
|
{
|
|
title: '备注',
|
|
field: 'reamark',
|
|
},
|
|
{
|
|
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: 'area',
|
|
component: 'Input',
|
|
rules: 'required',
|
|
},
|
|
{
|
|
label: '摄像机',
|
|
fieldName: 'deviceManageId',
|
|
component: 'ApiSelect',
|
|
rules: 'required',
|
|
componentProps: {
|
|
api: async () => {
|
|
const res = await deviceManageList({
|
|
pageNum: 1,
|
|
pageSize: 10000,
|
|
deviceType: 1,
|
|
});
|
|
return res;
|
|
},
|
|
resultField: 'rows',
|
|
labelField: 'deviceName',
|
|
valueField: 'id',
|
|
mode: 'multiple',
|
|
},
|
|
},
|
|
{
|
|
label: '备注',
|
|
fieldName: 'reamark',
|
|
component: 'Input',
|
|
},
|
|
];
|