From 8de8ffd91ab6f96f35cf1357fd025051471ad4af Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期四, 23 十二月 2021 13:59:08 +0800
Subject: [PATCH] 完善国标树配置功能

---
 src/pages/gb28181/index/App.vue |  172 +++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 124 insertions(+), 48 deletions(-)

diff --git a/src/pages/gb28181/index/App.vue b/src/pages/gb28181/index/App.vue
index 76a50b0..498d79b 100644
--- a/src/pages/gb28181/index/App.vue
+++ b/src/pages/gb28181/index/App.vue
@@ -9,7 +9,7 @@
         type="border-card"
         @tab-click="hanleTabClick"
       >
-        <el-tab-pane label="鍥芥爣ID" name="gb28181">
+        <el-tab-pane label="鍥芥爣鏈嶅姟" name="gb28181">
           <div style="width: 775px">
             <!-- GB28181璁剧疆 -->
             <el-form :model="gb28181" :rules="rules" label-width="130px" class="alarmSetting" ref="gb28181">
@@ -17,7 +17,7 @@
                   <ip-input :ip="gb28181.ServerIp" @on-blur="gb28181.ServerIp = arguments[0]"></ip-input>
               </el-form-item>-->
 
-              <div style="text-align: left; margin-bottom: 16px">
+              <div style="text-align: left;margin-bottom: 16px;">
                 <el-radio-group v-model="gb28181.idType">
                   <el-radio :label="0">杈撳叆宸叉湁ID</el-radio>
                   <el-radio :label="1">鐢熸垚鏂扮殑ID</el-radio>
@@ -116,12 +116,8 @@
             border
             fit
             highlight-current-row
-            style="width: 100%; color: #000"
-            :header-cell-style="{
-              background: '#f8f8f8',
-              color: '#222222',
-              height: '30px'
-            }"
+            style="width: 100%; color:#000"
+            :header-cell-style="{ background: '#f8f8f8', color: '#222222', height: '30px' }"
           >
             <el-table-column type="index" label="搴忓彿" align="center" width="50"></el-table-column>
             <el-table-column prop="name" label="鍚嶇О" align="center"></el-table-column>
@@ -138,29 +134,55 @@
           </el-table>
         </el-tab-pane>
         <el-tab-pane label="鍥芥爣鎽勫儚鏈�" name="cameras">
-          <div style="text-align: left">
+          <div style="text-align:left">
             <el-button type="primary" size="small" @click="updateCamerasFromVideosvr">鍒锋柊</el-button>
           </div>
-          <div class="camera-title">
-            <b>鍥芥爣鎽勫儚鏈洪厤缃�</b>
-            <span>(鏈�澶氬嬀閫�500璺憚鍍忔満)</span>
-          </div>
-          <tree-menu
-            ref="tree"
-            app="gb28181"
-            treeName="localTree"
-            :node="TreeDataPool.treeData"
-            :height="treeHeight"
-            :setting="treeSettings"
-            clickType="multiple"
-            style="width: 600px; min-height: 500px"
-          />
-          <div class="base-image" v-loading="TreeDataPool.baseImageLoading">
-            <span>{{ TreeDataPool.cameraNameForBaseImage }}</span>
-            <div class="camera-image" v-show="TreeDataPool.cameraNameForBaseImage.length">
-              <img :src="'data:image/png;base64,' + TreeDataPool.gb28181CameraBaseImage" width="450px" alt />
+
+          <div class="tree-container">
+            <div class="tree-box">
+              <div class="camera-title">
+                <b>鍥芥爣鎽勫儚鏈�</b>
+              </div>
+              <tree-menu
+                ref="ztree"
+                app="gb28181"
+                treeName="localTree"
+                clickType="multiple"
+                :node="TreeDataPool.treeData"
+                :height="treeHeight"
+                :setting="treeSettings"
+                @itemChecked="onItemCheck"
+                search
+                style="width:500px;min-height:500px"
+              />
+            </div>
+
+            <div class="tree-box">
+              <div class="camera-title">
+                <b>宸查�夋憚鍍忔満</b>
+                <span>(鏈�澶氬嬀閫�500璺憚鍍忔満)</span>
+              </div>
+              <!-- <tree-menu
+                ref="dstTree"
+                treeName="localTree"
+                :node="dstTreeData"
+                :height="treeHeight"
+                :setting="treeSettingsSelect"
+                style="width:500px;min-height:500px"
+              /> -->
+              <div class="select-tree-menu" :style="`max-height:${750 - 200}px;`">
+                <z-tree :nodes="dstTreeData" :show-checkbox="false" :gb28181="true" search />
+              </div>
+            </div>
+
+            <div class="base-image" v-loading="TreeDataPool.baseImageLoading">
+              <span>{{ TreeDataPool.cameraNameForBaseImage }}</span>
+              <div class="camera-image" v-show="TreeDataPool.cameraNameForBaseImage.length">
+                <img :src="'data:image/png;base64,' + TreeDataPool.gb28181CameraBaseImage" width="450px" alt />
+              </div>
             </div>
           </div>
