<!-- 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>
&lt;!&ndash;                <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>&ndash;&gt;

                <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="deviceName" />
                        </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" (click)="showConfigDeviceModal(null)" ><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="70px">序号</th>
                <th nzWidth="130px">设备类型</th>
<!--                <th nzWidth="100px">设备名称</th>-->
                <th nzWidth="120px">设备SN</th>
                <th nzWidth="120px">设备KEY</th>
                <th nzWidth="150px">设备IMEI</th>
                <th nzWidth="150px">设备ICCID</th>
                <th nzWidth="130px">小票顶部标题</th>
                <th nzWidth="130px">小票来源显示</th>
                <th nzWidth="130px">小票底部文案</th>
                <th nzWidth="110px">创建时间</th>
                <th nzWidth="120px" nzRight="0px">操作</th>
            </tr>
            </thead>
            <tbody>
            <tr *ngFor="let data of basicTable.data;let i = index">
                <td>{{i+1}}</td>
                <td>
                    <span *ngIf="data.type == 1">商鹏云打印机</span>
                    <span *ngIf="data.type == 2">ZKC云打印机</span>
                </td>
<!--                <td>{{data.deviceName}}</td>-->
                <td>{{data.deviceSn?data.deviceSn:'未填写'}} </td>
                <td>{{data.deviceKey?data.deviceKey:'未填写'}}</td>
                <td>{{data.deviceImei?data.deviceImei:'未填写'}}</td>
                <td>{{data.deviceIccid?data.deviceIccid:'未填写'}}</td>
                <td>{{data.receiptTop?data.receiptTop:'默认'}}</td>
                <td>{{data.receiptSource?data.receiptSource:'默认'}}</td>
                <td>{{data.receiptBottom?data.receiptBottom:'默认'}}</td>
                <td>{{data.createTime | 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)="showConfigDeviceModal(data)"><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)]="configDeviceModal" nzTitle="{{configDeviceModalTitle}}" (nzOnCancel)="closeConfigDeviceModal()" nzWidth="500px" [nzFooter]="null">
    <form nz-form [formGroup]="configDeviceForm">

        <nz-form-item>
            <nz-form-label [nzSpan]="6" nzRequired >设备类型</nz-form-label>
            <nz-form-control [nzSpan]="14">
                <nz-select formControlName="type" [nzPlaceHolder]="'请选择设备类型'">
                    <nz-option nzValue="1" nzLabel="商鹏云打印机"></nz-option>
                    <nz-option nzValue="2" nzLabel="ZKC云打印机"></nz-option>
                </nz-select>
            </nz-form-control>
        </nz-form-item>
<!--
        <nz-form-item>
            <nz-form-label [nzSpan]="6" nzRequired >设备名称</nz-form-label>
            <nz-form-control [nzSpan]="14">
                <input nz-input formControlName="deviceName" [placeholder]="'请输入设备名称'" />
            </nz-form-control>
        </nz-form-item>-->

        <nz-form-item *ngIf="configDeviceForm.controls.type.value == 1">
            <nz-form-label [nzSpan]="6" nzRequired >设备SN</nz-form-label>
            <nz-form-control [nzSpan]="14">
                <input nz-input formControlName="deviceSn" [placeholder]="'请输入设备SN号'" />
            </nz-form-control>
        </nz-form-item>

        <nz-form-item *ngIf="configDeviceForm.controls.type.value == 1">
            <nz-form-label [nzSpan]="6" nzRequired >设备KEY</nz-form-label>
            <nz-form-control [nzSpan]="14">
                <input nz-input formControlName="deviceKey"  [placeholder]="'请输入设备KEY'"/>
            </nz-form-control>
        </nz-form-item>

        <nz-form-item *ngIf="configDeviceForm.controls.type.value == 2">
            <nz-form-label [nzSpan]="6" nzRequired >设备IMEI</nz-form-label>
            <nz-form-control [nzSpan]="14">
                <input nz-input formControlName="deviceImei" [placeholder]="'请输入设备IMEI'"/>
            </nz-form-control>
        </nz-form-item>

        <nz-form-item *ngIf="configDeviceForm.controls.type.value == 2">
            <nz-form-label [nzSpan]="6" nzRequired >设备ICCID</nz-form-label>
            <nz-form-control [nzSpan]="14">
                <input nz-input formControlName="deviceIccid" [placeholder]="'请输入设备ICCID'"/>
            </nz-form-control>
        </nz-form-item>

        <nz-form-item>
            <nz-form-label [nzSpan]="6">
                小票顶部标题
                <i nz-icon nz-tooltip nzTooltipTitle="“小票顶部标题” 最多7位字符" nzType="question-circle" nzTheme="outline"></i>
            </nz-form-label>
            <nz-form-control [nzSpan]="14">
                <input nz-input formControlName="receiptTop" maxlength="9" [placeholder]="'默认：嗨森逛'"/>
            </nz-form-control>
        </nz-form-item>

        <nz-form-item>
            <nz-form-label [nzSpan]="6">
                小票来源显示
                <i nz-icon nz-tooltip nzTooltipTitle="“小票来源显示” 最多10位字符" nzType="question-circle" nzTheme="outline"></i>
            </nz-form-label>
            <nz-form-control [nzSpan]="14">
                <input nz-input formControlName="receiptSource" maxlength="10" [placeholder]="'默认：嗨森逛'"/>
            </nz-form-control>
        </nz-form-item>

        <nz-form-item>
            <nz-form-label [nzSpan]="6">
                小票底部文案
                <i nz-icon nz-tooltip nzTooltipTitle="“小票底部文案” 最多15位字符" nzType="question-circle" nzTheme="outline"></i>
            </nz-form-label>
            <nz-form-control [nzSpan]="14">
                <input nz-input formControlName="receiptBottom" maxlength="15" [placeholder]="'默认：开心又省钱；来”嗨森逛“'"/>
            </nz-form-control>
        </nz-form-item>

        <div style="text-align: center;">
            <button nz-button nzType="primary" style="width: 150px;" (click)="submitConfigDevice()">确定</button>
        </div>
    </form>
</nz-modal>
