...
|
...
|
@@ -19,7 +19,30 @@ |
19
|
19
|
</a-button>
|
20
|
20
|
</template>
|
21
|
21
|
<template #toolbar>
|
22
|
|
- <Button @click="handleBatchAck" type="primary" :disabled="getCanBatchAck">批量处理</Button>
|
|
22
|
+ <Tooltip>
|
|
23
|
+ <template #title>
|
|
24
|
+ <div>激活未确认可以处理,清除</div>
|
|
25
|
+ <div>激活已确认只可清除,已经处理</div>
|
|
26
|
+ <div>清除未确认只可处理,已经清除</div>
|
|
27
|
+ <div>清除已确认不需要做处理</div>
|
|
28
|
+ </template>
|
|
29
|
+ <Button @click="handleBatchClear" type="primary" :disabled="getCanBatchClear">
|
|
30
|
+ <QuestionCircleOutlined class="cursor-pointer" />
|
|
31
|
+ <span>批量清除</span>
|
|
32
|
+ </Button>
|
|
33
|
+ </Tooltip>
|
|
34
|
+ <Tooltip>
|
|
35
|
+ <template #title>
|
|
36
|
+ <div>激活未确认可以处理,清除</div>
|
|
37
|
+ <div>激活已确认只可清除,已经处理</div>
|
|
38
|
+ <div>清除未确认只可处理,已经清除</div>
|
|
39
|
+ <div>清除已确认不需要做处理</div>
|
|
40
|
+ </template>
|
|
41
|
+ <Button @click="handleBatchAck" type="primary" :disabled="getCanBatchAck">
|
|
42
|
+ <QuestionCircleOutlined class="cursor-pointer" />
|
|
43
|
+ <span>批量处理</span>
|
|
44
|
+ </Button>
|
|
45
|
+ </Tooltip>
|
23
|
46
|
</template>
|
24
|
47
|
</BasicTable>
|
25
|
48
|
<AlarmDetailDrawer @register="registerDetailDrawer" @success="handleSuccess" />
|
...
|
...
|
@@ -29,10 +52,10 @@ |
29
|
52
|
import { defineComponent, nextTick, h, computed } from 'vue';
|
30
|
53
|
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
31
|
54
|
import { alarmColumns, alarmSearchSchemas } from './config/detail.config';
|
32
|
|
- import { doBatchAckAlarm, getDeviceAlarm } from '/@/api/device/deviceManager';
|
|
55
|
+ import { doBatchAckAlarm, doBatchClearAlarm, getDeviceAlarm } from '/@/api/device/deviceManager';
|
33
|
56
|
import { useDrawer } from '/@/components/Drawer';
|
34
|
57
|
import AlarmDetailDrawer from './cpns/AlarmDetailDrawer.vue';
|
35
|
|
- import { Modal, Button } from 'ant-design-vue';
|
|
58
|
+ import { Modal, Button, Tooltip } from 'ant-design-vue';
|
36
|
59
|
import { JsonPreview } from '/@/components/CodeEditor';
|
37
|
60
|
import { getDeviceDetail } from '/@/api/device/deviceManager';
|
38
|
61
|
import { getAttribute } from '/@/api/ruleengine/ruleengineApi';
|
...
|
...
|
@@ -44,6 +67,7 @@ |
44
|
67
|
import { AlarmLogItem } from '/@/api/device/model/deviceConfigModel';
|
45
|
68
|
import { AlarmStatus } from '/@/enums/alarmEnum';
|
46
|
69
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
70
|
+ import { QuestionCircleOutlined } from '@ant-design/icons-vue';
|
47
|
71
|
|
48
|
72
|
export default defineComponent({
|
49
|
73
|
name: 'AlarmCenter',
|
...
|
...
|
@@ -52,6 +76,8 @@ |
52
|
76
|
BasicTable,
|
53
|
77
|
TableAction,
|
54
|
78
|
AlarmDetailDrawer,
|
|
79
|
+ QuestionCircleOutlined,
|
|
80
|
+ Tooltip,
|
55
|
81
|
},
|
56
|
82
|
|
57
|
83
|
setup() {
|
...
|
...
|
@@ -60,6 +86,7 @@ |
60
|
86
|
title: '告警记录列表',
|
61
|
87
|
api: getDeviceAlarm,
|
62
|
88
|
columns: alarmColumns,
|
|
89
|
+ rowKey: 'id',
|
63
|
90
|
useSearchForm: true,
|
64
|
91
|
formConfig: {
|
65
|
92
|
labelWidth: 120,
|
...
|
...
|
@@ -168,9 +195,30 @@ |
168
|
195
|
};
|
169
|
196
|
};
|
170
|
197
|
|
|
198
|
+ const getCanBatchClear = computed(() => {
|
|
199
|
+ const rowSelection = getRowSelection();
|
|
200
|
+ const getRows: AlarmLogItem[] = getSelectRows();
|
|
201
|
+
|
|
202
|
+ return (
|
|
203
|
+ !rowSelection.selectedRowKeys?.length ||
|
|
204
|
+ getRows.some(
|
|
205
|
+ (item) =>
|
|
206
|
+ item.status === AlarmStatus.CLEARED_ACK || item.status === AlarmStatus.CLEARED_UN_ACK
|
|
207
|
+ )
|
|
208
|
+ );
|
|
209
|
+ });
|
|
210
|
+
|
171
|
211
|
const getCanBatchAck = computed(() => {
|
172
|
212
|
const rowSelection = getRowSelection();
|
173
|
|
- return !rowSelection.selectedRowKeys?.length;
|
|
213
|
+ const getRows: AlarmLogItem[] = getSelectRows();
|
|
214
|
+
|
|
215
|
+ return (
|
|
216
|
+ !rowSelection.selectedRowKeys?.length ||
|
|
217
|
+ getRows.some(
|
|
218
|
+ (item) =>
|
|
219
|
+ item.status === AlarmStatus.CLEARED_ACK || item.status === AlarmStatus.ACTIVE_ACK
|
|
220
|
+ )
|
|
221
|
+ );
|
174
|
222
|
});
|
175
|
223
|
|
176
|
224
|
const { createMessage } = useMessage();
|
...
|
...
|
@@ -183,6 +231,15 @@ |
183
|
231
|
reload();
|
184
|
232
|
};
|
185
|
233
|
|
|
234
|
+ const handleBatchClear = async () => {
|
|
235
|
+ const ids = getSelectRows<AlarmLogItem>().map((item) => item.id);
|
|
236
|
+ if (!ids.length) return;
|
|
237
|
+ await doBatchClearAlarm(ids);
|
|
238
|
+ createMessage.success('操作成功');
|
|
239
|
+ clearSelectedRowKeys();
|
|
240
|
+ reload();
|
|
241
|
+ };
|
|
242
|
+
|
186
|
243
|
return {
|
187
|
244
|
registerTable,
|
188
|
245
|
registerDetailDrawer,
|
...
|
...
|
@@ -190,7 +247,9 @@ |
190
|
247
|
handleSuccess,
|
191
|
248
|
handleViewAlarmDetails,
|
192
|
249
|
handleBatchAck,
|
|
250
|
+ handleBatchClear,
|
193
|
251
|
getCanBatchAck,
|
|
252
|
+ getCanBatchClear,
|
194
|
253
|
};
|
195
|
254
|
},
|
196
|
255
|
});
|
...
|
...
|
|