浏览代码

[FE]统计AI报警未处理的数据

liuwenxun 4 年之前
父节点
当前提交
3bbc9dd33e

+ 4 - 1
security-protection-platform/src/api/aialarm/index.js

7
    return $default.get('/sp/aiAlarmManage/queryPageAiAlarm', params)
7
    return $default.get('/sp/aiAlarmManage/queryPageAiAlarm', params)
8
  },
8
  },
9
  // 获取报警列表详情信息
9
  // 获取报警列表详情信息
10
  getAlarmDetail(id) {
10
  getAlarmDetail (id) {
11
    return $default.get('/sp/aiAlarmManage/queryOneAiAlarmInfo', id).catch((err) => { return err })
11
    return $default.get('/sp/aiAlarmManage/queryOneAiAlarmInfo', id).catch((err) => { return err })
12
  },
12
  },
13
  // 获取报警类型查询下拉框
13
  // 获取报警类型查询下拉框
19
  },
19
  },
20
  dispose (params) {
20
  dispose (params) {
21
    return $default.post('/sp/aiAlarmManage/changeTaskStatus', params)
21
    return $default.post('/sp/aiAlarmManage/changeTaskStatus', params)
22
  },
23
  getAiAlarmCount () {
24
    return $default.get('/sp/aiAlarmManage/queryAiAlarmCount')
22
  }
25
  }
23

26

24
}
27
}

+ 25 - 4
security-protection-platform/src/layout/components/Sidebar/SidebarItem.vue

