角色管理-新增、修改

This commit is contained in:
liweijin
2018-12-10 18:31:18 +08:00
parent ff561a6886
commit 628f041b17
11 changed files with 644 additions and 15 deletions
@@ -8,7 +8,7 @@
<div class="operation-box">
<button (click)="addModify(1)" nz-button nzType="primary"><i nz-icon type="plus" theme="outline"></i>新增</button>
<button *ngIf="canEdit" (click)="addModify(2)" nz-button nzType="default"><i nz-icon type="edit" theme="outline"></i>修改</button>
<button *ngIf="canDel" (click)="delete" nz-button nzType="danger"><i nz-icon type="delete" theme="outline"></i>删除</button>
<button *ngIf="canDel" (click)="delete()" nz-button nzType="danger"><i nz-icon type="delete" theme="outline"></i>删除</button>
</div>
<nz-skeleton [nzActive]="true" [nzParagraph]="{ rows: 16 }" *ngIf='modifyType==3&&!orgDetail'></nz-skeleton>
<!-- 详情 begin -->
@@ -176,7 +176,7 @@
<th>姓名</th>
<th>用户名</th>
<th>电话</th>
<th>操作</th>
<th>操作</th>
</tr>
</thead>
<tbody>
@@ -194,7 +194,7 @@
</form>
<div class="user-footer" *ngIf="modifyType!=3">
<button (click)='submitForm()' [nzLoading]="isLoadingSave" nz-button nzType="primary" class="mr10" [disabled]='!this.validateForm.valid||!this.nameOnly'>保存</button>
<button (click)='submitForm()' [nzLoading]="isLoadingSave" nz-button nzType="primary" class="mr10" [disabled]='!validateForm.valid||!nameOnly'>保存</button>
<button (click)='cancel()' nz-button nzType="default">取消</button>
</div>
<!-- 新增、修改 end -->
@@ -219,9 +219,8 @@
</div>
<!-- 机构负责人选择 -->
<!-- 选择所属机构 -->
<div class="org-selete-box">
<nz-drawer [nzBodyStyle]="{ height: 'calc(100% - 55px)', overflow: 'auto', 'padding-bottom':'53px' }" [nzMaskClosable]="false" [nzWidth]="auto" [nzVisible]="visibleUsers" nzTitle="选择机构" (nzOnClose)="closeUser()">
<nz-drawer [nzBodyStyle]="{ height: 'calc(100% - 55px)', overflow: 'auto', 'padding-bottom':'53px' }" [nzMaskClosable]="false" [nzWidth]="auto" [nzVisible]="visibleUsers" nzTitle="机构负责人" (nzOnClose)="closeUser()">
<div class="users-box" [hidden]='statusParamsUsers.status!=3'>
<div class="user-table-box">
<nz-table [nzShowPagination]='false' #dataSet [nzData]="userData">
@@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { FormBuilder,FormControl,FormGroup,Validators} from '@angular/forms';
import { HttpClientService } from '../../../services/http-client.service';
import { Router } from '@angular/router';
import { NzMessageService } from 'ng-zorro-antd';
import { NzMessageService,NzModalRef, NzModalService } from 'ng-zorro-antd';
import { Observable } from 'rxjs';
import 'ztree';
@@ -50,12 +50,15 @@ export class DepartmentManagementComponent implements OnInit {
oldLoginName:any=''; //修改时,保存原本的系统账号,用于检测唯一性
checkNameStatus:any=''; //检测账号唯一性的图标状态
orgList:any=[];
confirmModal:NzModalRef;
constructor(
private fb: FormBuilder,
private http:HttpClientService,
private router:Router,
private message: NzMessageService,
) { }
private modal: NzModalService,
) {
}
ngOnInit() {
$('.tree-box').css('height',(document.documentElement.clientHeight-106+'px'));
@@ -111,6 +114,26 @@ export class DepartmentManagementComponent implements OnInit {
}
}
//删除
delete(){
this.confirmModal = this.modal.confirm({
nzTitle: '删除',
nzContent: '确定删除【'+this.orgDetail.organization+'】?',
nzOnOk: () => new Promise((resolve, reject) => {
this.http.delete('/sysapi/setting/organization/delOrgByid/'+this.orgDetail.id).subscribe((json)=>{
if(json.is_success){
resolve();
this.message.success(`删除成功!`);
this.initTree();
}else{
reject();
this.message.error(`删除失败!`);
}
})
}).catch(() => console.log('Oops errors!'))
});
}
//保存
submitForm(){
let pid='';
@@ -129,7 +152,7 @@ export class DepartmentManagementComponent implements OnInit {
this.message.success(`新增成功!`);
this.initTree();
}else{
this.message.success(`新增失败!`);
this.message.error(`新增失败!`);
}
})
}else if(this.modifyType==2){
@@ -138,7 +161,7 @@ export class DepartmentManagementComponent implements OnInit {
this.message.success(`修改成功!`);
this.initTree();
}else{
this.message.success(`修改失败!`);
this.message.error(`修改失败!`);
}
})
}