diff --git a/src/app/pages/system-management/user-management/user-management-modify/user-management-modify.component.ts b/src/app/pages/system-management/user-management/user-management-modify/user-management-modify.component.ts index 9f2484e..f484657 100644 --- a/src/app/pages/system-management/user-management/user-management-modify/user-management-modify.component.ts +++ b/src/app/pages/system-management/user-management/user-management-modify/user-management-modify.component.ts @@ -76,6 +76,36 @@ export class UserManagementModifyComponent implements OnInit { this.statusParamsDetail.status = 3; } }) + this.statusParamsTree.status = 1; + this.http.get("/sysapi/setting/organization/list").subscribe(json => { + if (json.is_success) { + if (json.body.length > 0) { + this.statusParamsTree.status = 3; + for (var i = 0; i < json.body.length; i++) { + let option = json.body[i]; + option.name = option.organization; + if (option.pid) { + option.pId = option.pid; + } else { + option.pId = 'hsfuhiw34239j89sauf98992h3indshv98h392hf9mplsd032fs2a2313fc'; + } + } + json.body.push({ + name: "全部机构", + isParent: true, + open: true, + id: 'hsfuhiw34239j89sauf98992h3indshv98h392hf9mplsd032fs2a2313fc', + }) + this.orgList = json.body; + } else { + //数据为空 + this.statusParamsTree.status = 4; + } + } else { + //请求失败 + this.statusParamsTree.status = 0; + } + }) } //获取用户详情 queryUserDetail() { @@ -172,7 +202,7 @@ export class UserManagementModifyComponent implements OnInit { //打开机构树抽屉 open(): void { this.treeSelected = ''; - this.statusParamsTree.status = 1; + // this.statusParamsTree.status = 1; this.visible = true; this.initTree(); @@ -308,41 +338,10 @@ export class UserManagementModifyComponent implements OnInit { //获取机构列表,树模型数据处理 initTree() { //获取目录列表 - this.statusParamsTree.status = 1; - this.http.get("/sysapi/setting/organization/list").subscribe(json => { - if (json.is_success) { - if (json.body.length > 0) { - this.orgList = json.body; - this.statusParamsTree.status = 3; - let children = []; - for (var i = 0; i < json.body.length; i++) { - let option = json.body[i]; - option.name = option.organization; - if (option.pid) { - option.pId = option.pid; - } else { - option.pId = 'hsfuhiw34239j89sauf98992h3indshv98h392hf9mplsd032fs2a2313fc'; - } - } - json.body.push({ - name: "全部机构", - isParent: true, - open: true, - id: 'hsfuhiw34239j89sauf98992h3indshv98h392hf9mplsd032fs2a2313fc', - }) - } else { - //数据为空 - this.statusParamsTree.status = 4; - } - } else { - //请求失败 - this.statusParamsTree.status = 0; - } - this.zNodes = json.body; - $.fn.zTree.init($("#treeDemo"), this.setting, this.zNodes); - var zTree = $.fn.zTree.getZTreeObj("treeDemo"); - let node = zTree.getNodes(); - }) + this.zNodes = this.orgList; + $.fn.zTree.init($("#treeDemo"), this.setting, this.zNodes); + var zTree = $.fn.zTree.getZTreeObj("treeDemo"); + let node = zTree.getNodes(); } diff --git a/src/app/pages/system-management/user-management/user-management.component.html b/src/app/pages/system-management/user-management/user-management.component.html index 3161ee9..6323397 100644 --- a/src/app/pages/system-management/user-management/user-management.component.html +++ b/src/app/pages/system-management/user-management/user-management.component.html @@ -53,8 +53,8 @@