<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>
               运维工作
            </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="3">
        <button (click)="addPlan()" nz-button nzType="default"><i class="anticon anticon-plus-circle-o"></i>新增计划</button>
    </div>
    <div nz-col nzSpan="4">
        <nz-select nzAllowClear style="width: 100%;" [(ngModel)]="obj.status" nzPlaceHolder="计划状态">
            <nz-option nzLabel="未开始" nzValue="0"></nz-option>
            <nz-option nzLabel="待处理" nzValue="1"></nz-option>
            <nz-option nzLabel="已完成" nzValue="2"></nz-option>
            <nz-option nzLabel="待确认" nzValue="3"></nz-option>
        </nz-select>
    </div>
    <div nz-col nzSpan="4">
        <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"></div>
    <div nz-col nzSpan="5">
        <input type="text" nz-input [(ngModel)]="obj.searchStr" placeholder="计划名称/负责人">
    </div>
    <div nz-col nzSpan="2">
        <button (click)="search()" nz-button nzType="default"><i class="anticon anticon-search" style="color: #6097b7"></i>搜索
        </button>
    </div>
</div>

<nz-table #nzTable [nzData]="planList" [nzLoading]="isLoading">
    <thead>
    <tr>
        <th nzWidth="20%">计划名称</th>
        <th>计划类型</th>
        <th>计划负责人</th>
        <th>循环周期</th>
        <th>开始日期</th>
        <th>计划状态</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <tr *ngFor="let data of nzTable.data">
        <td class="round-tag tag-form">
            {{data.title}}
        </td>
        <td>
            {{data.typeName}}
        </td>
        <td>{{data.principals[0].username}}</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>{{data.startTime | date:"yyyy-MM-dd HH:mm:ss"}}</td>
        <td>
            <span *ngIf="data.status == 0">未开始</span>
            <span *ngIf="data.status == 1">待处理</span>
            <span *ngIf="data.status == 2">已完成</span>
            <span *ngIf="data.status == 3">待确认</span>
        </td>
        <td class="handle main-color">
            <span (click)="lookPlan(data.id,data.title)">查看</span>
            <span *ngIf="data.status == 1" (click)="dealPlan(data.id)">处理</span>
            <span *ngIf="data.status == 0 || data.status == 2"(click)="editPlan(data.id)">编辑</span>
            <span *ngIf="data.status != 1" class="handle-delete" (click)="deletePlan(data)">删除</span>
        </td>
    </tr>
    </tbody>
</nz-table>

<nz-modal [nzMaskClosable]="false" [(nzVisible)]="modal.isVisible" nzTitle="处理" (nzOnCancel)="handleCancel()" (nzOnOk)="handleOk()" [nzOkLoading]="modal.isOkLoading">
    <form>
        <nz-form-item>
            <nz-form-label [nzSpan]="7" nzRequired nzFor="name">处理结果</nz-form-label>
            <nz-form-control [nzSpan]="12">
                <nz-radio-group [(ngModel)]="modal.processResult" [ngModelOptions]="{standalone: true}">
                    <label nz-radio nzValue="0">未解决</label>
                    <label nz-radio nzValue="1">部分解决</label>
                    <label nz-radio nzValue="2">已解决</label>
                </nz-radio-group>
            </nz-form-control>
        </nz-form-item>
        <nz-form-item>
            <nz-form-label [nzSpan]="7" nzRequired nzFor="name">完成时间</nz-form-label>
            <nz-form-control [nzSpan]="15">
                <nz-date-picker [(ngModel)]="modal.date" nzFormat="yyyy-MM-dd" [ngModelOptions]="{standalone: true}"></nz-date-picker>
                <nz-time-picker [(ngModel)]="modal.time" [ngModelOptions]="{standalone: true}"></nz-time-picker>
            </nz-form-control>
        </nz-form-item>
        <nz-form-item>
            <nz-form-label [nzSpan]="7" nzRequired nzFor="name">处理情况</nz-form-label>
            <nz-form-control [nzSpan]="12">
                <textarea [(ngModel)]="modal.processRemark" [ngModelOptions]="{standalone: true}" row="4" nz-input></textarea>
            </nz-form-control>
        </nz-form-item>
    </form>
</nz-modal>


<!--巡检计划-->
<smart-plan-modal #smartPlanMoadl (done)="getList()"></smart-plan-modal>

<!--查看计划-->
<smart-look-plan #smartLookPlan></smart-look-plan>
