角度模板中的调用函数

时间:2019-05-08 09:36:39

标签: angular spring

我正在开发angular6 /弹簧靴应用程序。在我的模型中,报价具有与订单的OneToOne类型关系。因此,报价可以传递给订单。为此,我显示带有“传递给订单”按钮的报价清单。我只想在报价尚未传递到订单时显示此按钮。我已经在弹簧侧创建了以下功能。解决此类问题的最佳方法是什么?谢谢

    public interface QuoteRepository extends CrudRepository<Quote, Long>  {
      @Query("select count(*) from Order as o where o.quote.idQuote = ?1 ")
      Long testOrder(Long idQuote);
    } 
    @GetMapping("/quotes/test")
    public Long testOrder(@RequestBody Long idQuote) {
      return quoteService.testOrder(idQuote);
    }

列出角引号

    <div class="mat-elevation-z8" style="margin-top: 60px">
                <mat-paginator [pageSizeOptions]="[5, 10, 25, 100]" 
    [pageSize]="5" showFirstLastButtons></mat-paginator>
            <mat-table [dataSource]="dataSource"  matSort>
              <ng-container matColumnDef="countryDep">
                <mat-header-cell *matHeaderCellDef  mat-sort- 
    header>Départ</mat- 
    header-cell>
                <mat-cell *matCellDef="let element"> 
    {{element.countryDep.name}} 
    </mat-cell>
              </ng-container>
              <ng-container matColumnDef="countryArriv">
                <mat-header-cell *matHeaderCellDef  mat-sort- 
    header>Destination</mat-header-cell>
                <mat-cell *matCellDef="let element"> 
    {{element.countryArriv.name}}</mat-cell>
              </ng-container>
              <ng-container matColumnDef="availableDate">
                <mat-header-cell *matHeaderCellDef  mat-sort- 
     header>Disponibilité</mat-header-cell>
                <mat-cell *matCellDef="let element">{{element.availableDate | 
     date: 'dd/MM/yyyy'}}</mat-cell>
              </ng-container>
              <ng-container matColumnDef="mandatoryDate">
                <mat-header-cell *matHeaderCellDef  mat-sort-header>Livraison 
     avant</mat-header-cell>
                <mat-cell *matCellDef="let element">{{element.mandatoryDate | 
     date: 'dd/MM/yyyy'}}</mat-cell>
              </ng-container>
              <ng-container matColumnDef="dangerous">
                <mat-header-cell *matHeaderCellDef mat-sort- 
     header>Dangereux</mat-header-cell>
                <mat-cell *matCellDef="let element">{{element.dangerous}} 
     </mat- 
    cell>
              </ng-container>
              <ng-container matColumnDef="totalClearance">
                <mat-header-cell *matHeaderCellDef mat-sort- 
    header>Dédouanement</mat-header-cell>
                <mat-cell *matCellDef="let element">{{element.totalClearance}} 
    </mat-cell>
              </ng-container>
              <ng-container matColumnDef="total">
                <mat-header-cell *matHeaderCellDef mat-sort-header>Total</mat- 
    header-cell>
                <mat-cell *matCellDef="let element">{{element.total}}</mat- 
    cell>
              </ng-container>
              <ng-container matColumnDef="actions">
                <mat-header-cell *matHeaderCellDef></mat-header-cell>
                <mat-cell *matCellDef="let row">
                <button mat-icon-button color="primary" (click)="onEdit(row)"> 
    <mat-icon>launch</mat-icon></button>
                <button mat-icon-button color="primary"  
    (click)="transformToOrder(row)"><mat-icon aria-label="Passer en 
    commande">shopping_cart</mat-icon></button>
                <button mat-icon-button color="warn" 
    (click)="onDelete(row.$key)"><mat-icon>delete_outline</mat-icon></button>

0 个答案:

没有答案