Przeglądaj źródła

实时标绘 优化回显、实现删除

Hwf 8 miesięcy temu
rodzic
commit
7d64199ef0

+ 18 - 0
src/api/videoMonitor/index.ts

@@ -46,3 +46,21 @@ export function updateUserVideoPoints(data) {
     data: data
   });
 }
+
+// 获取用户绑定视频点位
+export function getVideoTagInfo(params) {
+  return request({
+    url: '/api/videoResource/videoinfo/get_video_tag_info',
+    method: 'get',
+    params: params
+  });
+}
+
+// 视频点位标签信息-添加
+export function addVideoTag(data) {
+  return request({
+    url: '/api/videoResource/videoinfo/add_video_tag',
+    method: 'post',
+    data: data
+  });
+}

+ 1 - 1
src/components/Dialog/index.vue

@@ -5,7 +5,7 @@
         {{ title ? title : '弹窗' }}
       </div>
       <div v-if="!!getTagId" class="tags">
-        <div v-for="(item, index) in tags" :key="index" class="tag">{{ item.name }}</div>
+        <div v-for="(item, index) in tags" :key="index" class="tag">{{ item.dict_label }}</div>
         <div class="add-tag" @click="handleShowAddTag">+添加标签</div>
       </div>
       <i class="decoration" />

+ 18 - 3
src/components/VideoTagEdit/index.vue

@@ -9,7 +9,7 @@
         <div class="title">当前标签</div>
       </div>
       <div class="tags">
-        <div v-for="(item, index) in currentTags" :key="index" class="tag">{{ item.name }}</div>
+        <div v-for="(item, index) in currentTags" :key="index" class="tag">{{ item.dict_label }}</div>
       </div>
       <div class="title-box">
         <div class="title">新建标签</div>
@@ -61,6 +61,8 @@
 </template>
 
 <script lang="ts" setup name="VideoTagEdit">
+import { addVideoTag, getVideoTagInfo } from '@/api/videoMonitor';
+
 const props = defineProps({
   modelValue: Boolean,
   id: String
@@ -75,11 +77,17 @@ let typeOptions = ref([]);
 let industry = ref('');
 let industryTags = ref([]);
 let industryOptions = ref([]);
+
+const getData = () => {
+  getVideoTagInfo({ video_code: props.id }).then((res) => {
+    currentTags.value = res.data;
+  });
+};
 watch(
   () => props.id,
   () => {
     if (!!props.id) {
-      currentTags.value = [{ name: '河坝' }, { name: '水库' }];
+      getData();
       recentTags.value = [{ name: '河坝' }, { name: '水库' }, { name: '山塘' }];
       typeTags.value = [{ name: '河坝' }, { name: '水库' }, { name: '山塘' }];
       industryTags.value = [{ name: '河坝' }, { name: '水库' }, { name: '山塘' }];
@@ -108,8 +116,15 @@ const handleClose = () => {
   emits('update:modelValue', false);
 };
 const handleAdd = () => {
+  addVideoTag({
+    video_code: props.id,
+    dict_value: addTag.value,
+    dict_type: 'video_type'
+  }).then(() => {
+    getData();
+  });
   addTag.value = '';
-}
+};
 </script>
 
 <style lang="scss" scoped>

+ 2 - 3
src/views/globalMap/LeftMenu.vue

@@ -61,8 +61,7 @@
               >
                 <div class="text1" :title="item.name" @click="handleShowDialog(item)">{{ item.name }}</div>
                 <div class="tags">
-                  <div class="tag">{{ item.dict_label }}</div>
-                  <!--                  <div v-for="(item2, index2) in item.tags" :key="index2" class="tag">{{ item2.name }}</div>-->
+                  <div v-for="(item2, index2) in item.tag_info" :key="index2" class="tag">{{ item2.dict_label }}</div>
                 </div>
               </div>
               <div v-show="searchState.showList && searchState.videoList.length === 0" style="text-align: center">无数据</div>
@@ -120,7 +119,7 @@
     <Dialog
       v-if="showDialog"
       v-model="showDialog"
-      v-model:tags="videoMonitorData.tags"
+      v-model:tags="videoMonitorData.tag_info"
       type="lg"
       header-type="header2"
       title="视频"

+ 4 - 0
src/views/globalMap/RightMenu/OnlinePlotting/index.vue

@@ -715,6 +715,10 @@ const removeOverlayByIndex = (index: number) => {
     // 移除地图上覆盖物
     map.remove(overlays[index]);
     if (collaboration.value) {
+      console.log(JSON.stringify({
+        operation: 'delete',
+        id: overlays[index].getExtData()?.id
+      }));
       webSock.send(
         JSON.stringify({
           operation: 'delete',