Browse Source

ETA1.3.9上线

jwyu 1 năm trước cách đây
mục cha
commit
1559dbe1e1

+ 9 - 0
src/api/modules/thirdBaseApi.js

@@ -81,6 +81,10 @@ const smmDataInterface = {
 	classifyList: params => {
 		return http.get('/datamanage/smm/classify',params);
 	},
+	// 分类下的指标列表
+	edbListForClassify:params=>{
+		return http.get('/datamanage/smm/index/list',params)
+	},
 	/**
 	 * 获取指标目录详情
 	 * @param {ClassifyId}  分类id
@@ -235,6 +239,11 @@ const steelInterface = {
 		return http.get('/datamanage/mysteel_chemical/classify')
 	},
 
+	//指标懒加载
+	edbListForClassify:params=>{
+		return http.get('/datamanage/mysteel_chemical/index/list',params)
+	},
+
 	/**
 	 * 编辑分类 ClassifyName BaseFromMysteelChemicalClassifyId ParentId  Level
 	 * @param {*} params 

+ 6 - 0
src/views/dataEntry_manage/thirdBase/components/targetDialog.vue

@@ -37,6 +37,7 @@
               }"
               style="width: 90%"
               placeholder="请选择分类"
+              ref='classifyIns'
             />
           </el-form-item>
           <el-form-item label="指标ID" prop="from_edb_code">
@@ -202,6 +203,9 @@ export default {
           }]);
       if (Ret !== 200) return;
 
+      //获取所选的父级分类数据id
+      const selectClassifyNodes=this.$refs.classifyIns.getCheckedNodes()[0].path
+      console.log(selectClassifyNodes);
       if (!edb_id) {
         //新增
         this.isAddLoading = true;
@@ -209,6 +213,7 @@ export default {
           this.cancelHandle();
           this.$emit("successCallback", {
             code: Data.UniqueCode,
+            selectClassifyNodes:selectClassifyNodes,
             id: Data.BaseFromMysteelChemicalIndexId,
           });
         }, 20000);
@@ -217,6 +222,7 @@ export default {
         this.cancelHandle();
         this.$emit("successCallback", {
           code: Data.UniqueCode,
+          selectClassifyNodes:selectClassifyNodes,
           id: Data.BaseFromMysteelChemicalIndexId,
         });
       }

+ 7 - 1
src/views/dataEntry_manage/thirdBase/mixins/leftMixin.js

@@ -48,7 +48,12 @@ export default {
         this.defaultShowNodes = arr;
       }
       this.select_node = code;
-      this.$refs.treeRef.setCurrentKey(this.select_node);
+      this.$nextTick(()=>{
+        setTimeout(() => {
+          this.$refs.treeRef.setCurrentKey(this.select_node);
+        }, 300);
+      })
+      
       // // 重置筛选状态
       this.edb_id = id;
       this.getFrequency();
@@ -72,6 +77,7 @@ export default {
 
     /* 拖动时node宽度跟随变化 */
     resetNodeStyle: _.debounce(function(node) {
+      console.log(node);
 			const tree = $('.target_tree')[0];
 			let width = tree.offsetWidth;
 			let label_wid =

+ 46 - 9
src/views/dataEntry_manage/thirdBase/smmTargetbase.vue

@@ -55,12 +55,15 @@
           :props="{
             label: 'ClassifyName',
             children: 'Children',
+            isLeaf:'isLeaf'
           }"
           draggable
           :current-node-key="select_node"
           :expand-on-click-node="false"
           check-strictly
           empty-text="暂无分类"
+          lazy
+					:load="getLazyTreeData"
           @current-change="nodeChangeHandle"
           :default-expanded-keys="defaultShowNodes"
           @node-expand="handleNodeExpand"
@@ -377,6 +380,37 @@ export default {
       });
       return arr;
     },
