diff --git a/src/app/system-management/push/push.component.html b/src/app/system-management/push/push.component.html index 1fda6ab..7125fd5 100644 --- a/src/app/system-management/push/push.component.html +++ b/src/app/system-management/push/push.component.html @@ -2,6 +2,7 @@
通知推送权限配置 +
diff --git a/src/app/system-management/push/push.component.ts b/src/app/system-management/push/push.component.ts index 944b28f..1538028 100644 --- a/src/app/system-management/push/push.component.ts +++ b/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 { 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() } - + } }