|
|
@ -34,6 +34,7 @@ import {DateMinutesDiffPipe} from "../../../pipes/common/date-minutes-diff.pipe" |
|
|
|
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
|
|
|
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
|
|
|
import {NzTypographyComponent} from "ng-zorro-antd/typography"; |
|
|
|
import {NzTypographyComponent} from "ng-zorro-antd/typography"; |
|
|
|
import {environment} from "../../../../environments/environment"; |
|
|
|
import {environment} from "../../../../environments/environment"; |
|
|
|
|
|
|
|
import {NzUploadModule} from "ng-zorro-antd/upload"; |
|
|
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
@Component({ |
|
|
|
selector: 'app-gas-order-receipt', |
|
|
|
selector: 'app-gas-order-receipt', |
|
|
@ -84,15 +85,18 @@ import {environment} from "../../../../environments/environment"; |
|
|
|
NzTooltipDirective, |
|
|
|
NzTooltipDirective, |
|
|
|
DateMinutesDiffPipe, |
|
|
|
DateMinutesDiffPipe, |
|
|
|
NzDividerComponent, |
|
|
|
NzDividerComponent, |
|
|
|
NzTypographyComponent |
|
|
|
NzTypographyComponent, |
|
|
|
|
|
|
|
NzUploadModule |
|
|
|
], |
|
|
|
], |
|
|
|
templateUrl: './gas-order-receipt.component.html', |
|
|
|
templateUrl: './gas-order-receipt.component.html', |
|
|
|
styleUrl: './gas-order-receipt.component.less' |
|
|
|
styleUrl: './gas-order-receipt.component.less' |
|
|
|
}) |
|
|
|
}) |
|
|
|
export class GasOrderReceiptComponent { |
|
|
|
export class GasOrderReceiptComponent { |
|
|
|
imageUrl = environment.imageUrl; |
|
|
|
imageUrl = environment.imageUrl; |
|
|
|
loadingObject = { |
|
|
|
baseUrl = environment.baseUrl; |
|
|
|
title: "加载中...", |
|
|
|
|
|
|
|
|
|
|
|
loadingObject: any = { |
|
|
|
|
|
|
|
title: "处理中...", |
|
|
|
status: false, |
|
|
|
status: false, |
|
|
|
}; |
|
|
|
}; |
|
|
|
// 表单页数
|
|
|
|
// 表单页数
|
|
|
@ -112,6 +116,12 @@ export class GasOrderReceiptComponent { |
|
|
|
failForm: FormGroup; |
|
|
|
failForm: FormGroup; |
|
|
|
failModel = false; |
|
|
|
failModel = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
importErrorModal = false; |
|
|
|
|
|
|
|
importErrorData: any = []; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
importFleUrlForm: FormGroup; |
|
|
|
|
|
|
|
importModal = false; |
|
|
|
constructor(private fb: NonNullableFormBuilder, |
|
|
|
constructor(private fb: NonNullableFormBuilder, |
|
|
|
private gasOrderReceiptService : GasOrderReceiptService, |
|
|
|
private gasOrderReceiptService : GasOrderReceiptService, |
|
|
|
private storage: BrowserStorageService, |
|
|
|
private storage: BrowserStorageService, |
|
|
@ -124,6 +134,10 @@ export class GasOrderReceiptComponent { |
|
|
|
remark: ['',[Validators.required]], |
|
|
|
remark: ['',[Validators.required]], |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.importFleUrlForm = this.fb.group({ |
|
|
|
|
|
|
|
fileUrl: [''], |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 初始化搜索框
|
|
|
|
// 初始化搜索框
|
|
|
|
this.searchForm = this.fb.group({ |
|
|
|
this.searchForm = this.fb.group({ |
|
|
|
orderNo: [''], |
|
|
|
orderNo: [''], |
|
|
@ -262,5 +276,94 @@ export class GasOrderReceiptComponent { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 打开导入模态框 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
showImport() { |
|
|
|
|
|
|
|
this.importModal = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 提交导入设备 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
submitImport() { |
|
|
|
|
|
|
|
this.loadingObject.spinning = true; |
|
|
|
|
|
|
|
this.loadingObject.msg = '导入中...'; |
|
|
|
|
|
|
|
if (this.importFleUrlForm.controls['fileUrl'].value == null) { |
|
|
|
|
|
|
|
this.modal.warning({ |
|
|
|
|
|
|
|
nzTitle: '提示', |
|
|
|
|
|
|
|
nzContent: '请上传文件', |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.loadingObject.spinning = false; |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.gasOrderReceiptService.importComplete(this.importFleUrlForm.value, (data: any) => { |
|
|
|
|
|
|
|
this.loadingObject.spinning = false; |
|
|
|
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
|
|
|
if (data['return_data'].length === 0) { |
|
|
|
|
|
|
|
this.modal.success({ |
|
|
|
|
|
|
|
nzTitle: '提示', |
|
|
|
|
|
|
|
nzContent: '成功', |
|
|
|
|
|
|
|
nzOnOk: () => this.queryData() |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.modal.warning({ |
|
|
|
|
|
|
|
nzTitle: '提示', |
|
|
|
|
|
|
|
nzOkText: '导入失败数据', |
|
|
|
|
|
|
|
nzContent: '只有部分数据导入成功', |
|
|
|
|
|
|
|
nzOnOk: () => this.showImportErrorModal(data['return_data']) |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.importModal = true; |
|
|
|
|
|
|
|
this.modal.error({ |
|
|
|
|
|
|
|
nzTitle: '提示', |
|
|
|
|
|
|
|
nzContent: data['return_msg'], |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 打开导入错误数据模态框 |
|
|
|
|
|
|
|
* @param data |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
showImportErrorModal(data:any) { |
|
|
|
|
|
|
|
this.importErrorData = data; |
|
|
|
|
|
|
|
this.importErrorModal = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 导入设备回调 |
|
|
|
|
|
|
|
* @param fileInfo |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
importDeviceChange(fileInfo: any) { |
|
|
|
|
|
|
|
if (fileInfo.file.status !== 'uploading') { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (fileInfo.file.status === 'done') { |
|
|
|
|
|
|
|
this.loadingObject.spinning = false; |
|
|
|
|
|
|
|
if (fileInfo.file.response.return_code === '000000') { |
|
|
|
|
|
|
|
if (fileInfo.file.response.return_data == null || fileInfo.file.response.return_data.length === 0) { |
|
|
|
|
|
|
|
this.modal.error({ |
|
|
|
|
|
|
|
nzTitle: '提示', |
|
|
|
|
|
|
|
nzContent: '文件上传失败', |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.importFleUrlForm.controls['fileUrl'].setValue(fileInfo.file.response.return_data[0]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.modal.error({ |
|
|
|
|
|
|
|
nzTitle: '提示', |
|
|
|
|
|
|
|
nzContent: fileInfo.file.response.return_msg, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (fileInfo.file.status === 'error') { |
|
|
|
|
|
|
|
this.loadingObject.spinning = false; |
|
|
|
|
|
|
|
this.modal.error({ |
|
|
|
|
|
|
|
nzTitle: '提示', |
|
|
|
|
|
|
|
nzContent: '导入失败' |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|