import { Component, OnInit, ViewChild } from '@angular/core'; import { Router } from '@angular/router'; import { STComponent, STColumn, 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'; @Component({ selector: 'app-express-detail-modal', templateUrl: './express-detail-modal.component.html', styleUrls: ['./express-detail-modal.component.less'] }) export class ExpressDetailModalComponent implements OnInit { data = []; selectedData = []; url = `/api/fcc/ficoExpressH/getFicoVatinvHByExpress`; @ViewChild('st', { static: true }) st!: STComponent; @ViewChild('sf', { static: false }) sf!: SFComponent; columns: STColumn[] = [ { title: '发票号码', index: 'invoiceno', width: 160, className: 'text-left' }, { title: '发票代码', index: 'invoiceno2', width: 160, className: 'text-left' }, { title: '申请编号', index: 'vatinvcode', width: 160, className: 'text-left' }, { title: '网络货运人', index: 'ltdName', width: 120, className: 'text-left' }, { title: '购买人', index: 'artoname', width: 120, className: 'text-left' }, { title: '价税合计', index: 'vatmoney', width: 120, type: 'widget', className: 'text-right font-weight-bold', widget: { type: 'currency-chy', params: ({ record }) => ({ value: record.vatmoney }) } }, { title: '金额', index: 'vatnotax', width: 90, type: 'widget', className: 'text-right', widget: { type: 'currency-chy', params: ({ record }) => ({ value: record.vatnotax }) } }, { title: '税率', index: 'tax', width: 90, className: 'text-right', format: item => `${item.tax ? ((item.tax as number) * 100).toFixed(2) : 0}%` }, { title: '税额', index: 'vattax', width: 90, type: 'widget', className: 'text-right', widget: { type: 'currency-chy', params: ({ record }) => ({ value: record.vattax }) } }, { title: '开票日期', index: 'invoicedate', type: 'date', width: 150, className: 'text-center' } ]; searchSchema: SFSchema = { properties: { invoiceno: { title: '', type: 'string', ui: { placeholder: '发票号码' } }, expressno: { title: '', type: 'string', ui: { placeholder: '申请编号' } }, createTime: { title: '', type: 'string', ui: { widget: 'sl-from-to-search', format: 'yyyy-MM-dd' } as SFDateWidgetSchema } } }; expressCode!: any; constructor(public service: TicketService, private nzModalService: NzModalService, private router: Router) {} ngOnInit(): void {} beforeReq = (requestOptions: STRequestOptions) => { Object.assign(requestOptions.body, { expressno: this.expressCode }); if (this.sf) { Object.assign(requestOptions.body, { ...this.sf?.value, createTime: { start: this.sf?.value.createTime?.[0] || '', end: this.sf?.value.createTime?.[1] || '' } }); } return requestOptions; }; /** * 重置表单 */ resetSF() { this.sf.reset(); } }