From 1d09e1e41396c03dfb7d49bb4e076eb115eb4194 Mon Sep 17 00:00:00 2001 From: chendingwei <1170506816@qq.com> Date: Thu, 29 Dec 2022 18:02:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=87=E7=AD=BE=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/index.ts | 14 ++++--- src/views/page/Aside/cameraRightMenu.vue | 3 +- src/views/page/cameraCenter.vue | 53 ++++++++++++++++++------ 3 files changed, 51 insertions(+), 19 deletions(-) diff --git a/src/store/index.ts b/src/store/index.ts index 2151672..3c00fdb 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -10,8 +10,9 @@ export const useStore = defineStore('Index', { audioCount: 0, audioCurrentCount: 0, editType: 0, - addLabel: {cmMarkGroupId:0,labelType:"",isAddLabel: false}, - curTreeKey:"" + addLabel: { cmMarkGroupId: 0, labelType: "", isAddLabel: false }, + curTreeKey: "", + labelGroupList: [] } }, @@ -21,7 +22,7 @@ export const useStore = defineStore('Index', { addCameraMap(list: any) { this.treeData = [] for (let item of list) { - this.cameraMap.set(item.id+'', item); + this.cameraMap.set(item.id + '', item); this.treeData.push({ title: item.ip, key: item.id }); } return this.cameraMap @@ -38,8 +39,11 @@ export const useStore = defineStore('Index', { updateaudioCount(num: number) { this.audioCount = num }, - updateIsAddLabel(obj:any){ - this.addLabel=obj + updateIsAddLabel(obj: any) { + this.addLabel = obj + }, + updateLabelGroupList(arr: any) { + this.labelGroupList = arr } }, }) \ No newline at end of file diff --git a/src/views/page/Aside/cameraRightMenu.vue b/src/views/page/Aside/cameraRightMenu.vue index 4c1ad4a..d61d487 100644 --- a/src/views/page/Aside/cameraRightMenu.vue +++ b/src/views/page/Aside/cameraRightMenu.vue @@ -83,6 +83,7 @@ function init() { let result = res.data if (result.code == 200) { labelList.value=result.data + piniaStore.updateLabelGroupList(result.data) } }) } @@ -99,7 +100,7 @@ onMounted(() => { width: 80px; } .labelList{ - cursor: pointer; + cursor: pointer !important; } @keyframes rounte { from { diff --git a/src/views/page/cameraCenter.vue b/src/views/page/cameraCenter.vue index 7f92211..b669af9 100644 --- a/src/views/page/cameraCenter.vue +++ b/src/views/page/cameraCenter.vue @@ -7,16 +7,24 @@ @loadedmetadata="changeVideoCanvasSize" @mouseover="mouseOverVideo" @mouseout="mouseOutVideo" @mousedown="mouseDownVideo"> -
-
+
{{ item.name }}
+
+ +
+ +
{{ item.name }}
+
+
-
+
@@ -36,8 +44,8 @@
-
+
@@ -102,7 +110,6 @@ watch(curSelectKey, (newVal, oldVal) => { switchCamera(newVal) }) watch(addLabel, (newVal, oldVal) => { - console.log(newVal); if (newVal.isAddLabel) { isActiveChoose.value = true document.body.onmousemove = (e) => { @@ -218,7 +225,7 @@ function mouseDownVideo(e: MouseEvent) { VideoHeight: videoHeight, CanvasLeftRatio: canvasLeftRatio, CanvasTopRatio: canvasTopRatio, - CmMarkGroupId:addLabel.value.cmMarkGroupId + CmMarkGroupId: addLabel.value.cmMarkGroupId } markLabelApi.AddReturnId({ 'entity': entity @@ -245,17 +252,18 @@ function mouseDownVideo(e: MouseEvent) { isDelete: false, inFlag: true, name: name, + groupName:name } labelList.value.push(obj) isActiveChoose.value = false - piniaStore.updateIsAddLabel({ cmMarkGroupId:0,labelType: "", isAddLabel: false }) + piniaStore.updateIsAddLabel({ cmMarkGroupId: 0, labelType: "", isAddLabel: false }) } }); }) } else { //右键取消 isActiveChoose.value = false - piniaStore.updateIsAddLabel({ cmMarkGroupId:0,labelType: "", isAddLabel: false }) + piniaStore.updateIsAddLabel({ cmMarkGroupId: 0, labelType: "", isAddLabel: false }) } } @@ -317,12 +325,22 @@ function getRtspUrl(cameraObj: any): string { return `rtsp://${cameraObj.userName}:${cameraObj.password}@${cameraObj.ip}:554/Streaming/Channels/101?transportmode=unicast&profile=Profile_1`; } function getLabel(cbCameraId: string | number) { - let str=JSON.stringify({ cbCameraId }) - markLabelApi.GetList({queryJson:str}).then((res: any) => { - console.log(res, 'resmarkLabelApi'); + let str = JSON.stringify({ cbCameraId }) + markLabelApi.GetList({ queryJson: str }).then((res: any) => { if (res.data.code == 200) { console.log(res, 'res'); labelList.value = res.data.data + labelList.value = labelList.value.map((item: any) => { + let labelGroupList = piniaStore.labelGroupList + labelGroupList.forEach((element: any) => { + if (element.id == item.cmMarkGroupId) { + item.groupName = element.name + } + }); + return item + }) + console.log(labelList.value, 'labelList.value'); + } }) } @@ -437,7 +455,16 @@ onUnmounted(() => { } } + .lavels-video { + position: fixed; + transform: translate(-50%, -100%); + } + .lavels-build { + + transform: translate(-10px, -10px); + position: fixed; + } }