소스 검색

左侧树优化

wyh 9 달 전
부모
커밋
47272ac23b

+ 18 - 8
src/components/module_interLock/UEquipmentTree/UEquipmentTree.vue

@@ -1,6 +1,10 @@
 <template>
   <div class="equipment-tree-container">
-    <a-input-search style="margin-bottom: 8px" placeholder="Search" @change="onChange" />
+    <div>
+      <a-button type="primary" icon="plus"  style="width:13%;"/>
+      <a-input-search style="width:85%;margin-left:2%" placeholder="Search" @change="onChange" />
+    </div>
+
     <div class="tree-container">
       <a-tree
         :expanded-keys="expandedKeys"
@@ -28,6 +32,7 @@
         searchValue: '',
         autoExpandParent: true,
         tpmListData: [], // 原始数据
+        // tpmTreeData: [], // 树形列表使用数据
         tpmTreeData: [], // 树形列表使用数据
         replaceFields: {
           children: 'children',
@@ -45,10 +50,13 @@
             console.log('11111',res)
             // 防止res.result对tpmListData造成地址赋值的问题
             this.tpmListData = JSON.parse(JSON.stringify(res))
-            this.tpmTreeData = this.handleTree(res, "id", "pid")
+            // 现版本
+            this.tpmTreeData = this.tpmListData
+            // 原版本
+            // this.tpmTreeData = this.handleTree(res, "id", "parentId")
             console.log(this.tpmTreeData)
           // } else {
-            
+
           // }
         })
       },
@@ -77,10 +85,12 @@
         // 循环寻找父级
         // console.log(this.findParents(this.tpmTreeData, '287813167808513'))
 
-        
 
-        
-        this.tpmTreeData = this.handleTree(filterData, "id", "pid")
+
+        // 原版本
+        // this.tpmTreeData = this.handleTree(filterData, "id", "parentId")
+        // 现版本
+        this.tpmTreeData = filterData
         // const expandedKeys = dataList.map(item => {
         //   if (item.name.indexOf(value) > -1) {
         //       // return getParentKey(item.key, gData);
@@ -97,7 +107,7 @@
       // findParents(treeData,id){
       //   let allparents = []
       //   if(treeData.length==0){
-      //     return 
+      //     return
       //   }
 
       //   let findele = (data,id) => {
@@ -111,7 +121,7 @@
       //         if(!!item.children){
       //             findele(item.children,id)
       //         }
-              
+
       //       }
       //     })
       //   }

+ 5 - 5
src/views/module_interLock/InterlockSummary/InterlockSummaryList.vue

@@ -293,7 +293,7 @@
           deleteBatch: "/summary/interlockSummary/deleteBatch",
           exportXlsUrl: "/summary/interlockSummary/exportXls",
           importExcelUrl: "summary/interlockSummary/importExcel",
-          
+
         },
         dictOptions:{},
         superFieldList:[],
@@ -319,7 +319,7 @@
           on: {
             // 鼠标移入
             mouseenter: event => {
-              // 维护一个变量记录当前行id 因为我是根据id来进行行合并的 
+              // 维护一个变量记录当前行id 因为我是根据id来进行行合并的
               this.mouseSummaryid = record.summaryid
             },
             //移除 清除id 还原样式
@@ -429,11 +429,11 @@
                 if(loopHealthLevel == that.dataSource[i].loopHealthLevel){
                   console.log(99,i,interlocknamePD,that.dataSource[i].interlockname)
                   if (interlocknamePD == that.dataSource[i].interlockname) {
-                    console.log(11111)
+                    // console.log(11111)
                     that.dataSource[i].rowSpan3 = 0
                     rowSpan3++
                   } else {
-                    console.log(22222)
+                    // console.log(22222)
                     that.dataSource[i+1].rowSpan3 = rowSpan3
                     that.dataSource[i].rowSpan3 = 0
                     rowSpan3 = 1
@@ -454,7 +454,7 @@
             that.dataSource[0].rowSpan = rowSpan
             that.dataSource[0].rowSpan2 = rowSpan2
             that.dataSource[0].rowSpan3 = rowSpan3
-            console.log(22222222222,that.dataSource)
+            // console.log(22222222222,that.dataSource)
 
 
             if(res.result.total)