|
|
|
@ -25,6 +25,7 @@ export class TodayWarningComponent implements OnInit {
|
|
|
|
|
this.validateForm = this.fb.group({ |
|
|
|
|
level: [null], |
|
|
|
|
type: [null], |
|
|
|
|
event: [null], |
|
|
|
|
area: [null], |
|
|
|
|
disposalState: [null], |
|
|
|
|
datePickerStart: [new Date(`${moment(new Date()).format('YYYY-MM-DD')} 00:00`)], |
|
|
|
@ -60,21 +61,78 @@ export class TodayWarningComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//预警类型接口
|
|
|
|
|
warningTypes: any //预警接口数据
|
|
|
|
|
warningTypesDetails: any |
|
|
|
|
warningTypesDetailsCopy: any |
|
|
|
|
|
|
|
|
|
warningTypes: any //预警接口数据
|
|
|
|
|
warningTypesCopy: any |
|
|
|
|
warningLevels: any |
|
|
|
|
warningLevelsCopy: any |
|
|
|
|
warningType() { |
|
|
|
|
this.http.get('/api/services/app/Violation/GetAllList').subscribe((data: any) => { |
|
|
|
|
this.warningTypesDetails = data.result |
|
|
|
|
this.warningTypesDetails = JSON.parse(JSON.stringify(data.result)) |
|
|
|
|
this.warningTypesDetailsCopy = JSON.parse(JSON.stringify(data.result)) //原始数据备份
|
|
|
|
|
this.warningTypes = (data.result as any).groupBy((t) => { return t.violationType }); |
|
|
|
|
this.warningTypesCopy = (data.result as any).groupBy((t) => { return t.violationType }) |
|
|
|
|
this.warningLevels = (data.result as any).groupBy((t) => { return t.level }); |
|
|
|
|
this.warningLevelsCopy = (data.result as any).groupBy((t) => { return t.level }) |
|
|
|
|
this.warningLevels.sort(function (a, b) { |
|
|
|
|
if (a.key < b.key) { |
|
|
|
|
return -1; |
|
|
|
|
} else if (a.key == b.key) { |
|
|
|
|
return 0; |
|
|
|
|
} else { |
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
this.warningLevelsCopy.sort(function (a, b) { |
|
|
|
|
if (a.key < b.key) { |
|
|
|
|
return -1; |
|
|
|
|
} else if (a.key == b.key) { |
|
|
|
|
return 0; |
|
|
|
|
} else { |
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
// console.log(111, this.warningTypesDetails)
|
|
|
|
|
// console.log(222, this.warningTypesCopy)
|
|
|
|
|
// console.log(333, this.warningLevels)
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
typeChange(e) { |
|
|
|
|
if (!e) { |
|
|
|
|
this.warningTypesDetails = this.warningTypesDetailsCopy |
|
|
|
|
this.warningLevels = this.warningLevelsCopy |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
this.warningTypes.forEach(element => { |
|
|
|
|
if (element.key == e) { |
|
|
|
|
this.warningTypesDetails = element |
|
|
|
|
this.warningLevels = (element as any).groupBy((t) => { return t.level }); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
this.validateForm.patchValue({ |
|
|
|
|
event: null, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
levelChange(e) { |
|
|
|
|
if (!e) { |
|
|
|
|
this.warningTypesDetails = this.warningTypesDetailsCopy |
|
|
|
|
this.warningTypes = this.warningTypesCopy |
|
|
|
|
this.validateForm.patchValue({ |
|
|
|
|
type: null, |
|
|
|
|
}); |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
this.warningLevels.forEach(element => { |
|
|
|
|
if (element.key == e) { |
|
|
|
|
this.warningTypesDetails = element |
|
|
|
|
this.warningTypes = (element as any).groupBy((t) => { return t.violationType }); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
this.validateForm.patchValue({ |
|
|
|
|
event: null, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//获得预警列表
|
|
|
|
@ -86,7 +144,10 @@ export class TodayWarningComponent implements OnInit {
|
|
|
|
|
getEarlyWarningList() { |
|
|
|
|
this.isLoading = true |
|
|
|
|
let ViolationIds = [] |
|
|
|
|
if (this.validateForm.value.type) { |
|
|
|
|
if (this.validateForm.value.event) { |
|
|
|
|
ViolationIds = this.validateForm.value.event |
|
|
|
|
} |
|
|
|
|
if (this.validateForm.value.type && !this.validateForm.value.event) { |
|
|
|
|
this.warningTypesDetails.forEach(item => { |
|
|
|
|
item.id ? ViolationIds.push(item.id) : null |
|
|
|
|
}); |
|
|
|
@ -102,7 +163,7 @@ export class TodayWarningComponent implements OnInit {
|
|
|
|
|
let params = { |
|
|
|
|
Level: this.validateForm.value.level, |
|
|
|
|
ViolationIds: ViolationIds, |
|
|
|
|
ViolateArea: this.validateForm.value.area, |
|
|
|
|
ViolateAreas: this.validateForm.value.area, |
|
|
|
|
organizationUnitId: JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id, |
|
|
|
|
ViolateTime: (this.validateForm.value.datePickerEnd && this.validateForm.value.datePickerStart) ? [moment(this.validateForm.value.datePickerStart).format('yyyy-MM-DD HH:mm:ss'), moment(this.validateForm.value.datePickerEnd).format('yyyy-MM-DD HH:mm:ss')] : null, |
|
|
|
|
IsHandled: disposalState, |
|
|
|
|