From c208b104011e0bbdc824960ed025b597d081c78f Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期六, 18 六月 2022 01:56:31 +0800
Subject: [PATCH] 摄像机配置: 修复国标刷底图api

---
 src/pages/cameraAccess/components/SeparateRules.vue |  405 +++++++++++++++++++++++----------------------------------
 1 files changed, 161 insertions(+), 244 deletions(-)

diff --git a/src/pages/cameraAccess/components/SeparateRules.vue b/src/pages/cameraAccess/components/SeparateRules.vue
index ed6295b..19fb894 100644
--- a/src/pages/cameraAccess/components/SeparateRules.vue
+++ b/src/pages/cameraAccess/components/SeparateRules.vue
@@ -15,11 +15,7 @@
             </span>
           </div>
 
-          <div
-            v-if="Camera.analytics"
-            class="flex-box"
-            v-show="cameraType === 'camera'"
-          >
+          <div v-if="Camera.analytics" class="flex-box" v-show="cameraType === 'camera'">
             <span class="label">澶勭悊鏂瑰紡</span>
             <toggle-button
               :value="Camera.dealWay"
@@ -28,29 +24,20 @@
               :color="{
                 checked: '#3D68E1',
                 unchecked: '#FF7733',
-                disabled: '#CCCCCC',
+                disabled: '#CCCCCC'
               }"
               :sync="true"
               @change="changePoll"
             />
           </div>
-          <div
-            v-if="Camera.analytics"
-            class="flex-box"
-            v-show="cameraType === 'camera'"
-          >
+          <div v-if="Camera.analytics" class="flex-box" v-show="cameraType === 'camera'">
             <span class="label">澶勭悊鐘舵��: {{ camStatus }}</span>
           </div>
-          <div
-            v-if="Camera.analytics"
-            class="flex-box"
-            v-show="cameraType === 'camera'"
-          >
+          <div v-if="Camera.analytics" class="flex-box" v-show="cameraType === 'camera'">
             <span class="label"
               >鍒嗚鲸鐜�:
               {{
-                Camera.camearInfo.resolution_width == 0 ||
-                Camera.camearInfo.resolution_height == 0
+                Camera.camearInfo.resolution_width == 0 || Camera.camearInfo.resolution_height == 0
                   ? "鏈満鍒嗚鲸鐜�"
                   : `${Camera.camearInfo.resolution_width} * ${Camera.camearInfo.resolution_height}`
               }}</span
@@ -64,12 +51,7 @@
           <div v-if="Camera.analytics" class="flex-box">
             <span class="label">绠楁硶蹇�熼�氶亾</span>
             <div class="channel flex-box">
-              <el-tooltip
-                effect="dark"
-                content="澶嶅埗姝ゆ憚鍍忔満绠楁硶瑙勫垯"
-                placement="bottom"
-                popper-class="atooltip"
-              >
+              <el-tooltip effect="dark" content="澶嶅埗姝ゆ憚鍍忔満绠楁硶瑙勫垯" placement="bottom" popper-class="atooltip">
                 <span
                   style="color: #3d68e1; cursor: pointer; font-size: 23px"
                   @click="ctrlC"
@@ -79,9 +61,7 @@
               <el-tooltip
                 effect="dark"
                 :content="
-                  !TreeDataPool.ctrlCameraId
-                    ? '绮樿创绠楁硶瑙勫垯'
-                    : `绮樿创绠楁硶瑙勫垯锛屾潵婧愶細${TreeDataPool.ctrlCameraName}`
+                  !TreeDataPool.ctrlCameraId ? '绮樿创绠楁硶瑙勫垯' : `绮樿创绠楁硶瑙勫垯锛屾潵婧愶細${TreeDataPool.ctrlCameraName}`
                 "
                 placement="bottom"
                 popper-class="atooltip"
@@ -128,19 +108,13 @@
           <div class="draw-box">
             <div class="draw-box-title">
               <b style="font-size: 14px">缁樺埗鍖哄煙</b>
