<div nz-row class="breadcrumbs">
    <div nz-col nzSpan="16">
        <nz-breadcrumb class="padding-8-0">
            <nz-breadcrumb-item>
                首页
            </nz-breadcrumb-item>
            <nz-breadcrumb-item>
                <a>运维工作</a>
            </nz-breadcrumb-item>
            <nz-breadcrumb-item>
                资产备件
            </nz-breadcrumb-item>
            <nz-breadcrumb-item>
                子分类详情
            </nz-breadcrumb-item>
            <nz-breadcrumb-item>
                资产详情
            </nz-breadcrumb-item>
        </nz-breadcrumb>
    </div>
    <div nz-col nzSpan="8" class="text-right">
        <button nzType="primary" (click)="returnBack()" nz-button>返回上一页</button>
        <button (click)="ngOnInit()" nz-button nzType="primary"><i class="anticon anticon-sync"></i></button>
        <smart-full-screen></smart-full-screen>
    </div>
</div>

<div class="tabset">
    <div class="tabset-btn">
        <button (click)="showEditModal()" nz-button nzType="default">编辑</button>
        <button (click)="deleteModal()" nz-button nzType="default">删除</button>
    </div>
    <nz-tabset [nzType]="'card'" class="tabs-smart ">
        <nz-tab #thirdTabs nzTitle="资产信息">
            <div nz-form class="ant-advanced-search-form form-select">

                <div nz-row [nzGutter]="24">
                    <div nz-col [nzSpan]="12">
                        <nz-form-item nzFlex>
                            <nz-form-label [nzOffset]="4" [nzSpan]="6" nzFor="equipmentTypeid">资产编号</nz-form-label>
                            <nz-form-control [nzSpan]="14">
                                {{inventoryExtend?.inventoryNo}}
                                <ng-container *ngIf="!inventoryExtend?.hostid">
                                    <button style="margin-left: 10px;" nzSize="small" (click)="linkThen()" nz-button
                                            nzType="primary">关联
                                    </button>
                                </ng-container>
                                <ng-container *ngIf="inventoryExtend?.hostid">
                                    <span style="margin-left: 10px;" (click)="goToHost(inventoryExtend?.hostid)"
                                          class="main-color cursor">已关联监控资源</span>
                                </ng-container>
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                </div>

                <div nz-row [nzGutter]="24">
                    <div nz-col [nzSpan]="12">
                        <nz-form-item nzFlex>
                            <nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired nzFor="equipmentTypeid">资产名称
                            </nz-form-label>
                            <nz-form-control [nzSpan]="14">
                                {{inventoryExtend?.name}}
                            </nz-form-control>
                        </nz-form-item>
                    </div>

                    <div nz-col [nzSpan]="12">
                        <nz-form-item nzFlex>
                            <nz-form-label [nzSpan]="6">负责人</nz-form-label>
                            <nz-form-control [nzSpan]="14">
                                {{inventoryExtend?.person}}
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                </div>

                <div nz-row [nzGutter]="24">
                    <div nz-col [nzSpan]="12">
                        <nz-form-item nzFlex>
                            <nz-form-label [nzOffset]="4" nzRequired [nzSpan]="6">父分类
                            </nz-form-label>
                            <nz-form-control [nzSpan]="14">{{inventoryExtend?.typeparentname}}</nz-form-control>
                        </nz-form-item>
                    </div>
                    <div nz-col [nzSpan]="12">
                        <nz-form-item nzFlex>
                            <nz-form-label [nzSpan]="6" nzRequired>子分类
                            </nz-form-label>
                            <nz-form-control [nzSpan]="14">{{inventoryExtend?.typename}}</nz-form-control>
                        </nz-form-item>
                    </div>

                </div>

                <div nz-row [nzGutter]="24">
                    <div nz-col [nzSpan]="12">
                        <nz-form-item nzFlex>
                            <nz-form-label [nzOffset]="4" [nzSpan]="6" nzFor="secondLevelType">资产数量
                            </nz-form-label>
                            <nz-form-control [nzSpan]="14">
                                {{inventoryExtend?.inventorycount}}
                            </nz-form-control>
                        </nz-form-item>
                    </div>

                    <div nz-col [nzSpan]="12">
                        <nz-form-item nzFlex>
                            <nz-form-label [nzSpan]="6" nzFor="invertoryname">品牌</nz-form-label>
                            <nz-form-control [nzSpan]="14">
                                {{inventoryExtend?.invertoryname}}
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                </div>

                <div nz-row [nzGutter]="24">
                    <div nz-col [nzSpan]="12">
                        <nz-form-item nzFlex>
                            <nz-form-label [nzOffset]="4" [nzSpan]="6">库存</nz-form-label>
                            <nz-form-control [nzSpan]="14">
                                {{inventoryExtend?.stock}}
                            </nz-form-control>
                        </nz-form-item>
                    </div>

                    <div nz-col [nzSpan]="12">
                        <nz-form-item nzFlex>
                            <nz-form-label [nzSpan]="6">型号</nz-form-label>
                            <nz-form-control [nzSpan]="14">
                                {{inventoryExtend?.serialnoA}}
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                </div>

                <div nz-row [nzGutter]="24">
                    <div nz-col [nzSpan]="12">
                        <nz-form-item nzFlex>
                            <nz-form-label [nzOffset]="4" [nzSpan]="6">使用</nz-form-label>
                            <nz-form-control [nzSpan]="14">
                                {{inventoryExtend?.usedcount}}
                            </nz-form-control>
                        </nz-form-item>
                    </div>

                    <div nz-col [nzSpan]="12">
                        <nz-form-item nzFlex>
                            <nz-form-label [nzSpan]="6">MAC地址</nz-form-label>
                            <nz-form-control [nzSpan]="14">
                                {{inventoryExtend?.mac}}
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                </div>
                <div nz-row [nzGutter]="24">
                    <div nz-col [nzSpan]="12">
                        <nz-form-item nzFlex>
                            <nz-form-label [nzOffset]="4" [nzSpan]="6">借出</nz-form-label>
                            <nz-form-control [nzSpan]="14">
                                {{inventoryExtend?.lendcount}}
                            </nz-form-control>
                        </nz-form-item>
                    </div>

                    <div nz-col [nzSpan]="12">
                        <nz-form-item nzFlex>
                            <nz-form-label [nzSpan]="6">维保到期</nz-form-label>
                            <nz-form-control [nzSpan]="14">
                                {{inventoryExtend?.maintenanceExpiration}}
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                </div>

                <div nz-row [nzGutter]="24">
                    <div nz-col [nzSpan]="12">
                        <nz-form-item nzFlex>
                            <nz-form-label [nzOffset]="4" [nzSpan]="6">维修</nz-form-label>
                            <nz-form-control [nzSpan]="14">
                                {{inventoryExtend?.repaircount}}
                            </nz-form-control>
                        </nz-form-item>
                    </div>

                    <div nz-col [nzSpan]="12">
                        <nz-form-item nzFlex>
                            <nz-form-label [nzSpan]="6">存放地点</nz-form-label>
                            <nz-form-control [nzSpan]="14">
                                {{inventoryExtend?.storageLocation}}
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                </div>

                <div nz-row [nzGutter]="24">
                    <div nz-col [nzSpan]="12">
                        <nz-form-item nzFlex>
                            <nz-form-label [nzOffset]="4" [nzSpan]="6">报废</nz-form-label>
                            <nz-form-control [nzSpan]="14">
                                {{inventoryExtend?.scrapcount}}
                                <!--<input nz-input placeholder="报废" name="scrapcount" [(ngModel)]="inventoryExtend?.scrapcount">-->
                            </nz-form-control>
                        </nz-form-item>
                    </div>
                </div>
            </div>
        </nz-tab>
        <nz-tab #thirdTabs nzTitle="关联事件">
            <nz-table #nzTable [nzData]="thingList" [nzFrontPagination]="false" [nzTotal]="totalNum"
                      [nzPageIndex]="pageNum" [nzPageSize]="pageCount" (nzPageIndexChange)="change($event)"
                      [nzLoading]="loading">
                <thead>
                <tr>
                    <th nzShowSort>时间</th>
                    <th>事件编号</th>
                    <th>标题</th>
                    <th nzWidth="15%">事件来源</th>
                    <th>事件分类</th>
                    <th>处理人</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr *ngFor="let data of nzTable.data">
                    <td class="table-timeline">
                        <nz-timeline-item>{{data.createTime | date:"yyyy-MM-dd HH:mm:ss"}}</nz-timeline-item>
                    </td>
                    <td class="round-tag tag-form">
                        {{data.id}}
                    </td>
                    <td>{{data.title}}</td>
                    <td>
                        <span *ngIf="data.source == 0">系统告警</span>
                        <span *ngIf="data.source == 1">手动新增</span>
                    </td>
                    <td>{{data.typeName}}</td>
                    <td>
                        {{data.operators[0]?.username}}
                    </td>
                    <td>
                        <ng-container *ngIf="data.status == 0">待处理</ng-container>
                        <ng-container *ngIf="data.status == 1">已结束</ng-container>
                    </td>
                    <td class="list-icon main-color">
                        <span class="cursor" *ngIf="data.status == 1" (click)="lookEvent(data)">查看</span>
                    </td>
                </tr>
                </tbody>
            </nz-table>

        </nz-tab>
    </nz-tabset>
</div>


<!--选择资源-->
<smart-select-group #smartSelectGroup (done)="setLink($event)"></smart-select-group>
<!--资产-->
<smart-assets #smartAssets (done)="getDetail()"></smart-assets>
