From a3f357e8a60443b74b64c7479113c68eb35ce1f5 Mon Sep 17 00:00:00 2001
From: ZZJ <10913410+zzj2100@user.noreply.gitee.com>
Date: 星期五, 15 七月 2022 19:44:57 +0800
Subject: [PATCH] 控制轮询

---
 src/pages/cameraAccess/components/SeparateRules.vue |   66 +++++++++-----------------------
 1 files changed, 19 insertions(+), 47 deletions(-)

diff --git a/src/pages/cameraAccess/components/SeparateRules.vue b/src/pages/cameraAccess/components/SeparateRules.vue
index ed6295b..fe51cc4 100644
--- a/src/pages/cameraAccess/components/SeparateRules.vue
+++ b/src/pages/cameraAccess/components/SeparateRules.vue
@@ -2,7 +2,7 @@
   <div class="s-separate-rules">
     <div class="ai">
       <div class="check-area">
-        <div class="ai-select">
+        <div class="ai-select" v-if="TreeDataPool.selectedNode.type !== 'MENU'">
           <div v-show="cameraType === 'camera'">
             <span>
               <span class="label">瑙嗛鍒嗘瀽澶勭悊</span>
@@ -16,7 +16,7 @@
           </div>
 
           <div
-            v-if="Camera.analytics"
+            v-if="Camera.analytics && isShowPolling === 'show'"
             class="flex-box"
             v-show="cameraType === 'camera'"
           >
@@ -160,6 +160,7 @@
                   :loading="Camera.loading"
                   :canvasWidth="canvasWidth"
                   :canvasHeight="canvasHeight"
+                  :isGB28181="Camera.gb28181"
                   @fromCanvas="getCanvasData"
                   @changeLoading="changeLoading"
                   @refresh="refresh"
@@ -299,6 +300,7 @@
   },
   data() {
     return {
+      isShowPolling: sessionStorage.getItem("isShowPolling"),
       mockSceneData: [],
       loading: false,
       Camera: new VideoRuleData(),
@@ -316,7 +318,7 @@
         },
       },
       tableRuleList: [],
-      camStatus:'',
+      camStatus: "",
       cameraId: "",
       showSysInfo: false,
       showCanvas: true,
@@ -330,7 +332,6 @@
     };
   },
   mounted() {
-    this.mockAsync();
     this.PollData.statistics();
   },
   watch: {
@@ -357,19 +358,19 @@
           switch (res.data.status) {
             case 0:
               this.camStatus = "鏈厤瑙勫垯";
-              return 
+              return;
             case 1:
               this.camStatus = "绛夊緟杞澶勭悊";
-              return 
+              return;
             case 2:
               this.camStatus = "姝e湪鎵ц鍒嗘瀽澶勭悊";
-              return 
+              return;
             case -1:
               this.camStatus = "鍏朵粬鎯呭喌瀵艰嚧鏈鐞�";
-              return
+              return;
             case -2:
               this.camStatus = "鏁呴殰瀵艰嚧鏈鐞�";
-              return
+              return;
           }
         }
       });
@@ -447,41 +448,14 @@
     swiperSlideChange() {
       this.swiperIndex = this.$refs.swiper.swiper.activeIndex;
     },
-    mockAsync() {
-      setTimeout(() => {
-        this.mockSceneData = [
-          {
-            scenename: "name1",
-            id: 1,
-            icon: ["iconrenlianjiance", "icongetijingzhi"],
-          },
-          { scenename: "name2", id: 2, icon: ["iconchouyan-copy"] },
-          {
-            scenename: "name3",
-            id: 3,
-            icon: [
-              "iconrenshukouzhao",
-              "iconchouyan-copy",
-              "iconrenlianjiance",
-              "icongetijingzhi",
-            ],
-          },
-          {
-            scenename: "name4",
-            id: 4,
-            icon: ["iconchouyan-copy", "iconrenlianjiance", "icongetijingzhi"],
-          },
-          { scenename: "name5", id: 5, icon: ["icongetijingzhi"] },
-          {
-            scenename: "name6",
-            id: 6,
-            icon: ["iconrenshukouzhao", "icongetijingzhi"],
-          },
-          { scenename: "name7", id: 7, icon: ["iconrenlianjiance"] },
-        ];
-      }, 3000);
-    },
     drawBaseImg() {
+      if (!this.Camera.cameraId) {
+        this.$notify({
+          type: "warning",
+          message: "璇峰厛閫夋嫨鎽勫儚鏈�",
+        });
+        return;
+      }
       if (Array.isArray(this.$refs.canvas)) {
         if (this.$refs.canvas.length > 0) {
           this.$refs.canvas[0].showModal();
@@ -505,12 +479,10 @@
     async initCameraData(id, type) {
       this.Camera = new VideoRuleData();
 
-      console.log("121212");
-      console.log(type);
-
       if (id && id !== "") {
         this.loading = false;
         this.Camera.cameraId = id;
+        this.Camera.gb28181 = type === 1;
         if (type === 1) {
           await this.Camera.update(true);
         } else {
@@ -571,7 +543,7 @@
           camera_ids: [this.Camera.cameraId],
           run_type: val,
         }).then((rsp) => {
-          this.getStatus()
+          this.getStatus();
           if (rsp && rsp.success) {
             this.$notify({
               type: "success",

--
Gitblit v1.8.0