-              <span
-                class="el-dropdown-link"
-                @click="drawBaseImg"
-                style="position: relative; top: 5px; cursor: pointer"
-              >
+              <span class="el-dropdown-link" @click="drawBaseImg" style="position: relative; top: 5px; cursor: pointer">
                 <i class="iconfont iconbianji1" style="font-size: 28px"></i>
               </span>
             </div>
             <div style="width: 590px; height: 16px">
               <b style="font-size: 14px">{{
-                Camera.camearInfo.alias
-                  ? Camera.camearInfo.alias
-                  : Camera.camearInfo.name
+                Camera.camearInfo.alias ? Camera.camearInfo.alias : Camera.camearInfo.name
               }}</b>
             </div>
             <div class="img-box">
@@ -160,6 +134,7 @@
                   :loading="Camera.loading"
                   :canvasWidth="canvasWidth"
                   :canvasHeight="canvasHeight"
+                  :isGB28181="Camera.gb28181"
                   @fromCanvas="getCanvasData"
                   @changeLoading="changeLoading"
                   @refresh="refresh"
@@ -175,16 +150,9 @@
                     class="swiper-box-container2"
                     style="width: 100%"
                   >
-                    <swiper-slide
-                      v-for="(data, index) in swipercanvasData"
-                      :key="index"
-                    >
+                    <swiper-slide v-for="(data, index) in swipercanvasData" :key="index">
                       <div>
-                        <b
-                          class="video-title"
-                          style="font-size: 14px; margin-top: -10px"
-                          >{{ data.name }}</b
-                        >
+                        <b class="video-title" style="font-size: 14px; margin-top: -10px">{{ data.name }}</b>
                         <polygon-canvas
                           class="cavas"
                           ref="canvas"
@@ -208,20 +176,12 @@
                       </div>
                     </swiper-slide>
                   </swiper>
-                  <div
-                    class="swiper-local-prev"
-                    v-show="swipercanvasData.length > 1"
-                    @click="prevClick"
-                  >
+                  <div class="swiper-local-prev" v-show="swipercanvasData.length > 1" @click="prevClick">
                     <div class="icon-btn" slot="button-prev">
                       <i class="iconfont iconzuo"></i>
                     </div>
                   </div>
-                  <div
-                    class="swiper-local-next"
-                    v-show="swipercanvasData.length > 1"
-                    @click="nextClick"
-                  >
+                  <div class="swiper-local-next" v-show="swipercanvasData.length > 1" @click="nextClick">
                     <div class="icon-btn" slot="button-next">
                       <i class="iconfont iconyou1"></i>
                     </div>
@@ -259,21 +219,21 @@
 </template>
 
 <script>
-import { savePolygon } from "@/api/polygon";
+import { savePolygon } from "@/api/polygon"
 
-import { pasteRules } from "@/api/task";
-import { getCameraInfo } from "@/api/camera";
-import { saveCameraScene } from "@/api/scene";
+import { pasteRules } from "@/api/task"
+import { getCameraInfo } from "@/api/camera"
+import { saveCameraScene } from "@/api/scene"
 
-import { changeRunType } from "@/api/pollConfig";
-import { findAllFileByStackId } from "@/api/localVedio";
-import VideoRuleData from "@/Pool/VideoRuleData";
+import { changeRunType } from "@/api/pollConfig"
+import { findAllFileByStackId } from "@/api/localVedio"
+import VideoRuleData from "@/Pool/VideoRuleData"
 
