|
@@ -31,7 +31,7 @@
|
|
|
tpmTreeData: [], // 树形列表使用数据
|
|
|
replaceFields: {
|
|
|
children: 'children',
|
|
|
- title: 'name',
|
|
|
+ title: 'interlockName',
|
|
|
},
|
|
|
}
|
|
|
},
|
|
@@ -41,14 +41,15 @@
|
|
|
methods: {
|
|
|
getTpmTreeData(){
|
|
|
getAction(`/base/interlockBase/lever12`).then(res=>{
|
|
|
- if (res.success) {
|
|
|
+ // if (res.success) {
|
|
|
+ console.log('11111',res)
|
|
|
// 防止res.result对tpmListData造成地址赋值的问题
|
|
|
- this.tpmListData = JSON.parse(JSON.stringify(res.result))
|
|
|
- this.tpmTreeData = this.handleTree(res.result, "id", "parentid")
|
|
|
+ this.tpmListData = JSON.parse(JSON.stringify(res))
|
|
|
+ this.tpmTreeData = this.handleTree(res, "id", "pid")
|
|
|
console.log(this.tpmTreeData)
|
|
|
- } else {
|
|
|
+ // } else {
|
|
|
|
|
|
- }
|
|
|
+ // }
|
|
|
})
|
|
|
},
|
|
|
filterTreeNode(node) {
|
|
@@ -65,11 +66,11 @@
|
|
|
// 筛选后数据
|
|
|
var filterData = []
|
|
|
// 筛选符合条件的数据:包含当前搜索的项
|
|
|
- console.log(this.tpmListData)
|
|
|
- filterData = this.tpmListData.filter(item => (item.name.indexOf(value) !== -1))
|
|
|
+ console.log('原数据',this.tpmListData)
|
|
|
+ filterData = this.tpmListData.filter(item => (item.interlockName.indexOf(value) !== -1))
|
|
|
// var data = []
|
|
|
// filterData.forEach(item => {
|
|
|
- // var arr = this.tpmListData.filter(data => item.parentid === data.id)
|
|
|
+ // var arr = this.tpmListData.filter(data => item.pid === data.id)
|
|
|
// console.log('父级', arr)
|
|
|
// // filterData = [...filterData, ...arr]
|
|
|
// })
|
|
@@ -79,7 +80,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
- this.tpmTreeData = this.handleTree(filterData, "id", "parentid")
|
|
|
+ this.tpmTreeData = this.handleTree(filterData, "id", "pid")
|
|
|
// const expandedKeys = dataList.map(item => {
|
|
|
// if (item.name.indexOf(value) > -1) {
|
|
|
// // return getParentKey(item.key, gData);
|