6
6
7
let onlyOneChild = null
7
let onlyOneChild = null
8
8
9
// async function getAiAlarmCount () {
10
//   // let res = await aialarmapi.getAiAlarmCount()
11
12
//   const res = await new Promise((resolve) => {
13
//     return resolve(aialarmapi.getAiAlarmCount())
14
//   })
15
16
//   // console.log('数据是', res)
17
//   return res
18
// }
19
9
function hasOneShowingChild (children = [], parent) {
20
function hasOneShowingChild (children = [], parent) {
10
  const showingChildren = children.filter(item => {
21
  const showingChildren = children.filter(item => {
11
    if (item.hidden) {
22
    if (item.hidden) {
59
    basePath: {
70
    basePath: {
60
      type: String,
71
      type: String,
61
      default: ''
72
      default: ''
73
    },
74
75
    AiAlarmCount: {
76
      type: Array,
77
      default: null
62
    }
78
    }
63
  },
79
  },
80
64
  render (h, { props }) {
81
  render (h, { props }) {
65
    const item = props.item
82
    const item = props.item
66
83
67
    // AI报警里的数字可以通过meta来传
84
    const AiAlarmCount = props.AiAlarmCount
68
85
69
    const defaultTitle = 'No Title'
86
    const defaultTitle = 'No Title'
70
    if (item.hidden) return null
87
    if (item.hidden) return null
72
      const icon = onlyOneChild.meta && onlyOneChild.meta.icon ? <t-icon icon={onlyOneChild.meta.icon} /> : ''
89
      const icon = onlyOneChild.meta && onlyOneChild.meta.icon ? <t-icon icon={onlyOneChild.meta.icon} /> : ''
73
90
74
      if (item.path === '/alarm') {
91
      if (item.path === '/alarm') {
75
        // console.log(item.children[0].meta)
76
        const confirmedCount = item.children[0].meta.confirmedCount
77
        const unconfirmedCount = item.children[0].meta.unconfirmedCount
92
        var confirmedCount = 0
93
        var unconfirmedCount = 0
94
        if (AiAlarmCount.length > 0) {
95
          confirmedCount = AiAlarmCount[1].value
96
          unconfirmedCount = AiAlarmCount[0].value
97
        }
98
78
        return (
99
        return (
79
          <t-menu-item name={resolvePath(props.basePath, onlyOneChild.path)}>
100
          <t-menu-item name={resolvePath(props.basePath, onlyOneChild.path)}>
80
            { icon}
101
            { icon}

+ 17 - 1
security-protection-platform/src/layout/components/Sidebar/index.vue

6
    </div>
6
    </div>
7
    <t-scroll-bar style="height:100%">
7
    <t-scroll-bar style="height:100%">
8
      <t-menu :active-name="activeMenu" :collapse="isCollapse" mode="vertical" type="light" @on-select="handleMenuSelect">
8
      <t-menu :active-name="activeMenu" :collapse="isCollapse" mode="vertical" type="light" @on-select="handleMenuSelect">
9
        <sidebar-item v-for="route in permission_routes" :key="route.path" :item="route" :base-path="route.path" />
9
        <sidebar-item v-for="route in permission_routes" :key="route.path" :item="route" :base-path="route.path" :ai-alarm-count="AiAlarmCount" />
10
      </t-menu>
10
      </t-menu>
11
    </t-scroll-bar>
11
    </t-scroll-bar>
12
  </div>
12
  </div>
17
import Logo from './Logo'
17
import Logo from './Logo'
18
import SidebarItem from './SidebarItem'
18
import SidebarItem from './SidebarItem'
19
import variables from '@/styles/variables.scss'
19
import variables from '@/styles/variables.scss'
20
import aialarmapi from '@/api/aialarm'
20
21
21
export default {
22
export default {
22
  components: { SidebarItem, Logo },
23
  components: { SidebarItem, Logo },
24
  data () {
25
    return {
26
      AiAlarmCount: []
27
    }
28
  },
29
23
  computed: {
30
  computed: {
24
    ...mapGetters([
31
    ...mapGetters([
25
      'permission_routes',
32
      'permission_routes',
43
    isCollapse () {
50
    isCollapse () {
44
      return !this.sidebar.opened
51
      return !this.sidebar.opened
45
    }
52
    }
53
54
  },
55
  created () {
56
    this.getAiAlarmCount()
46
  },
57
  },
47
  methods: {
58
  methods: {
48
    handleMenuSelect (name) {
59
    handleMenuSelect (name) {
50
    },
61
    },
51
    handleSidebarCollapse () {
62
    handleSidebarCollapse () {
52
      this.$store.dispatch('app/toggleSideBar')
63
      this.$store.dispatch('app/toggleSideBar')
64
    },
65
    async getAiAlarmCount () {
66
      let res = await aialarmapi.getAiAlarmCount()
67
68
      this.AiAlarmCount = res.data.data
53
    }
69
    }
54
  }
70
  }
55
}
71
}

+ 1 - 1
security-protection-platform/src/modules/aialarm/index.vue

347
      if (res.status === 200) {
347
      if (res.status === 200) {
348
        this.$Message.success('操作成功')
348
        this.$Message.success('操作成功')
349
        this.data[this.currentdata.index].status = res.data.data.status
349
        this.data[this.currentdata.index].status = res.data.data.status
350
        if (res.data.data.status == 'END') {
350
        if (res.data.data.status === 'END') {
351
          this.data[this.currentdata.index].processTime = res.data.data.doneDate
351
          this.data[this.currentdata.index].processTime = res.data.data.doneDate
352
        }
352
        }
353
      } else {
353
      } else {

+ 1 - 1
security-protection-platform/src/routes.js

102
        name: 'ai_alarm',
102
        name: 'ai_alarm',
103
        path: '',
103
        path: '',
104
        component: () => import(/* webpackChunkName: "alarm" */ './modules/aialarm/index.vue'),
104
        component: () => import(/* webpackChunkName: "alarm" */ './modules/aialarm/index.vue'),
105
        meta: { title: 'AI报警', icon: 'bell', unconfirmedCount: 10, confirmedCount: 100 }
105
        meta: { title: 'AI报警', icon: 'bell' }
106
      }
106
      }
107
    ]
107
    ]
108
  }, {
108
  }, {