-import TimeSlider from "./TimeSlider";
-import polygonCanvas from "@/components/canvas";
-import Sysinfo from "@/components/subComponents/SystemInfo";
-import SceneRule from "./SceneRule";
-import SlideScene from "./scene/SlideScene";
+import TimeSlider from "./TimeSlider"
+import polygonCanvas from "@/components/canvas"
+import Sysinfo from "@/components/subComponents/SystemInfo"
+import SceneRule from "./SceneRule"
+import SlideScene from "./scene/SlideScene"
 
 export default {
   components: {
@@ -281,21 +241,19 @@
     polygonCanvas,
     Sysinfo,
     SceneRule,
-    SlideScene,
+    SlideScene
   },
   directives: {
     focus: {
-      inserted: function (el) {
-        el.querySelector("input").focus();
-      },
-    },
+      inserted: function(el) {
+        el.querySelector("input").focus()
+      }
+    }
   },
   computed: {
     cameraType() {
-      return this.TreeDataPool.treeActiveName === "camera"
-        ? "camera"
-        : "dataStack";
-    },
+      return this.TreeDataPool.treeActiveName === "camera" ? "camera" : "dataStack"
+    }
   },
   data() {
     return {
@@ -308,15 +266,15 @@
         grabCursor: true,
         pagination: {
           el: ".swiper-pagination",
-          type: "fraction",
+          type: "fraction"
         },
         navigation: {
           nextEl: ".swiper-local-next",
-          prevEl: ".swiper-local-prev",
-        },
+          prevEl: ".swiper-local-prev"
+        }
       },
       tableRuleList: [],
-      camStatus:'',
+      camStatus: "",
       cameraId: "",
       showSysInfo: false,
       showCanvas: true,
@@ -326,29 +284,28 @@
       swiperIndex: 0,
       swipercanvasData: [],
       stackFilesPage: 1,
-      stackFilesSize: 5,
-    };
+      stackFilesSize: 5
+    }
   },
   mounted() {
-    this.mockAsync();
-    this.PollData.statistics();
+    this.PollData.statistics()
   },
   watch: {
     "Camera.cameraId": {
       handler(n, o) {
         if (n) {
           if (this.TreeDataPool.treeActiveName == "dataStack") {
-            this.stackFilesPage = 1;
-            this.stackFilesSize = 5;
-            this.stackId = n;
+            this.stackFilesPage = 1
+            this.stackFilesSize = 5
+            this.stackId = n
             if (this.stackId) {
-              this.swipercanvasData = [];
-              this.getStackFiles();
+              this.swipercanvasData = []
+              this.getStackFiles()
             }
           }
         }
-      },
-    },
+      }
+    }
   },
   methods: {
     getStatus() {
@@ -356,336 +313,296 @@
         if (res.success) {
           switch (res.data.status) {
             case 0:
-              this.camStatus = "鏈厤瑙勫垯";
-              return 
+              this.camStatus = "鏈厤瑙勫垯"
+              return
             case 1:
-              this.camStatus = "绛夊緟杞澶勭悊";
-              return 
+              this.camStatus = "绛夊緟杞澶勭悊"
+              return
             case 2:
-              this.camStatus = "姝e湪鎵ц鍒嗘瀽澶勭悊";
-              return 
+              this.camStatus = "姝e湪鎵ц鍒嗘瀽澶勭悊"
+              return
             case -1:
-              this.camStatus = "鍏朵粬鎯呭喌瀵艰嚧鏈鐞�";
+              this.camStatus = "鍏朵粬鎯呭喌瀵艰嚧鏈鐞�"
               return
             case -2:
-              this.camStatus = "鏁呴殰瀵艰嚧鏈鐞�";
+              this.camStatus = "鏁呴殰瀵艰嚧鏈鐞�"
               return
           }
         }
-      });
+      })
     },
     prevClick() {
       if (this.swiperIndex == 0) {
         if (this.stackFilesPage > 1) {
-          this.stackFilesPage--;
-          this.getStackFiles(true);
+          this.stackFilesPage--
+          this.getStackFiles(true)
         } else {
           this.$message({
             type: "info",
-            message: "褰撳墠宸叉槸绗竴椤�",
-          });
+            message: "褰撳墠宸叉槸绗竴椤�"
+          })
         }
       }
     },
     nextClick() {
       if (this.swiperIndex == this.swipercanvasData.length - 1) {
-        this.stackFilesPage++;
-        this.getStackFiles(true);
+        this.stackFilesPage++
+        this.getStackFiles(true)
       }
     },
     getStackFiles(onClick = false) {
-      this.getStackFileLoading = true;
-      let _this = this;
+      this.getStackFileLoading = true
+      let _this = this
       findAllFileByStackId({
         name: "",
         stackId: this.stackId,
         page: this.stackFilesPage,
         size: this.stackFilesSize,
-        type: 0,
+        type: 0
       })
         .then((res) => {
           if (res && res.success) {
             if (res.data.dataList.length > 0) {
-              this.swipercanvasData = [];
+              this.swipercanvasData = []
               this.swipercanvasData = res.data.dataList.map((item) => {
                 return {
                   name: item.name,
                   stackId: item.stack_id,
                   baseImg:
-                    item.type == 2
-                      ? `/files/${item.path.substr(
-                          item.path.lastIndexOf("/") + 1
-                        )}`
-                      : item.snapshot_url,
+                    item.type == 2 ? `/files/${item.path.substr(item.path.lastIndexOf("/") + 1)}` : item.snapshot_url,
                   type: item.type,
                   id: item.id,
-                  loading: false,
-                };
-              });
-              this.swiperIndex = 0;
-              this.$refs.swiper.swiper.activeIndex = 0;
+                  loading: false
+                }
+              })
+              this.swiperIndex = 0
+              this.$refs.swiper.swiper.activeIndex = 0
             } else {
               if (onClick) {
                 this.$message({
                   type: "warning",
-                  message: "宸叉棤鏇村鏁版嵁!",
-                });
+                  message: "宸叉棤鏇村鏁版嵁!"
+                })
               }
             }
           } else {
             this.$message({
               type: "error",
-              message: "鏁版嵁璇锋眰澶辫触,璇风◢鍚庨噸璇�!",
-            });
+              message: "鏁版嵁璇锋眰澶辫触,璇风◢鍚庨噸璇�!"
+            })
           }
