|
|
@@ -10,9 +10,13 @@
|
|
|
<script>
|
|
|
import { getDeviceAlarms } from '@/api/device'
|
|
|
import { createListOptions } from '@/utils'
|
|
|
-import { AssetType } from '@/constant'
|
|
|
+import {
|
|
|
+ AssetType,
|
|
|
+ AlarmStrategy,
|
|
|
+ AlarmStrategies
|
|
|
+} from '@/constant'
|
|
|
|
|
|
-const Alarms = {
|
|
|
+const Alarm = {
|
|
|
0: '疑似黑屏',
|
|
|
1: '设备离线',
|
|
|
2: '屏幕拓扑结构异常',
|
|
|
@@ -26,13 +30,6 @@ const Alarms = {
|
|
|
1000: '分割器异常'
|
|
|
}
|
|
|
|
|
|
-function getAlarmType (type) {
|
|
|
- if (type >= 1101 && type <= 1116) {
|
|
|
- return '分割器异常'
|
|
|
- }
|
|
|
- return Alarms[type] || '-'
|
|
|
-}
|
|
|
-
|
|
|
export default {
|
|
|
name: 'DeviceAlarm',
|
|
|
props: {
|
|
|
@@ -52,26 +49,31 @@ export default {
|
|
|
cols: [
|
|
|
{ type: 'refresh' },
|
|
|
{ prop: 'asset', label: '截图', type: 'asset', on: this.onView },
|
|
|
- { prop: 'type', label: '告警类型' },
|
|
|
+ { prop: 'type', label: '类型' },
|
|
|
{ prop: 'handle', label: '处理方式' },
|
|
|
{ prop: 'status', label: '处理结果', type: 'tag' },
|
|
|
- { prop: 'note', label: '短信通知', type: 'tag' },
|
|
|
- { prop: 'email', label: '邮件通知', type: 'tag' },
|
|
|
- { prop: 'happenTime', label: '告警时间' }
|
|
|
+ ...AlarmStrategies.map(key => {
|
|
|
+ return {
|
|
|
+ prop: key,
|
|
|
+ label: `${AlarmStrategy[key]}通知`,
|
|
|
+ type: 'tag'
|
|
|
+ }
|
|
|
+ }),
|
|
|
+ { prop: 'happenTime', label: '时间', 'min-width': 120 }
|
|
|
]
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- transform ({ pic, picUrl, type, handle, status, note, email, happenTime }) {
|
|
|
- return {
|
|
|
+ transform ({ pic, picUrl, type, handle, status, happenTime, ...data }) {
|
|
|
+ const alarm = {
|
|
|
asset: pic && picUrl
|
|
|
? {
|
|
|
type: AssetType.IMAGE,
|
|
|
url: picUrl
|
|
|
}
|
|
|
: null,
|
|
|
- type: getAlarmType(type),
|
|
|
+ type: this.getType(type),
|
|
|
handle: ['应用重启', '设备重启', '恢复出厂', '未干预'][handle] || '-',
|
|
|
status: handle <= 2 && status <= 2
|
|
|
? {
|
|
|
@@ -79,16 +81,34 @@ export default {
|
|
|
label: ['处理中', '成功', '失败'][status]
|
|
|
}
|
|
|
: null,
|
|
|
- note: {
|
|
|
- type: ['danger', 'success'][note],
|
|
|
- label: ['否', '是'][note]
|
|
|
- },
|
|
|
- email: {
|
|
|
- type: ['danger', 'success'][email],
|
|
|
- label: ['否', '是'][email]
|
|
|
- },
|
|
|
happenTime
|
|
|
}
|
|
|
+ AlarmStrategies.forEach(key => {
|
|
|
+ alarm[key] = this.getTag(data[key])
|
|
|
+ })
|
|
|
+ return alarm
|
|
|
+ },
|
|
|
+ getType (type) {
|
|
|
+ if (type >= 1101 && type <= 1116) {
|
|
|
+ return '分割器异常'
|
|
|
+ }
|
|
|
+ return Alarm[type] || '-'
|
|
|
+ },
|
|
|
+ getTag (value) {
|
|
|
+ switch (value) {
|
|
|
+ case 0:
|
|
|
+ return {
|
|
|
+ type: 'danger',
|
|
|
+ label: '否'
|
|
|
+ }
|
|
|
+ case 1:
|
|
|
+ return {
|
|
|
+ type: 'success',
|
|
|
+ label: '是'
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ return null
|
|
|
+ }
|
|
|
},
|
|
|
onView (asset) {
|
|
|
this.$refs.previewDialog.show(asset)
|