Browse Source

[完善]推送管理页面完善

beijing
邵佳豪 2 years ago
parent
commit
f483ba06de
  1. 22
      src/app/system-management/push/edit-push-item/edit-push-item.component.html
  2. 20
      src/app/system-management/push/edit-push-item/edit-push-item.component.ts
  3. 10
      src/app/system-management/push/push.component.html
  4. 59
      src/app/system-management/push/push.component.ts
  5. 2
      src/app/system-management/role/addrole/addrole.component.html
  6. 2
      src/app/system-management/role/addrole/addrole.component.ts
  7. 2
      src/app/system-management/role/editrole/editrole.component.html
  8. 2
      src/app/system-management/role/editrole/editrole.component.ts

22
src/app/system-management/push/edit-push-item/edit-push-item.component.html

@ -1,20 +1,32 @@
<div class="box"> <div class="box">
<form nz-form [formGroup]="validateForm"> <form nz-form [formGroup]="validateForm">
<nz-form-item> <nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="推送范围">推送范围</nz-form-label> <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="推送范围">推送范围</nz-form-label>
<nz-form-control> <nz-form-control>
<nz-select [(ngModel)]="multiplePushValue" formControlName="push" nzPlaceHolder="请选择推送范围" <nz-select [(ngModel)]="multiplePushValue" formControlName="push" nzPlaceHolder="请选择推送范围"
nzMode="multiple"> nzMode="multiple">
<nz-option *ngFor="let item of pushList" [nzValue]="item.id" [nzLabel]="item.displayName"></nz-option> <nz-option *ngFor="let item of pushRoleIds" [nzValue]="item.id" [nzLabel]="item.displayName">
</nz-option>
</nz-select> </nz-select>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<nz-form-item> <!-- <nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="处置范围">处置范围</nz-form-label> <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="处置范围">处置范围</nz-form-label>
<nz-form-control> <nz-form-control>
<nz-select [(ngModel)]="multipleHandleValue" formControlName="handle" nzPlaceHolder="请选择处置范围" <nz-select [(ngModel)]="multipleHandleValue" formControlName="handle" nzPlaceHolder="请选择处置范围"
nzMode="multiple"> nzMode="multiple">
<nz-option *ngFor="let item of handleList" [nzValue]="item.id" [nzLabel]="item.displayName"></nz-option> <nz-option *ngFor="let item of handleList" [nzValue]="item.id" [nzLabel]="item.displayName">
</nz-option>
</nz-select>
</nz-form-control>
</nz-form-item> -->
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="短信范围">短信范围</nz-form-label>
<nz-form-control>
<nz-select [(ngModel)]="multipleNoteValue" formControlName="note" nzPlaceHolder="请选择短信范围"
nzMode="multiple">
<nz-option *ngFor="let item of noteRoleIds" [nzValue]="item.id" [nzLabel]="item.displayName">
</nz-option>
</nz-select> </nz-select>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>

20
src/app/system-management/push/edit-push-item/edit-push-item.component.ts

@ -11,26 +11,24 @@ export class EditPushItemComponent implements OnInit {
@Input() data?: any; @Input() data?: any;
@Input() pushRoleIds?: any; @Input() pushRoleIds?: any;
@Input() handleRoleIds?: any; // @Input() handleRoleIds?: any;
@Input() noteRoleIds?: any;
validateForm!: FormGroup; validateForm!: FormGroup;
constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient) { } constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient) { }
multiplePushValue: any multiplePushValue: any
multipleHandleValue: any multipleHandleValue: any
pushList multipleNoteValue: any
handleList
ngOnInit(): void { ngOnInit(): void {
this.pushList = this.pushRoleIds;
this.handleList = this.handleRoleIds;
console.log(this.pushRoleIds)
console.log(this.handleRoleIds)
this.multiplePushValue = this.data.pushRoleIds this.multiplePushValue = this.data.pushRoleIds
this.multipleHandleValue = this.data.handleRoleIds // this.multipleHandleValue = this.data.handleRoleIds
this.multipleNoteValue = this.data.smsPushRoleIds
this.validateForm = this.fb.group({ this.validateForm = this.fb.group({
push: [null, [Validators.required]], push: [null],
handle: [null, [Validators.required]] // handle: [null]
note: [null],
}); });
} }
} }

