<template>
  <div class="Inspection">
    <div class="InspectionMain">
      <div class="CRTop">
        <div>
          <span>年检管理</span>
        </div>
        <div style="text-align:right">
          <el-button type="primary" v-if="InspectionBtn.InspectionBtn122" round plain @click="exportExcel">导出excel</el-button>
        </div>
      </div>
      <el-row>
        <el-tabs
          class="BCtabs"
          v-model="activeName"
          type="border-card"
          @tab-click="changeInspection"
        >
          <el-tab-pane label="计划中" name="first"></el-tab-pane>
          <el-tab-pane label="执行中" name="second"></el-tab-pane>
          <el-tab-pane label="已完成" name="third"></el-tab-pane>
          <el-form
            class="TableSelectMain"
            :model="InspectionSearch"
            :inline="true"
            label-position="left"
          >
            <el-row>
              <el-form-item style="width:13%">
                <el-select
                  v-model="InspectionSearch.regionId"
                  clearable filterable
                  placeholder="选择区域"
                  @change="getprojectList"
                >
                  <el-option
                    v-for="item in RegionList"
                    :key="item.id"
                    :label="item.areaName"
                    :value="item.id"
                  ></el-option>
                </el-select>
              </el-form-item>
              <el-form-item style="width:13%">
                <el-select v-model="InspectionSearch.projectId" clearable filterable placeholder="选择项目">
                  <el-option
                    v-for="item in RegionProjectList"
                    :key="item.projectId"
                    :label="item.projectName"
                    :value="item.projectId"
                  ></el-option>
                </el-select>
              </el-form-item>

              <el-form-item style="width:18%" v-if="InspectionStatus!=-1">
                <el-select v-model="InspectionSearch.stepName" clearable filterable placeholder="选择年检状态">
                  <el-option
                    v-for="item in stepStatusList"
                    :key="item.value"
                    :label="item.name"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-form-item>

              <el-form-item style="width:15%" v-if="InspectionStatus!=-1">
                <el-select v-model="InspectionSearch.workerId" clearable filterable placeholder="选择维保工">
                  <el-option
                    v-for="item in WorkerList"
                      :key="item.userId"
                      :label="item.name"
                      :value="item.userId"
                  ></el-option>
                </el-select>
              </el-form-item>

              <el-form-item style="width:18%">
                <el-input v-model="InspectionSearch.info" placeholder="输入电梯注册代码"></el-input>
              </el-form-item>

              <el-form-item style="width:15%">
                <el-button type="primary" round @click="searchInsp">查询</el-button>
                <el-button type="info" plain round @click="searchClear">重置</el-button>
              </el-form-item>
            </el-row>
          </el-form>
          
          <p class="SearchTitle" v-if="InspectionStatus==-1">
            符合条件
            <span style="color:#379FFF">{{InspectionDataTotal}}</span>条
          </p>
          <p class="SearchTitle" v-else>
            总记录条数
            <span style="color:#379FFF">{{TitleTotal}}</span>条，符合条件
            <span style="color:#379FFF">{{InspectionDataTotal}}</span>条
          </p>

          <div class="InspectionTable">
            <el-table
              ref="multipleTable"
              :data="InspectionData"
              style="width: 100%"
              tooltip-effect="dark"
              class="InspectionTable"
              :header-cell-style="{'background-color':'rgba(250,250,250,1)'}"
              border
              v-loading="InspectionDataLoad"
              @selection-change="LifthandleSelectionChange"
            >
              <el-table-column type="selection"></el-table-column>
              <el-table-column prop="areaName" label="区域" min-width="80px" :show-overflow-tooltip="true"></el-table-column>
              <el-table-column prop="projectName" label="项目名称" min-width="100px" :show-overflow-tooltip="true"></el-table-column>
              <!-- <el-table-column prop="liftCode" label="梯号" min-width="80px" :show-overflow-tooltip="true"></el-table-column> -->
              <el-table-column prop="registrationCode" label="注册代码" min-width="100px" :show-overflow-tooltip="true"></el-table-column>
              <el-table-column prop="devicePosition" label="电梯位置" min-width="100px" :show-overflow-tooltip="true"></el-table-column>
              <el-table-column prop="directorName" label="区域主管"></el-table-column>
              <el-table-column :label="InspectionStatus!=-1?'维保工':'是否检查限速器'">
                <template slot-scope="props">
                  <span v-if="InspectionStatus!=-1">{{props.row.workerName}}</span>
                  <span v-else>{{props.row.isCheckGoverner==1?'是':'否'}}</span>
                </template>
              </el-table-column>
              <el-table-column :label="InspectionStatus==-1?'是否荷载试验':(activeName=='third'?'年检完成时间':'年检时间')">
                <template slot-scope="props">
                  <span >{{InspectionStatus==-1?(props.row.loadInspectionSetting==1?'是':'否'):(activeName=='third'?props.row.finishTime:props.row.planDate)}}</span>
              
                </template>
              </el-table-column>
              <el-table-column v-if="InspectionStatus!=-1"  label="是否检查限速器">
                <template slot-scope="props">
                  <span>{{props.row.isCheckGoverner==1?'是':'否'}}</span>
                </template>
              </el-table-column>
              <el-table-column v-if="InspectionStatus!=-1" label="是否荷载试验">
                <template slot-scope="props">
                  <span>{{props.row.loadInspectionSetting==1?'是':'否'}}</span>
                </template>
              </el-table-column>
              <el-table-column label="状态" v-if="InspectionStatus!=-1">
                <template slot-scope="props">
                  <span>{{props.row.stepName==0?'未开始':(props.row.stepName==1?'自检':(props.row.stepName==2?'报检':(props.row.stepName==3?'场检':(props.row.stepName==4?'确认':''))))}}</span>
                </template>
              </el-table-column>
              <el-table-column
                label="操作"
                v-if="InspectionStatus!=-1"
                :min-width="activeName=='second'?'260px':'150px'"
                fixed="right"
              >
                <template slot-scope="props">
                  <el-button
                    type="primary"
                    plain
                    round
                    style="margin-left: 5px;"
                    @click="initPlan(props.row)"
                    v-if="activeName=='second'&&InspectionBtn.InspectionBtn119"
                  >计划修改</el-button>
                    <!-- <el-button
                    type="warning"
                    plain
                    round
                    style="margin-left: 5px;"
                    @click="initNew(props.row)"
                    v-if="activeName=='first'"
                  >提交年检进度</el-button> -->
                  <!-- <el-button
                    type="primary"
                    plain
                    round
                    style="margin-left: 5px;"
                    @click="editInstep(props.row)"
                    v-if="props.row.stepStatus!=0&&activeName!='first'"
                  >修改</el-button> -->
                  <el-button
                    type="warning"
                    plain
                    round
                    style="margin-left: 5px;"
                    @click="showinitNew(props.row)"
                    v-if="props.row.stepStatus!=0&&InspectionStatus==0&&InspectionBtn.InspectionBtn120"
                  >提交年检进度</el-button>
                  <el-button
                    type="warning"
                    plain
                    round
                    style="margin-left: 5px;"
                    @click="showInstep(props.row)"
                    v-if="props.row.stepStatus!=0&&InspectionStatus!=0&&InspectionBtn.InspectionBtn121"
                  >查看</el-button>
                  <!-- <el-button
                    type="success"
                    plain
                    round
                    style="margin-left: 5px;"
                    v-if="activeName=='first'"
                    @click="initLastYear(props.row)"
                  >上年年检</el-button> -->
                  <!-- <el-button
                    type="success"
                    plain
                    round
                    style="margin-left: 5px;"
                    v-if="activeName=='second'"
                    @click="lookImg(props.row)"
                  >查看</el-button> -->
                </template>
              </el-table-column>
            </el-table>
            <div class="pagenation">
              <span>
                <el-pagination
                  background
                  layout="prev, pager, next, sizes, total, jumper"
                  :total="InspectionDataTotal"
                  @current-change="Inspectionclick"
                  @size-change="InspectionhandleSizeChange"
                  :page-sizes="[5, 10, 15, 20]"
                  :page-size="pagesize"
                ></el-pagination>
              </span>
            </div>
          </div>
        </el-tabs>
      </el-row>
    </div>

    <!--计划修改-->
    <div class="InspectionPlanning">
      <el-dialog
        title="计划修改"
        :visible.sync="dialogPassInspectionPlanning"
        width="70%"
        :before-close="handleClose"
      >
        <div class="InspectionPlanningMain">
          <p class="InspectionPlanningMainTitle">电梯信息</p>
          <el-row class="TmBackground">
            <!-- <h5 class="mb10" style="font-size:18px;">电梯信息</h5> -->
            <el-row>
              <el-col :xs="7" :sm="7" :md="7" :lg="7" class="mb15">
                <span>区域:</span>
                <span>{{InspectionPlanningData.areaName}}</span>
              </el-col>
              <el-col :xs="9" :sm="9" :md="9" :lg="9" class="mb15">
                <span>项目名称:</span>
                <span>{{InspectionPlanningData.projectName}}</span>
              </el-col>
              <el-col :xs="8" :sm="8" :md="8" :lg="8" class="mb15">
                电梯编号:
                <span>{{InspectionPlanningData.ilftCode}}</span>
              </el-col>
              <el-col :xs="12" :sm="12" :md="12" :lg="12" class="mb15">
                注册代码:
                <span>{{InspectionPlanningData.registrationCode}}</span>
              </el-col>
              <el-col :xs="12" :sm="12" :md="12" :lg="12" class="mb15">
                电梯位置:
                <span>{{InspectionPlanningData.devicePosition}}</span>
              </el-col>
              <el-col :xs="12" :sm="12" :md="12" :lg="12" class="mb15">
                区域主管:
                <span>{{InspectionPlanningData.directorName}}</span>
              </el-col>
              <el-col :xs="12" :sm="12" :md="12" :lg="12" class="mb15">
                维保工:
                <span>{{InspectionPlanningData.workerName}}</span>
              </el-col>
              <el-col :xs="24" :sm="24" :md="24" :lg="24" class="mb15">
                计划时间:
                <span>{{InspectionPlanningData.planDate}}</span>
              </el-col>
            </el-row>
          </el-row>
          <p class="InspectionPlanningMainTitle">设置</p>
          <el-form :model="InspectionPlanningData" :inline="true" label-position="left">
            <el-row class="mb15">
              <el-col :xs="6" :sm="6" :md="6" :lg="6">
                <span>是否检查限速器：</span>
              </el-col>
              <el-col :xs="12" :sm="12" :md="12" :lg="12">
                <el-radio-group v-model="InspectionPlanningData.isCheckGoverner">
                  <el-radio :label="1">是</el-radio>
                  <el-radio :label="0">否</el-radio>
                </el-radio-group>
              </el-col>
            </el-row>
            <el-row>
              <el-col :xs="6" :sm="6" :md="6" :lg="6">
                <span>荷载年检设置：</span>
              </el-col>
              <el-col :xs="12" :sm="12" :md="12" :lg="12">
                <el-radio-group v-model="InspectionPlanningData.loadInspectionSetting">
                  <el-radio :label="1">是</el-radio>
                  <el-radio :label="0">否</el-radio>
                </el-radio-group>
              </el-col>
            </el-row>
          </el-form>
        </div>
        <div slot="footer" class="dialog-footer Txc">
          <el-button @click="dialogPassInspectionPlanning = false">取 消</el-button>
          <el-button type="primary" @click="submitPlanning">确 定</el-button>
        </div>
      </el-dialog>
    </div>

    <div class="confirmFour">
      <el-dialog
        title="确认审核"
        :visible.sync="dialogconfirmFour"
        width="30%"
        :before-close="handleClose"
      >
        <p>
          注意！由于年检不合格，此电梯将转换为停止服务状态。
        </p>
        <p>请确认是否将该年检设置为不合格？</p>
        <div slot="footer" class="dialog-footer Txc">
          <el-button @click="dialogconfirmFour = false">取 消</el-button>
          <el-button type="primary" @click="confirmFourSubmit">确 定</el-button>
        </div>
      </el-dialog>
    </div>

    <!--提交年检信息-->
    <div class="YearlyEditor">
      <el-dialog
        :title="initStatus==1?'提交年检进度':'修改年检进度'"
        :visible.sync="dialogYearlyEditor"
        width="80%"
        :before-close="handleClose"
      >
        <div class="stepSDiv">
          <div class="stepDiv" @click="tostepInspect(1)"><span :style="{color:activeNameYearly<=0?'#606266':'#409EFF'}">自检</span></div>
          <div class="stepDiv" @click="tostepInspect(2)"><span :style="{color:activeNameYearly<=1?'#606266':'#409EFF'}">报检</span></div>
          <div class="stepDiv" @click="tostepInspect(3)"><span :style="{color:activeNameYearly<=2?'#606266':'#409EFF'}">场检</span></div>
          <div class="stepDiv" @click="tostepInspect(4)"><span :style="{color:activeNameYearly<=3?'#606266':'#409EFF'}">确认</span></div>
          <!-- <div class="stepDiv" @click="tostepInspect(item.index)" v-for="item in stepData" :key="item.index"><span :class="activeNameYearly=0?'':(activeNameYearly=1&&item)">{{item.name}}</span></div> -->
        </div>

        <el-form
          :model="YearlyEditorData1"
          class="YearlyEditorMain"
          :inline="true"
          label-position="left"
          :rules="YearlyEditorDataRule1" ref="YearlyEditorData1"
          v-if="InspectionstepStatus==1" 
        >
          <!-- <p class="YearlyEditorMainTitle">人员信息</p>
              <el-row>
                <el-col :xs="12" :sm="12" :md="8" :lg="8" class="mb5">
                  <el-row>
                    <el-col :sm="10" :md="10" :lg="10" class="selectUp">
                      <span>
                        政府质检人员
                        <i class="FontRed">﹡</i>
                      </span>
                    </el-col>
                    <el-col :sm="14" :md="14" :lg="14">
                      <el-input v-model="YearlyEditorData.Inspector" placeholder="请输入政府质检人员"></el-input>
                    </el-col>
                  </el-row>
                </el-col>
                <el-col :xs="12" :sm="12" :md="8" :lg="8" class="mb5">
                  <el-row>
                    <el-col :sm="10" :md="10" :lg="10" class="selectUp">
                      <span>
                        公司年检人员
                        <i class="FontRed">﹡</i>
                      </span>
                    </el-col>
                    <el-col :sm="14" :md="14" :lg="14">
                      <el-input v-model="YearlyEditorData.Operator" placeholder="请输入公司年检人员"></el-input>
                    </el-col>
                  </el-row>
                </el-col>
                <el-col :xs="12" :sm="12" :md="8" :lg="8" class="mb5">
                  <el-row>
                    <el-col :sm="10" :md="10" :lg="10" class="selectUp">
                      <span>
                        联系电话
                        <i class="FontRed">﹡</i>
                      </span>
                    </el-col>
                    <el-col :sm="14" :md="14" :lg="14">
                      <el-input v-model="YearlyEditorData.Telephone" placeholder="请输入联系电话"></el-input>
                    </el-col>
                  </el-row>
                </el-col>
          </el-row>-->
          <p class="YearlyEditorMainTitle">电梯信息</p>
          <el-row>
            <el-form-item label="注册代码" style="width:30%">
              <span>{{YearlyEditorData1.registrationCode}}</span>
            </el-form-item>

            <el-form-item label="电梯年检时间：" prop="planDate" style="width:60%">
              <span v-if="IsShowInspec">{{YearlyEditorData1.planDate}}</span>
              <el-date-picker
                v-else
                type="month"
                placeholder="选择电梯年检时间"
                v-model="YearlyEditorData1.planDate"
                value-format="yyyy-MM-dd"

              ></el-date-picker>
            </el-form-item>
          </el-row>
          <p class="YearlyEditorMainTitle">设置</p>
          <el-row class="mb10" style="line-height: 40px;">
            <el-form-item label="是否检验限速器：" prop="isCheckGoverner" style="width:50%">
              <span v-if="IsShowInspec">{{YearlyEditorData1.isCheckGoverner==1?'是':'否'}}</span>
              <el-radio-group v-model="YearlyEditorData1.isCheckGoverner" v-else>
                <el-radio :label="1">是</el-radio>
                <el-radio :label="0">否</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="是否荷载试验：" prop="loadInspectionSetting" style="width:50%">
              <span v-if="IsShowInspec">{{YearlyEditorData1.loadInspectionSetting==1?'是':'否'}}</span>
              <el-radio-group v-model="YearlyEditorData1.loadInspectionSetting" v-else>
                <el-radio :label="1">是</el-radio>
                <el-radio :label="0">否</el-radio>
              </el-radio-group>
            </el-form-item>
            
          </el-row>
          <el-row class="mb10">
            <el-form-item label="自检时间：" prop="selfcheckDate">
              <span v-if="IsShowInspec">{{YearlyEditorData1.selfcheckDate}}</span>
              <el-date-picker
              v-else
                type="date"
                placeholder="选择自检时间"
                v-model="YearlyEditorData1.selfcheckDate"
                value-format="yyyy-MM-dd"
              ></el-date-picker>
            </el-form-item>
          </el-row>
          <el-row class="selfcheckReportImg">
            <el-form-item label="自检报告：" >
              <span v-if="IsShowInspec" 
              >
              <div style="display:inline-block;width:32%;height:178px;cursor: pointer;" class="demo-image__preview" v-for="(item,index) in fileListself"  :key="index"
                      :label="index"
                      :value="item" @click="handlePictureCardPreviewf00(item)">
               <el-image   :src="item" style="width:100%;height:100%" ></el-image>
              </div>
              </span >
              <el-upload  
              v-else
              action="https://app.edtyun.com:8443/business/common/upload"
              list-type="picture-card"
              :file-list="fileListselfImage"
              :limit="3"
              :on-exceed="handlePicturelimit"
              :on-success="handleAvatarSuccessself0"
              :on-preview="handlePictureCardPreviewf0"
              :on-remove="handleRemoveself0"
            > 
          
              <i class="el-icon-plus avatar-uploader-icon"></i>
            </el-upload>
            </el-form-item>

            


            
          </el-row>

              
          <!-- <p class="YearlyEditorMainTitle">上传证件</p>
          <el-row>
            <el-col :xs="8" :sm="8" :md="8" :lg="8">
              <p class="mb5" style="font-size:16px">
                上传扫描合格证
                <i class="FontRed">﹡</i>
              </p>
              <el-upload
                class="avatar-uploader"
                action="https://jsonplaceholder.typicode.com/posts/"
                :show-file-list="false"
                :on-success="handleAvatarSuccess"
                :before-upload="beforeAvatarUpload"
              >
                <img
                  v-if="YearlyEditorData.CertificateImgUrl"
                  :src="YearlyEditorData.CertificateImgUrl"
                  class="avatar"
                />
                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
              </el-upload>
            </el-col>

            <el-col :xs="8" :sm="8" :md="8" :lg="8">
              <p class="mb5" style="font-size:16px">年检报告：</p>

              <el-upload
                class="avatar-uploader"
                action="https://jsonplaceholder.typicode.com/posts/"
                :auto-upload="false"
                :on-change="handleFile"
                :on-remove="handleRemoveFile"
              >
                <img v-if="dialogImageUrl" src="../../../../assets/img/file.png" class="avatar" />
                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
              </el-upload>
            </el-col>

            <el-col :xs="8" :sm="8" :md="8" :lg="8">
              
            </el-col>
          </el-row> -->
          <!-- <p v-if="initStatus==1" class="YearlyEditorMainTitleNext">下次年检计划</p>
          <el-row class="mb10" style="margin-left:20px" v-if="initStatus==1">
            <el-col :xs="5" :sm="5" :md="5" :lg="5" class="selectUp">
              <span>
                下次年检时间
                <i class="FontRed">﹡</i>
              </span>
            </el-col>
            <el-col :sm="14" :md="14" :lg="14">
              <el-date-picker
                type="month"
                placeholder="选择下次年检时间"
                v-model="YearlyEditorData.NextInspectionTime"
              ></el-date-picker>
            </el-col>
          </el-row>
          <el-row v-if="initStatus==1" class="mb10" style="margin-left:20px;line-height: 40px;">
            <el-col :xs="5" :sm="5" :md="5" :lg="5" class="selectUp">
              <span style="font-size:14px">
                是否检验限速器
                <i class="FontRed">﹡</i>
              </span>
            </el-col>
            <el-col :xs="12" :sm="12" :md="12" :lg="12">
              <el-radio-group v-model="YearlyEditorData.NextIsCheckGoverner">
                <el-radio :label="1">是</el-radio>
                <el-radio :label="0">否</el-radio>
              </el-radio-group>
            </el-col>
          </el-row>
          <el-row v-if="initStatus==1" class="mb10" style="margin-left:20px;line-height: 40px;">
            <el-col :xs="5" :sm="5" :md="5" :lg="5" class="selectUp">
              <span style="font-size:14px">
                是否荷载试验
                <i class="FontRed">﹡</i>
              </span>
            </el-col>
            <el-col :xs="12" :sm="12" :md="12" :lg="12">
              <el-radio-group v-model="YearlyEditorData.NextIsLoad">
                <el-radio :label="1">是</el-radio>
                <el-radio :label="0">否</el-radio>
              </el-radio-group>
            </el-col>
          </el-row> -->
        </el-form>

        <el-form
          :model="YearlyEditorData2"
          class="YearlyEditorMain"
          :inline="true"
          label-position="left"
          :rules="YearlyEditorDataRule2" ref="YearlyEditorData2"
          v-if="InspectionstepStatus==2" 
        >

          <el-row>
            <el-form-item label="区域：" style="width:33%">
              <span>{{YearlyEditorData2.areaName}}</span>
            </el-form-item>
            <el-form-item label="项目名称：" style="width:33%">
              <span>{{YearlyEditorData2.projectName}}</span>
            </el-form-item>
            <el-form-item label="电梯编号：" style="width:33%">
              <span>{{YearlyEditorData2.liftCode}}</span>
            </el-form-item>
          </el-row>
          <el-row>
            <el-form-item label="注册代码：" style="width:33%">
              <span>{{YearlyEditorData2.registrationCode}}</span>
            </el-form-item>
            <el-form-item label="电梯位置：" style="width:33%">
              <span>{{YearlyEditorData2.devicePosition}}</span>
            </el-form-item>
            <el-form-item label="区域主管：" style="width:33%">
              <span>{{YearlyEditorData2.directorName}}</span>
            </el-form-item>
          </el-row>
          <el-row>
            <el-form-item label="维保工：" style="width:33%">
              <span>{{YearlyEditorData2.workerName}}</span>
            </el-form-item>
            <el-form-item label="计划时间：" style="width:33%">
              <span>{{YearlyEditorData2.planDate?YearlyEditorData2.planDate.substring(0,7):YearlyEditorData2.planDate}}</span>
            </el-form-item>
          </el-row>
          <el-row>
            <el-form-item label="是否检查限速器：" style="width:33%">
              <span>{{YearlyEditorData2.isCheckGoverner==1?'是':'否'}}</span>
            </el-form-item>
            <el-form-item label="荷载年检设置：" style="width:33%">
              <span>{{YearlyEditorData2.loadInspectionSetting==1?'是':'否'}}</span>
            </el-form-item>
          </el-row>
          <hr style="height:1px;background:rgba(233,233,233,1);">
          <p class="YearlyEditorMainTitle">人员信息</p>
          <el-row class="mb15">
            <el-form-item label="政府质检人员" prop="inspector" style="width:50%">
              <span v-if="IsShowInspec">{{YearlyEditorData2.inspector}}</span>
              <el-input v-else v-model="YearlyEditorData2.inspector" placeholder="输入政府质检人员"></el-input>
            </el-form-item>
            <el-form-item label="公司年检人员" prop="operator" style="width:50%">
              <span v-if="IsShowInspec">{{YearlyEditorData2.operator}}</span>
              <el-input v-else v-model="YearlyEditorData2.operator" placeholder="输入公司年检人员"></el-input>
            </el-form-item>
           
          </el-row>
          <el-row class="mb15">
            <el-form-item label="联系电话" prop="telephone" style="width:45%">
              <span v-if="IsShowInspec">{{YearlyEditorData2.telephone}}</span>
              <el-input v-else v-model="YearlyEditorData2.telephone" placeholder="输入联系电话"></el-input>
            </el-form-item>
            <el-form-item label="现场检验时间：" prop="checkDate" style="width:55%">
              <span v-if="IsShowInspec">{{YearlyEditorData2.checkDate}}</span>
              <el-date-picker v-else
                type="date"
                placeholder="选择现场检验时间"
                v-model="YearlyEditorData2.checkDate"
                value-format="yyyy-MM-dd"
              ></el-date-picker>
            </el-form-item>
          </el-row>
          <el-row class="selfcheckReportImg">
            <el-form-item label="自检报告：" >
              <div style="display:inline-block;width:32%;height:178px;cursor: pointer;" class="demo-image__preview" v-for="(item,index) in fileListself"  :key="index"
                      :label="index"
                      :value="item" @click="handlePictureCardPreviewf00(item)">
              <el-image   :src="item" style="width:100%;height:100%;cursor: pointer;" ></el-image>
              </div>
            </el-form-item>
          </el-row>
          <!-- <el-row>
            <el-form-item label="自检时间：" prop="selfcheckDate">
              <el-date-picker
                type="month"
                placeholder="选择自检时间"
                v-model="YearlyEditorData2.selfcheckDate"
              ></el-date-picker>
            </el-form-item>
          </el-row>
          <p class="mb5" style="font-size:16px">自检报告：</p>
          <el-row>
            <el-upload
              class="avatar-uploader"
              action="https://jsonplaceholder.typicode.com/posts/"
              :auto-upload="false"
              :on-change="handleFile1"
              :on-remove="handleRemoveFile1"
            >
              <img v-if="dialogImageUrl1" src="../../../../assets/img/file.png" class="avatar" />
              <i v-else class="el-icon-plus avatar-uploader-icon"></i>
            </el-upload>
          </el-row> -->

              
          <!-- <p class="YearlyEditorMainTitle">上传证件</p>
          <el-row>
            <el-col :xs="8" :sm="8" :md="8" :lg="8">
              <p class="mb5" style="font-size:16px">
                上传扫描合格证
                <i class="FontRed">﹡</i>
              </p>
              <el-upload
                class="avatar-uploader"
                action="https://jsonplaceholder.typicode.com/posts/"
                :show-file-list="false"
                :on-success="handleAvatarSuccess"
                :before-upload="beforeAvatarUpload"
              >
                <img
                  v-if="YearlyEditorData.CertificateImgUrl"
                  :src="YearlyEditorData.CertificateImgUrl"
                  class="avatar"
                />
                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
              </el-upload>
            </el-col>

            <el-col :xs="8" :sm="8" :md="8" :lg="8">
              <p class="mb5" style="font-size:16px">年检报告：</p>

              <el-upload
                class="avatar-uploader"
                action="https://jsonplaceholder.typicode.com/posts/"
                :auto-upload="false"
                :on-change="handleFile"
                :on-remove="handleRemoveFile"
              >
                <img v-if="dialogImageUrl" src="../../../../assets/img/file.png" class="avatar" />
                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
              </el-upload>
            </el-col>

            <el-col :xs="8" :sm="8" :md="8" :lg="8">
              
            </el-col>
          </el-row> -->
          <!-- <p v-if="initStatus==1" class="YearlyEditorMainTitleNext">下次年检计划</p>
          <el-row class="mb10" style="margin-left:20px" v-if="initStatus==1">
            <el-col :xs="5" :sm="5" :md="5" :lg="5" class="selectUp">
              <span>
                下次年检时间
                <i class="FontRed">﹡</i>
              </span>
            </el-col>
            <el-col :sm="14" :md="14" :lg="14">
              <el-date-picker
                type="month"
                placeholder="选择下次年检时间"
                v-model="YearlyEditorData.NextInspectionTime"
              ></el-date-picker>
            </el-col>
          </el-row>
          <el-row v-if="initStatus==1" class="mb10" style="margin-left:20px;line-height: 40px;">
            <el-col :xs="5" :sm="5" :md="5" :lg="5" class="selectUp">
              <span style="font-size:14px">
                是否检验限速器
                <i class="FontRed">﹡</i>
              </span>
            </el-col>
            <el-col :xs="12" :sm="12" :md="12" :lg="12">
              <el-radio-group v-model="YearlyEditorData.NextIsCheckGoverner">
                <el-radio :label="1">是</el-radio>
                <el-radio :label="0">否</el-radio>
              </el-radio-group>
            </el-col>
          </el-row>
          <el-row v-if="initStatus==1" class="mb10" style="margin-left:20px;line-height: 40px;">
            <el-col :xs="5" :sm="5" :md="5" :lg="5" class="selectUp">
              <span style="font-size:14px">
                是否荷载试验
                <i class="FontRed">﹡</i>
              </span>
            </el-col>
            <el-col :xs="12" :sm="12" :md="12" :lg="12">
              <el-radio-group v-model="YearlyEditorData.NextIsLoad">
                <el-radio :label="1">是</el-radio>
                <el-radio :label="0">否</el-radio>
              </el-radio-group>
            </el-col>
          </el-row> -->
        </el-form>

        <el-form
          :model="YearlyEditorData3"
          class="YearlyEditorMain"
          :inline="true"
          label-position="left"
          v-if="InspectionstepStatus==3||InspectionstepStatus==4" 
        >

          <el-row>
            <el-form-item label="区域：" style="width:33%">
              <span>{{YearlyEditorData3.areaName}}</span>
            </el-form-item>
            <el-form-item label="项目名称：" style="width:33%">
              <span>{{YearlyEditorData3.projectName}}</span>
            </el-form-item>
            <el-form-item label="电梯编号：" style="width:33%">
              <span>{{YearlyEditorData3.liftCode}}</span>
            </el-form-item>
          </el-row>
          <el-row>
            <el-form-item label="注册代码：" style="width:33%">
              <span>{{YearlyEditorData3.registrationCode}}</span>
            </el-form-item>
            <el-form-item label="电梯位置：" style="width:33%">
              <span>{{YearlyEditorData3.devicePosition}}</span>
            </el-form-item>
            <el-form-item label="区域主管：" style="width:33%">
              <span>{{YearlyEditorData3.directorName}}</span>
            </el-form-item>
          </el-row>
          <el-row>
            <el-form-item label="维保工：" style="width:33%">
              <span>{{YearlyEditorData3.workerName}}</span>
            </el-form-item>
            <el-form-item label="计划时间：" style="width:33%">
              <span>{{YearlyEditorData3.planDate?YearlyEditorData3.planDate.substring(0,7):YearlyEditorData3.planDate}}</span>
            </el-form-item>
          </el-row>
          <el-row>
            <el-form-item label="是否检查限速器：" style="width:33%">
              <span>{{YearlyEditorData3.isCheckGoverner==1?'是':'否'}}</span>
            </el-form-item>
            <el-form-item label="荷载年检设置：" style="width:33%">
              <span>{{YearlyEditorData3.loadInspectionSetting==1?'是':'否'}}</span>
            </el-form-item>
            <el-form-item label="现场检验时间：" style="width:33%">
              <span>{{YearlyEditorData3.checkDate?YearlyEditorData3.checkDate.substring(0,10):YearlyEditorData3.checkDate}}</span>
            </el-form-item>
          </el-row>
          <hr style="height:1px;background:rgba(233,233,233,1);">
          <el-row class="selfcheckReportImg">
            <el-form-item label="自检报告：">
              <div style="display:inline-block;width:32%;height:178px;cursor: pointer;" class="demo-image__preview" v-for="(item,index) in fileListself"  :key="index"
                      :label="index"
                      :value="item" @click="handlePictureCardPreviewf00(item)">
              <el-image   :src="item" style=";width:100%;height:100%;cursor: pointer;" ></el-image>
              </div>
            </el-form-item>
            <el-form-item label="检验结果：" style="width:32%;margin-right: 1%;">
              <div class="demo-image__preview" v-if="InspectionstepStatus==3&&IsShowInspec" @click="handlePictureCardPreviewf00(YearlyEditorData3.checkResultImg)">
                <el-image  :src="YearlyEditorData3.checkResultImg" style="width:100%;height:178px;cursor: pointer;" ></el-image>
              </div>
              <el-upload
              class="avatar-uploader"
              ref="fileList"
              action="https://app.edtyun.com:8443/business/common/upload"
              :headers="{'Authorization':token}"
              :show-file-list="false"
              :on-success="handleAvatarSuccess2"
              :on-preview="handlePictureCardPreviewf0"
              :on-remove="handleRemove2"
              v-if ="InspectionstepStatus==3&&!IsShowInspec"
              >
                <div class="demo-image__preview" v-if="YearlyEditorData3.checkResultImg" @click="handlePictureCardPreviewf00(YearlyEditorData3.checkResultImg)">
                  <el-image  :src="YearlyEditorData3.checkResultImg" style="width:100%;height:178px;cursor: pointer;" ></el-image>
                </div>
                <!-- <img v-if="YearlyEditorData3.checkResultImg" :src="YearlyEditorData3.checkResultImg" class="avatar" /> -->
                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
              </el-upload>
              <div class="demo-image__preview" v-if="InspectionstepStatus==4" @click="handlePictureCardPreviewf00(YearlyEditorData3.checkResultImg)">
                <el-image  :src="YearlyEditorData3.checkResultImg" style="width:100%;height:178px;cursor: pointer;" ></el-image>
              </div>
            </el-form-item>
            <el-form-item v-if="InspectionstepStatus==4" label="年检报告：" style="width:33%">
              <div class="demo-image__preview" v-if="IsShowInspec" @click="handlePictureCardPreviewf00(YearlyEditorData3.annualInspectionImg)">
                <el-image  :src="YearlyEditorData3.annualInspectionImg" style="width:100%;height:178px;cursor: pointer;" ></el-image>
              </div>
              <!-- <img v-if="IsShowInspec" :src="YearlyEditorData3.annualInspectionImg" style="width:100%;height:178px" /> -->
              <el-upload
                v-else
                class="avatar-uploader"
                ref="fileList"
                action="https://app.edtyun.com:8443/business/common/upload"
                :headers="{'Authorization':token}"
                :show-file-list="false"
                :on-success="handleAvatarSuccess3"
                :on-preview="handlePictureCardPreviewf0"
                :on-remove="handleRemove3"
              >
                <div class="demo-image__preview"  v-if="YearlyEditorData3.annualInspectionImg" @click="handlePictureCardPreviewf00(YearlyEditorData3.annualInspectionImg)">
                  <el-image  :src="YearlyEditorData3.annualInspectionImg" style="width:100%;height:178px;cursor: pointer;" ></el-image>
                </div>
                <!-- <img v-if="YearlyEditorData3.annualInspectionImg" :src="YearlyEditorData3.annualInspectionImg" class="avatar" /> -->
                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
              </el-upload>
            </el-form-item>
            <el-form-item v-if="InspectionstepStatus==4" label="合格证：" style="width:33%">
              <div class="demo-image__preview"  v-if="IsShowInspec" @click="handlePictureCardPreviewf00(YearlyEditorData3.certificateImgUrl)">
                  <el-image  :src="YearlyEditorData3.certificateImgUrl" style="width:100%;height:178px;cursor: pointer;" ></el-image>
                </div>
              <!-- <img v-if="IsShowInspec" :src="YearlyEditorData3.certificateImgUrl" style="width:100%;height:178px" /> -->
              <el-upload
              v-else
              class="avatar-uploader"
              ref="fileList"
              action="https://app.edtyun.com:8443/business/common/upload"
              :headers="{'Authorization':token}"
              :show-file-list="false"
              :on-success="handleAvatarSuccess4"
              :on-preview="handlePictureCardPreviewf0"
              :on-remove="handleRemove4"
              >

              <div class="demo-image__preview"  v-if="YearlyEditorData3.certificateImgUrl" @click="handlePictureCardPreviewf00(YearlyEditorData3.certificateImgUrl)">
                <el-image  :src="YearlyEditorData3.certificateImgUrl" style="width:100%;height:178px" ></el-image>
                </div>
                <!-- <img v-if="YearlyEditorData3.certificateImgUrl" :src="YearlyEditorData3.certificateImgUrl" class="avatar" /> -->
                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
              </el-upload>
            </el-form-item>
          </el-row>
        </el-form>
        <el-form 
          :model="YearlyEditorData4"
          class="YearlyEditorMain"
          :inline="true"
          label-position="left"
          v-if="InspectionstepStatus==3" 
        >
         <p>下次年检计划设置</p>
         <el-row>
           <span style="display: inline-block;margin-top: 12px;color: #F56C6C;">*</span>
           <el-form-item label="下次年检时间：" >
             <span v-if="IsShowInspec">{{YearlyEditorData4.nextInspectionTime}}</span>
              <el-date-picker
              v-else
                type="month"
                placeholder="请选择下次年检时间"
                v-model="YearlyEditorData4.nextInspectionTime"
                value-format="yyyy-MM-dd"
              ></el-date-picker>
           </el-form-item>
         </el-row>
         <el-row>
           <span style="display: inline-block;margin-top: 12px;color: #F56C6C;">*</span>
           <el-form-item label="是否荷载试验：">
             <span v-if="IsShowInspec">{{YearlyEditorData4.loadInspectionSetting==1?'是':'否'}}</span>
              <el-radio-group v-model="YearlyEditorData4.loadInspectionSetting" v-else>
                <el-radio :label="1">是</el-radio>
                <el-radio :label="0">否</el-radio>
              </el-radio-group>
           </el-form-item>
         </el-row>
         <el-row>
           <span style="display: inline-block;margin-top: 12px;color: #F56C6C;">*</span>
           <el-form-item label="是否检验限速器：">
             <span v-if="IsShowInspec">{{YearlyEditorData4.isCheckGoverner==1?'是':'否'}}</span>
              <el-radio-group v-model="YearlyEditorData4.isCheckGoverner" v-else>
                <el-radio :label="1">是</el-radio>
                <el-radio :label="0">否</el-radio>
              </el-radio-group>
           </el-form-item>
         </el-row>

        </el-form>
        <div slot="footer" class="dialog-footer Txc">
          <el-button v-if="InspectionstepStatus==1&&!IsShowInspec" type="primary" round @click="submitYear('YearlyEditorData1')">确 定</el-button>
          <el-button v-if="InspectionstepStatus==2&&!IsShowInspec" type="primary" round @click="submitYear('YearlyEditorData2')">确 定</el-button>
          <el-button v-if="InspectionstepStatus==3&&!IsShowInspec" type="primary" round @click="checkStatus(1)">合 格</el-button>
          <el-button v-if="InspectionstepStatus==3&&!IsShowInspec" type="warning" round plain @click="checkStatus(2)">整 改</el-button>
          <el-button v-if="InspectionstepStatus==3&&!IsShowInspec" type="danger" round plain @click="checkStatus(0)">不 合 格</el-button>
          <el-button v-if="InspectionstepStatus==4&&!IsShowInspec" type="primary" round @click="checkStatus(1)">合 格</el-button>
          <el-button v-if="InspectionstepStatus==4&&!IsShowInspec" type="danger" round plain @click="checkStatus(0)">不 合 格</el-button>
          <el-button round @click="dialogYearlyEditor = false">取 消</el-button>
        </div>
      </el-dialog>
    </div>

    <!--上年年检-->
    <div class="lastyear">
      <el-dialog
        title="上年年检"
        :visible.sync="dialoglastyear"
        width="70%"
        :before-close="handleClose"
      >
        <div class="InspectionPlanningMain">
          <p class="InspectionPlanningMainTitle">电梯信息</p>
          <el-row class="TmBackground">
            <el-row>
              <el-col :xs="7" :sm="7" :md="7" :lg="7" class="mb15">
                <span>区域:</span>
                <span>{{lastyearData.RegionName}}</span>
              </el-col>
              <el-col :xs="9" :sm="9" :md="9" :lg="9" class="mb15">
                <span>项目名称:</span>
                <span>{{lastyearData.ProjectName}}</span>
              </el-col>
              <el-col :xs="8" :sm="8" :md="8" :lg="8" class="mb15">
                电梯编号:
                <span>{{lastyearData.LiftCode}}</span>
              </el-col>
              <el-col :xs="12" :sm="12" :md="12" :lg="12" class="mb15">
                注册代码:
                <span>{{lastyearData.RegistrationCode}}</span>
              </el-col>
              <el-col :xs="12" :sm="12" :md="12" :lg="12" class="mb15">
                电梯位置:
                <span>{{lastyearData.UseCompanyCode}}</span>
              </el-col>
              <el-col :xs="12" :sm="12" :md="12" :lg="12" class="mb15">
                区域主管:
                <span>{{lastyearData.AdminName}}</span>
              </el-col>
              <el-col :xs="12" :sm="12" :md="12" :lg="12" class="mb15">
                维保工:
                <span>{{lastyearData.RegionName}}</span>
              </el-col>
              <el-col :xs="7" :sm="7" :md="7" :lg="7" class="mb15">
                <span>上次年检时间:</span>
                <span>{{lastyearData.FinishTime}}</span>
              </el-col>
              <el-col :xs="9" :sm="9" :md="9" :lg="9" class="mb15">
                <span>是否检查限速器:</span>
                <span>{{lastyearData.IsCheckGoverner}}</span>
              </el-col>
              <el-col :xs="8" :sm="8" :md="8" :lg="8" class="mb15">
                是否进行荷载检验:
                <span>{{lastyearData.IsLoad}}</span>
              </el-col>
            </el-row>
          </el-row>
          <p class="InspectionPlanningMainTitle">报告</p>
          <el-row>
            <el-col :xs="8" :sm="8" :md="8" :lg="8">
              <p class="mb5" style="font-size:16px">年检报告：</p>
              <div class="avatar-uploader">
                <img src="../../../../assets/img/file.png" class="avatar" />
              </div>
              <p style="padding-left:70px">
                <a
                  href="http://edtyun.cc/AnnualInspection/201909/6/mr_201909061650063fba20443aca4c8cbac2e6d5cfb8e873.doc"
                >下载</a>
              </p>
            </el-col>

            <el-col :xs="8" :sm="8" :md="8" :lg="8">
              <p class="mb5" style="font-size:16px">自检报告：</p>
              <div class="avatar-uploader">
                <img src="../../../../assets/img/file.png" class="avatar" />
              </div>
              <p style="padding-left:70px">
                <a
                  href="http://edtyun.cc/AnnualInspection/201909/6/mr_201909061650063fba20443aca4c8cbac2e6d5cfb8e873.doc"
                >下载</a>
              </p>
            </el-col>
          </el-row>
        </div>
        <div slot="footer" class="dialog-footer Txc">
          <el-button @click="dialoglastyear = false">取 消</el-button>
          <el-button type="primary">确 定</el-button>
        </div>
      </el-dialog>
    </div>

    <div>
      <el-dialog :visible.sync="dialogVisible">
        <img width="100%" :src="dialogImageUrl11" alt="">
      </el-dialog>
    </div>

    <!--查看-->
    <div class="InspectionPic">
      <el-dialog
        title="电梯合格证"
        :visible.sync="dialogInspectionPic"
        width="50%"
        :before-close="handleClose"
      >
        <div class="block">
          <el-carousel height="350px">
            <el-carousel-item v-for="item in InspectionPicData" :key="item.Sort">
              <el-image :src="item.ImgURL" fit="fill"></el-image>
            </el-carousel-item>
          </el-carousel>
        </div>
        <div slot="footer" class="dialog-footer Txc">
          <el-button @click="dialogInspectionPic = false">关 闭</el-button>
        </div>
      </el-dialog>
    </div>
  </div>
