Files
bbq/src/app/routes/tax-management/components/invoice-reporting/verify-result/verify-result.component.ts
2022-04-20 10:02:43 +08:00

140 lines
3.6 KiB
TypeScript

import { Component, OnInit, ViewChild } from '@angular/core';
import { Router } from '@angular/router';
import { STColumn, STComponent, STRequestOptions } from '@delon/abc/st';
import { SFSchema } from '@delon/form';
import { ModalHelper, _HttpClient } from '@delon/theme';
import { NzModalRef } from 'ng-zorro-antd/modal';
import { TaxManagementService } from '../../../services/tax-management.service';
@Component({
selector: 'app-tax-management-Invoice-reporting-verify-result',
templateUrl: './verify-result.component.html',
})
export class TaxManagementInvoiceVerifyResultComponent implements OnInit {
searchSchema: SFSchema = {
properties: {
no: {
type: 'string',
title: '编号'
}
}
};
@ViewChild('st') private readonly st!: STComponent;
columns: STColumn[] = [];
record: any = {}
subjectType: string = '0';
tabs: any[] = [
{ name: '平台信息', value: '0' },
{ name: '货主信息', value: '1' },
{ name: '司机信息', value: '2' },
{ name: '订单信息', value: '3' },
];
// get reqParams() {
// console.log(this.subjectType);
// const params ={
// subjectId: this.record?.shipperId,
// subjectType: this.subjectType,
// }
// return params;
// }
beforeReq = (requestOptions: STRequestOptions) => {let a: string = '';
switch (this.subjectType) {
case '0':
a = this.record?.networkTransporterId;
break
case '1':
a = this.record?.shipperId;
break
case '2':
a = this.record?.driverId;
break
case '3':
a = this.record?.wayBillId;
break
}
Object.assign(requestOptions.body, {
subjectId: a ,
subjectType: this.subjectType,
});
return requestOptions;
};
afterRes = (data: any[], rawData?: any) => {
console.log(data)
return data.map(item => ({
...item,
}));
};
constructor(public service: TaxManagementService, private modalRef: NzModalRef, public router: Router) {
}
ngOnInit(): void {
console.log(this.record);
this.initST();
}
/**
* 初始化数据列表
*/
initST() {
this.columns = [
{ title: '序号', type: 'no', className: 'text-center', width: '60px', },
{ title: '校验字段', index: 'checkFieldName', className: 'text-center', width: '120px', },
{
title: '是否必填',
index: 'requiredStatus',
className: 'text-center',
width: '100px',
type: 'enum',
enum: {
0: '否',
1: '是'
}
},
{ title: '上传值', index: 'fieldValue', className: 'text-center', width: '150px', },
{
title: '本地校验', index: 'checkStatus', className: 'text-center', width: '100px',
type: 'enum',
enum: {
0: '校验中',
1: '通过',
2: '不通过'
}
},
{ title: '错误内容', index: 'remark', className: 'text-center', width: '150px', },
]
}
add(): void {
// this.modal
// .createStatic(FormEditComponent, { i: { id: 0 } })
// .subscribe(() => this.st.reload());
}
selectTab(e: any) {
setTimeout(() => {
console.log(e?.value);
this.subjectType = e?.value;
console.log(this.subjectType);
this.st.load(1);
})
}
update() {
if (this.record?.billType === '1') {
window.open(location.origin + `/#/order-management/vehicle-detailChange/${this.record?.id}`)
} else if (this.record.billType === '2') {
window.open(location.origin + `/#/order-management/bulk-detailChange/${this.record?.id}`);
}
}
close(): void {
this.modalRef.destroy();
}
}