Commit 5e7bad2313473ab1ad7234735b695ffe3d0fc609
Merge branch 'ft_modify_alarm_log' into 'main_dev'
feat: 告警记录新增告警设备和告警级别筛选 See merge request yunteng/thingskit-front!603
Showing
2 changed files
with
55 additions
and
0 deletions
@@ -2,6 +2,7 @@ import { alarmLevel, statusType } from '/@/views/device/list/config/detail.confi | @@ -2,6 +2,7 @@ import { alarmLevel, statusType } from '/@/views/device/list/config/detail.confi | ||
2 | import { FormSchema } from '/@/components/Form'; | 2 | import { FormSchema } from '/@/components/Form'; |
3 | import { BasicColumn } from '/@/components/Table'; | 3 | import { BasicColumn } from '/@/components/Table'; |
4 | import moment from 'moment'; | 4 | import moment from 'moment'; |
5 | +import { findDictItemByCode } from '/@/api/system/dict'; | ||
5 | 6 | ||
6 | export enum AlarmStatus { | 7 | export enum AlarmStatus { |
7 | CLEARED_UN_ACK = 'CLEARED_UNACK', | 8 | CLEARED_UN_ACK = 'CLEARED_UNACK', |
@@ -68,6 +69,44 @@ export const alarmSearchSchemas: FormSchema[] = [ | @@ -68,6 +69,44 @@ export const alarmSearchSchemas: FormSchema[] = [ | ||
68 | }, | 69 | }, |
69 | }, | 70 | }, |
70 | { | 71 | { |
72 | + field: 'deviceName', | ||
73 | + label: '告警设备', | ||
74 | + component: 'Input', | ||
75 | + colProps: { span: 6 }, | ||
76 | + componentProps: { | ||
77 | + maxLength: 255, | ||
78 | + placeholder: '请输入告警设备', | ||
79 | + }, | ||
80 | + dynamicRules: () => { | ||
81 | + return [ | ||
82 | + { | ||
83 | + required: false, | ||
84 | + validator: (_, value) => { | ||
85 | + if (String(value).length > 255) { | ||
86 | + return Promise.reject('字数不超过255个字'); | ||
87 | + } | ||
88 | + return Promise.resolve(); | ||
89 | + }, | ||
90 | + }, | ||
91 | + ]; | ||
92 | + }, | ||
93 | + }, | ||
94 | + { | ||
95 | + field: 'severity', | ||
96 | + label: '告警级别', | ||
97 | + component: 'ApiSelect', | ||
98 | + colProps: { span: 6 }, | ||
99 | + componentProps: { | ||
100 | + placeholder: '请选择告警级别', | ||
101 | + api: findDictItemByCode, | ||
102 | + params: { | ||
103 | + dictCode: 'severity_type', | ||
104 | + }, | ||
105 | + labelField: 'itemText', | ||
106 | + valueField: 'itemValue', | ||
107 | + }, | ||
108 | + }, | ||
109 | + { | ||
71 | field: 'alarmTime', | 110 | field: 'alarmTime', |
72 | label: '告警时间', | 111 | label: '告警时间', |
73 | component: 'RangePicker', | 112 | component: 'RangePicker', |
@@ -11,6 +11,7 @@ import { TypeEnum } from './data'; | @@ -11,6 +11,7 @@ import { TypeEnum } from './data'; | ||
11 | import { PageEnum } from '/@/enums/pageEnum'; | 11 | import { PageEnum } from '/@/enums/pageEnum'; |
12 | import { useGo } from '/@/hooks/web/usePage'; | 12 | import { useGo } from '/@/hooks/web/usePage'; |
13 | import { useAuthDeviceDetail } from '../hook/useAuthDeviceDetail'; | 13 | import { useAuthDeviceDetail } from '../hook/useAuthDeviceDetail'; |
14 | +import { findDictItemByCode } from '/@/api/system/dict'; | ||
14 | 15 | ||
15 | // 设备详情的描述 | 16 | // 设备详情的描述 |
16 | export const descSchema = (emit: EmitType): DescItem[] => { | 17 | export const descSchema = (emit: EmitType): DescItem[] => { |
@@ -144,7 +145,22 @@ export const alarmSearchSchemas: FormSchema[] = [ | @@ -144,7 +145,22 @@ export const alarmSearchSchemas: FormSchema[] = [ | ||
144 | componentProps: { | 145 | componentProps: { |
145 | showTime: { defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')] }, | 146 | showTime: { defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')] }, |
146 | }, | 147 | }, |
148 | + colProps: { span: 7 }, | ||
149 | + }, | ||
150 | + { | ||
151 | + field: 'severity', | ||
152 | + label: '告警级别', | ||
153 | + component: 'ApiSelect', | ||
147 | colProps: { span: 6 }, | 154 | colProps: { span: 6 }, |
155 | + componentProps: { | ||
156 | + placeholder: '请选择告警级别', | ||
157 | + api: findDictItemByCode, | ||
158 | + params: { | ||
159 | + dictCode: 'severity_type', | ||
160 | + }, | ||
161 | + labelField: 'itemText', | ||
162 | + valueField: 'itemValue', | ||
163 | + }, | ||
148 | }, | 164 | }, |
149 | ]; | 165 | ]; |
150 | export const alarmColumns: BasicColumn[] = [ | 166 | export const alarmColumns: BasicColumn[] = [ |