10
src/app/system-management/push/push.component.html

@ -24,17 +24,21 @@
<th style="width: 20%;">预警类别</th> <th style="width: 20%;">预警类别</th>
<th style="width: 20%;">预警/分析事件</th> <th style="width: 20%;">预警/分析事件</th>
<th style="width: 25%;">预警推送范围</th> <th style="width: 25%;">预警推送范围</th>
<th style="width: 25%;">预警处置范围</th> <!-- <th style="width: 25%;">预警处置范围</th> -->
<th style="width: 25%;">短信推送范围</th>
<th style="width: 10%;">操作</th> <th style="width: 10%;">操作</th>
</tr> </tr>
<tr *ngFor="let item of list"> <tr *ngFor="let item of list">
<td>{{item.violationType}}</td> <td>{{item.violationType}}</td>
<td>{{item.eventSystemName}}</td> <td>{{item.eventSystemName}}</td>
<td> <td>
<span class="name" *ngFor="let i of item.pushRoleNames">{{i}}</span> <span class="name" *ngFor="let i of item.pushRoleNames">{{i}}</span>
</td> </td>
<td> <!-- <td>
<span class="name" *ngFor="let i of item.handleRoleNames">{{i}}</span> <span class="name" *ngFor="let i of item.handleRoleNames">{{i}}</span>
</td> -->
<td>
<span class="name" *ngFor="let i of item.noteRoleNames">{{i}}</span>
</td> </td>
<td> <td>
<span style="color: #2399FF;cursor: pointer;" (click)="edititem(item)">编辑</span> <span style="color: #2399FF;cursor: pointer;" (click)="edititem(item)">编辑</span>

59
src/app/system-management/push/push.component.ts

