Browse Source

Merge branch 'cd_bug_4132'

hbchen 7 months ago
parent
commit
e44bcf8b9f

+ 40 - 0
src/views/dataEntry_manage/coal/index.vue

@@ -62,6 +62,9 @@
           :current-node-key="select_node"
           :props="defaultProps"
           default-expand-all
+          :default-expanded-keys="defaultShowNodes"
+          @node-expand="handleNodeExpand"
+          @node-collapse="handleNodeCollapse"
           :default-checked-keys="[select_classify]"
           ref="coalTree"
           highlight-current
@@ -178,6 +181,7 @@ export default {
       select_classify_name: "", //选择的分类名称
       select_node: 0,
       isAuto: true, // 改变分类时是否自动获取数据
+      defaultShowNodes:[]
     };
   },
   methods: {
@@ -315,6 +319,7 @@ export default {
         this.haveMore = false;
         this.select_Unit = res.Data[0].Unit;
         this.select_classify = res.Data[0].ClassifyId;
+        this.orientationNode(res.Data[0].GroupId)
         this.select_UpdateTime = res.Data[0].ModifyTime;
         // 合并数据
         // this.tableOption = [{
@@ -351,6 +356,41 @@ export default {
         console.log(err);
       }
     },
+    // 左侧目录定位
+    orientationNode(Id){
+      this.select_node = Id;
+      this.$refs.coalTree.setCurrentKey(this.select_node);
+      this.defaultShowNodes.push(Id)
+      this.$nextTick(() => {
+        setTimeout(()=>{
+            let parent = document.getElementsByClassName('filter-tree')[0]
+            let node = parent.querySelector('.is-current')
+            parent.scrollTo({
+              top: node.offsetTop-200
+            })
+        },300)
+      })
+    },
+    // 树节点展开
+    handleNodeExpand(data) {
+      // 保存当前展开的节点
+      let flag = this.defaultShowNodes.some((item) => item === data.ClassifyId);
+
+      if (!flag) {
+        // 不存在则存到数组里
+        this.defaultShowNodes.push(data.ClassifyId);
+      }
+    },
+
+    // 树节点关闭
+    handleNodeCollapse(data) {
+      this.defaultShowNodes.some((item, index) => {
+        if (item === data.ClassifyId) {
+          // 删除关闭节点
+          this.defaultShowNodes.length = index;
+        }
+      });
+    },
     loadNext() {
       this.page_no++;
       this.getDataList();

+ 40 - 6
src/views/dataEntry_manage/thirdBase/YyzxData.vue

@@ -62,6 +62,9 @@
           :expand-on-click-node="false"
           check-strictly
           highlight-current
+          :default-expanded-keys="defaultShowNodes"
+          @node-expand="handleNodeExpand"
+          @node-collapse="handleNodeCollapse"
           empty-text="暂无分类"
           @current-change="nodeChangeHandle"
         >
@@ -160,6 +163,7 @@ export default {
       leftSearchVal: "", //左侧搜索值
       leftSearchTradeCode: "", //如果是搜索选择的 则有此code
       isShowSingleData: false, //右侧是否展示的是单个指标数据
+      defaultShowNodes: [], //展开的节点
     };
   },
   methods: {
@@ -253,8 +257,6 @@ export default {
         this.rightShow = true;
         if (res.Ret !== 200) return;
         const DataList = res.Data.Data || [];
-        // 设置为没有更多数据
-        this.haveMore = false;
         // 合并数据
         this.tableOption = [
           {
@@ -262,6 +264,7 @@ export default {
             ...res.Data,
           },
         ];
+        this.orientationNode(res.Data ? res.Data.ClassifyId:-1)
         // 这里是单个指标所以不用合并日期
         const arr = DataList.map((item) => item.DataTime);
         this.dateArr = [...new Set(arr)].sort().reverse();
@@ -278,16 +281,47 @@ export default {
             this.dateArr.push("");
             if (this.dateArr.length >= 12) break;
           }
-        this.select_quota = res.Data.IndexName;
-        this.select_Unit = res.Data.Unit;
-        this.select_frequency = res.Data.Frequency;
-        this.select_ModifyTime = res.Data.ModifyTime || "";
         this.dataloading = false;
         this.rightShow && this.initWidth();
       } catch (err) {
         console.log(err);
       }
     },
+    // 左侧目录定位
+    orientationNode(Id){
+      this.select_classify = Id;
+      this.defaultShowNodes.push(Id)
+      this.$refs.treeRef.setCurrentKey(Id);
+      this.$nextTick(() => {
+        setTimeout(()=>{
+          let parent = document.getElementsByClassName('scroll-wrap')[0]
+          let node = parent.querySelector('.is-current')
+          parent.scrollTo({
+            top: node.offsetTop-200
+          })
+        },300)
+      })
+    },
+    // 树节点展开
+    handleNodeExpand(data) {
+      // 保存当前展开的节点
+      let flag = this.defaultShowNodes.some((item) => item === data.ClassifyId);
+
+      if (!flag) {
+        // 不存在则存到数组里
+        this.defaultShowNodes.push(data.ClassifyId);
+      }
+    },
+
+    // 树节点关闭
+    handleNodeCollapse(data) {
+      this.defaultShowNodes.some((item, index) => {
+        if (item === data.ClassifyId) {
+          // 删除关闭节点
+          this.defaultShowNodes.length = index;
+        }
+      });
+    },
     initWidth() {
       this.$nextTick(() => {
         $(".right-box")[0].style.width =