解决用户修改保存所属机构内容丢失的问题

This commit is contained in:
zhouyuejun
2019-04-17 10:32:36 +08:00
parent 7cddbc3c2e
commit 4d63578b73
3 changed files with 42 additions and 39 deletions
@@ -76,6 +76,36 @@ export class UserManagementModifyComponent implements OnInit {
this.statusParamsDetail.status = 3; 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() { queryUserDetail() {
@@ -172,7 +202,7 @@ export class UserManagementModifyComponent implements OnInit {
//打开机构树抽屉 //打开机构树抽屉
open(): void { open(): void {
this.treeSelected = ''; this.treeSelected = '';
this.statusParamsTree.status = 1; // this.statusParamsTree.status = 1;
this.visible = true; this.visible = true;
this.initTree(); this.initTree();
@@ -308,41 +338,10 @@ export class UserManagementModifyComponent implements OnInit {
//获取机构列表,树模型数据处理 //获取机构列表,树模型数据处理
initTree() { initTree() {
//获取目录列表 //获取目录列表
this.statusParamsTree.status = 1; this.zNodes = this.orgList;
this.http.get("/sysapi/setting/organization/list").subscribe(json => { $.fn.zTree.init($("#treeDemo"), this.setting, this.zNodes);
if (json.is_success) { var zTree = $.fn.zTree.getZTreeObj("treeDemo");
if (json.body.length > 0) { let node = zTree.getNodes();
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();
})
} }
@@ -53,8 +53,8 @@
<td> <td>
<i (click)="addModify(2,item)" class="table-operation-btn edit" nz-icon type="edit" <i (click)="addModify(2,item)" class="table-operation-btn edit" nz-icon type="edit"
theme="outline"></i> theme="outline"></i>
<nz-divider nzType="vertical"></nz-divider> <nz-divider *ngIf="currentUserInfo.uid!==item.uid" nzType="vertical"></nz-divider>
<i nz-popconfirm nzTitle="确定删除该用户?" nzOkText="确定" nzCancelText="取消" (nzOnConfirm)="delectConfirm(item)" <i *ngIf="currentUserInfo.uid!==item.uid" nz-popconfirm nzTitle="确定删除该用户?" nzOkText="确定" nzCancelText="取消" (nzOnConfirm)="delectConfirm(item)"
class="table-operation-btn danger" nz-icon type="delete" theme="outline"></i> class="table-operation-btn danger" nz-icon type="delete" theme="outline"></i>
</td> </td>
</tr> </tr>
@@ -33,7 +33,9 @@ export class UserManagementComponent implements OnInit {
orgId:'', orgId:'',
} }
visible = false; visible = false;
userDetail:any={}; //用户详情 userDetail:any={}; //用户详情
currentUserInfo = JSON.parse(sessionStorage.getItem('userInfo'));
constructor( constructor(
@@ -43,6 +45,8 @@ export class UserManagementComponent implements OnInit {
) { } ) { }
ngOnInit() { ngOnInit() {
// this.currentUserInfo = JSON.parse(sessionStorage.getItem('userInfo'));
// console.log(sessionStorage.getItem('userInfo'));
// 页面监听 动态改变表单高度 // 页面监听 动态改变表单高度
$('#tree-box').css('height',(document.documentElement.clientHeight-106+'px')); $('#tree-box').css('height',(document.documentElement.clientHeight-106+'px'));
$('#main-box-user').css('height',(document.documentElement.clientHeight-106+'px')); $('#main-box-user').css('height',(document.documentElement.clientHeight-106+'px'));