|
|
|
@ -146,28 +146,23 @@ export default {
|
|
|
|
|
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
|
|
|
|
// 执行查询 |
|
|
|
|
getAreaPage(params).then(response => { |
|
|
|
|
this.list = response.data.list; |
|
|
|
|
this.list = response.data.list; |
|
|
|
|
this.total = response.data.total; |
|
|
|
|
|
|
|
|
|
this.allList = this.list; |
|
|
|
|
let filterList = this.list.filter(t => t.parentId == 0); |
|
|
|
|
let oneList = []; |
|
|
|
|
if(filterList.length == 0){ |
|
|
|
|
//没有上级 |
|
|
|
|
this.list.forEach(t => { |
|
|
|
|
oneList.push({id:one.id, name:one.name, occupied:one.occupied, area:one.area, createTime:one.createTime, children:twoList}); |
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
filterList.forEach((one) => { |
|
|
|
|
filterList.forEach((one) => { |
|
|
|
|
let twoList = []; |
|
|
|
|
this.list.forEach((two) => { |
|
|
|
|
if(one.id == two.parentId){ |
|
|
|
|
twoList.push({id:two.id, name:two.name, occupied:two.occupied, area:two.area, createTime:two.createTime}) |
|
|
|
|
} |
|
|
|
|
let filterTwoList = this.list.filter(t => t.parentId == one.id); |
|
|
|
|
filterTwoList.forEach(two =>{ |
|
|
|
|
let filterThreeList = this.list.filter(t => t.parentId == two.id); |
|
|
|
|
let threeList = []; |
|
|
|
|
filterThreeList.forEach(three =>{ |
|
|
|
|
threeList.push({id:three.id, name:three.name, occupied:three.occupied, area:three.area, createTime:three.createTime}); |
|
|
|
|
}) |
|
|
|
|
twoList.push({id:two.id, name:two.name, occupied:two.occupied, area:two.area, createTime:two.createTime, children:threeList}) |
|
|
|
|
}) |
|
|
|
|
oneList.push({id:one.id, name:one.name, occupied:one.occupied, area:one.area, createTime:one.createTime, children:twoList}); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
this.list = oneList; |
|
|
|
|
this.loading = false; |
|
|
|
|
}); |
|
|
|
|