You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.3 KiB
50 lines
1.3 KiB
import { HttpClient } from '@angular/common/http'; |
|
import { Component, Input, OnInit } from '@angular/core'; |
|
import { NzMessageService } from 'ng-zorro-antd/message'; |
|
|
|
@Component({ |
|
selector: 'app-warning-events', |
|
templateUrl: './warning-events.component.html', |
|
styleUrls: ['./warning-events.component.scss'] |
|
}) |
|
export class WarningEventsComponent implements OnInit { |
|
@Input() data?: any; |
|
constructor(private http: HttpClient, private message: NzMessageService) { } |
|
|
|
ngOnInit(): void { |
|
// console.log(this.data) |
|
this.getWarningList() |
|
} |
|
|
|
warningList: any |
|
getWarningList() { |
|
this.http.get('/api/services/app/Violation/GetStationViolationConfig', { |
|
params: { |
|
organizationId: this.data.id |
|
} |
|
}).subscribe((data: any) => { |
|
|
|
data.result.forEach(element => { |
|
element.enable = !element.disabled |
|
}); |
|
this.warningList = data.result |
|
// console.log('预警列表', this.warningList) |
|
}) |
|
} |
|
|
|
isLoading = false |
|
change(item) { |
|
this.isLoading = true |
|
// console.log(item) |
|
let body = { |
|
stationId: item.stationId, |
|
violationId: item.violation.id, |
|
disabled: !item.enable |
|
} |
|
this.http.post('/api/services/app/Violation/UpdateStationViolation', body).subscribe(data => { |
|
this.isLoading = false |
|
this.message.create('success', '修改成功'); |
|
}) |
|
} |
|
|
|
}
|
|
|