Przeglądaj źródła

[FE]实现AI报警的角标交互

liuwenxun 4 lat temu
rodzic
commit
4dc762760a

+ 12 - 0
security-protection-platform/src/layout/components/Sidebar/index.vue

@ -32,6 +32,11 @@ export default {
32 32
      'permission_routes',
33 33
      'sidebar'
34 34
    ]),
35
    isFollow () {
36
      // 需要检测的数据
37
      // console.log('state是', this.$store.state.alarm.count)
38
      return this.$store.state.alarm.count
39
    },
35 40
    activeMenu () {
36 41
      const route = this.$route
37 42
      const { meta, path } = route
@ -52,6 +57,12 @@ export default {
52 57
    }
53 58
54 59
  },
60
  watch: {
61
    isFollow (newVal, oldVal) {
62
      // console.log('我发生改变了')
63
      this.getAiAlarmCount()
64
    }
65
  },
55 66
  created () {
56 67
    this.getAiAlarmCount()
57 68
  },
@ -63,6 +74,7 @@ export default {
63 74
      this.$store.dispatch('app/toggleSideBar')
64 75
    },
65 76
    async getAiAlarmCount () {
77
      // console.log('数据是:', this.$store.state.alarm.count)
66 78
      let res = await aialarmapi.getAiAlarmCount()
67 79
68 80
      this.AiAlarmCount = res.data.data

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

@ -350,6 +350,7 @@ export default {
350 350
        this.loading = false
351 351
        // 关闭模态框
352 352
        this.details_modal = false
353
        this.$store.commit('alarm/add', 1)
353 354
        // this.data[this.currentdata.index].status = res.data.data.status
354 355
        // if (res.data.data.status === 'END') {
355 356
        //   this.data[this.currentdata.index].processTime = res.data.data.doneDate

+ 22 - 0
security-protection-platform/src/store/modules/alarm.js

@ -0,0 +1,22 @@
1
const state = {
2
  count: 1
3
}
4

5
const mutations = {
6

7
  add (state, i) {
8
    state.count = state.count + i
9
  }
10
}
11

12
const actions = {
13

14
}
15

16
export default {
17
  namespaced: true,
18
  state,
19
  mutations,
20
  actions
21
}
22