From 4a800a8fc83c6bd1f86a8e847b079a51a7532c09 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期三, 20 七月 2022 15:05:58 +0800
Subject: [PATCH] 修复国标配置的bug

---
 src/pages/panoramicView/components/RelateCamera.vue |   79 ++++++++++++++++++++++++---------------
 1 files changed, 48 insertions(+), 31 deletions(-)

diff --git a/src/pages/panoramicView/components/RelateCamera.vue b/src/pages/panoramicView/components/RelateCamera.vue
index f7dd219..9ea7cce 100644
--- a/src/pages/panoramicView/components/RelateCamera.vue
+++ b/src/pages/panoramicView/components/RelateCamera.vue
@@ -32,7 +32,7 @@
           </div>
           <div class="bottom">
             <span @click.stop="editGroup(group)">缂栬緫鍒嗙粍</span>
-            <el-popconfirm title="纭畾鍒犻櫎璇ュ垎缁勫悧?" @onConfirm="removeGroup(group)">
+            <el-popconfirm title="纭畾鍒犻櫎璇ュ垎缁勫悧?" @confirm="removeGroup(group)">
               <el-button slot="reference" type="text">鍒犻櫎鍒嗙粍</el-button>
             </el-popconfirm>
           </div>
@@ -40,6 +40,7 @@
       </div>
     </div>
     <!-- <div class="part" v-if="groupList.length"> -->
+    <el-divider></el-divider>
     <div class="part" v-if="groupList.length!==0 && Object.keys(curGroup)">
       <div class="title">缁樺埗鍖哄煙(鐢ㄤ簬绠楁硶鍒嗘瀽)</div>
       <div class="relative-partment" v-if="curGroup.cameras&&curGroup.cameras.length">
@@ -48,6 +49,7 @@
         </div>
       </div>
     </div>
+    <el-divider></el-divider>
     <div class="part relative-config" v-if="Object.keys(curGroup)">
       <div class="title">
         <div class="left">
@@ -81,7 +83,7 @@
           <div class="right">
             <el-button type="text" @click="saveRelativePolygon(item)">淇濆瓨</el-button>
 
-            <el-popconfirm title="纭畾鍒犻櫎璇ラ厤缃悧?" @onConfirm="delRelation(item)" v-if="item.id">
+            <el-popconfirm title="纭畾鍒犻櫎璇ラ厤缃悧?" @confirm="delRelation(item)" v-if="item.id">
               <el-button class="btn-del" slot="reference" type="text" icon="el-icon-delete"></el-button>
             </el-popconfirm>
             <el-button
