介绍:本教程主要介绍在OA项目中如何返回 树状结构的 Json数据? 下面做的是怎么样列出所有部门以及子部门
效果图:
返回的数据:
[{
"id": 1,
"text": "研发本部",
"leaf": false,
"children": [{
"id": 5,
"text": "发动机部",
"leaf": true
}, {
"id": 4,
"text": "开发部",
"leaf": false,
"children": [{
"id": 11,
"text": "网络室",
"leaf": true
}, {
"id": 10,
"text": "软件室",
"leaf": true
}]
}]
}, {
"id": 2,
"text": "销售本部",
"leaf": false,
"children": [{
"id": 6,
"text": "销售部",
"leaf": true
}, {
"id": 7,
"text": "售后服务部"