Browse Source

新增角色级别

beijing
jingbowen 2 years ago
parent
commit
a17d8495ec
  1. 2
      src/app/system-management/role/addrole/addrole.component.html
  2. 23
      src/app/system-management/role/addrole/addrole.component.ts
  3. 2
      src/app/system-management/role/editrole/editrole.component.html
  4. 21
      src/app/system-management/role/editrole/editrole.component.ts
  5. 2
      src/app/system-management/role/role.component.html
  6. 22
      src/app/system-management/role/role.component.ts

2
src/app/system-management/role/addrole/addrole.component.html

@ -23,7 +23,7 @@
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="组织等级">组织等级</nz-form-label>
<nz-form-control>
<nz-select formControlName="organizationsLevel" nzPlaceHolder="请选择组织等级">
<nz-option *ngFor="let o of levelList" [nzValue]="o.id" [nzLabel]="o.name"></nz-option>
<nz-option *ngFor="let o of levelList" [nzValue]="o.level" [nzLabel]="o.name"></nz-option>
</nz-select>
<ng-template #renderTemplate>
<nz-spin *ngIf="isLoading"></nz-spin>

23
src/app/system-management/role/addrole/addrole.component.ts

@ -15,7 +15,6 @@ export class AddroleComponent implements OnInit {
@Input() nodes?: any;
@Input() title?: string;
@Input() subtitle?: string;
validateForm!: FormGroup;
constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient, private toTree: TreeService) { }
@ -23,6 +22,20 @@ export class AddroleComponent implements OnInit {
ngOnInit(): void {
this.nodes.length != 0 ? null : this.getAllMenus()
this.loadMore();
let level=JSON.parse(sessionStorage.getItem('userdata')).organization.level
let levelList=[
{level:0,name:'无'},
{level:1,name:'销售公司'},
{level:2,name:'省公司'},
{level:3,name:'区域'},
{level:4,name:'油站'},
]
// this.levelList=[]
levelList.forEach(e=>{
if(e.level>=level||e.level==0){
this.levelList.push(e)
}
})
this.validateForm = this.fb.group({
name: [null, [Validators.required]],
power: [null],
@ -54,13 +67,7 @@ export class AddroleComponent implements OnInit {
this.modal.destroy({ data: 'this the result data' });
}
optionList = [];
levelList=[
{id:0,name:'无'},
{id:1,name:'销售公司'},
{id:2,name:'省公司'},
{id:3,name:'区域'},
{id:4,name:'油站'},
]
levelList=[]
isLoading = false;
//获取权限列表
loadMore() {

2
src/app/system-management/role/editrole/editrole.component.html

@ -20,7 +20,7 @@
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="组织等级">组织等级</nz-form-label>
<nz-form-control>
<nz-select [(ngModel)]="levelValue" formControlName="organizationsLevel" nzPlaceHolder="请选择组织等级">
<nz-option *ngFor="let o of levelList" [nzValue]="o.id" [nzLabel]="o.name"></nz-option>
<nz-option *ngFor="let o of levelList" [nzValue]="o.level" [nzLabel]="o.name"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>

21
src/app/system-management/role/editrole/editrole.component.ts

@ -15,13 +15,7 @@ export class EditroleComponent implements OnInit {
@Input() nodes?: any;
validateForm!: FormGroup;
constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient, private toTree: TreeService) { }
levelList=[
{id:0,name:'无'},
{id:1,name:'销售公司'},
{id:2,name:'省公司'},
{id:3,name:'区域'},
{id:4,name:'油站'},
]
levelList=[]
multipleValue: any
levelValue
ngOnInit(): void {
@ -30,6 +24,19 @@ export class EditroleComponent implements OnInit {
this.nodes.length != 0 ? null : this.getAllMenus()
this.multipleValue = this.data.grantedPermissions
this.levelValue=this.data.organizationsLevel
let level=JSON.parse(sessionStorage.getItem('userdata')).organization.level
let levelList=[
{level:0,name:'无'},
{level:1,name:'销售公司'},
{level:2,name:'省公司'},
{level:3,name:'区域'},
{level:4,name:'油站'},
]
levelList.forEach(e=>{
if(e.level>=level||e.level==0){
this.levelList.push(e)
}
})
this.getMenus()
this.validateForm = this.fb.group({
name: [null, [Validators.required]],

2
src/app/system-management/role/role.component.html

@ -26,7 +26,7 @@
<span *ngFor="let item of data.grantedFlatPermissions">{{item.displayName}}</span>
</td>
<td>
{{levelList[data.organizationsLevel]}}
{{levelList[data.organizationsLevel].name}}
</td>
<td>
{{(data.lastModificationTime ? data.lastModificationTime : data.creationTime) | date:"yyyy-MM-dd HH:mm:ss"}}

22
src/app/system-management/role/role.component.ts

@ -25,7 +25,13 @@ export class RoleComponent implements OnInit {
private http: HttpClient,
private toTree: TreeService
) {}
levelList = ["无", "销售公司", "省公司", "区域", "油站"];
levelList=[
{level:0,name:'无'},
{level:1,name:'销售公司'},
{level:2,name:'省公司'},
{level:3,name:'区域'},
{level:4,name:'油站'},
]
ngOnInit(): void {
this.getAllRoles();
@ -49,15 +55,7 @@ export class RoleComponent implements OnInit {
})
.subscribe((data: any) => {
console.log("角色列表", data.result.items);
let level = JSON.parse(sessionStorage.getItem("userdata")).organization
.level;
this.listOfData = [];
data.result.items.forEach((ele) => {
if (ele.organizationsLevel >= level || ele.organizationsLevel == 0) {
this.listOfData.push(ele);
}
});
this.listOfData = [...this.listOfData];
this.listOfData = data.result.items;
});
}
@ -96,7 +94,7 @@ export class RoleComponent implements OnInit {
nzMaskClosable: false,
nzOnOk: async () => {
if (instance.validateForm.valid) {
await new Promise((resolve,reject) => {
await new Promise((resolve, reject) => {
console.log("表单信息", instance.validateForm);
let body = {
name: instance.validateForm.value.name,
@ -159,7 +157,7 @@ export class RoleComponent implements OnInit {
nzMaskClosable: false,
nzOnOk: async () => {
if (instance.validateForm.valid) {
await new Promise((resolve,reject) => {
await new Promise((resolve, reject) => {
console.log("表单信息", instance.validateForm);
let body = {
id: item.id,

Loading…
Cancel
Save