Browse Source

展开多层

V1.0
mk 3 years ago
parent
commit
4768227216
  1. 18
      src/views/modules/base/community/community.vue

18
src/views/modules/base/community/community.vue

@ -470,6 +470,7 @@ export default {
this.getHouseList(); this.getHouseList();
}, },
async lazyLoadTree(node, resolve) { async lazyLoadTree(node, resolve) {
console.log(node);
const url = `/actual/base/communityBuilding/tree/nextTreeNode?id=${node.data.id}&level=${node.data.level}`; const url = `/actual/base/communityBuilding/tree/nextTreeNode?id=${node.data.id}&level=${node.data.level}`;
const { data, code, msg } = await requestGet(url); const { data, code, msg } = await requestGet(url);
if (code === 0) { if (code === 0) {
@ -536,24 +537,23 @@ export default {
}, },
// //
async handleChangeSerch (){ async handleChangeSerch (){
this.startLoading() this.startLoading()
this.$refs.ref_tree.$data.store.lazy = !this.filterText this.$refs.ref_tree.$data.store.lazy = !this.filterText
if(this.filterText.length > 0 && this.filterText!=''){ if(this.filterText.length > 0 && this.filterText!=''){
const url = `/actual/base/communityBuilding/tree/search?keyword=${this.filterText}` const url = `/actual/base/communityBuilding/tree/search?keyword=${this.filterText}`
const {data,code,msg} = await requestGet(url) const {data,code,msg} = await requestGet(url)
if(data[0].children.length>0){ if(data[0].children.length>0){
this.treeData = data this.treeData = data
this.autoOpenArr.push(this.treeData[0].id); for(let i in this.treeData[0].children){
this.autoOpenArr.push(this.treeData[0].id,this.treeData[0].children[i].id,this.treeData[0].children[0].children[0].id);
}
}else{ }else{
this.treeData = [] this.treeData = []
setTimeout(() => {
this.loadTree()
}, 5)
this.$message.error('暂未找到!') this.$message.error('暂未找到!')
} }
}else { }else {
this.treeData = [] this.treeData = []
this.autoOpenArr = []
this.loadTree() this.loadTree()
} }
this.endLoading() this.endLoading()
@ -665,9 +665,6 @@ export default {
const url = "/actual/base/communityBuilding/tree/initTree" const url = "/actual/base/communityBuilding/tree/initTree"
const { data, code, msg } = await requestGet(url) const { data, code, msg } = await requestGet(url)
if (code === 0) { if (code === 0) {
this.openNodes = []
this.openNodes.push(data.id)
this.treeData = [] this.treeData = []
this.treeData.push(data) this.treeData.push(data)
if (!isRefresh && data) { if (!isRefresh && data) {
@ -736,7 +733,6 @@ export default {
this.updateStartDate = '' this.updateStartDate = ''
this.updateEndDate = '' this.updateEndDate = ''
this.showRoomTable = false this.showRoomTable = false
this.selObj = JSON.parse(JSON.stringify(obj)) this.selObj = JSON.parse(JSON.stringify(obj))
this.getTreeObj(obj) this.getTreeObj(obj)
await nextTick(1000) await nextTick(1000)

Loading…
Cancel
Save