From 186dee8db959e83a753785290c4a02e681a6a109 Mon Sep 17 00:00:00 2001
From: ZZJ <zzjdsg2300@163.com>
Date: 星期一, 10 一月 2022 18:10:46 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/web/vue-smart-ai

---
 src/pages/gb28181/index/App.vue |  415 ++++++++++++++++++++++++++++++----------------------------
 1 files changed, 214 insertions(+), 201 deletions(-)

diff --git a/src/pages/gb28181/index/App.vue b/src/pages/gb28181/index/App.vue
index f1dd8e8..498d79b 100644
--- a/src/pages/gb28181/index/App.vue
+++ b/src/pages/gb28181/index/App.vue
@@ -9,21 +9,15 @@
         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"
-            >
+            <el-form :model="gb28181" :rules="rules" label-width="130px" class="alarmSetting" ref="gb28181">
               <!-- <el-form-item label="鍥介檯鏈嶅姟鍣↖P" prop="ServerIp">
                   <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>
@@ -74,11 +68,7 @@
                     :value="item.id"
                   ></el-option>
                 </el-select>
-                <el-button
-                  type="text"
-                  style="position: absolute"
-                  v-show="gb28181.idType === 1"
-                  @click="newGBID"
+                <el-button type="text" style="position: absolute" v-show="gb28181.idType === 1" @click="newGBID"
                   >鐢熸垚ID</el-button
                 >
               </el-form-item>
@@ -97,11 +87,7 @@
               </el-form-item>
 
               <el-form-item label="鍥芥爣绔彛" prop="GbServerPort">
-                <el-input
-                  v-model.number="gb28181.GbServerPort"
-                  placeholder="璇疯緭鍏�"
-                  size="small"
-                ></el-input>
+                <el-input v-model.number="gb28181.GbServerPort" placeholder="璇疯緭鍏�" size="small"></el-input>
               </el-form-item>
 
               <el-form-item label="寮�鍚壌鏉�" style="text-align: left">
@@ -118,9 +104,7 @@
               </el-form-item>
 
               <el-form-item style="float: right">
-                <el-button type="primary" @click="submitGB28281" size="small"
-                  >淇濆瓨</el-button
-                >
+                <el-button type="primary" @click="submitGB28281" size="small">淇濆瓨</el-button>
               </el-form-item>
             </el-form>
           </div>
@@ -132,87 +116,73 @@
             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>
-            <el-table-column
-              prop="publicid"
-              label="ID"
-              align="center"
-            ></el-table-column>
-            <el-table-column
-              prop="ip"
-              label="IP"
-              align="center"
-            ></el-table-column>
+            <el-table-column type="index" label="搴忓彿" align="center" width="50"></el-table-column>
+            <el-table-column prop="name" label="鍚嶇О" align="center"></el-table-column>
+            <el-table-column prop="publicid" label="ID" align="center"></el-table-column>
+            <el-table-column prop="ip" label="IP" align="center"></el-table-column>
             <el-table-column prop="status" label="鐘舵��" align="center">
               <template slot-scope="scope">
-                <span
-                  :style="scope.row.alive ? `color:#047d19` : 'color:#f11a1a;'"
-                  >{{ scope.row.alive ? "鍦ㄧ嚎" : "绂荤嚎" }}</span
-                >
+                <span :style="scope.row.alive ? `color:#047d19` : 'color:#f11a1a;'">{{
+                  scope.row.alive ? "鍦ㄧ嚎" : "绂荤嚎"
+                }}</span>
               </template>
             </el-table-column>
-            <el-table-column
-              prop="corp"
-              label="澶囨敞"
-              align="center"
-            ></el-table-column>
+            <el-table-column prop="corp" label="澶囨敞" align="center"></el-table-column>
           </el-table>
         </el-tab-pane>
         <el-tab-pane label="鍥芥爣鎽勫儚鏈�" name="cameras">
-          <div style="text-align: left">
-            <el-button
-              type="primary"
-              size="small"
-              @click="updateCamerasFromVideosvr"
-              >鍒锋柊</el-button
-            >
+          <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">
@@ -221,9 +191,7 @@
             / {{ TreeDataPool.gb28181ChildNodeCount }} ) 璺�
           </span>
 
-          <el-button type="primary" size="small" @click="saveChecked"
-            >淇濆瓨</el-button
-          >
+          <el-button type="primary" size="small" @click="saveChecked">淇濆瓨</el-button>
         </el-tab-pane>
       </el-tabs>
     </div>
