Commit bb16c7433e96b5c539f218fb6156e0ba5d2b54f6

Authored by sqy
1 parent ee270b63

'暂时存储'

... ... @@ -2,7 +2,6 @@ import { formatToDateTime } from '/@/utils/dateUtil';
2 2 import { FormSchema } from '/@/components/Form';
3 3 import { BasicColumn } from '/@/components/Table';
4 4 import { DeviceTypeEnum } from '/@/api/device/model/deviceModel';
5   -import {} from '';
6 5
7 6 export const columns: BasicColumn[] = [
8 7 {
... ... @@ -110,9 +109,7 @@ export const alarmSearchSchemas: FormSchema[] = [
110 109 field: 'startTime',
111 110 label: ' ',
112 111 component: 'DatePicker',
113   - componentProps: {
114   - format: (value) => dayjs(value).valueOf(),
115   - },
  112 + componentProps: {},
116 113 colProps: { span: 6 },
117 114 },
118 115 ];
... ... @@ -145,30 +142,6 @@ export const alarmColumns: BasicColumn[] = [
145 142 width: 160,
146 143 },
147 144 ];
148   -const alarmLevel = (type: string): string => {
149   - if (type === 'CRITICAL') {
150   - return '危险';
151   - } else if (type === 'MAJOR') {
152   - return '重要';
153   - } else if (type === 'MINOR') {
154   - return '次要';
155   - } else if (type === 'WARNING') {
156   - return '警告';
157   - } else {
158   - return '不确定';
159   - }
160   -};
161   -const statusType = (type: string): string => {
162   - if (type === 'CLEARED_UNACK') {
163   - return '清除未确认';
164   - } else if (type === 'CLEARED_ACK') {
165   - return '清除已确认';
166   - } else if (type === 'ACTIVE_ACK') {
167   - return '激活已确认';
168   - } else {
169   - return '激活未确认';
170   - }
171   -};
172 145
173 146 export const alarmSchemasForm: FormSchema[] = [
174 147 {
... ... @@ -277,3 +250,28 @@ export const childDeviceColumns: BasicColumn[] = [
277 250 width: 160,
278 251 },
279 252 ];
  253 +
  254 +export const alarmLevel = (type: string): string => {
  255 + if (type === 'CRITICAL') {
  256 + return '危险';
  257 + } else if (type === 'MAJOR') {
  258 + return '重要';
  259 + } else if (type === 'MINOR') {
  260 + return '次要';
  261 + } else if (type === 'WARNING') {
  262 + return '警告';
  263 + } else {
  264 + return '不确定';
  265 + }
  266 +};
  267 +export const statusType = (type: string): string => {
  268 + if (type === 'CLEARED_UNACK') {
  269 + return '清除未确认';
  270 + } else if (type === 'CLEARED_ACK') {
  271 + return '清除已确认';
  272 + } else if (type === 'ACTIVE_ACK') {
  273 + return '激活已确认';
  274 + } else {
  275 + return '激活未确认';
  276 + }
  277 +};
... ...
... ... @@ -9,7 +9,7 @@
9 9 <BasicForm @register="registerForm" />
10 10 <div class="flex justify-end">
11 11 <a-button type="primary" class="mr-4" @click="handleAlarm">处理</a-button>
12   - <a-button type="danger" @click="clearAlarm">清除</a-button>
  12 + <a-button danger type="primary" @click="clearAlarm">清除</a-button>
13 13 </div>
14 14 </BasicModal>
15 15 </template>
... ... @@ -20,6 +20,7 @@
20 20 import { BasicForm, useForm } from '/@/components/Form';
21 21 import { alarmSchemasForm } from '../../config/detail.config';
22 22 import { clearOrAckAlarm } from '/@/api/device/deviceManager';
  23 + import { alarmLevel, statusType } from '../../config/detail.config';
23 24 export default defineComponent({
24 25 name: 'AlarmDetailDrawer',
25 26 components: {
... ... @@ -34,7 +35,11 @@
34 35 const alarmId = ref('');
35 36 const [registerModal, { closeModal }] = useModalInner(async (data) => {
36 37 await resetFields();
37   - await setFieldsValue(data);
  38 + await setFieldsValue({
  39 + ...data,
  40 + severity: alarmLevel(data.severity),
  41 + status: statusType(data.status),
  42 + });
38 43 alarmId.value = data.id;
39 44 console.log(data);
40 45 });
... ...