<!-- 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" *ngIf="this.secUserObjectType !== 3">
                    <nz-form-item>
                        <nz-form-label [nzSpan]="8">区域名称</nz-form-label>
                        <nz-form-control [nzSpan]="14">
                            <input nz-input formControlName="regionName" />
                        </nz-form-control>
                    </nz-form-item>
                </div>

                <div nz-col nzSpan="8" *ngIf="this.secUserObjectType !== 3">
                    <nz-form-item>
                        <nz-form-label [nzSpan]="8">油站编号</nz-form-label>
                        <nz-form-control [nzSpan]="14">
                            <input nz-input formControlName="merStoreKey" />
                        </nz-form-control>
                    </nz-form-item>
                </div>

                <div nz-col nzSpan="8" *ngIf="this.secUserObjectType !== 3">
                    <nz-form-item>
                        <nz-form-label [nzSpan]="8">油站名称</nz-form-label>
                        <nz-form-control [nzSpan]="14">
                            <input nz-input formControlName="merStoreName" />
                        </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="oilNo">
                                <nz-option *ngFor="let item of oilNoArray" 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">
                            <nz-select nzAllowClear formControlName="oilType">
                                <nz-option nzLabel="汽油" nzValue="1"></nz-option>
                                <nz-option nzLabel="柴油" nzValue="2"></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">
                            <nz-select nzAllowClear formControlName="priceType">
                                <nz-option *ngFor="let item of priceTypeArray" 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">
                            <nz-select nzAllowClear formControlName="executionType">
                                <nz-option nzLabel="立刻执行" nzValue="1"></nz-option>
                                <nz-option nzLabel="定时执行" nzValue="2"></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">
                            <nz-select nzAllowClear formControlName="status">
                                <nz-option nzLabel="等待中" nzValue="1"></nz-option>
                                <nz-option nzLabel="已执行" nzValue="2"></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-oil-price/task-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" *ngIf="this.secUserObjectType !== 3">区域名称</th>
                <th nzWidth="100px" *ngIf="this.secUserObjectType !== 3">油站编号</th>
                <th nzWidth="200px" *ngIf="this.secUserObjectType !== 3">油站名称</th>
                <th nzWidth="80px">油品号</th>
                <th nzWidth="90px">油品类型</th>
                <th nzWidth="90px">价格类型</th>
                <th nzWidth="90px">执行价格</th>
                <th nzWidth="90px">执行方式</th>
                <th nzWidth="160px">执行时间</th>
                <th nzWidth="90px">任务状态</th>
                <th nzWidth="160px">创建时间</th>
                <th nzWidth="120px">创建人</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 *ngIf="this.secUserObjectType !== 3">{{data.regionName}}</td>
                <td *ngIf="this.secUserObjectType !== 3">{{data.merStoreKey?data.merStoreKey:'无'}}</td>
                <td *ngIf="this.secUserObjectType !== 3">{{data.merStoreName?data.merStoreName:'无'}}</td>
                <td>{{data.oilNo}}</td>
                <td>{{data.oilTypeName}}</td>
                <td>{{data.priceType | oilPriceTaskPriceType}}</td>
                <td>￥{{data.price}}</td>
                <td>{{data.executionType | oilPriceTaskExecutionType}}</td>
                <td>{{data.startTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td>
                <td>{{data.status | oilPriceTaskStatus}}</td>
                <td>{{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td>
                <td>{{data.opUserName}}</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 *ngIf="data.status == 1" (click)="showDelConfirm(data.id)"><a>删除任务</a></li>
                             <li nz-menu-item *ngIf="data.status != 1" nzDisabled>暂无操作</li>
                        </ul>
                    </nz-dropdown-menu>
                </td>
            </tr>
            </tbody>
        </nz-table>
    </div>
</nz-spin>