@@ -237,23 +205,25 @@
   getGb28181AreaList,
   newGb28181ID,
   getAllSubServer,
-  saveGb28181CamTree,
-} from "./api";
+  saveGb28181CamTree
+} from "./api"
 
-import TreeMenu from "@/components/giantTree/index";
-import { isPort, isIPv4 } from "@/scripts/validate";
-import bus from "@/plugin/bus";
+import TreeMenu from "@/components/giantTree/index"
+import { isPort, isIPv4 } from "@/scripts/validate"
+import ZTree from "@/components/giantTree/zTree/ztree"
+
 export default {
   name: "Gb28181Setting",
   components: {
     TreeMenu,
+    ZTree
   },
   directives: {
     focus: {
-      inserted: function (el) {
-        el.querySelector("input").focus();
-      },
-    },
+      inserted: function(el) {
+        el.querySelector("input").focus()
+      }
+    }
   },
 
   data() {
@@ -268,46 +238,47 @@
       idType: 1,
       treeSettings: {
         check: {
-          enable: true,
-        },
-        view: {
-          showLine: true,
-          showIcon: true, // default to hide icon
-        },
+          enable: true
+        }
+      },
+      treeSettingsSelect: {
+        check: {
+          enable: false
+        }
       },
       rules: {
         ip: [
           {
             required: true,
             message: "璇疯緭鍏P鍦板潃",
-            trigger: "change",
+            trigger: "change"
           },
-          { validator: isIPv4, trigger: "change" },
+          { validator: isIPv4, trigger: "change" }
         ],
         ServerIp: [
           {
             required: true,
             message: "璇疯緭鍏P鍦板潃",
-            trigger: "change",
+            trigger: "change"
           },
-          { validator: isIPv4, trigger: "change" },
+          { validator: isIPv4, trigger: "change" }
         ],
         ServerPort: [
           {
             required: true,
             message: "璇疯緭鍏ョ鍙�",
-            trigger: "change",
+            trigger: "change"
           },
-          { validator: isPort, trigger: "change" },
+          { validator: isPort, trigger: "change" }
         ],
         GbServerPort: [
           {
             required: true,
             message: "璇疯緭鍏ョ鍙�",
-            trigger: "change",
+            trigger: "change"
           },
-          { validator: isPort, trigger: "change" },
-        ],
+          { validator: isPort, trigger: "change" }
+        ]
       },
       locationCity: {
         province: "",
@@ -315,97 +286,100 @@
         county: "",
         provinceOptions: [],
         cityOptions: [],
-        countyOptions: [],
+        countyOptions: []
       },
-    };
+      dstTreeData: []
+    }
   },
   mounted() {
-    this.TreeDataPool.multiple = true;
+    this.TreeDataPool.multiple = true
 
     // 璁板綍鐩綍鏄惁鎶樺彔
-    let foldList = localStorage.getItem("ztree_fold_list");
+    let foldList = localStorage.getItem("ztree_fold_list")
     if (foldList) {
-      this.TreeDataPool.foldNodeList = JSON.parse(foldList);
+      this.TreeDataPool.foldNodeList = JSON.parse(foldList)
     }
 
-    this.initGB28181Conf();
+    this.initGB28181Conf()
   },
   methods: {
     hanleTabClick(tab, event) {
       if (this.activeName == "subordinates") {
         getAllSubServer().then((rsp) => {
           if (rsp && rsp.success) {
-            this.subDevTable = rsp.data;
+            this.subDevTable = rsp.data
           }
-        });
+        })
       } else if (this.activeName == "cameras") {
-        this.getCamerasFromVideosvr();
+        this.getCamerasFromVideosvr()
       }
+
+      // this.TreeDataPool.fetchGbTree()
+      // this.dstTreeData = this.TreeDataPool.gb28181Data
     },
     async getCamerasFromVideosvr() {
-      this.loading = true;
-      await this.TreeDataPool.fetchVideosvrCameras(false);
-      this.loading = false;
+      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;
+      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)
-      );
+      localStorage.setItem("ztree_fold_list", JSON.stringify(this.TreeDataPool.foldNodeList))
 
       if (this.TreeDataPool.gb28181CheckedCount > 500) {
         this.$message({
           type: "warning",
-          message: "鏈�澶氫粎鏀寔閫夋嫨500璺憚鍍忔満. 璇烽噸鏂伴�夋嫨",
-        });
+          message: "鏈�澶氫粎鏀寔閫夋嫨500璺憚鍍忔満. 璇烽噸鏂伴�夋嫨"
+        })
 
