Files
bbq/src/app/routes/financial-management/components/voucher-management/voucher-management.component.ts
wangshiming 5cddf9a778 状态更新
2022-01-14 15:27:15 +08:00

318 lines
8.3 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 { ShipperBaseService } from '@shared';
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-voucher-management',
templateUrl: './voucher-management.component.html',
styleUrls: ['../../../commom/less/box.less']
})
export class VoucherManagementComponent implements OnInit {
@ViewChild('st', { static: true })
st!: STComponent;
@ViewChild('sf', { static: false })
sf!: SFComponent;
@ViewChild('auditModal', { static: false })
auditModal!: any;
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,
createtime: {
start: this.sf.value.createtime?.[0] || null,
end: this.sf.value.createtime?.[1] || null
},
invdate: {
start: this.sf.value.invdate?.[0] || null,
end: this.sf.value.invdate?.[1] || null
}
});
}
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
}
},
inpinvcode: {
type: 'string',
title: '凭证号',
ui: {
autocomplete: 'off',
placeholder: '请输入'
}
},
ltdid: {
type: 'string',
title: '客户',
ui: {
widget: 'select',
placeholder: '请选择',
allowClear: true,
asyncData: () => this.service.getNetworkFreightForwarder()
},
default: ''
},
createtime: {
title: '凭证时间',
type: 'string',
ui: {
widget: 'sl-from-to-search',
format: 'yyyy-MM-dd'
} as SFDateWidgetSchema
},
inpinvc2ode: {
type: 'string',
title: '原始单号',
ui: {
autocomplete: 'off',
placeholder: '请输入',
visibleIf: {
expand: (value: boolean) => value
}
}
},
invtype: {
type: 'string',
title: '原始单类型',
ui: {
widget: 'select',
placeholder: '请选择',
visibleIf: {
expand: (value: boolean) => value
}
}
},
createtim2e: {
title: '创建时间',
type: 'string',
ui: {
widget: 'sl-from-to-search',
format: 'yyyy-MM-dd',
visibleIf: {
expand: (value: boolean) => value
}
} as SFDateWidgetSchema
},
inpinvcosde: {
type: 'string',
title: '凭证摘要',
ui: {
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
}
}
},
s2ts: {
type: 'string',
title: '科目',
ui: {
widget: 'dict-select',
params: { dictKey: 'refund:apply:status' },
placeholder: '请选择',
visibleIf: {
expand: (value: boolean) => value
}
}
},
remarks: {
type: 'string',
title: '借方金额',
ui: {
placeholder: '请输入',
visibleIf: {
expand: (value: boolean) => value
}
}
},
billCode: {
type: 'string',
title: '贷方金额',
ui: {
placeholder: '请输入',
visibleIf: {
expand: (value: boolean) => value
}
}
},
s2t2s: {
type: 'string',
title: '帐套',
ui: {
widget: 'dict-select',
params: { dictKey: 'refund:apply:status' },
placeholder: '请选择',
visibleIf: {
expand: (value: boolean) => value
}
}
},
s22t2s: {
type: 'string',
title: '凭证状态',
ui: {
widget: 'dict-select',
params: { dictKey: 'refund:apply:status' },
placeholder: '请选择',
visibleIf: {
expand: (value: boolean) => value
}
}
},
feecode: {
type: 'string',
title: 'NC凭证',
ui: {
placeholder: '请输入',
visibleIf: {
expand: (value: boolean) => value
}
}
},
feecsode: {
type: 'string',
title: '汇总凭证号',
ui: {
placeholder: '请输入',
visibleIf: {
expand: (value: boolean) => value
}
}
},
s22t2ss: {
type: 'string',
title: '导入NC',
ui: {
widget: 'dict-select',
params: { dictKey: 'refund:apply:status' },
placeholder: '请选择',
visibleIf: {
expand: (value: boolean) => value
}
}
},
s22t2s1s: {
type: 'string',
title: '是否汇总',
ui: {
widget: 'select',
placeholder: '请选择',
visibleIf: {
expand: (value: boolean) => value
}
}
}
}
};
}
private initST(): STColumn[] {
return [
{ title: '', index: 'key', type: 'checkbox' },
{ title: '凭证号', index: 'inpinvcode', type: 'link' },
{ title: '帐套', index: 'ltdid' },
{ title: '凭证时间', index: 'invdate', type: 'date' },
{ title: '凭证类型', index: 'invoiceno' },
{ title: '序号', index: 'invmoney' },
{ title: '摘要', index: 'invtax' },
{ title: '币种', index: 'invtype' },
{ title: '借方金额', index: 'hrto' },
{ title: '贷方金额', index: 'createtime', type: 'date' },
{ title: 'NC凭证', index: 'createbyname' },
{ title: '汇总凭证号', index: 'sts' },
{ title: '凭证状态', index: 'sts' },
{ title: '创建时间', index: 'sts' },
{ title: '创建人', index: 'sts' },
{
title: '操作',
width: '90px',
buttons: [
{
text: '浏览'
},
{
text: '修改'
},
{
text: '删除 '
},
{
text: '提交'
}
]
}
];
}
}