This commit is contained in:
Taric Xin
2021-12-23 17:07:57 +08:00
parent eb432e521f
commit 37daa23ae1
3 changed files with 140 additions and 143 deletions

View File

@ -1,6 +1,6 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { Router } from '@angular/router';
import { STComponent, STColumn, STChange } from '@delon/abc/st';
import { STComponent, STColumn, STChange, STRequestOptions } from '@delon/abc/st';
import { SFComponent, SFSchema, SFDateWidgetSchema } from '@delon/form';
import { NzModalService } from 'ng-zorro-antd/modal';
import { TicketService } from '../../services/ticket.service';
@ -20,100 +20,8 @@ export class InvoicedListComponent implements OnInit {
logosticsModal!: any;
@ViewChild('logosticsLogsModal', { static: false })
logosticsLogsModal!: any;
columns: STColumn[] = [
{ title: '', index: 'key', type: 'checkbox' },
{ title: '发票号码', index: 'no' },
{ title: '申请编号', index: 'callNo' },
{ title: '托运人', index: 'callNo' },
{ title: '无车承运人', index: 'callNo' },
{ title: '运单数', index: 'callNo' },
{ title: '开票金额', index: 'callNo' },
{ title: '税价合计', index: 'callNo' },
{ title: '开票日期', index: 'updatedAt', type: 'date' },
{ title: '快递信息', render: 'logostics' },
{
title: '操作',
buttons: [
{
text: '作废发票',
click: item => this.deletedInvoice(item)
},
{
text: '预览发票',
click: item => this.routeTo(item)
},
{
text: '填写物流',
click: item => this.editInvoice(item)
}
]
}
];
searchSchema: SFSchema = {
properties: {
expand: {
type: 'boolean',
ui: {
hidden: true
}
},
orderSn: {
type: 'string',
title: '发票号码',
ui: {
autocomplete: 'off'
}
},
orderSn2: {
type: 'string',
title: '申请编号',
ui: {
autocomplete: 'off'
}
},
createTime: {
title: '开票日期',
type: 'string',
ui: {
widget: 'date',
mode: 'range',
format: 'yyyy-MM-dd'
} as SFDateWidgetSchema
},
receiveName: {
type: 'string',
title: '托运人',
enum: [{ label: '全部', value: '全部' }],
ui: {
widget: 'select',
placeholder: '请选择',
change: (i: any) => {
this.sf.value.receiveName = i;
this.sf?.setValue('/receiveName', i);
},
visibleIf: {
expand: (value: boolean) => value
}
}
},
receiveName2: {
type: 'string',
title: '无车承运人',
enum: [{ label: '全部', value: '全部' }],
ui: {
widget: 'select',
placeholder: '请选择',
change: (i: any) => {
this.sf.value.receiveName2 = i;
this.sf?.setValue('/receiveName2', i);
},
visibleIf: {
expand: (value: boolean) => value
}
}
}
}
};
columns: STColumn[] = this.initST();
searchSchema: SFSchema = this.initSF();
reqParams = {};
@ -125,15 +33,19 @@ export class InvoicedListComponent implements OnInit {
ngOnInit(): void {}
beforeReq = (requestOptions: STRequestOptions) => {
if (this.sf) {
this.reqParams = { ...this.sf.value };
}
return requestOptions;
};
stChange(e: STChange): void {
switch (e.type) {
case 'checkbox':
this.selectedRows = e.checkbox!;
this.totalCallNo = this.selectedRows.reduce((total, cv) => total + cv.callNo, 0);
break;
case 'filter':
this.st.load();
break;
}
}
@ -141,26 +53,11 @@ export class InvoicedListComponent implements OnInit {
add(): void {}
routeTo(item: any) {
this.router.navigate(['/ticket/invoice-list-detail/1']);
}
delete(item: any) {
this.st.removeRow(item);
}
editInvoice(item: any) {
const modal = this.nzModalService.create({
nzTitle: '填写物流/修改物流',
nzContent: this.logosticsModal,
nzOnOk: () => {}
});
modal.afterClose.subscribe(res => {
this.st.load();
});
}
deletedInvoice(item: any) {
deletedInvoice() {
if (this.selectedRows?.length <= 0) {
this.service.msgSrv.warning('请选择发票');
return;
}
this.nzModalService.warning({
nzTitle: '确定将所选发票作废?',
nzCancelText: '取消',
@ -168,6 +65,18 @@ export class InvoicedListComponent implements OnInit {
});
}
invoiceHongChong() {
if (this.selectedRows?.length <= 0) {
this.service.msgSrv.warning('请选择发票');
return;
}
this.nzModalService.warning({
nzTitle: '确定将所选发票红冲?',
nzCancelText: '取消',
nzOnOk: () => {}
});
}
showlogosticsLogs(item: any) {
this.nzModalService.create({
nzTitle: '查看物流',
@ -192,4 +101,105 @@ export class InvoicedListComponent implements OnInit {
this._$expand = !this._$expand;
this.sf?.setValue('/expand', this._$expand);
}
private initSF(): SFSchema {
return {
properties: {
expand: {
type: 'boolean',
ui: {
hidden: true
}
},
orderSn: {
type: 'string',
title: '发票号码',
ui: {
autocomplete: 'off'
}
},
orderSn2: {
type: 'string',
title: '申请编号',
ui: {
autocomplete: 'off'
}
},
createTime: {
title: '开票日期',
type: 'string',
ui: {
widget: 'date',
mode: 'range',
format: 'yyyy-MM-dd'
} as SFDateWidgetSchema
},
receiveName: {
type: 'string',
title: '购买人',
enum: [{ label: '全部', value: '全部' }],
ui: {
widget: 'select',
placeholder: '请选择',
visibleIf: {
expand: (value: boolean) => value
}
}
},
receiveName2: {
type: 'string',
title: '网络货运人',
enum: [{ label: '全部', value: '全部' }],
ui: {
widget: 'select',
placeholder: '请选择',
visibleIf: {
expand: (value: boolean) => value
}
}
}
}
};
}
private initST(): STColumn[] {
return [
{ title: '', index: 'key', type: 'checkbox' },
{ title: '发票号码', index: 'no', width: 150 },
{ title: '申请编号', index: 'callNo', width: 150 },
{ title: '申请时间', index: 'updatedAt', type: 'date', width: 150 },
{ title: '发票类型', index: 'callNo', width: 100 },
{ title: '网络货运人', index: 'callNo', width: 120 },
{ title: '购买人', index: 'callNo', width: 90 },
{ title: '订单数', index: 'callNo', width: 90 },
{ title: '价税合计', index: 'callNo', width: 100 },
{ title: '金额', index: 'callNo', width: 90 },
{ title: '税率', index: 'callNo', width: 90 },
{ title: '税额', index: 'callNo', width: 90 },
{ title: '开票日期', index: 'updatedAt', type: 'date', width: 150 },
{
title: '快递信息',
render: 'logostics',
width: 120,
format: item => `顺丰快递</br>6202110012313`
},
{ title: '状态', render: 'logostics', width: 90 },
{
title: '操作',
fixed: 'right',
className: 'text-center',
width: 110,
buttons: [
{
text: '查看明细',
click: item => this.router.navigate(['/ticket/invoice-list/detail/1'])
},
{
text: '查看物流',
click: item => this.showlogosticsLogs(item)
}
]
}
];
}
}