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

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.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();
}
@@ -53,8 +53,8 @@
<td>
<i (click)="addModify(2,item)" class="table-operation-btn edit" nz-icon type="edit"
theme="outline"></i>
<nz-divider nzType="vertical"></nz-divider>
<i nz-popconfirm nzTitle="确定删除该用户?" nzOkText="确定" nzCancelText="取消" (nzOnConfirm)="delectConfirm(item)"
<nz-divider *ngIf="currentUserInfo.uid!==item.uid" nzType="vertical"></nz-divider>
<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>
</td>
</tr>
@@ -33,7 +33,9 @@ export class UserManagementComponent implements OnInit {
orgId:'',
}
visible = false;
userDetail:any={}; //用户详情
userDetail:any={}; //用户详情
currentUserInfo = JSON.parse(sessionStorage.getItem('userInfo'));
constructor(
@@ -43,6 +45,8 @@ export class UserManagementComponent implements OnInit {
) { }
ngOnInit() {
// this.currentUserInfo = JSON.parse(sessionStorage.getItem('userInfo'));
// console.log(sessionStorage.getItem('userInfo'));
// 页面监听 动态改变表单高度
$('#tree-box').css('height',(document.documentElement.clientHeight-106+'px'));
$('#main-box-user').css('height',(document.documentElement.clientHeight-106+'px'));