<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="6">
        <nz-select nzAllowClear style="width: 100%;" [(ngModel)]="obj.typeId" nzPlaceHolder="计划类型">
            <ng-container *ngFor="let item of planTypeList">
                <nz-option [nzValue]="item.id" [nzLabel]="item.name"></nz-option>
            </ng-container>
        </nz-select>
    </div>
    <div nz-col nzSpan="6">
        <input type="text" (keyup.enter)="search()" nz-input [(ngModel)]="obj.searchStr"
               placeholder="计划编号、创建人、计划名称、参与人">
    </div>
    <div nz-col nzSpan="2">
        <button (click)="search()"
                nz-button nzType="default"><i class="anticon anticon-search"></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>
<div nz-row [nzGutter]="4" class="search-form">
    <div nz-col nzSpan="9">
        <span class="main-color margin-right-15">执行时间:</span>
        <nz-radio-group [(ngModel)]="time.type" (ngModelChange)="changeTimeType($event)">
            <label *ngFor="let item of timeType" nz-radio-button
                   [nzValue]="item.value">{{item.label}}</label>
        </nz-radio-group>
    </div>
    <div nz-col nzSpan="6">
        <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-table #nzTable [nzData]="page.list" [nzLoading]="page.isLoading">
    <thead>
    <tr>
        <th nzWidth="20%">计划名称</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.title}}</td>
        <td>{{data.typeName}}</td>
        <td>{{data.principals[0].username}}</td>
        <td>{{data.startTime | date:'yyyy-MM-dd'}}</td>
        <td>{{data.endTime | date:'yyyy-MM-dd'}}</td>
        <td>{{data.nextExecution | date:'yyyy-MM-dd'}}</td>
        <td>
            <span *ngIf="data.cycleType == '0'">每天</span>
            <span *ngIf="data.cycleType == '1'">工作日</span>
            <span *ngIf="data.cycleType == '2'">每周</span>
            <span *ngIf="data.cycleType == '3'">每月</span>
            <span *ngIf="data.cycleType == '4'">每季度</span>
            <span *ngIf="data.cycleType == '5'">每半年</span>
            <span *ngIf="data.cycleType == '6'">无</span>
            /{{data.cycleNum}}次
        </td>
        <td class="handle main-color">
            <span *ngIf="data.status != 2" (click)="editPlan(data.id)">编辑</span>
            <span class="handle-delete" (click)="deletePlan(data)">删除</span>
        </td>
    </tr>
    </tbody>
</nz-table>
<smart-plan-config #smartPlanConfig (done)="getList()"></smart-plan-config>
