This commit is contained in:
Taric Xin
2022-01-17 20:38:28 +08:00
parent f8a55a7068
commit d8b381a4f0
11 changed files with 461 additions and 132 deletions

View File

@ -1,3 +1,4 @@
import { CurrencyPipe } from '@angular/common';
import { Component, OnInit, ViewChild } from '@angular/core';
import { Router } from '@angular/router';
import { STComponent, STColumn, STRequestOptions, STChange } from '@delon/abc/st';
@ -10,7 +11,8 @@ import { FreightAccountService } from '../../services/freight-account.service';
@Component({
selector: 'app-voucher-management',
templateUrl: './voucher-management.component.html',
styleUrls: ['../../../commom/less/box.less']
styleUrls: ['../../../commom/less/box.less'],
providers: [CurrencyPipe]
})
export class VoucherManagementComponent implements OnInit {
@ViewChild('st', { static: true })
@ -25,23 +27,36 @@ export class VoucherManagementComponent implements OnInit {
_$expand = false;
selectedRows: any[] = [];
constructor(public service: FreightAccountService, private nzModalService: NzModalService, private router: Router) {}
constructor(
public service: FreightAccountService,
private nzModalService: NzModalService,
private router: Router,
private currencyPipe: CurrencyPipe
) {}
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
}
...this.sf.value
});
if (this.sf.value.createTime) {
Object.assign(requestOptions.body, {
createTime: {
start: this.sf.value.createTime?.[0] || null,
end: this.sf.value.createTime?.[1] || null
}
});
}
if (this.sf.value.vctime) {
Object.assign(requestOptions.body, {
vctime: {
start: this.sf.value.vctime?.[0] || null,
end: this.sf.value.vctime?.[1] || null
}
});
}
}
return requestOptions;
};
@ -54,19 +69,6 @@ export class VoucherManagementComponent implements OnInit {
}
}
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
});
}
/**
* 重置表单
*/
@ -92,7 +94,7 @@ export class VoucherManagementComponent implements OnInit {
hidden: true
}
},
inpinvcode: {
vccode: {
type: 'string',
title: '凭证号',
ui: {
@ -100,7 +102,7 @@ export class VoucherManagementComponent implements OnInit {
placeholder: '请输入'
}
},
ltdid: {
cno: {
type: 'string',
title: '客户',
ui: {
@ -111,7 +113,7 @@ export class VoucherManagementComponent implements OnInit {
},
default: ''
},
createtime: {
vctime: {
title: '凭证时间',
type: 'string',
ui: {
@ -119,7 +121,7 @@ export class VoucherManagementComponent implements OnInit {
format: 'yyyy-MM-dd'
} as SFDateWidgetSchema
},
inpinvc2ode: {
sourceCode: {
type: 'string',
title: '原始单号',
ui: {
@ -130,7 +132,7 @@ export class VoucherManagementComponent implements OnInit {
}
}
},
invtype: {
sourceType: {
type: 'string',
title: '原始单类型',
ui: {
@ -141,7 +143,7 @@ export class VoucherManagementComponent implements OnInit {
}
}
},
createtim2e: {
createTime: {
title: '创建时间',
type: 'string',
ui: {
@ -162,19 +164,25 @@ export class VoucherManagementComponent implements OnInit {
}
}
},
sts: {
vctype: {
type: 'string',
title: '凭证类型',
enum: [
{ value: null, label: '全部' },
{ value: 'WLW', label: 'WLW' },
{ value: 'CH', label: 'CH' },
{ value: 'YHY', label: 'YHY' },
{ value: 'KP', label: 'KP' }
],
ui: {
widget: 'dict-select',
params: { dictKey: 'refund:apply:status' },
widget: 'select',
placeholder: '请选择',
visibleIf: {
expand: (value: boolean) => value
}
}
},
s2ts: {
subid: {
type: 'string',
title: '科目',
ui: {
@ -186,8 +194,8 @@ export class VoucherManagementComponent implements OnInit {
}
}
},
remarks: {
type: 'string',
drmoney: {
type: 'number',
title: '借方金额',
ui: {
placeholder: '请输入',
@ -196,8 +204,8 @@ export class VoucherManagementComponent implements OnInit {
}
}
},
billCode: {
type: 'string',
crmoney: {
type: 'number',
title: '贷方金额',
ui: {
placeholder: '请输入',
@ -206,7 +214,7 @@ export class VoucherManagementComponent implements OnInit {
}
}
},
s2t2s: {
vcltdid: {
type: 'string',
title: '帐套',
ui: {
@ -218,19 +226,24 @@ export class VoucherManagementComponent implements OnInit {
}
}
},
s22t2s: {
sts: {
type: 'string',
title: '凭证状态',
enum: [
{ value: null, label: '全部' },
{ value: 0, label: '新建' },
{ value: 1, label: '待审核' },
{ value: 2, label: '已通过' }
],
ui: {
widget: 'dict-select',
params: { dictKey: 'refund:apply:status' },
widget: 'select',
placeholder: '请选择',
visibleIf: {
expand: (value: boolean) => value
}
}
},
feecode: {
importncnotes: {
type: 'string',
title: 'NC凭证',
ui: {
@ -240,7 +253,7 @@ export class VoucherManagementComponent implements OnInit {
}
}
},
feecsode: {
vc2code: {
type: 'string',
title: '汇总凭证号',
ui: {
@ -250,7 +263,7 @@ export class VoucherManagementComponent implements OnInit {
}
}
},
s22t2ss: {
importnc: {
type: 'string',
title: '导入NC',
ui: {
@ -262,9 +275,14 @@ export class VoucherManagementComponent implements OnInit {
}
}
},
s22t2s1s: {
isvc2: {
type: 'string',
title: '是否汇总',
enum: [
{ value: null, label: '全部' },
{ value: 0, label: '否' },
{ value: 1, label: '是' }
],
ui: {
widget: 'select',
placeholder: '请选择',
@ -279,28 +297,41 @@ export class VoucherManagementComponent implements OnInit {
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', width: 150 },
{ title: '凭证状态', index: 'sts' },
{ title: '创建时间', index: 'sts' },
{ title: '创建人', index: 'sts' },
{ title: '', index: 'key', type: 'checkbox', width: 60, className: 'text-center', fixed: 'left' },
{ title: '凭证号', index: 'id', type: 'link', width: 150 },
{ title: '帐套', index: 'vcltdid', width: 150 },
{ title: '凭证时间', index: 'vctime', type: 'date', width: 150 },
{ title: '凭证类型', index: 'vctype', enum: { WLW: 'WLW', CH: 'CH', YHY: 'YHY', KP: 'KP' }, width: 150 },
{ title: '序号', index: 'invmoney', width: 150, format: _ => '1' },
{ title: '摘要', index: 'remarks', width: 300 },
{ title: '币种', index: 'currency', width: 100 },
{
title: '方金额',
index: 'drmoney',
width: 120,
className: 'text-right',
format: item => `${this.currencyPipe.transform(item.armoney || 0)}`
},
{
title: '贷方金额',
index: 'crmoney',
width: 120,
className: 'text-right',
format: item => `${this.currencyPipe.transform(item.armoney || 0)}`
},
{ title: 'NC凭证', index: 'importncnotes', width: 150 },
{ title: '汇总凭证号', index: 'vc2id', width: 150 },
{ title: '凭证状态', index: 'sts', enum: { 0: '新建', 1: '待审核', 2: '已通过' }, width: 120 },
{ title: '创建时间', index: 'createTime', width: 140 },
{ title: '创建人', index: 'createUserId', width: 150 },
{
title: '操作',
width: '130px',
fixed: 'right',
buttons: [
{
text: '浏览'
text: '浏览',
click: (item: any) => this.router.navigate(['/financial-management/voucher-management/detail/' + item.id])
},
{
text: '修改'