|
|
|
@ -10,6 +10,7 @@ import { debounceTime } from 'rxjs/operators';
|
|
|
|
|
import { Router } from '@angular/router'; |
|
|
|
|
import { OilUnloadingProcessComponent } from '../oil-unloading-process/oil-unloading-process.component'; |
|
|
|
|
import { TreeService } from 'src/app/service/tree.service'; |
|
|
|
|
import { NzMessageService } from 'ng-zorro-antd/message'; |
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-oil-unloading-process-list', |
|
|
|
|
templateUrl: './oil-unloading-process-list.component.html', |
|
|
|
@ -18,7 +19,7 @@ import { TreeService } from 'src/app/service/tree.service';
|
|
|
|
|
export class OilUnloadingProcessListComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
validateForm!: FormGroup; |
|
|
|
|
constructor(private toTree: TreeService, private http: HttpClient, private fb: FormBuilder, private router: Router, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private element: ElementRef) { } |
|
|
|
|
constructor(private toTree: TreeService, private http: HttpClient, private fb: FormBuilder, private router: Router, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private element: ElementRef, private message: NzMessageService) { } |
|
|
|
|
|
|
|
|
|
myChart: any //左侧饼图
|
|
|
|
|
mybarChart: any //柱状图
|
|
|
|
@ -648,8 +649,8 @@ export class OilUnloadingProcessListComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
let params = { |
|
|
|
|
IsCorrect: IsCorrect, |
|
|
|
|
StartTime: moment(this.validateForm.value.datePicker[0]).format('yyyy-MM-DD'), |
|
|
|
|
EndTime: moment(this.validateForm.value.datePicker[1]).format('yyyy-MM-DD'), |
|
|
|
|
StartTime: moment(this.validateForm.value.datePicker[0]).format('yyyy-MM-DD') + ' 00:00:00', |
|
|
|
|
EndTime: moment(this.validateForm.value.datePicker[1]).format('yyyy-MM-DD') + ' 23:59:59', |
|
|
|
|
IsContainsChildren: 'true', |
|
|
|
|
OrganizationUnitId: organizationUnitId, |
|
|
|
|
SkipCount: this.SkipCount, |
|
|
|
@ -777,4 +778,42 @@ export class OilUnloadingProcessListComponent implements OnInit {
|
|
|
|
|
this.router.navigate(['records/misinformationList']) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
exportExcel() { |
|
|
|
|
let organizationUnitId |
|
|
|
|
if (this.router.url.indexOf('petrolStation') != -1) { |
|
|
|
|
organizationUnitId = JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id |
|
|
|
|
} else { |
|
|
|
|
organizationUnitId = this.validateForm.value.organization |
|
|
|
|
} |
|
|
|
|
let IsCorrect = null |
|
|
|
|
if (this.validateForm.value.state) { |
|
|
|
|
this.validateForm.value.state == '0' ? IsCorrect = 'false' : IsCorrect = 'true' |
|
|
|
|
} |
|
|
|
|
const httpOptions = { |
|
|
|
|
responseType: 'blob' as 'json', |
|
|
|
|
}; |
|
|
|
|
let body = { |
|
|
|
|
IsCorrect: IsCorrect, |
|
|
|
|
StartTime: moment(this.validateForm.value.datePicker[0]).format('yyyy-MM-DD') + ' 00:00:00', |
|
|
|
|
EndTime: moment(this.validateForm.value.datePicker[1]).format('yyyy-MM-DD') + ' 23:59:59', |
|
|
|
|
IsContainsChildren: 'true', |
|
|
|
|
OrganizationUnitId: organizationUnitId |
|
|
|
|
} |
|
|
|
|
this.http.post(`/api/services/app/OilUnloadingProcess/ExportExcel`, body, 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', `导出失败`); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|