-          this.getStackFileLoading = false;
+          this.getStackFileLoading = false
         })
         .catch((e) => {
-          this.getStackFileLoading = false;
-        });
+          this.getStackFileLoading = false
+        })
     },
     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);
+      this.swiperIndex = this.$refs.swiper.swiper.activeIndex
     },
     drawBaseImg() {
       if (Array.isArray(this.$refs.canvas)) {
         if (this.$refs.canvas.length > 0) {
-          this.$refs.canvas[0].showModal();
+          this.$refs.canvas[0].showModal()
         }
       } else {
-        this.$refs.canvas.showModal();
+        this.$refs.canvas.showModal()
       }
     },
     getCanvasData(data) {
-      let polyon = { ...data };
-      polyon.camera_id = this.Camera.cameraId;
+      let polyon = { ...data }
+      polyon.camera_id = this.Camera.cameraId
       savePolygon(polyon).then((rsp) => {
-        this.Camera.getPolygon();
+        this.Camera.getPolygon()
         //this.Camera.getCameraTask();
-      });
+      })
     },
     refresh(url) {
-      this.Camera.baseImg = url;
+      this.Camera.baseImg = url
     },
     // 鍒濆鍖栨憚鍍忔満淇℃伅锛岀埗缁勪欢璋冪敤
     async initCameraData(id, type) {
-      this.Camera = new VideoRuleData();
-
-      console.log("121212");
-      console.log(type);
+      this.Camera = new VideoRuleData()
 
       if (id && id !== "") {
-        this.loading = false;
-        this.Camera.cameraId = id;
+        this.loading = false
+        this.Camera.cameraId = id
+        this.Camera.gb28181 = type === 1
         if (type === 1) {
-          await this.Camera.update(true);
+          await this.Camera.update(true)
         } else {
-          await this.Camera.update();
+          await this.Camera.update()
         }
       }
 
-      this.$refs.timeSlider.activeTab = this.VideoManageData.TimeRules[0].id;
-      this.showSysInfo = true;
+      this.$refs.timeSlider.activeTab = this.VideoManageData.TimeRules[0].id
+      this.showSysInfo = true
       // 鍒ゆ柇姝e湪鎵ц瀹炴椂鎴栬�呰疆璇换鍔�
       this.PollData.CameraList.forEach((element) => {
         if (element.id === this.Camera.cameraId) {
-          this.runType = element.run_type;
+          this.runType = element.run_type
         }
-      });
+      })
     },
 
     saveSceneRule(groupRule) {
-      const payload = { ...groupRule };
-      payload.cameraIds = [this.Camera.cameraId];
-      let _this = this;
+      const payload = { ...groupRule }
+      payload.cameraIds = [this.Camera.cameraId]
+      let _this = this
       saveCameraScene(payload).then((rsp) => {
         if (rsp && rsp.success) {
-          this.Camera.update();
+          this.Camera.update()
           this.$notify({
             type: "success",
-            message: "绛栫暐淇濆瓨鎴愬姛锛�",
-          });
+            message: "绛栫暐淇濆瓨鎴愬姛锛�"
+          })
           //鍒锋柊宸︿晶鏍�
 
-          _this.$root.$children[0].$children[0].querySearchAsync("camera");
+          _this.$root.$children[0].$children[0].querySearchAsync("camera")
         }
-      });
+      })
     },
     delScenRule() {
-      this.Camera.update();
+      this.Camera.update()
     },
     changeLoading(params) {
-      this.loading = params;
+      this.loading = params
     },
     //鏄惁杩涜瑙嗛鍒嗘瀽澶勭悊
     pollEnable(row) {
-      let val = 0;
+      let val = 0
       if (row) {
         if (this.PollData.RealTimeSum < this.PollData.channelTotal) {
-          this.Camera.dealWay = true;
-          val = 1;
+          this.Camera.dealWay = true
+          val = 1
         } else {
-          this.Camera.dealWay = false;
-          val = 0;
+          this.Camera.dealWay = false
+          val = 0
         }
       } else {
-        this.Camera.dealWay = false;
-        val = -1;
+        this.Camera.dealWay = false
+        val = -1
       }
       if (this.Camera.cameraId && this.Camera.cameraId !== undefined) {
         changeRunType({
           camera_ids: [this.Camera.cameraId],
-          run_type: val,
+          run_type: val
         }).then((rsp) => {
           this.getStatus()
           if (rsp && rsp.success) {
             this.$notify({
               type: "success",
-              message: "閰嶇疆鎴愬姛",
-            });
+              message: "閰嶇疆鎴愬姛"
+            })
           } else {
             this.$notify({
               type: "error",
-              message: "閰嶇疆澶辫触",
-            });
+              message: "閰嶇疆澶辫触"
+            })
           }
