From 2379a27a8b2e4368dc2079557525aeed6a11c631 Mon Sep 17 00:00:00 2001
From: hanbaoshan <hanbaoshan@aiotlink.com>
Date: 星期四, 22 十月 2020 14:10:31 +0800
Subject: [PATCH] 修复目录树切换数据栈treeNodes传入空串的bug

---
 src/pages/search/index/Searching.vue |   71 +++++++++++++++++++----------------
 1 files changed, 38 insertions(+), 33 deletions(-)

diff --git a/src/pages/search/index/Searching.vue b/src/pages/search/index/Searching.vue
index 7cd82d6..e42a814 100644
--- a/src/pages/search/index/Searching.vue
+++ b/src/pages/search/index/Searching.vue
@@ -243,7 +243,7 @@
     Card,
     UploadImg
   },
-  data() {
+  data () {
     return {
       cardWidth: "",
       center: "",
@@ -267,14 +267,14 @@
     };
   },
 
-  created() {
+  created () {
     this.TreeDataPool.readonly = true;
     this.TreeDataPool.gbReadonly = true;
     this.TreeDataPool.multiple = true;
     this.TreeDataPool.clean();
     this.TreeDataPool.fetchTreeData();
   },
-  mounted() {
+  mounted () {
     this.$nextTick(() => {
       let scrollContain = this.$refs.scrollContain
       this.VideoPhotoData.scrollContainDom = scrollContain
@@ -314,6 +314,7 @@
       this.searchTime = this.getDateInit();
       this.VideoPhotoData.searchTime = this.getDateInit();
       // this.VideoPhotoData.querySearchList();
+      console.log('mounted 鏌ヨes')
       this.setLoadSearch(this.VideoPhotoData.querySearchList());
     }
 
@@ -327,7 +328,7 @@
       });
     });
   },