@@ -142,7 +144,7 @@
 
 export default {
   components: { SlideCanvas },
-  data () {
+  data() {
     return {
       cameraData: [],
       relativeList: [],
@@ -161,11 +163,11 @@
       cameraAndPolygonData: []
     }
   },
-  mounted () {
+  mounted() {
     this.getAllCameraData();
   },
   methods: {
-    getAllCameraData () {
+    getAllCameraData() {
       let _this = this;
       getCamerasByServer().then(res => {
         if (res.success) {
@@ -176,27 +178,27 @@
         console.log(e)
       })
     },
-    polygonUpdate () {
+    polygonUpdate() {
       this.getAllGroups();
     },
-    delRelation (item, index) {
+    delRelation(item, index) {
       let _this = this;
       if (item.id) {
         delRelation(item.id).then(res => {
           if (res.success) {
             this.$notify({
               type: 'success',
-              message: res.data
+              message: res.msg
             });
             _this.findRelationByGroup();
           }
         })
-      }else{
-        this.relativeList.splice(index,1);
+      } else {
+        this.relativeList.splice(index, 1);
       }
 
     },
-    findRelationByGroup () {
+    findRelationByGroup() {
       let _this = this;
       findByGroup({ groupId: this.curGroup.id }).then(res => {
 
@@ -213,8 +215,8 @@
         })
       })
     },
-    saveRelativePolygon (item) {
-      debugger
+    saveRelativePolygon(item) {
+      // debugger
       if (!item.sourceObj || !item.targetObj) {
         this.$notify({
           type: 'warning',
@@ -250,17 +252,21 @@
       })
     },
 
-    async findPolygonByIds (cameras) {
+    async findPolygonByIds(cameras) {
       for (var i = 0; i < cameras.length; i++) {
+        if (Object.keys(cameras[i]).length == 0)
+          continue
         let res = await getAllPolygon({ cameraId: cameras[i].id });
         cameras[i].canvasData = res.data;
       }
       return cameras
     },
 
-    async getAllGroupInfo () {
+    async getAllGroupInfo() {
       let _this = this;
+      console.log("_this.cameraData", _this.cameraData)
       let res = await findCameraGroups();
+      console.log("res", res);
       let groupArr = res.data.map(item => {
         let obj = {}; //group
         obj.groupName = item.groupName;
@@ -303,9 +309,10 @@
     //     _this.checkCurrentGroup(_this.groupList[0]);
     //   })
     // },
-    async getAllGroups () {
+    async getAllGroups() {
       let _this = this;
       let groups = await this.getAllGroupInfo();
+      console.log("groups", groups)
       for (var i = 0; i < groups.length; i++) {
         groups[i].cameras = await _this.findPolygonByIds(groups[i].cameras)
       }
@@ -316,36 +323,44 @@
         this.groupList.length && this.checkCurrentGroup(_this.groupList[0]);
       } else {
         let group = this.groupList.find(one => one.id == this.groupForm.id);
-        if(group){
+        if (group) {
           this.groupList.length && this.checkCurrentGroup(group);
-        }else{
+        } else {
           this.groupList.length && this.checkCurrentGroup(_this.groupList[0]);
         }
-        
+
       }
 
 
     },
 
-    addRelation () {
+    addRelation() {
       let obj = { cameraArea1: '', cameraArea2: '' };
       this.relativeList.push(obj)
     },
 
-    editGroup (group) {
-      debugger
+    editGroup(group) {
+      // debugger
       this.groupModelVisible = true;
       //this.$refs['groupForm'].resetFields();
       //this.groupForm = group;
       this.groupForm = JSON.parse(JSON.stringify(group));
     },
-    removeGroup (group) {
+    removeGroup(group) {
       let _this = this;
       delCameraGroup(group.id).then(res => {
-        _this.getAllGroups()
+        if (res.success) {
+          this.$notify.success(res.msg)
+          _this.getAllGroups()
+        }else{
+          this.$notify.error("鍒犻櫎澶辫触")
+
+        }
+      }).catch((err) => {
+          this.$notify.error("鍒犻櫎澶辫触")
       })
     },
-    checkCurrentGroup (group) {
+    checkCurrentGroup(group) {
       this.groupList.forEach(group => {
         group.checked = false;
       });
@@ -375,10 +390,9 @@
           tempArr = tempArr.concat(cameraArea)
         });
         this.cameraAreas = tempArr;
-        console.log(this.cameraAreas)
       })
     },
-    confirmGroupDialog () {
+    confirmGroupDialog() {
       //璇锋眰淇濆瓨鏂板缓鎴栫紪杈戝垎缁�
       let _this = this;
       let params = {
@@ -413,7 +427,7 @@
       })
       //this.groupList.push(this.groupForm);
       saveCameraGroupInfo(params).then(res => {
-        if(res.success){
+        if (res.success) {
           this.$notify({
             type: 'success',
             message: '淇濆瓨鎴愬姛!'
@@ -424,7 +438,7 @@
       this.groupModelVisible = false;
 
     },
-    newGroup () {
+    newGroup() {
       this.groupModelVisible = true;
       this.$nextTick(() => {
         this.$refs['groupForm'].resetFields();
@@ -509,7 +523,7 @@
       position: relative;
       display: flex;
       &:after {
-        content: '';
+        content: "";
         position: absolute;
         font-size: 0;
         width: 1px;
@@ -531,7 +545,7 @@
     margin-bottom: 20px;
     .relative-partment {
       width: 1200px;
-      margin: 0 auto;
+      // margin: 0 auto;
       display: flex;
       justify-content: space-between;
       .area-wrap {
@@ -561,6 +575,9 @@
         .right {
           display: flex;
           align-items: center;
+          .el-button + .el-button {
+            margin-left: 0;
+          }
         }
         i {
           font-size: 20px;

--
Gitblit v1.8.0