import type { FormSchemaGetter } from '#/adapter/form'; import type { VxeGridProps } from '#/adapter/vxe-table'; import { h } from 'vue'; import { getPopupContainer } from '@vben/utils'; import { getDictOptions } from '#/utils/dict'; import { DictEnum } from '@vben/constants'; export const fallImg = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMIAAADDCAYAAADQvc6UAAABRWlDQ1BJQ0MgUHJvZmlsZQAAKJFjYGASSSwoyGFhYGDIzSspCnJ3UoiIjFJgf8LAwSDCIMogwMCcmFxc4BgQ4ANUwgCjUcG3awyMIPqyLsis7PPOq3QdDFcvjV3jOD1boQVTPQrgSkktTgbSf4A4LbmgqISBgTEFyFYuLykAsTuAbJEioKOA7DkgdjqEvQHEToKwj4DVhAQ5A9k3gGyB5IxEoBmML4BsnSQk8XQkNtReEOBxcfXxUQg1Mjc0dyHgXNJBSWpFCYh2zi+oLMpMzyhRcASGUqqCZ16yno6CkYGRAQMDKMwhqj/fAIcloxgHQqxAjIHBEugw5sUIsSQpBobtQPdLciLEVJYzMPBHMDBsayhILEqEO4DxG0txmrERhM29nYGBddr//5/DGRjYNRkY/l7////39v///y4Dmn+LgeHANwDrkl1AuO+pmgAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAwqADAAQAAAABAAAAwwAAAAD9b/HnAAAHlklEQVR4Ae3dP3PTWBSGcbGzM6GCKqlIBRV0dHRJFarQ0eUT8LH4BnRU0NHR0UEFVdIlFRV7TzRksomPY8uykTk/zewQfKw/9znv4yvJynLv4uLiV2dBoDiBf4qP3/ARuCRABEFAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKA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JyNSiEC/wGgKKC4YMA4TAAAAABJRU5ErkJggg=='; export const querySchema: FormSchemaGetter = () => [ { component: 'Input', fieldName: 'alarmType', label: '视频预警类型', }, { component: 'Select', componentProps: { getPopupContainer, options: getDictOptions(DictEnum.alarm_level, true), }, fieldName: 'level', label: '级别', }, /*{ component: 'Select', componentProps: { getPopupContainer, options: getDictOptions(DictEnum.alarm_state, true), }, fieldName: 'state', label: '处理状态', },*/ ]; export const columns: VxeGridProps['columns'] = [ { type: 'checkbox', width: 60 }, { title: '预警编号', field: 'id', }, { title: '预警时间', field: 'reportTime', }, { title: '设备ip', field: 'deviceIp', }, { title: '设备名称', field: 'deviceName', }, { title: '级别', field: 'level', slots: { default: ({ row }: any) => { const levelColors: Record = { 1: 'red', 2: 'orange', 3: 'blue', }; return h( 'span', { style: { color: levelColors[row.level] || '#666', fontWeight: 'bold', }, }, row.levelName, ); }, }, }, { title: '预警类型', field: 'alarmTypeName', slots: { default: ({ row }: any) => { return h('span', row.bigTypeName + '-' + row.smallTypeName); }, }, }, { title: '处理状态', field: 'stateName', }, { title: '创建时间', field: 'createTime', }, { field: 'action', fixed: 'right', slots: { default: 'action' }, title: '操作', width: 380, }, ]; export const modalSchema: FormSchemaGetter = () => [ { label: '主键', fieldName: 'id', component: 'Input', dependencies: { show: () => false, triggerFields: [''], }, }, { label: '预警编号', fieldName: 'id', component: 'Input', rules: 'required', disabled: true, }, { label: '预警时间', fieldName: 'reportTime', component: 'DatePicker', componentProps: { format: 'YYYY.MM.DD HH:mm', valueFormat: 'YYYY.MM.DD HH:mm', showTime: true, }, disabled: true, rules: 'required', }, { label: '预警类型', fieldName: 'alarmType', component: 'Input', rules: 'required', disabled: true, }, { label: '设备名称', fieldName: 'deviceIp', component: 'Input', disabled: true, rules: 'required', }, { label: '设备名称', fieldName: 'deviceName', disabled: true, component: 'Input', rules: 'required', }, { label: '重要级别', fieldName: 'level', component: 'Select', disabled: true, componentProps: { getPopupContainer, options: getDictOptions(DictEnum.alarm_level, true), }, rules: 'selectRequired', }, { label: '创建时间', fieldName: 'createTime', component: 'DatePicker', disabled: true, componentProps: { format: 'YYYY.MM.DD HH:mm', valueFormat: 'YYYY.MM.DD HH:mm', showTime: true, }, }, { label: '处理状态', component: 'Select', disabled: true, componentProps: { getPopupContainer, options: getDictOptions(DictEnum.alarm_state, true), }, fieldName: 'state', rules: 'selectRequired', }, { label: '描述', disabled: true, fieldName: 'description', component: 'Textarea', formItemClass: 'col-span-2', componentProps: { rows: 3, }, }, // 插入分割线 { component: 'Divider', fieldName: '_divider', formItemClass: 'col-span-2', hideLabel: true, renderComponentContent: () => { return { default: () => h('div', '处理'), }; }, }, { 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: { rows: 3, }, }, ];