+    // 懒加载指标
+    async getLazyTreeData(node,resolve){
+      // console.log(node);
+      let arr=[]
+      // 点击二级分类或者一级分类但是分类id为0的
+      if((node.level===2&&node.data.ClassifyId!=0)||(node.level===1&&node.data.ClassifyId==0)){
+        const res=await smmDataInterface.edbListForClassify({ClassifyId:node.data.ClassifyId})
+        if(res.Ret===200){
+          const temarr = res.Data.List || [];
+					arr=temarr.map(item=>{
+						return {
+							...item,
+              UniqueCode:`${item.ClassifyId}_${item.BaseFromSmmIndexId}_${item.BaseFromSmmIndexCode}`,
+              Button:{
+                AddButton: false,
+                OpButton: true,
+                DeleteButton: false,
+                MoveButton: true,
+                cleanButton: true,
+                targetDelButton: true,
+              },
+							isLeaf:true
+						}
+					})
+        }
+      }
+      if(node.level===1&&node.data.ClassifyId!==0){
+        arr=node.data.Children||[]
+      }
+      resolve(arr)
+    },
     /* 获取频度 */
     async getFrequency(defaultSelect) {
       const res = await smmDataInterface.frequencyList({
@@ -621,7 +655,7 @@ export default {
 
       this.$nextTick(() => {
         //找到父节点并展开
-        const targetData = this.getTargetData(e.IndexCode, this.classifyList);
+        const targetData = this.getTargetData(e.ClassifyId, this.classifyList);
         if (targetData) {
           //一级节点
           const { topParentNodeId, UniqueCode } = targetData;
@@ -636,11 +670,14 @@ export default {
           let width = tree.offsetWidth;
           let label_width =
             width > 500 ? "auto" : width <= 500 ? 90 : 0.7 * width;
-          targetData.NodeWidth = label_width;
-          this.select_node = UniqueCode;
-          this.$refs.treeRef.setCurrentNode(targetData);
-          const node = this.$refs.treeRef.getCurrentNode();
-          this.resetNodeStyle(node);
+          // targetData.NodeWidth = label_width;
+          this.select_node = `${e.ClassifyId}_${e.BaseFromSmmIndexId}_${e.IndexCode}`;
+
+          setTimeout(() => {
+            this.$refs.treeRef.setCurrentKey(this.select_node);
+            const node = this.$refs.treeRef.getNode(this.select_node);
+            this.resetNodeStyle(node);
+          }, 1000);
         }
         //this.handleScrollLeftWrap()
       });
@@ -652,11 +689,11 @@ export default {
         scrollTop: top - 200,
       });
     },
-    getTargetData(code, arr) {
+    getTargetData(ClassifyId, arr) {
       for (const item of arr) {
-        if (item.BaseFromSmmIndexCode === code) return item;
+        if (item.ClassifyId === ClassifyId) return item;
         if (item.Children && item.Children.length) {
-          const _item = this.getTargetData(code, item.Children);
+          const _item = this.getTargetData(ClassifyId, item.Children);
           if (_item) return _item;
         }
       }

+ 28 - 1
src/views/dataEntry_manage/thirdBase/steelChemicalbase.vue

@@ -48,6 +48,7 @@
           :props="{
             label: 'ClassifyName',
             children: 'Children',
+            isLeaf:'isLeaf'
           }"
           :allow-drag="canDragHandle"
           :allow-drop="canDropHandle"
@@ -57,6 +58,8 @@
           :expand-on-click-node="false"
           check-strictly
           empty-text="暂无分类"
+          lazy
+					:load="getLazyTreeData"
           @node-expand="handleNodeExpand"
           @node-collapse="handleNodeCollapse"
           @current-change="nodeChangeHandle"
@@ -310,6 +313,28 @@ export default {
         });
       });
     },
+    //指标懒加载
+    async getLazyTreeData(node,resolve){
+      let arr=[]
+      if(node.level===2){
+        const res=await steelInterface.edbListForClassify({
+          BaseFromMysteelChemicalClassifyId:node.data.BaseFromMysteelChemicalClassifyId
+        })
+        if(res.Ret===200){
+          const temarr=res.Data.List||[]
+          arr=temarr.map(item=>{
+            return {
+              ...item,
+              isLeaf:true
+            }
+          })
+        }
+      }else{
+        arr=node.data.Children||[]
+      }
+
+      resolve(arr)
+    },
 
     /* 获取频度 */
     getFrequency(defaultSelect) {
@@ -507,7 +532,9 @@ export default {
 
       this.leftSearchVal = e.IndexName;
 
-      this.getClassify({ code: e.UniqueCode, id: e.Id });
+      // 父级
+      let selectClassifyNodes=[`${e.ParentClassifyId}`,`${e.BaseFromMysteelChemicalClassifyId}`]
+      this.getClassify({ code: e.UniqueCode, id: e.Id ,selectClassifyNodes});
     },
 
     /* 编辑分类 */