</template>

<script>
export default {
  components: {},
  name: "Inspection",
  data() {
    return {
      fileList:[],
      activeName: "first",
      handleClose: null,
      //分页
      pagesize: 10,
      token:'',
      currpage: 1,
      InspectionDataTotal: 10,
      TitleTotal: 10,
      InspectionStatus: -1,
      InspectionSearch: {
        regionId: "",
        projectId: "",
        workerId: "",
        stepName: "",
        info: ""
      },
      InspectionstepStatus:1,
      RegionList: [],
      RegionProjectList: [],
      stepStatusList: [
        {
          value: 1,
          name: "自检"
        },
        {
          value: 2,
          name: "报检"
        },
        {
          value: 3,
          name: "场检"
        },
        {
          value: 4,
          name: "确认"
        }
      ],
      WorkerList: [],
      InspectionData: [],
      InspectionDataLoad:false,
      //计划修改
      dialogPassInspectionPlanning: false,
      InspectionPlanningData: {},
      //提交年检信息
      dialogYearlyEditor: false,
      dialogconfirmFour: false,
      YearlyEditorData1: {
        registrationCode: "",
        planDate:"",
        loadInspectionSetting: "",
        isCheckGoverner: "",
        selfcheckReportImg:"",
        selfcheckDate:"",
      },
      IsShowInspec:false,
      editInstepId:'',
      showInstepId:'',
      initNewId:'',
      YearlyEditorDataRule1:{
        beginInspectionDate: [
          { required: true, message: "电梯年检时间不能为空", trigger: "blur" }
        ],
        loadInspectionSetting: [
          { required: true, message: "荷载年检设置不能为空", trigger: "blur" }
        ],
        isCheckGoverner: [
          { required: true, message: "检查限速器不能为空", trigger: "blur" }
        ],
        selfcheckDate: [
          { required: true, message: "自检时间不能为空", trigger: "blur" }
        ],
      },
      YearlyEditorData2: {
        directorName: "",
        workerName: "",
        devicePosition: "",
        liftCode: "",
        registrationCode: "",
        projectName: "",
        areaName: "",
        isCheckGoverner: "",
        loadInspectionSetting: "",
        planDate:"",
        selfcheckReportImg:"",
        finishTime:"",
        inspector:"",
        operator:"",
        telephone:"",
      },
      YearlyEditorDataRule2:{
        selfcheckReportImg: [
          { required: true, message: "自检报告不能为空", trigger: "blur" }
        ],
        inspector: [
          { required: true, message: "政府质检人员不能为空", trigger: "blur" }
        ],
        operator: [
          { required: true, message: "公司年检人员不能为空", trigger: "blur" }
        ],
        telephone: [
          { required: true, message: "联系电话不能为空", trigger: "blur" }
        ],
        checkDate: [
          { required: true, message: "现场检验时间不能为空", trigger: "blur" }
        ],
      },
      YearlyEditorData3: {
        directorName: "",
        workerName: "",
        devicePosition: "",
        liftCode: "",
        registrationCode: "",
        projectName: "",
        areaName: "",
        isCheckGoverner: "",
        loadInspectionSetting: "",
        planDate:"",
        selfcheckReportImg:"",
        finishTime:"",
        inspector:"",
        operator:"",
        telephone:"",
        checkResultImg:"",
        annualInspectionImg:"",
        certificateImgUrl:""
      },
      YearlyEditorData4:{
        nextInspectionTime:"",
        loadInspectionSetting:"",
        isCheckGoverner:"",
      },
      dialogImageUrl2: "",
      dialogImageUrl1: "",
      dialogImageUrl3:"",
      disabled: false,
      initStatus: "",
      activeNameYearly:0,
      //上年年检
      dialoglastyear: false,
      lastyearData: {
        AdminName: "彭丹",
        AnnualInspectionDate: null,
        AnnualInspectionID: 1001112228260,
        CertificateImgUrl:
          "http://edtyun.cc/AnnualInspection/201908/6/mr_201908061747061936d3c70e914274a283e5c7f086d33b.jpg?x-oss-process=image/quality,q_60/auto-orient,0",
        CreateDate: "2019-08",
        CreateId: 0,
        FileUrl: null,
        FinishTime: "2019-08",
        GovernerID: null,
        GovernerVersion: null,
        InspectUrl: "",
        Inspector: "111",
        IsCheckGoverner: 1,
        IsLoad: 0,
        IsPass: 0,
        LiftCode: "ZT000017",
        LiftID: 1001105202177,
        LiftPosition: "武汉市江夏区",
        LiftStatus: 2,
        MTCompanyID: 1001102110557,
        NextInspectionTime: "2020-08",
        NextIsCheckGoverner: 0,
        NextIsLoad: 0,
        Operator: "222",
        PlanDate: "2019-08",
        ProjectCode: "XM000011",
        ProjectName: "流程测试",
        RegionName: "测试-武汉光谷",
        RegistrationCode: "1111111111111",
        SelfUrl: "",
        Status: 1,
        Telephone: "333333",
        Type: 0,
        UseCompanyCode: "23232424142423",
        WorkerName: null
      },
      stepData:[
        {
          index:1,
          name:'第一阶段'
        },{
          index:2,
          name:'第二阶段'
        },{
          index:3,
          name:'第三阶段'
        },{
          index:4,
          name:'第四阶段'
        }
      ],
      //修改
      //查看
      dialogInspectionPic: false,
      dialogVisible: false,
      dialogImageUrl11:'',
      fileListself:[],
      fileListselfImage:[],
      LiftChoose:[],
      InspectionPicData: [
        {
          ImgURL:
            "http://edtyun.cc/MaintenanceRecord/10011091049211/1.jpg?x-oss-process=image/watermark,image_d2F0ZXJtYXJrLnBuZz94LW9zcy1wcm9jZXNzPWltYWdlL3Jlc2l6ZSxQXzMw,t_60/quality,q_60/auto-orient,0",
          Sort: 1
        }
      ],
      InspectionBtn:{
        InspectionBtn119:0,
        InspectionBtn120:0,
        InspectionBtn121:0,
        InspectionBtn122:0,
      }
    };
  },
  created() {
    this.getWorker()
    this.getRegionList();
    this.token= JSON.parse(sessionStorage.getItem('token'))
    this.showInspectionData(-1,1, 10);

    var InspectionBtn = {}
    this.getButton(118).then(result => {
      if (result.data.statusCode==="1") {
        InspectionBtn = result.data.data
        InspectionBtn.map((item)=>{
          if(item.id==119){
            this.InspectionBtn.InspectionBtn119 = item.checked?1:0 
          }else if(item.id==120){
            this.InspectionBtn.InspectionBtn120 = item.checked?1:0  
          }else if(item.id==121){
            this.InspectionBtn.InspectionBtn121 = item.checked?1:0  
          }else if(item.id==122){
            this.InspectionBtn.InspectionBtn122 = item.checked?1:0  
          }
        })
        console.log(this.InspectionBtn.InspectionBtn56)
      }
    });
  },
  mounted() {
    
  },
  methods: {
    //获取区域下拉框数据
    getRegionList() {
      var url = "enterprise/region/project/regions";
      var param = {
        mtCompanyId: JSON.parse(sessionStorage.getItem('mtCompanyId'))
        // mtCompanyId: 1001102100031
      };
      this.axios.post(url, param).then(result => {
        var data = result;
        console.log(data);
        if (data.statusCode === "1" || data.statusCode === "9") {
          this.RegionList = data.data;
        } else {
          this.$message.error(data.message);
        }

        console.log(data.data);
      });
    },
    getprojectList() {
      var url = "business/project/projectIDList";
      var param = {
        regionId: this.InspectionSearch.regionId
      };
      this.axios.post(url, param).then(result => {
        var data = result;
        if (data.statusCode === "1" || data.statusCode === "9") {
          this.RegionProjectList = data.data;
        }
      });
    },
    //项目列表数据
    showInspectionData(status, pageNum, pageSize) {
      if(status==-1){
        this.InspectionDataLoad = true;
        var url =
          "/business/annualinspection/annual-inspection/toConfirm";
        var param = {
          mtCompanyId:JSON.parse(sessionStorage.getItem('mtCompanyId')),
          pageNum: pageNum,
          pageSize: pageSize,
        };
        this.InspectionSearch.regionId
          ? (param.regionId = this.InspectionSearch.regionId)
          : "";
        this.InspectionSearch.projectId
          ? (param.projectId = this.InspectionSearch.projectId)
          : "";
        this.InspectionSearch.info
          ? (param.registrationCode = this.InspectionSearch.info)
          : "";
        this.axios.post(url, param,{ headers: {'Authorization': this.token,'MobileType':1}}//设置header信息
  ).then(result => {
          var data = result;
          if (data.statusCode) this.InspectionDataLoad = false
          if (data.statusCode === "1") {
            this.InspectionData = data.data.rows
            this.InspectionDataTotal = data.data.total
          } else {
            this.$message.error(data.message);
          }
          
          // if (data.statusCode) this.InspectionDataLoad = false
          // if (data.statusCode === "1" || data.statusCode === "9") {
          //   this.InspectionData = data.data.page.rows;
          //   this.InspectionDataTotal = data.data.page.total;
          //   this.TitleTotal = data.data.count;
          // } else {
          //   this.$message.error(data.message);
          // }
        });
      }else{
        this.InspectionDataLoad = true;
        var url =
          "business/annualinspection/annual-inspection/page";
        var param = {
          mtCompanyId:JSON.parse(sessionStorage.getItem('mtCompanyId')),
          status: status,
          pageNum: pageNum,
          pageSize: pageSize,
        };
        this.InspectionSearch.regionId
          ? (param.regionId = this.InspectionSearch.regionId)
          : "";
        this.InspectionSearch.projectId
          ? (param.projectId = this.InspectionSearch.projectId)
          : "";
        this.InspectionSearch.workerId
          ? (param.workerId = this.InspectionSearch.workerId)
          : "";
        this.InspectionSearch.stepName
        ? (param.stepName = this.InspectionSearch.stepName)
        : "";
        this.InspectionSearch.info
          ? (param.info = this.InspectionSearch.info)
          : "";
        this.axios.post(url, param).then(result => {
          var data = result;
          console.log(data);
          if (data.statusCode) this.InspectionDataLoad = false
          if (data.statusCode === "1" || data.statusCode === "9") {
            this.InspectionData = data.data.page.rows;
            this.InspectionDataTotal = data.data.page.total;
            this.TitleTotal = data.data.count;
          } else {
            this.$message.error(data.message);
          }
        });
      }
      
    },
    // 分页页码
    Inspectionclick(val) {
      this.currpage = val;
      this.showInspectionData(this.InspectionStatus,val,this.pagesize);
    },
    // 分页显示条数
    InspectionhandleSizeChange(val) {
      this.pagesize = val;
      this.showInspectionData(this.InspectionStatus,this.currpage,val);
    },
    changeInspection(tab, event) {
      this.InspectionSearch= {
        regionId: "",
        projectId: "",
        workerId: "",
        stepName: "",
        info: ""
      }
      if (tab.$el.id == "pane-first") {
        this.InspectionStatus = -1;
        this.showInspectionData(-1,1, 10);
      }else if (tab.$el.id == "pane-second") {
        this.InspectionStatus = 0;
        this.showInspectionData(0, 1, 10);
      } else if (tab.$el.id == "pane-third") {
        this.InspectionStatus = 1;
        this.showInspectionData(1, 1, 10);
      }
    },
    
    //计划修改
    initPlan(row) {
      this.dialogPassInspectionPlanning = true;
      this.InspectionPlanningData = row;
    },
    submitPlanning(){
      var url =
        "business/annualinspection/annual-inspection/update";
      var param = {
        id:this.InspectionPlanningData.id,
        mtCompanyId:JSON.parse(sessionStorage.getItem('mtCompanyId')),
        isCheckGoverner:this.InspectionPlanningData.isCheckGoverner,
        loadInspectionSetting:this.InspectionPlanningData.loadInspectionSetting,
      }
      this.axios.post(url, param).then(result => {
        var data = result;
        if (data.statusCode === "1") {
          this.showInspectionData(this.InspectionStatus,this.currpage,this.pagesize);
          this.dialogPassInspectionPlanning = false;
        } else {
          this.$message.error(data.message);
        }
      });
    },
    getWorker(){
      var url = "system/companyuser/getCompanyMembers";
      var param = {
        companyId:JSON.parse(sessionStorage.getItem('mtCompanyId')),
        roleCode:"ROLEMTWORK"
      };
      this.axios.post(url, param).then(result => {
        var data = result;
        if(data.statusCode==="1"||data.statusCode==="9"){
          this.WorkerList = data.data
        }
      });
    },
    tostepInspect(index){
      this.fileListself = [];
      this.fileListselfImage = []
      if(index==1){
        this.InspectionstepStatus=1;
        this.activeNameYearly=0;
      }else if(index==2){
        this.InspectionstepStatus=2;
        this.activeNameYearly=1;
      }else if(index==3){
        this.InspectionstepStatus=3;
        this.activeNameYearly=2;
      }else if(index==4){
        this.InspectionstepStatus=4;
        this.activeNameYearly=3;
      }
      if(this.InspectionStatus==0){
        this.responseInspection(this.initNewId)
        console.log(1)
      }else{
        if(this.IsShowInspec){
          console.log(2)
          this.responseInspection(this.showInstepId)
        }else{
          console.log(3)
          this.responseInspection(this.editInstepId)
        }
      }
      
    },
    editInstep(row){
      this.editInstepId = row.id
      this.IsShowInspec = false
      this.tostepInspect(1)
      this.initNew(row)
    },
    showInstep(row){
      this.showInstepId = row.id
      this.IsShowInspec = true
      this.tostepInspect(1)
      this.initNew(row)
    },
    showinitNew(row){
      this.initNewId = row.id
      this.initStatus = 1;
      this.IsShowInspec = false
      this.initNew(row)
    },
    //提交年检信息
    initNew(row) {
      if(row.stepName==1){
        this.InspectionstepStatus=1;
        this.activeNameYearly=0;
      }else if(row.stepName==2){
        this.InspectionstepStatus=2;
        this.activeNameYearly=1;
      }else if(row.stepName==3){
        this.InspectionstepStatus=3;
        this.activeNameYearly=2;
      }else if(row.stepName==4){
        this.InspectionstepStatus=4;
        this.activeNameYearly=3;
      }
      this.dialogYearlyEditor = true;
      this.YearlyEditorData = {};
      this.responseInspection(row.id)
    },
    
    
    //返回阶段年检信息
    responseInspection(id){
      // var url = "business/annualinspection/annual-inspection/findOne";
      var url = "business/annualinspection/annual-inspection/findOne";
      var param = {
        id: id
      };
      this.axios.post(url, param).then(result => {
        var data = result;
        console.log(data);
        if (data.statusCode === "1") {
          if(this.InspectionstepStatus==1){
            this.YearlyEditorData1 = data.data
            this.fileListself = data.data.selfcheckReportImg?data.data.selfcheckReportImg.split(','):[]
            if(data.data.selfcheckReportImg){
              this.fileListself.map((item)=>{
                this.fileListselfImage.push({
                  url:item
                })
              })

            }
            
            
            // this.YearlyEditorData1.planDate = this.YearlyEditorData1.planDate?this.YearlyEditorData1.planDate.substring(0,10):''
            // this.YearlyEditorData1.selfcheckDate = this.YearlyEditorData1.selfcheckDate?this.YearlyEditorData1.selfcheckDate.substring(0,10):''
          }else if(this.InspectionstepStatus==2){
            this.YearlyEditorData2 = data.data
            this.fileListself = data.data.selfcheckReportImg?data.data.selfcheckReportImg.split(','):[]
           
        
          }else if(this.InspectionstepStatus==3){
            this.YearlyEditorData3 = data.data
            this.YearlyEditorData4 = data.data
            this.fileListself = data.data.selfcheckReportImg?data.data.selfcheckReportImg.split(','):[]
        
          }else if(this.InspectionstepStatus==4){
            this.YearlyEditorData3 = data.data
            this.fileListself = data.data.selfcheckReportImg?data.data.selfcheckReportImg.split(','):[]
         
          }
          // this.RegionList = data.data;
        } else {
          this.$message.error(data.message);
        }
      });
    },
    confirmFourSubmit(){
      this.submitModify(10)
    },
    checkStatus(index){
      if(this.InspectionstepStatus==3){
        if(this.YearlyEditorData3.checkResultImg){
          var stepStatus = 5
          if(this.YearlyEditorData4.nextInspectionTime&&(this.YearlyEditorData4.isCheckGoverner===0||this.YearlyEditorData4.isCheckGoverner===1)&&(this.YearlyEditorData4.loadInspectionSetting===0||this.YearlyEditorData4.loadInspectionSetting===1)){
              if(index==1){
                stepStatus = 5
              }else if(index==2){
                stepStatus = 6
              }else if(index==0){
                stepStatus = 7
              }
              this.submitModify(stepStatus)
          }else{
            this.$message.error("请填写正确的信息！");
          }
        }else{
          this.$message.error("请先上传检验结果！");
        }
      }else if(this.InspectionstepStatus==4){
        if(this.YearlyEditorData3.annualInspectionImg&&this.YearlyEditorData3.certificateImgUrl){
          var stepStatus = 9
          if(index==1){
          stepStatus = 9
          this.submitModify(stepStatus)
          }else if(index==0){
            stepStatus = 10
            this.dialogconfirmFour = true;
          }
          
        }else{
          this.$message.error("请先上传年检报告！");
        }
      }
    },
    submitModify(stepStatus){
      var url = "";
      var param={}
      if(this.InspectionstepStatus==3){
        url="business/annualinspection/annual-inspection/stepThree"
        param = {
          id:this.YearlyEditorData3.id,
          mtCompanyId:JSON.parse(sessionStorage.getItem('mtCompanyId')),
          checkResultImg:this.YearlyEditorData3.checkResultImg,
          projectId:this.YearlyEditorData3.projectId,
          loadInspectionSetting:this.YearlyEditorData4.loadInspectionSetting,
          nextInspectionTime:this.YearlyEditorData4.nextInspectionTime,
          isCheckGoverner:this.YearlyEditorData4.isCheckGoverner,
        }
        param.stepStatus =stepStatus;
      }else if(this.InspectionstepStatus==4){
        url="business/annualinspection/annual-inspection/stepFour"
        param = {
        id:this.YearlyEditorData3.id,
        mtCompanyId:JSON.parse(sessionStorage.getItem('mtCompanyId')),
        certificateImgUrl:this.YearlyEditorData3.certificateImgUrl,
        annualInspectionImg:this.YearlyEditorData3.annualInspectionImg,
        }
        param.stepStatus =stepStatus;
        
      }
      this.axios.post(url, param).then(result => {
        var data = result;
        if(data.statusCode==="1"){
          this.showInspectionData(this.InspectionStatus,this.currpage,this.pagesize);
          if(stepStatus==5){
            this.InspectionstepStatus=4;
            this.activeNameYearly=3;
            this.responseInspection(param.id)
          }else if(stepStatus==6){
            this.InspectionstepStatus=2;
            this.activeNameYearly=1;
            this.responseInspection(param.id)
          }else if(stepStatus==9||stepStatus==7||stepStatus==10){
            this.dialogYearlyEditor=false;
            this.dialogconfirmFour = false;
          }
        }else{
          this.$message.error(data.message);
        }
      });
    },
    beforeAvatarUpload(file) {
      const isLt2M = file.size / 1024 / 1024 < 2;
      if (!isLt2M) {
        this.$message.error("上传头像图片大小不能超过 2MB!");
      }
      return isLt2M;
    },
    handleFile2(file) {
      console.log(file);
      if (file.name) {
        this.dialogImageUrl2 = true;
        this.YearlyEditorData3.checkResultImg = "http://edtyun.cc/AnnualInspection/201912/26/mr_201912261431266c716a5161704c54aa43a52cece5e145.JPG?x-oss-process=image/quality,q_60/auto-orient,0"
        this.submitModify(4)
      }
    },
    handleRemoveFile2(file, fileList) {
      console.log(file, fileList);
      if (fileList.length == 0) {
        this.dialogImageUrl2 = false;
        this.YearlyEditorData3.checkResultImg =""
      }
    },
    handleFile3(file) {
      console.log(file);
      if (file.name) {
        this.dialogImageUrl3 = true;
        this.YearlyEditorData3.annualInspectionImg = "http://edtyun.cc/AnnualInspection/201912/26/mr_201912261431266c716a5161704c54aa43a52cece5e145.JPG?x-oss-process=image/quality,q_60/auto-orient,0"
        this.submitModify(8)
      }
    },
    handleRemoveFile3(file, fileList) {
      console.log(file, fileList);
      if (fileList.length == 0) {
        this.dialogImageUrl3 = false;
        this.YearlyEditorData3.annualInspectionImg =""
      }
    },
    handlePicturelimit(files, fileList) {
      this.$message({
        showClose: true,
        message: "最多上传3张图片！",
        type: "warning"
      });
    },
    handleAvatarSuccessself0(res, file) {
      this.fileListselfImage.push({
        url:res.data
      });
    },
    handlePictureCardPreviewf0(file) {
      this.dialogImageUrl11 = file.url;
      this.dialogVisible = true;
    },
    handlePictureCardPreviewf00(src){
      this.dialogImageUrl11 = src;
      this.dialogVisible = true;
    },
    handleRemoveself0(file, fileList) {
      this.fileListself.pop();
    },
    handleAvatarSuccess2(res, file) {
      this.YearlyEditorData3.checkResultImg = res.data;
      this.submitModify(4)
    },
    handleRemove2(file, fileList) {
      console.log(file, fileList);
    },
    handleAvatarSuccess3(res, file) {
      this.YearlyEditorData3.annualInspectionImg = res.data;
      this.submitModify(8)
    },
    handleRemove3(file, fileList) {
      console.log(file, fileList);
    },
    handleAvatarSuccess4(res, file) {
      this.YearlyEditorData3.certificateImgUrl = res.data;
      this.submitModify(8)
    },
    handleRemove4(file, fileList) {
      console.log(file, fileList);
    },
    
    //上年年检
    initLastYear(row) {
      this.dialoglastyear = true;
    },
    //修改
    init(row) {
      this.initStatus = 2;
      this.dialogYearlyEditor = true;
      this.YearlyEditorData = row;
    },
    //查看
    lookImg(row) {
      this.dialogInspectionPic = true;
      this.InspectionPicData[0].ImgURL = row.CertificateImgUrl;
    },
    searchInsp() {
      this.showInspectionData(this.InspectionStatus,this.currpage,this.pagesize);
    },
    searchClear(){
      this.InspectionSearch={
        regionId: "",
        projectId: "",
        workerId: "",
        stepName: "",
        info: ""
      };
      this.showInspectionData(this.InspectionStatus,this.currpage,this.pagesize);
    },
    LifthandleSelectionChange(val) {
      this.LiftChoose = val;
    },
    exportExcel() {
      if (this.LiftChoose.length == 0) {
        this.$message({
          message: "请先选择电梯",
          type: "warning"
        });
      } else {
        var list = [];
        for(var i=0;i<this.LiftChoose.length;i++){
          list.push(this.LiftChoose[i].id,)
        }
        var url = "business/annualinspection/annual-inspection/export";
        var param = {
          ids: list
        };
        this.axios.post(url, param, { responseType: "arraybuffer" }).then(res => {
          const aLink = document.createElement("a");
          let blob = new Blob([res], { type: "application/zip" });
          aLink.href = URL.createObjectURL(blob);
          aLink.setAttribute("download", "年检列表");
          aLink.click();
        });
      }
    },
    submitYear(formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          if (((!this.fileListselfImage.length)&&this.InspectionstepStatus==1)||((!this.YearlyEditorData2.selfcheckReportImg)&&this.InspectionstepStatus==2)) {
            this.$message.error("请上传自检报告！");
          }else{
            // var url = "business/annualinspection/annual-inspection/modify";
            var url = "";
            var param={};
            if(this.InspectionstepStatus==1){
              url="business/annualinspection/annual-inspection/stepOne"
              var selfcheckReportImgs = ''
              this.fileListselfImage.map((item)=>{
                 selfcheckReportImgs += item.url+','

              })
              param = {
                id:this.YearlyEditorData1.id,
                mtCompanyId:JSON.parse(sessionStorage.getItem('mtCompanyId')),
                selfcheckReportImg:selfcheckReportImgs.substring(0,selfcheckReportImgs.length-1),
                selfcheckDate:this.YearlyEditorData1.selfcheckDate,
              }
              param.stepStatus =2;
            }else if(this.InspectionstepStatus==2){
              url="business/annualinspection/annual-inspection/stepTwo"
              param = {
                id:this.YearlyEditorData2.id,
                mtCompanyId:JSON.parse(sessionStorage.getItem('mtCompanyId')),
                inspector:this.YearlyEditorData2.inspector,
                telephone:this.YearlyEditorData2.telephone,
                operator:this.YearlyEditorData2.operator,
                checkDate:this.YearlyEditorData2.checkDate,
              }
            }
            console.log(param)
            this.axios.post(url, param).then(result => {
              var data = result;
              if(data.statusCode==="1"){
                this.showInspectionData(this.InspectionStatus,this.currpage,this.pagesize);
                if(this.InspectionstepStatus==1){
                  this.InspectionstepStatus=2;
                  this.activeNameYearly=1;
                  this.responseInspection(param.id)
                }else if(this.InspectionstepStatus==2){
                  this.InspectionstepStatus=3
                  this.activeNameYearly=2;
                  this.responseInspection(param.id)
                }
              }else{
                this.$message.error(data.message);
              }
            });
          }
        } else {
          this.$message({
            message: "请输入正确信息！",
            type: "warning"
          });
          return;
        }
      });
    },
  }
};
</script>
<style lang="stylus">
$ft14 = 14px;

