<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>
    </div>
    <div nz-col nzSpan="8" class="text-right">
        <button (click)="ngOnInit()" nz-button nzType="primary"><i class="anticon anticon-sync"></i></button>
        <smart-full-screen></smart-full-screen>
    </div>
</div>
<div nz-row [nzGutter]="4" class="search-form">
    <div nz-col nzSpan="16">
        <span class="main-color margin-right-15">状态: </span>
        <nz-radio-group [(ngModel)]="obj.status">
            <label *ngFor="let item of costType" (click)="search()" nz-radio-button
                   [nzValue]="item.value">{{item.label}}</label>
        </nz-radio-group>
    </div>
    <div nz-col nzSpan="6">
        <input type="text" (keyup.enter)="search()" nz-input [(ngModel)]="obj.search" placeholder="变更编号、负责人、审核人">
    </div>
    <div nz-col nzSpan="2">
        <button (click)="search()"
                nz-button nzType="default"><i class="anticon anticon-search"></i>搜索
        </button>
    </div>
</div>
<div nz-row [nzGutter]="4" class="search-form">
    <div nz-col nzSpan="10">
        <span class="main-color margin-right-15">时间: </span>
        <nz-radio-group [(ngModel)]="time.type">
            <label *ngFor="let item of timeType" (click)="changeTimeType()" nz-radio-button
                   [nzValue]="item.value">{{item.label}}</label>
        </nz-radio-group>
    </div>
    <div nz-col nzSpan="8">
        <ng-container *ngIf="time.type == '99'">
            <nz-date-picker
                    [nzFormat]="timeFormat"
                    [(ngModel)]="time.startTime"
                    nzPlaceHolder="开始时间"></nz-date-picker>
            <nz-date-picker
                    [nzFormat]="timeFormat"
                    [(ngModel)]="time.endTime"
                    nzPlaceHolder="结束时间"></nz-date-picker>
        </ng-container>
    </div>
    <div nz-col nzOffset="1" nzSpan="2">
        <button (click)="downLoad()" [nzLoading]="isDownLoad"
                nz-button nzType="default"><i class="anticon anticon-download"></i>下载
        </button>
    </div>
    <div nz-col nzSpan="3">
        <button (click)="handleOpenModal()"
                nz-button nzType="default"><i class="anticon anticon-plus-circle-o"></i>发起变更
        </button>
    </div>
</div>


<nz-table #nzTable [nzData]="page.list" [nzLoading]="page.isLoading" [nzFrontPagination]="false"
          [nzTotal]="page.totalNum"
          [nzPageIndex]="page.pageNum" [nzPageSize]="page.pageCount" (nzPageIndexChange)="change($event)">
    <thead>
    <tr>
        <th>变更编号</th>
        <th>提交时间</th>
        <th>负责人</th>
        <th>变更级别</th>
        <th>变更内容</th>
        <th>审核人</th>
        <th>审核意见</th>
        <th>状态</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <tr *ngFor="let data of nzTable.data">
        <td>{{data.id}}</td>
        <td>{{data.createTime | date:'yyyy-MM-dd HH:mm:ss'}}</td>
        <td>{{data.manageUserName}}</td>
        <td>
            <span *ngIf="data.type == 1">普通变更</span>
            <span *ngIf="data.type == 2">重大变更</span>
            <span *ngIf="data.type == 3">紧急变更</span>
        </td>
        <td>{{data.description}}</td>
        <td>{{data.verifyUserName}}</td>
        <td>{{data.checkOpinion}}</td>
        <td>
            <span *ngIf="data.status == 1">待提交</span>
            <span *ngIf="data.status == 2">待审核</span>
            <span *ngIf="data.status == 3">审核通过</span>
            <span *ngIf="data.status == 4">审核未通过</span>
            <span *ngIf="data.status == 5">退回关闭</span>
            <span *ngIf="data.status == 6">待处理</span>
            <span *ngIf="data.status == 7">变更完成</span>
        </td>
        <td class="handle main-color">
            <span (click)="handleEditModal(data)" *ngIf="data.status == 1">提交审核</span>
            <span (click)="showChangeModal(data)" *ngIf="data.status == 5 || data.status == 7">查看</span>
            <span (click)="showTransforModal(data)" *ngIf="data.status == 3 || data.status == 6">任务转派</span>
            <span (click)="handleEditModal(data)" *ngIf="data.status == 4 || data.status == 1">编辑</span>
            <span (click)="showChangeModal(data)" *ngIf="data.status == 6">处理</span>
            <span class="handle-delete" (click)="deleteChange(data)"
                  *ngIf="data.status == 1 || data.status == 2 || data.status == 6 || data.status == 3
                || data.status == 4 || data.status == 7">删除</span>
        </td>
    </tr>
    </tbody>
</nz-table>
<!--新增变更-->
<smart-change-create #smartChangeCreate (done)="getList()"></smart-change-create>
<!--变更审核-->
<smart-change-verity #smartChangeVerity (done)="getList()"></smart-change-verity>
<!--转派or派单-->
<smart-transfor #smartTransfor (done)="getList()"></smart-transfor>
