From c7ec9e17f6e48335912bad1c07df56ba8eb8f662 Mon Sep 17 00:00:00 2001
From: heyujie <516346543@qq.com>
Date: 星期四, 05 五月 2022 13:35:21 +0800
Subject: [PATCH] page subuser

---
 src/views/hashrate/CameraManage/CameraRules/components/LinkageCameraBox.vue |   50 ++++++++++++++++++++++++++++++++++----------------
 1 files changed, 34 insertions(+), 16 deletions(-)

diff --git a/src/views/hashrate/CameraManage/CameraRules/components/LinkageCameraBox.vue b/src/views/hashrate/CameraManage/CameraRules/components/LinkageCameraBox.vue
index e666862..7990282 100644
--- a/src/views/hashrate/CameraManage/CameraRules/components/LinkageCameraBox.vue
+++ b/src/views/hashrate/CameraManage/CameraRules/components/LinkageCameraBox.vue
@@ -16,7 +16,7 @@
         </div>
 
         <div class="body">
-          <div class="row">
+          <div class="row" v-if="camera.analytics">
             <div class="label">澶勭悊鏂瑰紡:</div>
             <div
               class="button pollingBtn"
@@ -35,15 +35,14 @@
           </div>
           <div class="row">
             <div class="label">鍒嗚鲸鐜�:</div>
-            <div
-              class="data"
-              v-if="camera.camearInfo.resolution_width != undefined"
-            >
+            <div class="data">
               {{
-                camera.camearInfo.resolution_width == 0 ||
-                camera.camearInfo.resolution_height == 0
+                !camera.camearInfo.resolutionWidth ||
+                !camera.camearInfo.resolutionHeight ||
+                camera.camearInfo.resolutionWidth == 0 ||
+                camera.camearInfo.resolutionHeight == 0
                   ? "鏈満鍒嗚鲸鐜�"
-                  : `${camera.camearInfo.resolution_width} * ${camera.camearInfo.resolution_height}`
+                  : `${camera.camearInfo.resolutionWidth} * ${camera.camearInfo.resolutionHeight}`
               }}
             </div>
           </div>
@@ -61,7 +60,7 @@
 
 <script>
 import { changeRunType } from "@/api/pollConfig";
-import VideoRuleData from "@/Pool/VideoRuleData";
+import { getCameraInfo } from "@/api/camera";
 
 export default {
   props: {
@@ -121,19 +120,21 @@
 
     //瀹炴椂銆佽疆璇㈠垏鎹�
     changePoll(row, index) {
-      if (!this.cameraArr[index].analytics) {
-        return;
-      }
-
       //鍒ゆ柇鏄柊澧炶繕鏄洿鏂�
+      console.log(this.cameraArr[index]);
+
       if (
         this.cameraArr[index].cameraId &&
         this.cameraArr[index].cameraId !== undefined
       ) {
+        console.log(1);
         if (this.PollData.RealTimeSum < this.PollData.channelTotal) {
           if (row) {
+            console.log(2);
             this.cameraArr[index].dealWay = true;
           } else {
+            console.log(3);
+
             this.cameraArr[index].dealWay = false;
           }
           changeRunType({
@@ -184,12 +185,29 @@
     },
 
     getCameraInfo() {
-      this.cameras.forEach((id) => {
-        let newCamera = new VideoRuleData(id);
-        this.cameraArr.push(newCamera);
+      this.cameraArr = [];
+      this.cameras.forEach(async (id) => {
+        const rsp = await getCameraInfo(id);
+        if (rsp.success) {
+          this.cameraArr.push({
+            cameraId: rsp.data.id,
+            cameraName: rsp.data.name ? rsp.data.name : "",
+            analytics: rsp.data.runType !== -1 ? true : false,
+            dealWay: rsp.data.runType == 1 ? true : false,
+            camearInfo: {
+              resolutionWidth: rsp.data.resolutionWidth,
+              resolutionHeight: rsp.data.resolutionHeight,
+            },
+          });
+        }
       });
     },
   },
+  watch: {
+    cameras() {
+      this.getCameraInfo();
+    },
+  },
 };
 </script>
 

--
Gitblit v1.8.0