-          this.TreeDataPool.fetchTreeData();
-        });
+          this.TreeDataPool.fetchTreeData()
+        })
       }
-      this.PollData.statisticTaskInfo();
+      this.PollData.statisticTaskInfo()
     },
     //瀹炴椂銆佽疆璇㈠垏鎹�
     changePoll(row) {
       //鍒ゆ柇鏄柊澧炶繕鏄洿鏂�
-      debugger;
+      debugger
       if (this.Camera.cameraId && this.Camera.cameraId !== undefined) {
         if (this.PollData.RealTimeSum < this.PollData.channelTotal) {
           if (row.value) {
-            this.Camera.dealWay = true;
+            this.Camera.dealWay = true
           } else {
-            this.Camera.dealWay = false;
+            this.Camera.dealWay = false
           }
-          debugger;
+          debugger
           changeRunType({
             camera_ids: [this.Camera.cameraId],
-            run_type: this.Camera.dealWay ? 1 : 0,
+            run_type: this.Camera.dealWay ? 1 : 0
           }).then((rsp) => {
             if (rsp && rsp.success) {
               this.$notify({
                 type: "success",
-                message: "閰嶇疆鎴愬姛",
-              });
+                message: "閰嶇疆鎴愬姛"
+              })
             } else {
               this.$notify({
                 type: "error",
-                message: "閰嶇疆澶辫触",
-              });
+                message: "閰嶇疆澶辫触"
+              })
             }
-          });
+          })
         } else {
           if (this.Camera.dealWay) {
-            this.Camera.dealWay = false;
-            debugger;
+            this.Camera.dealWay = false
+            debugger
             changeRunType({
               camera_ids: [this.Camera.cameraId],
-              run_type: this.Camera.dealWay ? 1 : 0,
+              run_type: this.Camera.dealWay ? 1 : 0
             }).then((rsp) => {
               if (rsp && rsp.success) {
                 this.$notify({
                   type: "success",
-                  message: "閰嶇疆鎴愬姛",
-                });
+                  message: "閰嶇疆鎴愬姛"
+                })
               } else {
                 this.$notify({
                   type: "error",
-                  message: "閰嶇疆澶辫触",
-                });
+                  message: "閰嶇疆澶辫触"
+                })
               }
