瀏覽代碼

[FE]AI报警处理,AI报警角标,进出记录查询修改

liuwenxun 4 年之前
父節點
當前提交
a2092e7db9

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

22
      required: true
22
      required: true
23
    }
23
    }
24
  },
24
  },
25
  data() {
25
  data () {
26
    return {
26
    return {
27
      title: 'Vue Element Admin',
27
      title: 'Vue Element Admin',
28
      logo: 'https://wpimg.wallstcn.com/69a1c46c-eb1c-4b46-8bd4-e9e686ef5251.png'
28
      logo: 'https://wpimg.wallstcn.com/69a1c46c-eb1c-4b46-8bd4-e9e686ef5251.png'

+ 33 - 8
security-protection-platform/src/layout/components/Sidebar/SidebarItem.vue

6
6
7
let onlyOneChild = null
7
let onlyOneChild = null
8
8
9
function hasOneShowingChild(children = [], parent) {
9
function hasOneShowingChild (children = [], parent) {
10
  const showingChildren = children.filter(item => {
10
  const showingChildren = children.filter(item => {
11
    if (item.hidden) {
11
    if (item.hidden) {
12
      return false
12
      return false
31
  return false
31
  return false
32
}
32
}
33
33
34
function resolvePath(basePath, routePath) {
34
function resolvePath (basePath, routePath) {
35
  // if (isExternal(routePath)) {
35
  // if (isExternal(routePath)) {
36
  //   return routePath
36
  //   return routePath
37
  // }
37
  // }
61
      default: ''
61
      default: ''
62
    }
62
    }
63
  },
63
  },
64
  render(h, { props }) {
64
  render (h, { props }) {
65
    const item = props.item
65
    const item = props.item
66
67
    // AI报警里的数字可以通过meta来传
68
66
    const defaultTitle = 'No Title'
69
    const defaultTitle = 'No Title'
67
    if (item.hidden) return null
70
    if (item.hidden) return null
68
    if (hasOneShowingChild(item.children, item) && (!onlyOneChild.children || onlyOneChild.noShowingChildren) && !item.alwaysShow) {
71
    if (hasOneShowingChild(item.children, item) && (!onlyOneChild.children || onlyOneChild.noShowingChildren) && !item.alwaysShow) {
69
      const icon = onlyOneChild.meta && onlyOneChild.meta.icon ? <t-icon icon={onlyOneChild.meta.icon} /> : ''
72
      const icon = onlyOneChild.meta && onlyOneChild.meta.icon ? <t-icon icon={onlyOneChild.meta.icon} /> : ''
73
74
      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
78
        return (
79
          <t-menu-item name={resolvePath(props.basePath, onlyOneChild.path)}>
80
            { icon}
81
            <span class="menu-text">{onlyOneChild.meta && onlyOneChild.meta.title || defaultTitle}</span>
82
83
            <t-badge color="danger" count={unconfirmedCount} max={99}></t-badge>
84
            <span style="margin-right:5px;">  </span>
85
            <t-badge color="danger" count={confirmedCount} max={99}></t-badge>
86
87
          </t-menu-item>
88
        )
89
      }
90
70
      return (
91
      return (
71
        <t-menu-item name={resolvePath(props.basePath, onlyOneChild.path)}>
92
        <t-menu-item name={resolvePath(props.basePath, onlyOneChild.path)}>
72
          { icon }
73
          <span class="menu-text">{ onlyOneChild.meta && onlyOneChild.meta.title || defaultTitle}</span>
93
          { icon}
94
          <span class="menu-text">{onlyOneChild.meta && onlyOneChild.meta.title || defaultTitle}</span>
95
74
        </t-menu-item>
96
        </t-menu-item>
75
      )
97
      )
76
    } else {
98
    } else {
89
      return (
111
      return (
90
        <t-submenu ref="subMenu" name={resolvePath(props.basePath, item.path)}>
112
        <t-submenu ref="subMenu" name={resolvePath(props.basePath, item.path)}>
91
          <template slot="title">
113
          <template slot="title">
92
            { icon }
93
            <span class="menu-title">{ item.meta.title || defaultTitle }</span>
114
            {icon}
115
            <span class="menu-title">{item.meta.title || defaultTitle}</span>
94
          </template>
116
          </template>
95
          { sidebarItems }
117
          { sidebarItems}
96
        </t-submenu>
118
        </t-submenu>
97
      )
119
      )
98
    }
120
    }
106
    display: none;
128
    display: none;
107
  }
129
  }
108
}
130
}
131
.menu-text {
132
  margin-right: 5px;
133
}
109
</style>
134
</style>

+ 7 - 13
security-protection-platform/src/layout/components/Sidebar/index.vue

5
      <t-icon icon="format-indent-decrease-outline" />
5
      <t-icon icon="format-indent-decrease-outline" />
6
    </div>
6
    </div>
7
    <t-scroll-bar style="height:100%">
7
    <t-scroll-bar style="height:100%">
8
      <t-menu
9
        :active-name="activeMenu"
10
        :collapse="isCollapse"
11
        mode="vertical"
12
        type="light"
13
        @on-select="handleMenuSelect"
14
      >
8
      <t-menu :active-name="activeMenu" :collapse="isCollapse" mode="vertical" type="light" @on-select="handleMenuSelect">
15
        <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" />
16
      </t-menu>
10
      </t-menu>
17
    </t-scroll-bar>
11
    </t-scroll-bar>
31
      'permission_routes',
25
      'permission_routes',
32
      'sidebar'
26
      'sidebar'
33
    ]),
27
    ]),
34
    activeMenu() {
28
    activeMenu () {
35
      const route = this.$route
29
      const route = this.$route
36
      const { meta, path } = route
30
      const { meta, path } = route
37
      // if set path, the sidebar will highlight the path you set
31
      // if set path, the sidebar will highlight the path you set
40
      }
34
      }
41
      return path
35
      return path
42
    },