+
           <el-divider></el-divider>
 
           <span class="camera-seleted-text">
@@ -188,11 +210,13 @@
 
 import TreeMenu from "@/components/giantTree/index"
 import { isPort, isIPv4 } from "@/scripts/validate"
-import bus from "@/plugin/bus"
+import ZTree from "@/components/giantTree/zTree/ztree"
+
 export default {
   name: "Gb28181Setting",
   components: {
-    TreeMenu
+    TreeMenu,
+    ZTree
   },
   directives: {
     focus: {
@@ -215,6 +239,11 @@
       treeSettings: {
         check: {
           enable: true
+        }
+      },
+      treeSettingsSelect: {
+        check: {
+          enable: false
         }
       },
       rules: {
@@ -258,7 +287,8 @@
         provinceOptions: [],
         cityOptions: [],
         countyOptions: []
-      }
+      },
+      dstTreeData: []
     }
   },
   mounted() {
@@ -283,16 +313,23 @@
       } else if (this.activeName == "cameras") {
         this.getCamerasFromVideosvr()
       }
+
+      // this.TreeDataPool.fetchGbTree()
+      // this.dstTreeData = this.TreeDataPool.gb28181Data
     },
     async getCamerasFromVideosvr() {
       this.loading = true
       await this.TreeDataPool.fetchVideosvrCameras(false)
+      this.dstTreeData = this.TreeDataPool.newTreeByChecked(this.TreeDataPool.treeData)
       this.loading = false
     },
     async updateCamerasFromVideosvr() {
       this.loading = true
       await this.TreeDataPool.fetchVideosvrCameras(true)
       this.loading = false
+    },
+    onItemCheck() {
+      this.dstTreeData = this.TreeDataPool.newTreeByChecked(this.TreeDataPool.activeTreeData)
     },
     saveChecked() {
       localStorage.setItem("ztree_fold_list", JSON.stringify(this.TreeDataPool.foldNodeList))
@@ -507,16 +544,6 @@
     text-decoration: underline;
   }
 
-  .camera-title {
-    text-align: left;
-    padding: 0px 10px;
-    margin: 5px 0px;
-    height: 33px;
-    background-color: #e4e2e2;
-    line-height: 33px;
-    font-size: 14px;
-  }
-
   .camera-seleted-text {
     margin-right: 20px;
 
@@ -525,15 +552,64 @@
     }
   }
 
-  .base-image {
-    position: absolute;
-    top: 18%;
-    left: 57%;
-    width: 450px;
+  .tree-container {
+    display: flex;
+    .tree-box {
+      width: 500px;
+      margin: 5px 10px 0px 0px;
+      border: 1px solid #e4e2e2;
 
-    .camera-image {
-      background-color: black;
-      height: 254px;
+      .camera-title {
+        text-align: left;
+        padding: 0px 10px;
+        margin: 0px 0px;
+        height: 33px;
+        background-color: #e4e2e2;
+        line-height: 33px;
+        font-size: 14px;
+      }
+    }
+
+    .base-image {
+      margin: 140px 10px;
+      width: 450px;
+      height: 300px;
+
+      .camera-image {
+        background-color: black;
+        height: 254px;
+      }
+    }
+    .select-tree-menu {
+      // max-width: 350px;
+      overflow-x: hidden;
+      overflow-y: hidden;
+      margin-bottom: 4px;
+    }
+    .select-tree-menu::-webkit-scrollbar {
+      /*婊氬姩鏉℃暣浣撴牱寮�*/
+      width: 4px; /*楂樺鍒嗗埆瀵瑰簲妯珫婊氬姩鏉$殑灏哄*/
+      height: 4px;
+    }
+    .select-tree-menu::-webkit-scrollbar-thumb {
+      /*婊氬姩鏉¢噷闈㈠皬鏂瑰潡*/
+      border-radius: 5px;
+      -webkit-box-shadow: inset 0 0 5px rgba(157, 165, 183, 0);
+      background: rgb(202, 201, 201);
+    }
+    .select-tree-menu::-webkit-scrollbar-track {
+      /*婊氬姩鏉¢噷闈㈣建閬�*/
+      -webkit-box-shadow: inset 0 0 5px rgba(157, 165, 183, 0);
+      border-radius: 0;
+      background: rgb(235, 234, 234);
+    }
+    .select-tree-menu::-webkit-scrollbar-thumb:hover {
+      background: rgba(0, 0, 0, 0.4);
+    }
+    .select-tree-menu:hover {
+      overflow-x: visible;
+      overflow-y: auto;
+      margin-bottom: 0px;
     }
   }
 }

--
Gitblit v1.8.0