<!-- start 面包屑 -->
<app-breadcrumb></app-breadcrumb>
<!-- end 面包屑 -->
<!--条件搜索-->

<nz-spin [nzSpinning]="loadingObject.spinning" nzTip="{{loadingObject.msg}}">
    <div class="inner-content">
        <form nz-form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)">
            <div nz-row>

                <div nz-col nzSpan="8">
                    <nz-form-item>
                        <nz-form-label [nzSpan]="8">职位类型</nz-form-label>
                        <nz-form-control [nzSpan]="14">
                            <nz-select nzAllowClear formControlName="positionType">
                                <nz-option *ngFor="let item of positionTypeArray" nzLabel="{{item.codeName}}" nzValue="{{item.codeValue}}"></nz-option>
                            </nz-select>
                        </nz-form-control>
                    </nz-form-item>
                </div>

                <div nz-col nzSpan="8">
                    <nz-form-item>
                        <nz-form-label [nzSpan]="8">员工名称</nz-form-label>
                        <nz-form-control [nzSpan]="14">
                            <input nz-input formControlName="name" />
                        </nz-form-control>
                    </nz-form-item>
                </div>

                <div nz-col nzSpan="8">
                    <nz-form-item>
                        <nz-form-label [nzSpan]="8">员工电话</nz-form-label>
                        <nz-form-control [nzSpan]="14">
                            <input nz-input formControlName="telephone" />
                        </nz-form-control>
                    </nz-form-item>
                </div>

                <div nz-col nzSpan="8">
                    <nz-form-item>
                        <nz-form-label [nzSpan]="8">员工状态</nz-form-label>
                        <nz-form-control [nzSpan]="14">
                            <nz-select nzAllowClear formControlName="status">
                                <nz-option nzValue="1" nzLabel="正常"></nz-option>
                                <nz-option nzValue="2" nzLabel="禁用"></nz-option>
                            </nz-select>
                        </nz-form-control>
                    </nz-form-item>
                </div>


            </div>

            <div nz-row>
                <div nz-col nzSpan="24" class="search-button">
                    <button nz-button nzType="primary"><i nz-icon nzType="search" nzTheme="outline"></i>搜索</button>
                    <button nz-button nzType="default" (click)="resetForm()"><i nz-icon nzType="reload" nzTheme="outline"></i>重置</button>
                </div>
            </div>
        </form>
    </div>

    <div class="inner-content">
        <span>共计 {{dataObject.total?dataObject.total:0}} 条数据</span>
        <div class="operating-button">
            <button nz-button nzType="primary" class="right-btn" [routerLink]="['/admin/gas-staff/edit']" ><i nz-icon nzType="plus" nzTheme="outline"></i>增加员工</button>
        </div>

        <!--数组表格 -->
        <nz-table #basicTable
                  [nzData]="dataObject.list"
                  [nzTotal]="dataObject.total"
                  [nzFrontPagination]="false"
                  [nzLoading]="tableLoading"
                  [nzPageIndex]="whereObject.pageNum"
                  (nzPageIndexChange)="requestData($event)"
                  [nzScroll]="{ x: '1100px'}">
            <thead>
            <tr>
                <th nzWidth="60px">序号</th>
                <th nzWidth="100px">职位类型</th>
                <th nzWidth="100px">员工名称</th>
                <th nzWidth="100px">员工电话</th>
                <th nzWidth="100px">员工状态</th>
                <th nzWidth="140px">创建时间</th>
                <th nzWidth="140px">修改时间</th>
                <th nzWidth="110px" nzRight="0px">操作</th>
            </tr>
            </thead>
            <tbody>
            <tr *ngFor="let data of basicTable.data;let i = index">
                <td>{{i+1}}</td>
                <td>{{data.positionName}}</td>
                <td>{{data.name}}</td>
                <td>{{data.telephone}}</td>
                <td>{{data.status | gasStaffStatus}}</td>
                <td>{{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td>
                <td>{{data.updateTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td>
                <td nzRight="0px" class="table-td-operation">
                    <a nz-dropdown [nzDropdownMenu]="menu"> 操作列表 <i nz-icon nzType="down"></i> </a>
                    <nz-dropdown-menu #menu="nzDropdownMenu">
                        <ul nz-menu nzSelectable>
                            <li nz-menu-item (click)="showGasStaffQrCodeModal(data.id)"><a>二维码</a></li>
                            <li nz-menu-item [routerLink]="['/admin/gas-staff/edit']" [queryParams]="{ id: data.id}"><a>修改</a></li>
                            <li nz-menu-item (click)="showDisabledConfirm(data.id)" *ngIf="data.status == 1" ><a>禁用</a></li>
                            <li nz-menu-item (click)="showRecoverConfirm(data.id)" *ngIf="data.status == 2" ><a>恢复</a></li>
                            <li nz-menu-item (click)="showDelConfirm(data.id)"><a>删除</a></li>
                        </ul>
                    </nz-dropdown-menu>
                </td>
            </tr>
            </tbody>
        </nz-table>
    </div>
</nz-spin>

<nz-modal [(nzVisible)]="gasStaffQrCodeModal" nzTitle="二维码" (nzOnCancel)="closeGasStaffQrCodeModal()" nzWidth="400px" [nzFooter]="null">
    <img src="{{FILE_URL + 'gasStaff/' + gasStaffQrCodeImgUrl}}" style="width: 350px; height: 350px;">
    <div style="width: 100%;margin-top: 15px;text-align: center;">
        <span>鼠标右键点击“二维码”，另存为下载到本地</span>
    </div>
</nz-modal>
