From 3fac89b635c5ab9a918a6d1cbf2bc08b1fc83bd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BE=9A=E7=9A=93?= <1736436516@qq.com> Date: Fri, 26 Jul 2024 15:58:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BB=E9=A1=B5=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Home.vue | 101 ++++++++++++++++++++++++++++++---------- 1 file changed, 76 insertions(+), 25 deletions(-) diff --git a/src/components/Home.vue b/src/components/Home.vue index c7850a5..682ed00 100644 --- a/src/components/Home.vue +++ b/src/components/Home.vue @@ -24,7 +24,7 @@ @@ -41,6 +41,17 @@ + + +
+
+ +
+
+ +
+
+
@@ -61,7 +72,8 @@ -

告警状态: {{ selectedRow.status }}

+

告警状态: {{ statusMapping[selectedRow.status] + }}

摄像头编号: {{ selectedRow.camera_id }}

@@ -97,7 +109,10 @@ import * as echarts from 'echarts'; import Statistics from '../components/Statistics.vue'; import AlertChart from '../components/AlertChart.vue'; -import { login, getEvents, initCodeNameMap, codenameTranslate } from '../../superbox.js'; +import { login, getEvents, initCodeNameMap, codenameTranslate, getAlgorithms } from '../../superbox.js'; + +const username = 'turingvideo'; +const password = '1234qwer!'; export default { name: 'Home', @@ -113,38 +128,39 @@ export default { mediums: {}, duration: '', typeMapping: { - 'abnormal:525': '黑屏检测', - 'car_blocking:512': '车辆拥塞', - 'car_blocking:514': '违规停车', - 'escalator_status:518': '扶梯运行状态', - 'gathering:520': '人员密集', - 'gathering:521': '保洁点名', - 'intrude:513': '入侵检测', - 'long_term_door_status:526': '长期门状态检测', - 'lying_down:527': '人员倒地', - 'minizawu:531': '杂物堆积', - 'minizawu:532': '杂物堆积', - 'personnel_stay:535': '人员逗留', - 'vacant:524': '人员离岗', - 'zawu:516': '饮料垃圾检测', - 'zawu:517': '垃圾桶满溢', - 'zawu:519': '违规放置', - 'zawu:523': '绿化带垃圾检测', + // 'abnormal:525': '黑屏检测', + // 'car_blocking:512': '车辆拥塞', + // 'car_blocking:514': '违规停车', + // 'escalator_status:518': '扶梯运行状态', + // 'gathering:520': '人员密集', + // 'gathering:521': '保洁点名', + // 'intrude:513': '入侵检测', + // 'long_term_door_status:526': '长期门状态检测', + // 'lying_down:527': '人员倒地', + // 'minizawu:531': '杂物堆积', + // 'minizawu:532': '杂物堆积', + // 'personnel_stay:535': '人员逗留', + // 'vacant:524': '人员离岗', + // 'zawu:516': '饮料垃圾检测', + // 'zawu:517': '垃圾桶满溢', + // 'zawu:519': '违规放置', + // 'zawu:523': '绿化带垃圾检测', }, statusMapping: { - '': '待处理', - '': '处理中', - '': '已处理' + 'pending': '待处理', + 'closed': '已处理' }, currentPage: 1, pageSize: 20, + } }, async created() { try { - const token = await login('turingvideo', '1234qwer!'); + const token = await login(username, password); // await initCodeNameMap(token); this.tableData = await getEvents(token); + this.typeMapping = await this.fetchTypeMapping(token); console.log(this.tableData); } catch (error) { console.error("Error fetching events:", error); @@ -158,6 +174,23 @@ export default { } }, methods: { + async fetchTypeMapping(token) { + let algorithms = await getAlgorithms(token); + const additionalMappings = [ + { code_name: 'minizawu:532', name: '杂物堆积' }, + + ]; + algorithms = algorithms.concat(additionalMappings); + let mapping = {}; + algorithms.forEach((algorithm) => { + mapping[algorithm.code_name] = algorithm.name; + }); + + // console.log("mapping: ", mapping); + return mapping; + }, + + handleView(row) { this.selectedRow = row; this.duration = this.calculateDuration(row.started_at, row.ended_at); @@ -221,7 +254,7 @@ export default { } .top-scroll-content { -/* 高度滚动条显示出来默认值 */ + /* 高度滚动条显示出来默认值 */ height: 1px; } @@ -232,6 +265,24 @@ export default { padding-left: 7%; } +.right-panel { + display: flex; + flex-direction: column; + gap: 20px; + padding: 10px 10px 400px 10px; + background-color: #f5f5f5; + height: 600px; + overflow-y: auto; +} + +.panel-section { + flex: 1; + background-color: #fff; + padding: 20px; + box-shadow: 0 20px 8px rgba(0, 0, 0, 0.1); + border-radius: 8px; +} + /* 弹窗> 显示左右等分*/ .event-media { /* display: flex;