.Inspection {
  height: 100%;
  .el-date-editor.el-input.el-input--prefix.el-input--suffix.el-date-editor--date {
    width: 95%;
  }

  .cell {
    text-align: center;
  }

  .InspectionTable {
    .el-button {
      padding: 8px;
      font-size: 12px;
      border-radius: 10px;
      margin-bottom: 5px;
    }
  }

  .policy {
    .el-dialog__body {
      padding-top: 0px;
    }

    .policyTop {
      font-size: 12px;

      p {
        text-align: center;
      }

      .policyTopCompany {
        font-size: 16px;
        font-weight: bold;
      }

      .el-row {
        .el-col {
          text-align: center;
        }
      }
    }

    .policyBottom {
      width: 100%;
    }
  }

  .policyPic {
    .el-image {
      width: 100%;
      height: 100%;
    }
  }

  .Repairpolicy {
    .el-dialog__body {
      padding: 5px 20px;
    }

    .RepairpolicyContent {
      .RepairpolicyContentTop {
        border: 1px solid #dfdfdf;
        padding: 10px;
      }

      .RepairpolicyContentBottom {
      }
    }
  }

  .InspectionPic {
    .el-image {
      width: 100%;
      height: 100%;
    }
  }

  .CodeSContent .el-col {
    p {
      text-align: center;
      font-size: 20px;
      margin-bottom: 5px;
    }

    .el-row .el-col p {
      font-size: 12px;
    }

    .el-image {
      width: 100%;
      height: 100%;
    }
  }

  .InspectionPlanning, .lastyear {
    el-dialog__header {
      padding: 20px 20px 10px;
    }

    .el-dialog__body {
      padding: 0;
    }

    .InspectionPlanningMain {
      .InspectionPlanningMainTitle {
        /* border-left: 5px solid #40A9FF;
        padding-left: 20px; */
        color: #666666;
        font-size: 20px;
        line-height: 25px;
        height: 25px;
        margin: 20px;
        font-weight:bold
      }

      .TmBackground {
        /* background-color: #e6e6e6;
        border: 1px solid #cbcbcb;
        border-radius: 5px;
        padding: 10px; */
        margin: 20px 0;
        font-size: 16px;
        padding: 0 20px 20px;
        border-bottom: 1px solid rgba(233, 233, 233, 1);
      }

      .el-date-editor.el-input.el-input--prefix.el-input--suffix.el-date-editor--month {
        width: 45%;
      }

      .el-form {
        margin: 0 20px;
        font-size: 16px;
      }
    }
  }

  .YearlyEditor {
    .el-dialog__body {
      padding: 10px 20px;
    }
    .stepSDiv{
      padding: 13px 8%;
      border-radius: 4px;
      background: #f5f7fa;
      display: flex;
      
      div.stepDiv{
        cursor: pointer;
        flex-basis:33.3333%
        font-size:16px
      }
      
    }
    

    .YearlyEditorMain {
      font-size: 16px;
      .el-form-item{
        margin-right: 0;
        margin-bottom: 0;
        .el-form-item__label{
          font-size: 16px;
        }
      }
      
      .YearlyEditorMainTitle {
        /* border-left: 5px solid #40A9FF;
        padding-left: 20px; */
        color: #666666;
        font-size: 20px;
        line-height: 25px;
        height: 25px;
        margin: 20px 0;
        font-weight:bold
      }

      .YearlyEditorMainTitleNext {
        color: #000;
        background: #cbcaca;
        padding-left: 20px;
        font-size: 18px;
        font-weight: bold;
        margin: 10px 0;
      }

      .el-date-editor.el-input.el-input--prefix.el-input--suffix.el-date-editor--month {
        width: 90%;
      }
      .selfcheckReportImg .el-form-item .el-form-item__content {
          width: 100%;
          
      }
      .selfcheckReportImg {
        .el-form-item{
            width: 100%;
            .avatar-uploader{
              display: inline-block;
                width: 100%;
                margin-right: 1%;
            }
          }
      }
     
      .avatar-uploader .el-upload {
        border: 1px dashed #d9d9d9;
        border-radius: 6px;
        cursor: pointer;
        position: relative;
        overflow: hidden;
        width: 90%;
        height: 178px;
      }

      .avatar-uploader .el-upload:hover {
        border-color: #409EFF;
      }

      .avatar-uploader-icon {
        font-size: 28px;
        color: #8c939d;
        width: 100%;
        height: 178px;
        line-height: 178px;
        text-align: center;
      }

      .avatar {
        width: 100%;
        height: 100%;
        display: block;
      }

      .el-upload-list {
        width: 90%;
      }
    }
  }

  .InspectionMain {
    height: 100%;
    background: #fff;
  }
  .el-dialog__footer{
    text-align:center
  }
}
</style>

