<!-- 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="roleType == 5 && adminFlag == 1">
                    <nz-form-item>
                        <nz-form-label [nzSpan]="8">所属部门</nz-form-label>
                        <nz-form-control [nzSpan]="14">
                            <nz-select nzAllowClear formControlName="orgId">
                                <nz-option *ngFor="let item of orgArray" nzLabel="{{item.name}}" nzValue="{{item.id}}"></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="gasName" />
                        </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 formControlName="prestoreType">
                                <nz-option nzValue="0" nzLabel="非预存"></nz-option>
                                <nz-option nzValue="1" nzLabel="预存"></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 formControlName="amountsEarlyWarningStatus">
                                <nz-option nzValue="0" nzLabel="正常"></nz-option>
                                <nz-option nzValue="1" 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">
        </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="150px">所在公司</th>
                <th nzWidth="140px">所在商户</th>
                <th nzWidth="200px">油站名称</th>
                <th nzWidth="90px">预存类型</th>
                <th nzWidth="120px">账户余额</th>
                <th nzWidth="120px">预警余额</th>
                <th nzWidth="90px">预警状态</th>
                <th nzWidth="100px">油站编号</th>
                <th nzWidth="150px">油站地址</th>
                <th nzWidth="110px">创建时间</th>
                <th nzWidth="110px" nzRight="0px">操作</th>
            </tr>
            </thead>
            <tbody>
            <tr *ngFor="let data of basicTable.data;let i = index" style="{{data.amountsEarlyWarningStatus?'color: #aa1111;':''}}">
                <td>{{i+1}}</td>
                <td>{{data.companyName}}</td>
                <td>{{data.storeMerName}}</td>
                <td>{{data.storeName}}</td>
                <td>{{data.storePrestoreType? '预存' : '非预存'}}</td>
                <td>{{data.amounts?'￥'+data.amounts:'无'}}</td>
                <td>{{data.amountsEarlyWarning?'￥'+data.amountsEarlyWarning:'无'}}</td>
                <td>
                    <span *ngIf="data.amountsEarlyWarningStatus == null">无</span>
                    <span *ngIf="data.amountsEarlyWarningStatus == 0">正常</span>
                    <span *ngIf="data.amountsEarlyWarningStatus == 1">余额预警</span>
                </td>
                <td>{{data.storeKey}}</td>
                <td>{{data.storeAddress}}</td>
                <td>{{data.storeCreateTime | 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)="showEarlyWarningModal(data)">余额预警</li>
                        </ul>
                    </nz-dropdown-menu>
                </td>
            </tr>
            </tbody>
        </nz-table>
    </div>
</nz-spin>

<nz-modal [(nzVisible)]="amountsEarlyWarningModal" nzTitle="设置账户余额预警" (nzOnCancel)="closeEarlyWarningModal()" [nzFooter]="null">
    <form nz-form [formGroup]="amountsEarlyWarningFrom">
        <nz-form-item>
            <nz-form-label [nzSpan]="6">预警余额</nz-form-label>
            <nz-form-control [nzSpan]="14" nzExtra="预警余额设置为0，代表不需要预警">
                <nz-input-number nz-input formControlName="earlyWarning" [nzMin]="0" [nzMax]="99999999" [nzStep]="1" [nzPrecision]="2"></nz-input-number>
            </nz-form-control>
        </nz-form-item>
    </form>
    <div style="text-align: center;">
        <button nz-button nzType="primary" style="width: 150px;" (click)="submitEarlyWarning()">确定</button>
    </div>
</nz-modal>
