|
|
|
@ -855,4 +855,55 @@ export class CriminalRecordsAdminComponent implements OnInit {
|
|
|
|
|
}); |
|
|
|
|
const instance = modal.getContentComponent(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exportExcel() { |
|
|
|
|
// console.log(this.validateForm)
|
|
|
|
|
let ViolationIds = [] |
|
|
|
|
// console.log(this.validateForm.value.event)
|
|
|
|
|
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 |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
let disposalState |
|
|
|
|
if (this.validateForm.value.disposalState == '0') { |
|
|
|
|
disposalState = true |
|
|
|
|
} else if (this.validateForm.value.disposalState == '1') { |
|
|
|
|
disposalState = false |
|
|
|
|
} else { |
|
|
|
|
disposalState = null |
|
|
|
|
} |
|
|
|
|
const httpOptions = { |
|
|
|
|
responseType: 'blob' as 'json', |
|
|
|
|
params: { |
|
|
|
|
Level: this.validateForm.value.level, |
|
|
|
|
ViolationIds: ViolationIds, |
|
|
|
|
ViolateAreas: this.validateForm.value.site, |
|
|
|
|
OrganizationUnitId: this.validateForm.value.organization, |
|
|
|
|
IsContainsChildren: 'true', |
|
|
|
|
IsHandled: disposalState, |
|
|
|
|
ViolateTime: this.validateForm.value.datePicker ? [moment(this.validateForm.value.datePicker[0]).format('yyyy-MM-DD'), moment(this.validateForm.value.datePicker[1]).format('yyyy-MM-DD')] : null, |
|
|
|
|
Positive: this.validateForm.value.misinformation |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
this.http.get(`/api/services/app/ViolateRecord/ExportExcel`, httpOptions).subscribe((data: any) => { |
|
|
|
|
// console.log('导出成功')
|
|
|
|
|
// 文件名中有中文 则对文件名进行转码
|
|
|
|
|
const link = document.createElement('a'); |
|
|
|
|
const blob = new Blob([data], { type: 'application/vnd.ms-excel' }); |
|
|
|
|
link.setAttribute('href', window.URL.createObjectURL(blob)); |
|
|
|
|
link.setAttribute('download', '预警记录' + '.xls'); |
|
|
|
|
link.style.visibility = 'hidden'; |
|
|
|
|
document.body.appendChild(link); |
|
|
|
|
link.click(); |
|
|
|
|
document.body.removeChild(link); |
|
|
|
|
this.message.create('success', `导出成功`); |
|
|
|
|
}, err => { |
|
|
|
|
this.message.create('error', `导出失败`); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|