-            });
+            })
           }
         }
-        this.TreeDataPool.fetchTreeData();
-        this.PollData.statisticTaskInfo();
+        this.TreeDataPool.fetchTreeData()
+        this.PollData.statisticTaskInfo()
       }
     },
     //澶嶅埗
     ctrlC() {
-      this.TreeDataPool.ctrlCameraId = this.Camera.cameraId;
-      this.TreeDataPool.ctrlCameraName = this.Camera.cameraName;
+      this.TreeDataPool.ctrlCameraId = this.Camera.cameraId
+      this.TreeDataPool.ctrlCameraName = this.Camera.cameraName
       this.$notify({
         type: "success",
-        message: "澶嶅埗绠楁硶鎴愬姛锛�",
-      });
+        message: "澶嶅埗绠楁硶鎴愬姛锛�"
+      })
     },
     ctrlV() {
       if (this.Camera.cameraId === this.TreeDataPool.ctrlCameraId) {
         this.$notify({
           type: "warning",
-          message: "涓嶈兘绮樿创鏈憚鍍忔満鐨勭畻娉曞埌鏈憚鍍忔満锛�",
-        });
-        return false;
+          message: "涓嶈兘绮樿创鏈憚鍍忔満鐨勭畻娉曞埌鏈憚鍍忔満锛�"
+        })
+        return false
       }
       pasteRules({
         sourceId: this.TreeDataPool.ctrlCameraId,
-        targetIds: [this.Camera.cameraId],
+        targetIds: [this.Camera.cameraId]
       })
         .then((res) => {
           if (res && res.success) {
             this.$notify({
               type: "success",
-              message: "绮樿创绠楁硶鎴愬姛锛�",
-            });
-            this.initCameraData(this.Camera.cameraId);
+              message: "绮樿创绠楁硶鎴愬姛锛�"
+            })
+            this.initCameraData(this.Camera.cameraId)
           } else {
             this.$notify({
               type: "error",
-              message: "绮樿创绠楁硶澶辫触锛�",
-            });
+              message: "绮樿创绠楁硶澶辫触锛�"
+            })
           }
         })
         .catch((err) => {
           this.$notify({
             type: "error",
-            message: "绮樿创绠楁硶澶辫触锛�",
-          });
-        });
-    },
-  },
-};
+            message: "绮樿创绠楁硶澶辫触锛�"
+          })
+        })
+    }
+  }
+}
 </script>
 <style lang="scss">
 .el-message--info .el-message__content {

--
Gitblit v1.8.0