Ver código fonte

feat: device alarm type

Casper Dai 3 anos atrás
pai
commit
e9073d6c72
1 arquivos alterados com 34 adições e 9 exclusões
  1. 34 9
      src/views/device/detail/components/DeviceAlarm.vue

+ 34 - 9
src/views/device/detail/components/DeviceAlarm.vue

@@ -12,6 +12,27 @@ import { getDeviceAlarms } from '@/api/device'
 import { createListOptions } from '@/utils'
 import { AssetType } from '@/constant'
 
+const Alarms = {
+  0: '疑似黑屏',
+  1: '设备离线',
+  2: '屏幕拓扑结构异常',
+  3: '播放非法视频',
+  4: '接收卡离线',
+  5: '发送控制设备离线',
+  6: '浪潮智能网关离线',
+  7: '屏幕监控摄像头离线',
+  8: '人流监测摄像头离线',
+  9: '设备上线',
+  1000: '分割器异常'
+}
+
+function getAlarmType (type) {
+  if (type >= 1101 && type <= 1116) {
+    return '分割器异常'
+  }
+  return Alarms[type] || '-'
+}
+
 export default {
   name: 'DeviceAlarm',
   props: {
@@ -44,16 +65,20 @@ export default {
   methods: {
     transform ({ pic, picUrl, type, handle, status, note, email, happenTime }) {
       return {
-        asset: pic && picUrl ? {
-          type: AssetType.IMAGE,
-          url: picUrl
-        } : null,
-        type: ['疑似黑屏', '设备离线', '屏幕拓扑结构异常'][type] || '-',
+        asset: pic && picUrl
+          ? {
+            type: AssetType.IMAGE,
+            url: picUrl
+          }
+          : null,
+        type: getAlarmType(type),
         handle: ['应用重启', '设备重启', '恢复出厂', '未干预'][handle] || '-',
-        status: handle <= 2 && status <= 2 ? {
-          type: ['primary', 'success', 'danger'][status],
-          label: ['处理中', '成功', '失败'][status]
-        } : null,
+        status: handle <= 2 && status <= 2
+          ? {
+            type: ['primary', 'success', 'danger'][status],
+            label: ['处理中', '成功', '失败'][status]
+          }
+          : null,
         note: {
           type: ['danger', 'success'][note],
           label: ['否', '是'][note]