angular中修改表格单条信息

<div class="regional_body">
    <div class="regional_left">
        <div class="jurisdiction_list">
            <div class="jurisdiction_name">单位管辖列表(29)</div>
            <div class="list_add add" (click)='newDuty()'>
                <img src="assets/highway/imgs/sq-btnIcon-add.png" alt="">
                <span>新增</span>
            </div>
        </div>
        <div class="grid">
            <nz-table class="zt-main-table" [nzData]="tableData.datas" [nzLoading]="false" [nzFrontPagination]="false"
              [nzShowPagination]="false">
              <thead>
                <tr>
                  <th>名称</th>
                  <th>类型</th>
                  <th style="width: 210px;"></th>
                </tr>
              </thead>
              <tbody>
                  <!-- 新增 -->
                <tr *ngIf="editDutyItem && !editDutyItem.pkid">
                <td>
                    <ng-container>
                        <input type="text" nz-input [(ngModel)]="editDutyItem.deptName" />
                    </ng-container>
                </td>
                  <td>
                    <nz-select [(ngModel)]="editDutyItem.deptType" [nzShowSearch]="true" [nzAllowClear]="false"
                      nzPlaceHolder="请选择">
                      <nz-option [nzValue]="''" [nzLabel]="'全部'"></nz-option>
                      <nz-option [nzValue]="item.pkid" [nzLabel]="item.licensePlateNum" *ngFor="let item of policeCars">
                      </nz-option>
                    </nz-select>
                  </td>
                  <td class="action">
                        <ng-container>
                          <button nz-button nzType="default" [nzSize]="'small'" (click)="cancelEdit()">取消</button>
                          <button nz-button nzType="primary" [nzSize]="'small'" (click)="saveRecord()">保存</button>
                        </ng-container>
                   </td>
                </tr>
                <tr *ngFor="let data of tableData.datas" (click)="selectedRecord = data">
                    <!-- 展示 -->
                  <ng-container *ngIf="!(editDutyItem && editDutyItem.pkid == data.pkid)">
                    <td>{{data.deptName}}</td>
                    <td>{{data.deptTypeName}}</td>
                    <td>
                      <div class="action">
                        <img src="assets/highway/imgs/sq-btnTable-edit.png" (click)="startEdit(data, $event)"/>
                        <img src="assets/highway/imgs/sq-btnTable-delete.png" (click)="deleteDuty(data.pkid, $event)"/>
                      </div>
                    </td>
                  </ng-container>
                  <!-- 修改 -->
                  <ng-container *ngIf="editDutyItem && editDutyItem.pkid == data.pkid">
                    <td>
                        <ng-container>
                          <input type="text" nz-input [(ngModel)]="editDutyItem.deptName" />
                        </ng-container>
                    </td>
                    <td>
                      <nz-select [(ngModel)]="editDutyItem.deptType" [nzShowSearch]="true" [nzAllowClear]="false"
                        nzPlaceHolder="请选择">
                        <nz-option [nzValue]="''" [nzLabel]="'全部'"></nz-option>
                        <nz-option [nzValue]="item.pkid" [nzLabel]="item.licensePlateNum" *ngFor="let item of policeCars">
                        </nz-option>
                      </nz-select>
                    </td>
                    <td class="action" >
                      <ng-container>
                        <button nz-button nzType="primary" [nzSize]="'small'" (click)="sureEditData()">保存</button>
                        <button nz-button nzType="default" [nzSize]="'small'" (click)="cancelEdit()">取消</button>
                      </ng-container>
                    </td>
                  </ng-container>
                </tr>
              </tbody>
            </nz-table>
        </div>
    </div>
    <div class="regional_right">
        <div class="map" id="map"></div>
    </div>
</div>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值