Files
bbq/src/app/routes/financial-management/components/payment-order/payment-order.component.ts
2022-01-20 15:28:57 +08:00

267 lines
7.5 KiB
TypeScript

import { Component, OnInit, ViewChild } from '@angular/core';
import { Router } from '@angular/router';
import { STComponent, STColumn, STRequestOptions, STChange } from '@delon/abc/st';
import { SFComponent, SFSchema, SFDateWidgetSchema } from '@delon/form';
import { NzModalService } from 'ng-zorro-antd/modal';
import { AddCollectionInvoiceModalComponent } from 'src/app/routes/ticket-management/components/input-invoice/add-collection-invoice-modal/add-collection-invoice-modal.component';
import { TicketService } from 'src/app/routes/ticket-management/services/ticket.service';
import { FreightAccountService } from '../../services/freight-account.service';
@Component({
selector: 'app-payment-order',
templateUrl: './payment-order.component.html',
styleUrls: ['../../../commom/less/box.less', '../../../commom/less/expend-but.less']
})
export class PaymentOrderComponent implements OnInit {
@ViewChild('st', { static: true })
st!: STComponent;
@ViewChild('sf', { static: false })
sf!: SFComponent;
columns: STColumn[] = this.initST();
searchSchema: SFSchema = this.initSF();
_$expand = false;
selectedRows: any[] = [];
constructor(public service: FreightAccountService, private nzModalService: NzModalService, private router: Router) {}
ngOnInit(): void {}
beforeReq = (requestOptions: STRequestOptions) => {
if (this.sf) {
Object.assign(requestOptions.body, {
...this.sf.value
});
}
return requestOptions;
};
stChange(e: STChange): void {
switch (e.type) {
case 'checkbox':
this.selectedRows = e.checkbox!;
break;
}
}
addInvoice() {
if (this.selectedRows?.length <= 0) {
this.service.msgSrv.warning('请选择付款单');
return;
}
const modal = this.nzModalService.create({
nzTitle: '付款单',
nzContent: AddCollectionInvoiceModalComponent,
nzComponentParams: { i: { userId: 0 } },
nzFooter: null
});
}
/**
* 重置表单
*/
resetSF() {
this.sf.reset();
this._$expand = false;
}
/**
* 伸缩查询条件
*/
expandToggle() {
this._$expand = !this._$expand;
this.sf?.setValue('/expand', this._$expand);
}
private initSF(): SFSchema {
return {
properties: {
expand: {
type: 'boolean',
ui: {
hidden: true
}
},
paycodes: {
type: 'string',
title: '付款单号',
ui: {
widget: 'select',
placeholder: '请选择'
}
},
ltdid: {
type: 'string',
title: '网络货运人',
ui: {
widget: 'select',
placeholder: '请选择',
allowClear: true,
asyncData: () => this.service.getNetworkFreightForwarder()
},
default: null
},
orderS2n: {
type: 'string',
title: '付款状态',
ui: {
widget: 'dict-select',
params: { dictKey: 'refund:apply:status' },
placeholder: '请选择'
}
},
paytype: {
type: 'string',
title: '付款类型',
ui: {
widget: 'select',
placeholder: '请选择',
visibleIf: {
expand: (value: boolean) => value
}
}
},
paymode: {
type: 'string',
title: '付款方式',
ui: {
widget: 'select',
placeholder: '请选择',
visibleIf: {
expand: (value: boolean) => value
}
}
},
arto: {
type: 'string',
title: '收款人',
ui: {
widget: 'select',
placeholder: '请选择',
visibleIf: {
expand: (value: boolean) => value
}
}
},
billHCodes: {
type: 'string',
title: '订单号',
ui: {
widget: 'select',
placeholder: '请选择',
visibleIf: {
expand: (value: boolean) => value
}
}
},
paydate: {
title: '要求付款日期',
type: 'string',
ui: {
widget: 'sl-from-to-search',
format: 'yyyy-MM-dd',
visibleIf: {
expand: (value: boolean) => value
}
} as SFDateWidgetSchema
},
createTi1me: {
title: '确认日期',
type: 'string',
ui: {
widget: 'sl-from-to-search',
format: 'yyyy-MM-dd',
visibleIf: {
expand: (value: boolean) => value
}
} as SFDateWidgetSchema
},
waybillHCodes: {
type: 'string',
title: '运单号',
ui: {
widget: 'select',
placeholder: '请选择',
visibleIf: {
expand: (value: boolean) => value
}
}
},
feeHCodes: {
type: 'string',
title: '费用号',
ui: {
widget: 'select',
placeholder: '请选择',
visibleIf: {
expand: (value: boolean) => value
}
}
},
createTime: {
title: '创建时间',
type: 'string',
ui: {
widget: 'sl-from-to-search',
format: 'yyyy-MM-dd',
visibleIf: {
expand: (value: boolean) => value
}
} as SFDateWidgetSchema
},
remarks: {
type: 'string',
title: '付款备注',
ui: {
placeholder: '请选择',
visibleIf: {
expand: (value: boolean) => value
}
}
}
}
};
}
private initST(): STColumn[] {
return [
{ title: '', index: 'key', type: 'checkbox', fixed: 'left', className: 'text-center' },
{ title: '付款单号', index: 'payCode', type: 'link', width: 180 },
{ title: '网络货运人', index: 'ltdName', width: 160 },
{ title: '要求付款日期', index: 'payDate', type: 'date', className: 'text-center', width: 150 },
{
title: '付款金额',
index: 'payMoney',
width: 120,
type: 'widget',
className: 'text-right',
widget: { type: 'currency-chy', params: ({ record }) => ({ value: record.paymoney }) }
},
{ title: '付款类型', index: 'payTypeLabel', width: 130 },
{ title: '付款方式', index: 'payModeLabel', width: 130 },
{ title: '结算客户', index: 'shipperId', width: 160 },
{ title: '收款人', index: 'hrToName', width: 150 },
{ title: '应付已核销', index: 'callNo', width: 150 },
{ title: '确认日期', index: 'payDate2', type: 'date', className: 'text-center', width: 150 },
{ title: '创建时间', index: 'createTime', type: 'date', className: 'text-center', width: 150 },
{ title: '创建人', index: 'createUserId', width: 160 },
{ title: '付款备注', index: 'payRemarks', width: 200 },
{
title: '操作',
className: 'text-center',
fixed: 'right',
width: '110px',
buttons: [
{
text: '浏览',
click: item => this.router.navigate(['/financial-management/payment-order/detail/' + item.id])
},
// {
// text: '修改',
// }
]
}
];
}
}