刘向辉 3 years ago
parent
commit
88ba677813
  1. 1
      src/app/system-management/push/push.component.html
  2. 38
      src/app/system-management/push/push.component.ts

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

@ -2,6 +2,7 @@
<div class="topbox">
<div class="lefttop">
<span>通知推送权限配置</span>
<label nz-checkbox [(ngModel)]="checked" (ngModelChange)='changeNotePush($event)'>是否开启短信推送</label>
</div>
<div class="righttop">
<form nz-form [formGroup]="validateForm" (ngSubmit)="submitForm()">

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

@ -14,7 +14,7 @@ export class PushComponent implements OnInit {
validateForm!: FormGroup;
constructor(private modal: NzModalService, private viewContainerRef: ViewContainerRef, private fb: FormBuilder, private http: HttpClient, private message: NzMessageService) { }
checked
async ngOnInit(): Promise<void> {
this.validateForm = this.fb.group({
search: [null]
@ -23,9 +23,35 @@ export class PushComponent implements OnInit {
await this.getPutRoles()
await this.getHandleRoles()
this.getViolation()
this.getSetting()
}
//获取短信推送状态
getSetting() {
let params = {
settingName: 'ViolationSmsSwitch',
}
this.http.get('/api/services/app/Configuration/GetSetting', { params: params }).subscribe((data: any) => {
// console.log('获取短信推送状态', data)
data.result == 'true' ? this.checked = true : this.checked = false
})
}
changeNotePush(e) {
console.log(e)
let params = {
settingName: 'ViolationSmsSwitch',
value: e
}
this.http.post('/api/services/app/Configuration/SetSetting', '', { params: params }).subscribe((data: any) => {
// console.log('设置短信推送状态成功', data)
if(e){
this.message.create('success', '开启成功!');
}else{
this.message.create('success', '关闭成功!');
}
})
}
//获取预警类型
list: any
getViolation() {
@ -121,14 +147,14 @@ export class PushComponent implements OnInit {
this.validateForm.controls[i].markAsDirty();
this.validateForm.controls[i].updateValueAndValidity();
}
if(this.validateForm.value.search){
this.list = this.list.filter((item)=>{
if (this.validateForm.value.search) {
this.list = this.list.filter((item) => {
return item.violationType.indexOf(this.validateForm.value.search) != -1
})
}else{
} else {
this.getViolation()
}
}
}

Loading…
Cancel
Save