实际开发场景中,后台返回的数据不一定满足功能需求,这时候就需要根据条件将数据重新组装 :

GetPermissionList() {

this.loading = true

this.$axios({

method: "post",

url: this.postUrl.GetProjectListUrl,

data: this.$qs.stringify({

isGlobal:this.formselect.IsGlobal

})

})

.then(res => {

this.formselect.totals = res.data.Total

let tableData = [];

let tableChildrenData = [];

res.data.Data.forEach((it, inx) => {

if (it.ParentId == 0) {

tableData.push(it)

} else {

tableChildrenData.push(it)

}

});

tableData.forEach((it0, inx0) => {

it0.Children = [];

tableChildrenData.forEach((it1, inx1) => {

if (it1.ParentId == it0.ID) {

it0.Children.push(it1)

}

});

});

this.tableData = tableData;

this.loading = false

})

.catch(res => {

})

}

Logo

前往低代码交流专区

更多推荐