36
    },
43
    showLogo() {
37
    showLogo () {
44
      return this.$store.state.settings.sidebarLogo
38
      return this.$store.state.settings.sidebarLogo
45
    },
39
    },
46
    variables() {
40
    variables () {
47
      return variables
41
      return variables
48
    },
42
    },
49
    isCollapse() {
43
    isCollapse () {
50
      return !this.sidebar.opened
44
      return !this.sidebar.opened
51
    }
45
    }
52
  },
46
  },
53
  methods: {
47
  methods: {
54
    handleMenuSelect(name) {
48
    handleMenuSelect (name) {
55
      this.$router.push(name)
49
      this.$router.push(name)
56
    },
50
    },
57
    handleSidebarCollapse() {
51
    handleSidebarCollapse () {
58
      this.$store.dispatch('app/toggleSideBar')
52
      this.$store.dispatch('app/toggleSideBar')
59
    }
53
    }
60
  }
54
  }

+ 3 - 3
security-protection-platform/src/modules/access/index.vue

4
    <div class="access_header">
4
    <div class="access_header">
5
      <div>
5
      <div>
6
        <span class="title">开始时间 : </span>
6
        <span class="title">开始时间 : </span>
7
        <t-date-picker :confirm="false" v-model="searchdata.starttime" placeholder="请选择开始时间" style="width:200px;height:32px"></t-date-picker>
7
        <t-date-picker :confirm="false" v-model="searchdata.beginTime" placeholder="请选择开始时间" style="width:200px;height:32px"></t-date-picker>
8
      </div>
8
      </div>
9

9

10
      <div>
10
      <div>
11
        <span class="title">结束时间 : </span>
11
        <span class="title">结束时间 : </span>
12
        <t-date-picker :confirm="false" v-model="searchdata.endtime" placeholder="请选择结束时间" style="width:200px;height:32px"></t-date-picker>
