From 1a783e0a2068b1a99efb7a078f4a615f68dec18f Mon Sep 17 00:00:00 2001
From: heyujie <516346543@qq.com>
Date: 星期一, 18 七月 2022 16:15:35 +0800
Subject: [PATCH] add desc

---
 src/views/hashrate/CameraManage/CameraRules/index.vue |   58 +++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 43 insertions(+), 15 deletions(-)

diff --git a/src/views/hashrate/CameraManage/CameraRules/index.vue b/src/views/hashrate/CameraManage/CameraRules/index.vue
index 6c3c454..f951851 100644
--- a/src/views/hashrate/CameraManage/CameraRules/index.vue
+++ b/src/views/hashrate/CameraManage/CameraRules/index.vue
@@ -6,7 +6,7 @@
           <!-- 鍦烘櫙鍙婅鍒� -->
           <div class="left-top-left">
             <div class="title">鍦烘櫙</div>
-            <slide-scene :sceneData="Camera.rules"></slide-scene>
+            <slide-scene :sceneData="Camera.allSceneRule"></slide-scene>
           </div>
 
           <!-- 绠楀姏淇℃伅杩涘害鏉� -->
@@ -178,7 +178,9 @@
           <!-- 鎽勫儚鏈� -->
           <LinkageCameraBox
             :cameras="item.cameraIds"
-            @addLinkageRule="addLinkageRule(item.cameraIds)"
+            @addLinkageRule="
+              addLinkageRule(item.cameraIds, item.camera_polygons)
+            "
           ></LinkageCameraBox>
           <div class="Anchor" :id="'linkage_camera' + index"></div>
 
@@ -242,7 +244,7 @@
       :linkEditCamera="
         ruleType === 'linkage' && editSdkObj ? editSdkObj.camera_polygons : null
       "
-      :Cameras="ruleType === 'linkage' ? Carmeras : [Camera]"
+      :Cameras="ruleType === 'linkage' ? addData.cameras : [Camera]"
     ></SdkSettingBox>
 
     <!-- 閬僵灞� -->
@@ -355,6 +357,7 @@
       },
       showNewLinkage: false,
       newLinkageIds: [],
+      newLinkPlg: null,
 
       // swiperOption: {
       //   slidesPerView: 5,
@@ -543,8 +546,6 @@
         return;
       }
 
-      console.log("init");
-
       this.plumbIns.deleteEveryConnection();
       this.connectArr.forEach((item) => {
         item.deleteEveryConnection();
@@ -587,16 +588,8 @@
         .then((rsp) => {
           if (rsp && rsp.success) {
             rules = rsp.data.rules;
-            // 缁熶竴瑙勫垯缂栬緫鐨勬暟鎹粨鏋�
-            for (let i = 0; i < rules.length; i++) {
-              rules[i].group_rules = rules[i].rules;
-            }
 
             this.linkageRule = rules;
-
-            console.log(this.linkageRule);
-
-            this.$set(this.Camera, "rules", this.Camera.rules.concat(rules));
 
             this.$nextTick(() => {
               this.connectLine2();
@@ -817,7 +810,9 @@
       this.showAddBox = true;
     },
 
-    addLinkageRule(ids) {
+    addLinkageRule(ids, camera_polygons) {
+      console.log(7979);
+      console.log(camera_polygons);
       if (ids.length < 2) {
         this.$message({
           message: "璇疯嚦灏戦�夋嫨涓ゅ彴鎽勫儚鏈�",
@@ -828,6 +823,7 @@
       this.newLinkageIds = ids;
       this.ruleType = "linkage";
       this.showAddBox = true;
+      this.newLinkPlg = camera_polygons;
     },
 
     //鍥炲~鏂扮殑鐙珛鍦烘櫙
@@ -845,6 +841,9 @@
           });
         } else {
           //鑱斿姩鍦烘櫙
+          if (this.newLinkPlg) {
+            newRule.data.camera_polygons = this.newLinkPlg;
+          }
           newRule.data.cameraIds = this.newLinkageIds;
           this.linkageRule.push(newRule.data);
           this.$nextTick(() => {
@@ -909,6 +908,35 @@
         type,
         index,
       };
+      if (this.addData.type === "linkage") {
+        this.addData.cameras = [];
+        if (
+          this.linkageRule[index].camera_polygons &&
+          this.linkageRule[index].camera_polygons.length > 0
+        ) {
+          this.linkageRule[index].camera_polygons.forEach((camera) => {
+            this.addData.cameras.push({
+              polygonData: camera.polygon,
+              cameraName: camera.camera_name,
+              cameraId: camera.camera_id,
+            });
+          });
+        } else {
+          this.linkageRule[index].camera_polygons = [];
+          this.Carmeras.forEach((camera) => {
+            this.addData.cameras.push({
+              polygonData: camera.polygonData,
+              cameraName: camera.cameraName,
+              cameraId: camera.cameraId,
+            });
+            this.linkageRule[index].camera_polygons.push({
+              polygon: camera.polygonData,
+              camera_name: camera.cameraName,
+              camera_id: camera.cameraId,
+            });
+          });
+        }
+      }
       this.showSdkBox = false;
       this.showSdkSettingBox = true;
     },
@@ -921,6 +949,7 @@
           newRule.rule_with_pre = "&&";
           newRule.is_save_anyhow = true;
         }
+
         this.SeparateRules[this.addData.index].rules.push(newRule);
       }
 
@@ -968,7 +997,6 @@
             let rules = rsp.data.rules ? rsp.data.rules : [];
             if (rules[index]) {
               this.linkageRule[index] = rules[index];
-              this.linkageRule.group_rules = this.linkageRule.rules;
             } else {
               this.linkageRule.splice(index, 1);
             }

--
Gitblit v1.8.0