-  destroyed() {
+  destroyed () {
     window.removeEventListener("resize", this.getHeight);
     this.CardList.details = [];
     // this.TreeDataPool.treeActiveName = "camera";
@@ -342,12 +343,13 @@
     this.VideoPhotoData.selectWhites = [];
   },
   watch: {
-    "TreeDataPool.showTreeBox"(value) {
+    "TreeDataPool.showTreeBox" (value) {
       this.getHeight();
       if (this.VideoPhotoData.realSmallPath.length > 0) {
         this.VideoPhotoData.findPersonByPage();
       } else {
         // this.VideoPhotoData.querySearchList();
+        console.log('showTreeBox 鏌ヨes')
         this.setLoadSearch(this.VideoPhotoData.querySearchList());
       }
     },
@@ -366,6 +368,7 @@
             this.VideoPhotoData.findPersonByPage()
           } else {
             // this.VideoPhotoData.querySearchList();
+            console.log('TreeDataPool.selectedNodes 鏌ヨes')
             this.setLoadSearch(this.VideoPhotoData.querySearchList());
           }
         }
@@ -373,14 +376,15 @@
       deep: true    //娣卞害鐩戝惉
     },
     "DataStackPool.selectedDir": {
-      handler(nodes, oldNodes) {
-        if (nodes !== oldNodes) {
+      handler (nodes, oldNodes) {
+        if (nodes !== oldNodes && nodes.id != "") {
           // this.VideoPhotoData.treeNodes = nodes.map(i=>{return i.id});
           this.VideoPhotoData.treeNodes = [nodes.id];
           if (this.VideoPhotoData.uploadType) {
             this.VideoPhotoData.findPersonByPage()
           } else {
             // this.VideoPhotoData.querySearchList();
+            console.log('DataStackPool.selectedDir 鏌ヨes')
             this.setLoadSearch(this.VideoPhotoData.querySearchList());
           }
         }
@@ -441,7 +445,7 @@
     }
   },
   methods: {
-    isShowUpload() {
+    isShowUpload () {
       console.log('isShowUpload', this.VideoPhotoData.uploadDiaplay)
       this.getHeight();
       console.log("upload鐨勫�兼槸锛�", this.VideoPhotoData.uploadDiaplay)
@@ -463,13 +467,13 @@
         this.VideoPhotoData.showType = "search";
       }
     },
-    resizeWidth(w) {
+    resizeWidth (w) {
       this.defaultWidth = w;
     },
-    resizeHeight(h) {
+    resizeHeight (h) {
       this.defaultHeight = h;
     },
-    getHeight() {
+    getHeight () {
       let w = this.$refs.mid.offsetWidth;
       let integer = parseInt(w / 330);
       let integerSearchImg = parseInt((w - 300) / 325);
@@ -481,10 +485,10 @@
       this.cardWidth = `calc(${100 / integer}% - 20px)`;
       this.searchImgCardWidth = `calc(${100 / integerSearchImg}% - 20px)`;
     },
-    uploadChange() {
+    uploadChange () {
       this.VideoPhotoData.uploadDiaplay = false;
     },
-    blackAngWhite() {
+    blackAngWhite () {
       if (this.VideoPhotoData.selectBlacks.length > 0) {
         for (let i = 0; i < this.VideoPhotoData.whiteList.length; i++) {
           //this.VideoPhotoData.whiteList[i].disabled = true
@@ -510,7 +514,7 @@
         }
       }
     },
-    saveAddBase(item, index) {
+    saveAddBase (item, index) {
       if (this.VideoPhotoData.selectBlacks.length === 0 && this.VideoPhotoData.selectWhites.length === 0) {
         this.$notify({
           title: "娉ㄦ剰",
@@ -540,7 +544,7 @@
         this.VideoPhotoData.selectWhites = []
       })
     },
-    getDetails(ev, index) {
+    getDetails (ev, index) {
       //let obj = this.CardList.datalist[index];
       this.CardList.datalist = this.VideoPhotoData.cards;
       let obj = this.CardList.datalist[index];
@@ -550,17 +554,17 @@
       // this.CardList.details.push(obj);
       this.VideoPhotoData.activeCard = obj.activeObject.id;
     },
-    toAdd(item) {
+    toAdd (item) {
       this.CardList.addBaseList.push(item)
     },
-    handleClose(done) {
+    handleClose (done) {
       this.$confirm('纭鍏抽棴锛�')
         .then(_ => {
           done();
         })
         .catch(_ => { });
     },
-    showUpload() {
+    showUpload () {
       this.VideoPhotoData.uploadDiaplay = !this.VideoPhotoData.uploadDiaplay;
       //鍒濆鍖栨暟鎹�
       this.VideoPhotoData.clearStatus();
@@ -570,7 +574,7 @@
       // }
       //this.VideoPhotoData.uploadImg = require("C:/Users/mdesign/Desktop/cvasdv.jpg");
     },
-    getDateInit() {
+    getDateInit () {
       // 瑕佹眰 榛樿涓�涓湀
       const end = new Date();
       const start = new Date();
@@ -586,13 +590,13 @@
         this.$moment(end).format("YYYY-MM-DD HH:mm:ss")
       ];
     },
-    format(array) {
+    format (array) {
       return [
         this.$moment(array[0]).format("YYYY-MM-DD HH:mm:ss"),
         this.$moment(array[1]).format("YYYY-MM-DD HH:mm:ss")
       ];
     },
-    searchingBtn() {
+    searchingBtn () {
       // let obj = document.getElementById('searchMid');
       // console.log(obj,'target',document)
       // let load = this.$loading({
@@ -620,6 +624,7 @@
         this.VideoPhotoData.uploadDiaplay = false;
         //this.VideoPhotoData.page = this.currentPage;
         // this.VideoPhotoData.querySearchList();
+        console.log('鎼滅储鎸夐挳瑙﹀彂 鏌ヨes')
         this.setLoadSearch(this.VideoPhotoData.querySearchList());
       } else {
         console.log("浠ュ浘鎼滃浘");
@@ -628,7 +633,7 @@
         this.setLoadSearch(this.VideoPhotoData.findPersonByPage());
       }
     },
-    stringToNum() {
+    stringToNum () {
       var arr = [];
       this.alarmValues.forEach(element => {
         if (element == "-1") {
@@ -653,7 +658,7 @@
       // console.log("杈撳嚭鐨勬暟缁勶細", arr);
       return arr;
     },
-    changePages(page) {
+    changePages (page) {
       this.VideoPhotoData.page = page;
       if (!this.VideoPhotoData.uploadType) {
         console.log("鍒嗛〉鏀瑰彉锛�")
@@ -665,10 +670,10 @@
         this.setLoadSearch(this.VideoPhotoData.findPersonByPage());
       }
     },
-    closeWindow(index) {
+    closeWindow (index) {
       this.CardList.addBaseList.splice(index, 1);
     },
-    handleSizeChange(integer, integerSearchImg) {
+    handleSizeChange (integer, integerSearchImg) {
       if (this.VideoPhotoData.uploadDiaplay) {
         this.VideoPhotoData.size = integerSearchImg * 10;
         //this.VideoPhotoData.findPersonByPage();
@@ -677,7 +682,7 @@
         //this.VideoPhotoData.querySearchList();
       }
     },
-    sizeChange(size) {
+    sizeChange (size) {
       if (this.VideoPhotoData.uploadType) {
         this.VideoPhotoData.size = size;
         this.VideoPhotoData.findPersonByPage();
@@ -688,7 +693,7 @@
         this.setLoadSearch(this.VideoPhotoData.querySearchList());
       }
     },
-    clearSearch() {
+    clearSearch () {
       this.tagValues = []
       this.taskValues = []
       this.alarmValues = []
@@ -706,25 +711,25 @@
         this.setLoadSearch(this.VideoPhotoData.findPersonByPage());
       }
     },
-    disabled(data) {
+    disabled (data) {
       this.isDisabled = data;
     },
-    getCenter() {
+    getCenter () {
       this.center = {
         x: document.documentElement.clientWidth / 2 - 250,
         y: document.documentElement.clientHeight / 2 - 200
       };
     },
-    setLoadSearch(fn) {
+    setLoadSearch (fn) {
       this.AuthData.setLoading("searchMid", this);
       fn.then(_ => {
         this.AuthData.closeLoad();
       })
     },
-    getUrlKey(name) {
+    getUrlKey (name) {
       return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ""])[1].replace(/\+/g, '%20')) || null
     },
-    tagChange(obj) {
+    tagChange (obj) {
       console.log(obj)
       if (obj.length > 0) {
         this.showType = "compare";
@@ -936,7 +941,7 @@
       width: 100%;
       height: 100%;
       .el-loading-spinner-search {
-        background: url("/images/search/searchLoading.gif") no-repeat;
+        background: url('/images/search/searchLoading.gif') no-repeat;
       }
     }
   }

--
Gitblit v1.8.0