Files
admin-vben5/apps/web-antd/src/views/videoSystem/videoWarning/videoWarningProcessing/data.ts

247 lines
4.7 KiB
TypeScript
Raw Normal View History

import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
import { h } from 'vue';
2025-08-15 14:08:35 +08:00
import { getPopupContainer } from '@vben/utils';
import { getDictOptions } from '#/utils/dict';
import { DictEnum } from '@vben/constants';
export const querySchema: FormSchemaGetter = () => [
2025-09-08 17:50:44 +08:00
{
component: 'Input',
fieldName: 'deviceName',
label: '设备名称',
},
{
component: 'DatePicker',
fieldName: 'reportTime',
label: '预警时间',
componentProps: {
format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
},
{
component: 'Input',
fieldName: 'alarmType',
2025-09-08 17:50:44 +08:00
label: '预警类型',
},
{
component: 'Select',
componentProps: {
2025-08-15 14:08:35 +08:00
getPopupContainer,
2025-08-17 07:03:48 +08:00
options: getDictOptions(DictEnum.alarm_level, true),
},
fieldName: 'level',
label: '预警级别',
},
];
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{
title: '预警编号',
2025-08-15 14:08:35 +08:00
field: 'id',
},
{
title: '预警时间',
2025-08-15 14:08:35 +08:00
field: 'reportTime',
},
2025-08-18 09:06:31 +08:00
{
title: '设备IP',
2025-08-18 09:06:31 +08:00
field: 'deviceIp',
},
2025-08-12 13:51:35 +08:00
{
title: '设备名称',
field: 'deviceName',
},
{
title: '预警级别',
field: 'level',
slots: {
default: ({ row }: any) => {
const levelColors: Record<string, string> = {
2025-08-28 21:07:45 +08:00
1: 'blue',
2025-08-15 14:08:35 +08:00
2: 'orange',
2025-08-28 21:07:45 +08:00
3: 'red',
};
return h(
'span',
{
style: {
color: levelColors[row.level] || '#666',
fontWeight: 'bold',
},
},
2025-08-15 14:08:35 +08:00
row.levelName,
);
},
},
},
{
title: '预警类型',
2025-08-15 14:08:35 +08:00
field: 'alarmTypeName',
slots: {
default: ({ row }: any) => {
2025-08-15 14:08:35 +08:00
return h('span', row.bigTypeName + '-' + row.smallTypeName);
},
},
},
{
2025-08-15 14:08:35 +08:00
title: '处理状态',
field: 'stateName',
},
2025-08-12 13:51:35 +08:00
{
2025-08-18 09:06:31 +08:00
title: '创建时间',
field: 'createTime',
2025-08-12 13:51:35 +08:00
},
{
field: 'action',
fixed: 'right',
slots: { default: 'action' },
title: '操作',
width: 380,
},
];
export const modalSchema: FormSchemaGetter = () => [
{
label: '主键',
fieldName: 'id',
component: 'Input',
dependencies: {
show: () => false,
triggerFields: [''],
},
},
{
label: '预警编号',
2025-08-17 07:03:48 +08:00
fieldName: 'id',
component: 'Input',
rules: 'required',
2025-08-12 13:51:35 +08:00
disabled: true,
},
{
label: '预警时间',
2025-08-17 07:03:48 +08:00
fieldName: 'reportTime',
component: 'DatePicker',
componentProps: {
format: 'YYYY.MM.DD HH:mm',
valueFormat: 'YYYY.MM.DD HH:mm',
showTime: true,
},
2025-08-12 13:51:35 +08:00
disabled: true,
2025-08-18 09:06:31 +08:00
rules: 'required',
},
{
label: '预警类型',
2025-08-18 09:06:31 +08:00
fieldName: 'alarmType',
component: 'Input',
rules: 'required',
2025-08-12 13:51:35 +08:00
disabled: true,
},
{
label: '设备IP',
2025-08-18 09:06:31 +08:00
fieldName: 'deviceIp',
2025-08-12 13:51:35 +08:00
component: 'Input',
disabled: true,
rules: 'required',
2025-08-18 09:06:31 +08:00
},
2025-08-12 13:51:35 +08:00
{
label: '设备名称',
fieldName: 'deviceName',
2025-08-18 09:06:31 +08:00
disabled: true,
2025-08-12 13:51:35 +08:00
component: 'Input',
rules: 'required',
},
{
label: '预警级别',
2025-08-18 09:06:31 +08:00
fieldName: 'level',
component: 'Select',
disabled: true,
componentProps: {
2025-08-18 09:06:31 +08:00
getPopupContainer,
options: getDictOptions(DictEnum.alarm_level, true),
},
2025-08-18 09:06:31 +08:00
rules: 'selectRequired',
},
{
2025-08-18 09:06:31 +08:00
label: '创建时间',
fieldName: 'createTime',
2025-08-12 13:51:35 +08:00
component: 'DatePicker',
2025-08-18 09:06:31 +08:00
disabled: true,
2025-08-12 13:51:35 +08:00
componentProps: {
format: 'YYYY.MM.DD HH:mm',
valueFormat: 'YYYY.MM.DD HH:mm',
showTime: true,
},
},
{
2025-08-18 09:06:31 +08:00
label: '处理状态',
2025-08-12 13:51:35 +08:00
component: 'Select',
2025-08-18 09:06:31 +08:00
disabled: true,
2025-08-12 13:51:35 +08:00
componentProps: {
2025-08-17 07:03:48 +08:00
getPopupContainer,
2025-08-18 09:06:31 +08:00
options: getDictOptions(DictEnum.alarm_state, true),
2025-08-12 13:51:35 +08:00
},
2025-08-18 09:06:31 +08:00
fieldName: 'state',
2025-08-12 13:51:35 +08:00
rules: 'selectRequired',
},
{
label: '预警描述',
2025-08-18 09:06:31 +08:00
disabled: true,
fieldName: 'description',
component: 'Textarea',
formItemClass: 'col-span-2',
componentProps: {
2025-08-18 09:06:31 +08:00
rows: 3,
},
},
// 插入分割线
{
component: 'Divider',
fieldName: '_divider',
formItemClass: 'col-span-2',
hideLabel: true,
renderComponentContent: () => {
return {
default: () => h('div', '处理'),
};
},
},
2025-08-17 07:03:48 +08:00
{
2025-08-18 09:06:31 +08:00
label: '处理人',
fieldName: 'solveId',
component: 'Select',
},
{
label: '联系电话',
fieldName: 'phonenumber',
component: 'Input',
},
{
label: '邮箱',
fieldName: 'email',
component: 'Input',
},
{
label: '所在部门',
fieldName: 'deptName',
component: 'Input',
disabled: true,
},
{
label: '备注',
fieldName: 'remark',
component: 'Textarea',
formItemClass: 'col-span-2',
componentProps: {
2025-08-18 09:06:31 +08:00
rows: 3,
},
},
];