|
@@ -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)
|
|
|
// }
|
|
|
-
|
|
|
+
|
|
|
// }
|
|
|
// })
|
|
|
// }
|