import { CurrencyPipe } from '@angular/common'; import { Component, OnInit, ViewChild } from '@angular/core'; import { STComponent, STColumn, STRequestOptions } from '@delon/abc/st'; import { NzModalService } from 'ng-zorro-antd/modal'; import { TicketService } from '../../../services/ticket.service'; @Component({ selector: 'app-push-invoice', templateUrl: './push-invoice.component.html', styleUrls: ['./push-invoice.component.less'], providers: [CurrencyPipe] }) export class PushInvoiceComponent implements OnInit { @ViewChild('st', { static: false }) st!: STComponent; columns: STColumn[] = this.initST(); data = [ { key: 0, disabled: true, href: 'https://ant.design', avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png', no: 'TradeCode 0' }, { key: 1, disabled: false, href: 'https://ant.design', avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png', no: 'TradeCode 1' } ]; info: any = {}; id!: number; constructor(public service: TicketService, private nzModalService: NzModalService, private currencyPipe: CurrencyPipe) {} ngOnInit(): void { this.loadHeader(this.id); } beforeReq = (requestOptions: STRequestOptions) => { Object.assign(requestOptions.body, { vatinvHId: this.id }); return requestOptions; }; loadHeader(id: number) { this.service.request(this.service.$api_ficoVatinv_header, { id }).subscribe(res => { console.log(res); if (res) { this.info = res; } }); } private initST(): STColumn[] { return [ { title: '服务名称', index: 'vatname', width: 100 }, { title: '规格型号', index: 'vatmodel', width: 150 }, { title: '单位', index: 'vatunit', width: 90, className: 'text-center' }, { title: '数量', index: 'vatqty', width: 90, className: 'text-right' }, { title: '金额', index: 'vatnotax', width: 90, type: 'currency', format: item => `${this.currencyPipe.transform(item.vatnotax)}` }, { title: '税率', index: 'vatrate', width: 90, className: 'text-right' }, { title: '税额', index: 'vattax', width: 90, type: 'currency', format: item => `${this.currencyPipe.transform(item.vattax)}` } ]; } }