Files
bbq/src/app/routes/financial-management/components/receipt-order/receipt-order.component.ts
2022-01-20 20:51:32 +08:00

280 lines
8.0 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 { FreightAccountService } from '../../services/freight-account.service';
@Component({
selector: 'app-receipt-order',
templateUrl: './receipt-order.component.html',
styleUrls: ['../../../commom/less/box.less']
})
export class ReceiptOrderComponent 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
});
if (this.sf.value.brmdate) {
Object.assign(requestOptions.body, {
brmdate: {
start: this.sf.value.brmdate?.[0] || '',
end: this.sf.value.brmdate?.[1] || ''
}
});
}
}
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
}
},
brmcode: {
type: 'string',
title: '收款单号',
ui: {
widget: 'select',
placeholder: '请选择'
}
},
ltdid: {
type: 'string',
title: '网络货运人',
ui: {
widget: 'select',
placeholder: '请选择',
allowClear: true,
asyncData: () => this.service.getNetworkFreightForwarder()
},
default: null
},
bankreceipt: {
type: 'string',
title: '银行水单',
ui: {
widget: 'select',
placeholder: '请选择'
}
},
brmtype: {
type: 'string',
title: '收款类型',
ui: {
widget: 'select',
placeholder: '请选择',
visibleIf: {
expand: (value: boolean) => value
}
}
},
brmmode: {
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
}
}
},
sts: {
type: 'string',
title: '收款状态',
ui: {
widget: 'dict-select',
params: { dictKey: 'refund:apply:status' },
placeholder: '请选择',
visibleIf: {
expand: (value: boolean) => value
}
}
},
brmdate: {
title: '到账日期',
type: 'string',
ui: {
widget: 'sl-from-to-search',
format: 'yyyy-MM-dd',
visibleIf: {
expand: (value: boolean) => value
}
} as SFDateWidgetSchema
},
createTime: {
title: '创建时间',
type: 'string',
ui: {
widget: 'sl-from-to-search',
format: 'yyyy-MM-dd',
visibleIf: {
expand: (value: boolean) => value
}
} as SFDateWidgetSchema
},
billHCode: {
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
}
}
},
remarks: {
type: 'string',
title: '付款备注',
ui: {
placeholder: '请选择',
visibleIf: {
expand: (value: boolean) => value
}
}
}
}
};
}
private initST(): STColumn[] {
return [
{ title: '', index: 'key', type: 'checkbox', width: 60, fixed: 'left', className: 'text-center' },
{ title: '收款单号', index: 'brmcode', type: 'link', width: 180, className: 'text-left' },
{ title: '网络货运人', index: 'ltdName', width: 200, className: 'text-left' },
{ title: '到账日期', index: 'brmdate', type: 'date', width: 200, className: 'text-left' },
{ title: '收款账户', index: 'ltdaccountId', width: 200, className: 'text-left' },
{
title: '到账金额',
index: 'brmmoney',
width: 200,
type: 'widget',
className: 'text-right',
widget: { type: 'currency-chy', params: ({ record }) => ({ value: record.brmmoney }) }
},
{
title: '核销金额',
index: 'armoney',
width: 200,
type: 'widget',
className: 'text-right',
widget: { type: 'currency-chy', params: ({ record }) => ({ value: record.armoney }) }
},
{
title: '预收金额',
index: 'yskmoney',
width: 200,
type: 'widget',
className: 'text-right',
widget: { type: 'currency-chy', params: ({ record }) => ({ value: record.yskmoney }) }
},
{ title: '银行类型', index: 'banktypeLabel', width: 200, className: 'text-left' },
{ title: '收款类型', index: 'brmtypeLabel', width: 150, className: 'text-left' },
{ title: '收款方式', index: 'brmmode', width: 150, className: 'text-left' },
{ title: '付款人', index: 'artoname', width: 200, className: 'text-left' },
{ title: '银行水单', index: 'bankreceipt', width: 200, className: 'text-left' },
{ title: '创建时间', index: 'createTime', type: 'date', width: 200, className: 'text-left' },
{ title: '创建人', index: 'createUserId', width: 150, className: 'text-left' },
{ title: '收款状态', index: 'stsLabel', width: 200, className: 'text-left' },
{ title: '收款备注', index: 'remarks', width: 200, className: 'text-left' },
{
title: '操作',
width: '110px',
fixed: 'right',
className: 'text-center',
buttons: [
{
text: '浏览',
click: item => this.router.navigate(['/financial-management/receipt-order/detail/' + item.id])
},
// {
// text: '核销'
// }
]
}
];
}
}