@ -21,7 +21,8 @@ export class PushComponent implements OnInit {
}); });
await this.getPutRoles() await this.getPutRoles()
await this.getHandleRoles() // await this.getHandleRoles()
await this.getNoteRoles()
this.getViolation() this.getViolation()
this.getSetting() this.getSetting()
} }
@ -45,13 +46,15 @@ export class PushComponent implements OnInit {
} }
this.http.post('/api/services/app/Configuration/SetSetting', '', { params: params }).subscribe((data: any) => { this.http.post('/api/services/app/Configuration/SetSetting', '', { params: params }).subscribe((data: any) => {
// console.log('设置短信推送状态成功', data) // console.log('设置短信推送状态成功', data)
if(e){ if (e) {
this.message.create('success', '开启成功!'); this.message.create('success', '开启成功!');
}else{ } else {
this.message.create('success', '关闭成功!'); this.message.create('success', '关闭成功!');
} }
}) })
} }
//获取预警类型 //获取预警类型
list: any list: any
getViolation() { getViolation() {
@ -66,11 +69,19 @@ export class PushComponent implements OnInit {
} }
}); });
}); });
element.handleRoleNames = [] // element.handleRoleNames = []
element.handleRoleIds.forEach(item => { // element.handleRoleIds.forEach(item => {
this.handleRoleIds.forEach(i => { // this.handleRoleIds.forEach(i => {
// if (i.id == item) {
// element.handleRoleNames.push(i.displayName)
// }
// });
// });
element.noteRoleNames = []
element.smsPushRoleIds.forEach(item => {
this.noteRoleIds.forEach(i => {
if (i.id == item) { if (i.id == item) {
element.handleRoleNames.push(i.displayName) element.noteRoleNames.push(i.displayName)
} }
}); });
}); });
@ -79,6 +90,8 @@ export class PushComponent implements OnInit {
console.log('预警类型', this.list) console.log('预警类型', this.list)
}) })
} }
//获取推送的角色列表 //获取推送的角色列表
pushRoleIds pushRoleIds
async getPutRoles() { async getPutRoles() {
@ -90,20 +103,34 @@ export class PushComponent implements OnInit {
}) })
}) })
} }
handleRoleIds // handleRoleIds
// //获取处置的角色列表
// async getHandleRoles() {
// await new Promise<void>((resolve, reject) => {
// this.http.get('/api/services/app/Violation/GetHandleRoles').subscribe((data: any) => {
// this.handleRoleIds = data.result
// resolve(data)
// console.log('处置角色', data)
// })
// })
// }
noteRoleIds
//获取处置的角色列表 //获取处置的角色列表
async getHandleRoles() { async getNoteRoles() {
await new Promise<void>((resolve, reject) => { await new Promise<void>((resolve, reject) => {
this.http.get('/api/services/app/Violation/GetHandleRoles').subscribe((data: any) => { this.http.get('/api/services/app/Violation/GetSmsPutRoles').subscribe((data: any) => {
this.handleRoleIds = data.result this.noteRoleIds = data.result
resolve(data) resolve(data)
console.log('处置角色', data) console.log('短信角色', data)
}) })
}) })
} }
edititem(item) { edititem(item) {
console.log(item)
const modal = this.modal.create({ const modal = this.modal.create({
nzTitle: '编辑推送设置', nzTitle: '编辑推送设置',
nzContent: EditPushItemComponent, nzContent: EditPushItemComponent,
@ -112,7 +139,8 @@ export class PushComponent implements OnInit {
nzComponentParams: { nzComponentParams: {
data: item, data: item,
pushRoleIds: this.pushRoleIds, pushRoleIds: this.pushRoleIds,
handleRoleIds: this.handleRoleIds noteRoleIds: this.noteRoleIds,
// handleRoleIds: this.handleRoleIds
}, },
nzOnOk: async () => { nzOnOk: async () => {
if (instance.validateForm.valid) { if (instance.validateForm.valid) {
@ -121,7 +149,8 @@ export class PushComponent implements OnInit {
let body = { let body = {
id: item.id, id: item.id,
pushRoleIds: instance.validateForm.value.push, pushRoleIds: instance.validateForm.value.push,
handleRoleIds: instance.validateForm.value.handle, // handleRoleIds: instance.validateForm.value.handle,
smsPushRoleIds: instance.validateForm.value.note
} }
this.http.put('/api/services/app/Violation/UpdateRoles', body).subscribe(data => { this.http.put('/api/services/app/Violation/UpdateRoles', body).subscribe(data => {
resolve(data) resolve(data)

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

@ -9,7 +9,7 @@
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<nz-form-item> <nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="权限">权限</nz-form-label> <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="权限">权限</nz-form-label>
<nz-form-control> <nz-form-control>
<nz-select formControlName="power" nzPlaceHolder="请选择权限" nzMode="multiple"> <nz-select formControlName="power" nzPlaceHolder="请选择权限" nzMode="multiple">
<nz-option *ngFor="let o of optionList" [nzValue]="o" [nzLabel]="o.displayName"></nz-option> <nz-option *ngFor="let o of optionList" [nzValue]="o" [nzLabel]="o.displayName"></nz-option>

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

@ -25,7 +25,7 @@ export class AddroleComponent implements OnInit {
this.loadMore(); this.loadMore();
this.validateForm = this.fb.group({ this.validateForm = this.fb.group({
name: [null, [Validators.required]], name: [null, [Validators.required]],
power: [null, [Validators.required]], power: [null],
menus: [null] menus: [null]
}); });
} }

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

@ -9,7 +9,7 @@
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<nz-form-item> <nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="权限">权限</nz-form-label> <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="权限">权限</nz-form-label>
<nz-form-control> <nz-form-control>
<nz-select [(ngModel)]="multipleValue" formControlName="power" nzPlaceHolder="请选择权限" nzMode="multiple"> <nz-select [(ngModel)]="multipleValue" formControlName="power" nzPlaceHolder="请选择权限" nzMode="multiple">
<nz-option *ngFor="let o of optionList" [nzValue]="o.name" [nzLabel]="o.displayName"></nz-option> <nz-option *ngFor="let o of optionList" [nzValue]="o.name" [nzLabel]="o.displayName"></nz-option>

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

@ -23,7 +23,7 @@ export class EditroleComponent implements OnInit {
this.getMenus() this.getMenus()
this.validateForm = this.fb.group({ this.validateForm = this.fb.group({
name: [null, [Validators.required]], name: [null, [Validators.required]],
power: [null, [Validators.required]], power: [null],
menus: [null] menus: [null]
}); });
if (this.optionList.length == 0) { if (this.optionList.length == 0) {

Loading…
Cancel
Save