微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在 typescript angular 的单独行中更新位置表字段以导出 pdf

如何解决在 typescript angular 的单独行中更新位置表字段以导出 pdf

我正在尝试以角度创建一个 pdf 文件。一切正常,我只是在某一点卡住了。下表是 order.orderItems.map 对象的值。价值观是应该的。我只想将我用黄色绘制的字段作为当前值上方的一行。它应该像第二张图片有可能但我不能这样做。我的代码如下;

async generatePDF(action = 'download',id: number) {
    this.currentUser$ = this.accountService.currentUser$;
    var order = this.orders.find(o => o.id === id);
    this.currentUser$.pipe(take(1)).subscribe(
      value => this.user = value);
    let docDeFinition = {
      content: [
        {
          text: '',style: 'sectionHeader'
        },{
          columns: [
            [
              {
                text: `Order Date: ${new Date(order.orderDate).toLocaleString()}`,alignment: 'right'
              },{
                text: `Order No : "${((order.id).toFixed(0))}"`,alignment: 'right'
              }
            ]
          ]
        },{
          text: '',{
          text: 'Sayın' + ' ' + this.user.displayName + ',\n\n' +
            ' here is some text \n\n' +
            'here is some text,\n' +
            'here is some text',margin: [0,15]
        },{
          text: 'Vehicle List',style: 'sectionHeader',},{
          table: {

            headerRows: 1,widths: ['auto','auto','auto'],body: [

              [
                '','Status','Time','Km','Rent Cost','Over Km Cost','Gear Type','Fuel Type','Quantity',],...order.orderItems.map(p => {
                return [
                  [p.productName + ' ' + p.productModel + ' ' + p.productVersion + ' ' + p.productModelYear],(p.vehicleKm) ? (p.productType + ' ' + "(" + p.vehicleKm + " KM)") : p.productType,p.rentMonth,p.rentKm,(p.additionalProfit * p.quantity).toFixed(2) + 'TL',p.overKmPrice,p.productGearType,p.productFuelType,p.quantity
                ]
              })
            ]
          }
        }

enter image description here

enter image description here

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。