12
        <t-date-picker :confirm="false" v-model="searchdata.endTime" placeholder="请选择结束时间" style="width:200px;height:32px"></t-date-picker>
13
      </div>
13
      </div>
14

14

15
      <!-- <div>
15
      <!-- <div>
208
        var params = this.searchdata
208
        var params = this.searchdata
209
        params.pageNumber = this.page
209
        params.pageNumber = this.page
210
        params.pageSize = this.limit
210
        params.pageSize = this.limit
211
        // console.log(params)
211
        console.log(params)
212
        var res = await accessapi.getaccesslist({ params: params })
212
        var res = await accessapi.getaccesslist({ params: params })
213
        // console.log(res)
213
        // console.log(res)
214
        if (res.status === 200) {
214
        if (res.status === 200) {

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

147
          </div>
147
          </div>
148
        </div>
148
        </div>
149
        <div v-if="clickdetail==1">
149
        <div v-if="clickdetail==1">
150
          <div v-if="alarmDetailData.statusZh!='END'" class="radio">
150
          <div v-if="alarmDetailData.status!='END'" class="radio">
151
            <div>报警处理 : </div>
151
            <div>报警处理 : </div>
152
            <div v-if="alarmDetailData.statusZh=='INI'">
152
            <div v-if="alarmDetailData.status=='INI'">
153
              <t-radio-group v-model="status">
153
              <t-radio-group v-model="status">
154
                <t-radio label="RUN">
154
                <t-radio label="RUN">
155

155

163
              </t-radio-group>
163
              </t-radio-group>
164
            </div>
164
            </div>
165

165

166
            <div v-if="alarmDetailData.statusZh=='RUN'||alarmDetailData.statusZh=='FAL'">
166
            <div v-if="alarmDetailData.status=='RUN'||alarmDetailData.status=='FAL'">
167
              <t-radio-group v-model="status">
167
              <t-radio-group v-model="status">
168
                <t-radio label="END">关闭</t-radio>
168
                <t-radio label="END">关闭</t-radio>
169
              </t-radio-group>
169
              </t-radio-group>
328
      // 判断是否选择了单选框
328
      // 判断是否选择了单选框
329
      if (this.status) {
329
      if (this.status) {
330
        // 向后端发送数据
330
        // 向后端发送数据
331
        this.alarmdispose(this.currentdata.data.workTaskId, this.status)
331
        this.alarmdispose(this.alarmDetailData.workTaskId, this.status)
332
        // console.log(this.status)
332
        // console.log(this.status)
333
        // 关闭模态框
333
        // 关闭模态框
334
        this.details_modal = false
334
        this.details_modal = false
340
    async alarmdispose (id, status, processMemo) {
340
    async alarmdispose (id, status, processMemo) {
341
      const dict = { 'END': '已解决', 'RUN': '处理中', 'FAL': '误报' }
341
      const dict = { 'END': '已解决', 'RUN': '处理中', 'FAL': '误报' }
342

342

343
      console.log(id, status, dict[status])
344

343
      var res = await aialarmapi.dispose({ 'workTaskId': id, 'status': status, 'processMemo': dict.status })
345
      var res = await aialarmapi.dispose({ 'workTaskId': id, 'status': status, 'processMemo': dict.status })
344
      // console.log(res)
346
      console.log(res)
345
      if (res.status === 200) {
347
      if (res.status === 200) {
346
        this.$Message.success('操作成功')
348
        this.$Message.success('操作成功')
347
        this.data[this.currentdata.index].status = res.data.data.status
349
        this.data[this.currentdata.index].status = res.data.data.status

+ 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' }
105
        meta: { title: 'AI报警', icon: 'bell', unconfirmedCount: 10, confirmedCount: 100 }
106
      }
106
      }
107
    ]
107
    ]
108
  }, {
108
  }, {