-        return;
+        return
       }
 
-      this.loading = true;
+      this.loading = true
 
-      let treeData = this.TreeDataPool.newTreeByChecked(
-        this.TreeDataPool.activeTreeData
-      );
+      let treeData = this.TreeDataPool.newTreeByChecked(this.TreeDataPool.activeTreeData)
 
       saveGb28181CamTree({ checkedMenus: treeData })
         .then((rsp) => {
           if (rsp && rsp.success) {
             this.$message({
               type: "success",
-              message: "淇濆瓨鎴愬姛",
-            });
+              message: "淇濆瓨鎴愬姛"
+            })
           }
-          this.loading = false;
+          this.loading = false
         })
         .catch((err) => {
           this.$message({
             type: "error",
-            message: "淇濆瓨澶辫触",
-          });
-          this.loading = false;
-        });
+            message: "淇濆瓨澶辫触"
+          })
+          this.loading = false
+        })
     },
     initGB28181Conf() {
       getGB28181Config().then((rsp) => {
         if (rsp && rsp.success) {
-          this.gb28181 = rsp.data;
+          this.gb28181 = rsp.data
           //this.gb28181.idType = 0;
 
-          this.$set(this.gb28181, "idType", 0);
-          this.$refs["gb28181"].resetFields();
+          this.$set(this.gb28181, "idType", 0)
+          this.$refs["gb28181"].resetFields()
         }
-      });
+      })
       getGb28181AreaList().then((rsp) => {
         if (rsp && rsp.success) {
-          this.locationCity.provinceOptions = rsp.data;
+          this.locationCity.provinceOptions = rsp.data
         }
-      });
+      })
     },
     submitGB28281() {
       this.$refs["gb28181"].validate((valid) => {
@@ -414,62 +388,62 @@
             if (rsp && rsp.success) {
               this.$notify({
                 type: "success",
-                message: "GB28181璁剧疆淇濆瓨鎴愬姛",
-              });
+                message: "GB28181璁剧疆淇濆瓨鎴愬姛"
+              })
             }
-          });
+          })
         } else {
-          console.log("error submit!!");
-          return false;
+          console.log("error submit!!")
+          return false
         }
-      });
+      })
     },
     changeProvince() {
-      let pid = this.locationCity.province;
+      let pid = this.locationCity.province
       getGb28181AreaList({ parentId: pid }).then((rsp) => {
         if (rsp && rsp.success) {
-          this.locationCity.cityOptions = rsp.data;
-          this.locationCity.city = this.locationCity.cityOptions[0].id;
-          this.changeCity();
+          this.locationCity.cityOptions = rsp.data
+          this.locationCity.city = this.locationCity.cityOptions[0].id
+          this.changeCity()
         }
-      });
+      })
     },
     changeCity() {
-      let pid = this.locationCity.city;
+      let pid = this.locationCity.city
       getGb28181AreaList({ parentId: pid }).then((rsp) => {
         if (rsp && rsp.success) {
-          this.locationCity.countyOptions = rsp.data;
-          this.locationCity.county = this.locationCity.countyOptions[0].id;
+          this.locationCity.countyOptions = rsp.data
+          this.locationCity.county = this.locationCity.countyOptions[0].id
         }
-      });
+      })
     },
     newGBID() {
-      let cCode = this.locationCity.county + "";
+      let cCode = this.locationCity.county + ""
       newGb28181ID({ code: cCode }).then((rsp) => {
         if (rsp && rsp.success) {
-          this.gb28181.PublicId = rsp.data;
+          this.gb28181.PublicId = rsp.data
         }
-      });
+      })
     },
     menuOpen() {},
     menuClose() {},
     toOpenMenuList(e) {
-      let t = e.clientY - this.$el.offsetTop + 30;
-      let l = e.clientX - this.$el.offsetLeft;
+      let t = e.clientY - this.$el.offsetTop + 30
+      let l = e.clientX - this.$el.offsetLeft
 
       window.parent.postMessage(
         {
           source: location.href.split("/")[location.href.split("/").length - 1],
           trigger: "contextmenu",
           menuT: t,
-          menuL: l,
+          menuL: l
         },
         "*"
-      );
-      return false;
-    },
-  },
-};
+      )
+      return false
+    }
+  }
+}
 </script>
 <style lang="scss">
 .s-system-manage {
@@ -570,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;
 
@@ -588,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