<template>
  <div>
    <table>
      <tr>
        <td colspan="2">申请单位</td>
        <td colspan="2"><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.applyUnit" class="editInput"/></td>
        <td>作业单位</td>
        <td colspan="2"><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.taskUnit" class="editInput"/></td>
        <td>作业类别</td>
        <td colspan="2"><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.wallBlind" type="checkbox"/>堵盲板<input :disabled="(applyStatus-0) > 0" v-model="blindPlate.takeBlind" type="checkbox"/>抽盲板</td>
      </tr>
      <tr>
        <td rowspan="2" colspan="2">设备、管道名称</td>
        <td colspan="3">管道参数</td>
        <td colspan="3">盲板参数</td>
        <td colspan="2" rowspan="2">实施作业开始时间</td>
      </tr>
      <tr>
        <td>介质</td>
        <td>温度</td>
        <td>压力</td>
        <td>材质</td>
        <td>规格</td>
        <td>编号</td>
      </tr>
      <tr>
        <td colspan="2"><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.pipeName" class="editInput"/></td>
        <td><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.medium" class="editInput"/></td>
        <td><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.temperature" class="editInput"/></td>
        <td><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.pressure" class="editInput"/></td>
        <td><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.material" class="editInput"/></td>
        <td><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.specifications" class="editInput"/></td>
        <td><input disabled v-model="blindPlate.num" class="editInput"/></td>
        <td colspan="2" v-if="(applyStatus-0) == 0">
          <el-date-picker clearable size="small"
                          type="datetime"
                          v-model="blindPlate.workStartTime"
                          value-format="yyyy-MM-dd HH:mm:ss"
                          placeholder="选择实施作业开始时间"
                          style="width: 100%">
          </el-date-picker>
        </td>
        <td colspan="2" v-if="(applyStatus-0) > 0">
          {{ (blindPlate.workStartTime == null || blindPlate.workStartTime =='') ? "-" :blindPlate.workStartTime.split(" ")[0].split("-")[1]}}月{{(blindPlate.workStartTime == null || blindPlate.workStartTime =='') ? "-" :blindPlate.workStartTime.split(" ")[0].split("-")[2]}}日{{(blindPlate.workStartTime == null || blindPlate.workStartTime =='') ? "-" :blindPlate.workStartTime.split(" ")[1].split(":")[0]}}时{{(blindPlate.workStartTime == null || blindPlate.workStartTime =='') ? "-" :blindPlate.workStartTime.split(" ")[1].split(":")[1]}}分
        </td>
      </tr>
      <tr>
        <td colspan="10">
          <div style="text-align: left">盲板位置图（可另附图）及编号:</div>
          <div>
            <textarea :disabled="(applyStatus-0) > 0" v-model="blindPlate.blindDeviceNum" style="height: 96px"></textarea>
          </div>
          <div style="text-align: right">
            编制人：<input :disabled="(applyStatus-0) > 0" v-model="blindPlate.compiler" class="editInput" style="width: 150px"/>
            <el-date-picker clearable size="small"
                            type="datetime"
                            v-model="blindPlate.compilerTime"
                            value-format="yyyy-MM-dd HH:mm:ss"
                            placeholder="选择时间"
                            style="width: 200px"
                            v-if="(applyStatus-0) == 0">
            </el-date-picker>
            <span v-if="(applyStatus-0) > 0">
              {{ (blindPlate.compilerTime == null || blindPlate.compilerTime =='') ? "-" :blindPlate.compilerTime.split(" ")[0].split("-")[0]}}年{{ (blindPlate.compilerTime == null || blindPlate.compilerTime =='') ? "-" :blindPlate.compilerTime.split(" ")[0].split("-")[1]}}月{{(blindPlate.compilerTime == null || blindPlate.compilerTime =='') ? "-" :blindPlate.compilerTime.split(" ")[0].split("-")[2]}}日
            </span>
          </div>
        </td>
      </tr>
      <tr>
        <td colspan="2">作业负责人</td>
        <td colspan="2"><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.workLeader" class="editInput"/></td>
        <td>作业人</td>
        <td colspan="2"><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.worker" class="editInput"/></td>
        <td>监护人</td>
        <td colspan="2"><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.guarder" class="editInput"/></td>
      </tr>
      <tr>
        <td colspan="2">关联的其他特殊作业及安全作业票编号</td>
        <td colspan="8"><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.otherLicenceNum" class="editInput"/></td>
      </tr>
      <tr>
        <td colspan="2">风险辨识结果在下列画√</td>
        <td colspan="8" style="text-align: left">
          <el-row>
            <el-col :span="4">
              <input :disabled="(applyStatus-0) > 0" v-model="blindPlate.risk.numOne" type="checkbox"/>1.物体打击
            </el-col>
            <el-col :span="4">
              <input :disabled="(applyStatus-0) > 0" v-model="blindPlate.risk.numTwo" type="checkbox"/>2.车辆伤害
            </el-col>
            <el-col :span="4">
              <input :disabled="(applyStatus-0) > 0" v-model="blindPlate.risk.numThree" type="checkbox"/>3.机械伤害
            </el-col>
            <el-col :span="4">
              <input :disabled="(applyStatus-0) > 0" v-model="blindPlate.risk.numFour" type="checkbox"/>4.起重伤害
            </el-col>
            <el-col :span="4">
              <input :disabled="(applyStatus-0) > 0" v-model="blindPlate.risk.numFive" type="checkbox"/>5.触电
            </el-col>
            <el-col :span="4">
              <input :disabled="(applyStatus-0) > 0" v-model="blindPlate.risk.numSix" type="checkbox"/>6.淹溺
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="4">
              <input :disabled="(applyStatus-0) > 0" v-model="blindPlate.risk.numSeven" type="checkbox"/>7.灼烫
            </el-col>
            <el-col :span="4">
              <input :disabled="(applyStatus-0) > 0" v-model="blindPlate.risk.numEight" type="checkbox"/>8.火灾
            </el-col>
            <el-col :span="4">
              <input :disabled="(applyStatus-0) > 0" v-model="blindPlate.risk.numNine" type="checkbox"/>9、高处坠落
            </el-col>
            <el-col :span="4">
              <input :disabled="(applyStatus-0) > 0" v-model="blindPlate.risk.numTen" type="checkbox"/>10、坍塌
            </el-col>
            <el-col :span="4">
              <input v-model="blindPlate.risk.numEleven" type="checkbox"/>11、锅炉爆炸
            </el-col>
            <el-col :span="4">
              <input :disabled="(applyStatus-0) > 0" v-model="blindPlate.risk.numTwelve" type="checkbox"/>12、容器爆炸
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="4">
              <input :disabled="(applyStatus-0) > 0" v-model="blindPlate.risk.numThirteen" type="checkbox"/>13、其它爆炸
            </el-col>
            <el-col :span="4">
              <input :disabled="(applyStatus-0) > 0" v-model="blindPlate.risk.numFourteen" type="checkbox"/>14、中毒和窒
            </el-col>
            <el-col :span="4">
              <input :disabled="(applyStatus-0) > 0" v-model="blindPlate.risk.numFifteen" type="checkbox"/>15、其它伤害
            </el-col>
          </el-row>
        </td>
      </tr>
      <tr>
        <td>序号</td>
        <td colspan="7">安全措施</td>
        <td>是否涉及</td>
        <td>确认人</td>
      </tr>
      <tr>
        <td>1</td>
        <td colspan="7">在管道、设备上作业时,降低系统压力,作业点应为常压或微正压；</td>
        <td><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.safetyMeasures.measuresOne" class="editInput"/></td>
        <td><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.safetyMeasures.measuresOnePeople" class="editInput"/></td>
      </tr>
      <tr>
        <td>2</td>
        <td colspan="7">在有毒介质的管道、设备上作业时,作业人员应穿戴适合的个体防护装备；</td>
        <td><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.safetyMeasures.measuresTwo" class="editInput"/></td>
        <td><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.safetyMeasures.measuresTwoPeople" class="editInput"/></td>
      </tr>
      <tr>
        <td>3</td>
        <td colspan="7">火灾爆炸危险场所,作业人员穿防静电工作服、工作鞋；作业时使用防爆灯具和防爆工具；</td>
        <td><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.safetyMeasures.measuresThree" class="editInput"/></td>
        <td><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.safetyMeasures.measuresThreePeople" class="editInput"/></td>
      </tr>
      <tr>
        <td>4</td>
        <td colspan="7">火灾爆炸危险场所的气体管道,距作业地点30m内无其他动火作业；</td>
        <td><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.safetyMeasures.measuresFour" class="editInput"/></td>
        <td><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.safetyMeasures.measuresFourPeople" class="editInput"/></td>
      </tr>
      <tr>
        <td>5</td>
        <td colspan="7">在强腐蚀性介质的管道、设备上作业时,作业人员已采取防止酸碱化学灼伤的措施；</td>
        <td><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.safetyMeasures.measuresFive" class="editInput"/></td>
        <td><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.safetyMeasures.measuresFivePeople" class="editInput"/></td>
      </tr>
      <tr>
        <td>6</td>
        <td colspan="7">介质温度较高、可能造成烫伤的情况下,作业人员已采取防烫措施；</td>
        <td><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.safetyMeasures.measuresSix" class="editInput"/></td>
        <td><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.safetyMeasures.measuresSixPeople" class="editInput"/></td>
      </tr>
      <tr>
        <td>7</td>
        <td colspan="7">介质温度较低、可能造成人员冻伤情况下,作业人员已采取防冻伤措施；</td>
        <td><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.safetyMeasures.measuresSeven" class="editInput"/></td>
        <td><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.safetyMeasures.measuresSevenPeople" class="editInput"/></td>
      </tr>
      <tr>
        <td>8</td>
        <td colspan="7">同一管道上未同时进行两处及两处以上的盲板抽堵作业；</td>
        <td><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.safetyMeasures.measuresEight" class="editInput"/></td>
        <td><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.safetyMeasures.measuresEightPeople" class="editInput"/></td>
      </tr>
      <tr>
        <td>9</td>
        <td colspan="7">其他相关特殊作业已办理相应安全作业票；</td>
        <td><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.safetyMeasures.measuresNine" class="editInput"/></td>
        <td><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.safetyMeasures.measuresNineoPeople" class="editInput"/></td>
      </tr>
      <tr>
        <td>10</td>
        <td colspan="7">作业现场四周已设警戒区；</td>
        <td><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.safetyMeasures.measuresTen" class="editInput"/></td>
        <td><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.safetyMeasures.measuresTenPeople" class="editInput"/></td>
      </tr>
      <tr>
        <td>11</td>
        <td colspan="7">
          <div style="text-align: left">其他措施：</div>
          <div>
            <textarea :disabled="(applyStatus-0) > 0" v-model="blindPlate.safetyMeasures.measuresElevenDetail"></textarea>
          </div>
          <div style="text-align: right">
            编制人：<input :disabled="(applyStatus-0) > 0" v-model="blindPlate.safetyMeasures.measuresElevenEdit" class="editInput" style="width: 150px"/>
          </div>
        </td>
        <td><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.safetyMeasures.measuresEleven" class="editInput"/></td>
        <td><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.safetyMeasures.measuresElevenPeople" class="editInput"/></td>
      </tr>
      <tr>
        <td colspan="2">安全交底人</td>
        <td colspan="3"><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.discloser" class="editInput"/></td>
        <td colspan="2">接受交底人</td>
        <td colspan="3"><input :disabled="(applyStatus-0) > 0" v-model="blindPlate.recipient" class="editInput"/></td>
      </tr>
      <tr v-for="item in specialWorkPermitSigns" v-if="(applyStatus-0) > 0">
        <td colspan="2" v-if="item.staffType=='leader'">作业负责人意见</td>
        <td colspan="2" v-if="item.staffType=='workDept'">作业单位意见</td>
        <td colspan="2" v-if="item.staffType=='auditDept'">审核部门意见</td>
        <td colspan="2" v-if="item.staffType=='approval'">审批部门意见</td>
        <td colspan="2" v-if="item.staffType=='complete'">完工验收</td>
        <td colspan="3" v-if="(applyStatus-0) ==1"><input :disabled="item.staffId != $store.state.user.userId" v-model="item.opinion" class="editInput"/></td>
        <td colspan="3" v-if="(applyStatus-0) !=1"><input disabled v-model="item.opinion" class="editInput"/></td>
        <td colspan="1">签字:</td>
        <td colspan="2"><NewEsign :resultImg.sync ="item.signName" :isDisabled="item.staffId != $store.state.user.userId" :isReWrite="(applyStatus-0) ==1" :width="918" :height="100"/></td>
        <td colspan="2" v-if="(applyStatus-0) ==1">
          <el-date-picker clearable size="small"
                          v-model="item.signDate"
                          type="datetime"
                          :disabled="item.staffId != $store.state.user.userId"
                          value-format="yyyy-MM-dd HH:mm:ss"
                          placeholder="选择时间"
                          style="width: 100%">
          </el-date-picker>
        </td>
        <td colspan="2" v-if="(applyStatus-0) !=1">
          {{ item.signDate == null ? "-" :item.signDate.split(" ")[0].split("-")[0]}}年{{ item.signDate == null ? "-" :item.signDate.split(" ")[0].split("-")[1]}}月{{item.signDate == null ? "-" :item.signDate.split(" ")[0].split("-")[2]}}日{{item.signDate == null ? "-" :item.signDate.split(" ")[1].split(":")[0]}}时{{item.signDate == null ? "-" :item.signDate.split(" ")[1].split(":")[1]}}分
        </td>
      </tr>
    </table>

    <!-- 审批人选择 -->
    <div v-if="(applyStatus-0) == 0">
      <el-row style="margin-top: 10px">
        <el-col :span="4">
          <div style="font-size: 18px;margin-top: 5px">作业负责人：</div>
        </el-col>
        <el-col :span="8">
          <el-select v-model="leaderDeptId" filterable placeholder="请选择作业负责人部门" @change="switchDept(leaderDeptId)">
            <el-option
              v-for="item in deptList"
              :key="item.deptId"
              :label="item.deptName"
              :value="item.deptId"
            >
            </el-option>
          </el-select>
        </el-col>
        <el-col :span="12">
          <el-select v-model="leaderAuditor" filterable placeholder="请选择审核人">
            <el-option
              v-for="item in userList"
              :key="item.userId"
              :label="item.nickName"
              :value="item.userId"
            >
            </el-option>
          </el-select>
        </el-col>
      </el-row>

      <el-row style="margin-top: 10px">
        <el-col :span="4">
          <div style="font-size: 18px;margin-top: 5px">作业单位：</div>
        </el-col>
        <el-col :span="8">
          <el-select v-model="workDeptId" filterable placeholder="请选择作业单位" @change="switchDept(workDeptId)">
            <el-option
              v-for="item in deptList"
              :key="item.deptId"
              :label="item.deptName"
              :value="item.deptId"
            >
            </el-option>
          </el-select>
        </el-col>
        <el-col :span="12">
          <el-select v-model="workAuditor" filterable placeholder="请选择审核人">
            <el-option
              v-for="item in userList"
              :key="item.userId"
              :label="item.nickName"
              :value="item.userId"
            >
            </el-option>
          </el-select>
        </el-col>
      </el-row>

      <el-row style="margin-top: 10px">
        <el-col :span="4">
          <div style="font-size: 18px;margin-top: 5px">审核部门意见：</div>
        </el-col>
        <el-col :span="8">
          <el-select v-model="auditDeptDeptId" filterable placeholder="请选择审核部门" @change="switchDept(auditDeptDeptId)">
            <el-option
              v-for="item in deptList"
              :key="item.deptId"
              :label="item.deptName"
              :value="item.deptId"
            >
            </el-option>
          </el-select>
        </el-col>
        <el-col :span="12">
          <el-select v-model="auditDeptAuditor" filterable placeholder="请选择审核人">
            <el-option
              v-for="item in userList"
              :key="item.userId"
              :label="item.nickName"
              :value="item.userId"
            >
            </el-option>
          </el-select>
        </el-col>
      </el-row>

      <el-row style="margin-top: 10px">
        <el-col :span="4">
          <div style="font-size: 18px;margin-top: 5px">审批部门：</div>
        </el-col>
        <el-col :span="8">
          <el-select v-model="approvalDeptId" filterable placeholder="请选择审批部门" @change="switchDept(approvalDeptId)">
            <el-option
              v-for="item in deptList"
              :key="item.deptId"
              :label="item.deptName"
              :value="item.deptId"
            >
            </el-option>
          </el-select>
        </el-col>
        <el-col :span="12">
          <el-select v-model="approvalAuditor" filterable placeholder="请选择审核人">
            <el-option
              v-for="item in userList"
              :key="item.userId"
              :label="item.nickName"
              :value="item.userId"
            >
            </el-option>
          </el-select>
        </el-col>
      </el-row>

      <el-row style="margin-top: 10px">
        <el-col :span="4">
          <div style="font-size: 18px;margin-top: 5px">完工验收 ：</div>
        </el-col>
        <el-col :span="8">
          <el-select v-model="completeDeptId" filterable placeholder="请选择验收部门" @change="switchDept(completeDeptId)">
            <el-option
              v-for="item in deptList"
              :key="item.deptId"
              :label="item.deptName"
              :value="item.deptId"
            >
            </el-option>
          </el-select>
        </el-col>
        <el-col :span="12">
          <el-select v-model="completeAuditor" filterable placeholder="请选择审核人">
            <el-option
              v-for="item in userList"
              :key="item.userId"
              :label="item.nickName"
              :value="item.userId"
            >
            </el-option>
          </el-select>
        </el-col>
      </el-row>
    </div>

    <!-- 审核按钮 -->
    <div style="text-align: right;margin-top: 10px" v-if="applyStatus == '1'">
      <el-button type="primary" @click="submitApproval">确定</el-button>
      <el-button @click="cancelApproval">取消</el-button>
    </div>

    <div style="margin-top:10px;float: right" v-if="(applyStatus-0) > '1'"><el-button type="primary" v-print="'#flareUpPrint'">打印</el-button></div>

  </div>

</template>

<script>
  import { listDept } from "@/api/system/dept";
  import { listUser } from "@/api/system/user";
  import { addSpecialPermit, getSpecialWorkPermitByWorkPermitId } from "@/api/workPermit/specialPermit";
  import { addSign, listSign, batchUpdateSignWorkPermit } from "@/api/workPermit/workPermitSign";
  import { judgeSignUpdateTWorkPermit } from "@/api/workPermit/permit";
  import NewEsign from "@/components/SaftyWork/NewEsign";
    export default {
      name: "blind-plate",
      props:{
        workPermitId:{
          type:Number
        },
        licenceNum:{
          type:String
        },
        applyStatus:{
          type:String
        }
      },
      components:{
        NewEsign
      },
      data(){
        return{
          blindPlate:{
            applyUnit:"",
            taskUnit:"",
            licenceNum:"",//作业编号
            wallBlind: false,	//抽盲板
            takeBlind: false,	//堵盲板
            pipeName:"",//设备管道名称
            medium:"", //介质
            temperature:"",//温度
            pressure:"",//压力
            material:"",//材料
            specifications:"",//规格
            num:"",//编号
            workStartTime:"",//实施开始时间
            blindPictrue:"",//盲板位置图（附件）
            blindDeviceNum:"",//编号
            compiler:"",//编制人
            compilerTime:"",//编制日期
            workLeader:"",//作业负责人
            worker:"",//作业人
            guarder:"",//监护人
            otherLicenceNum:"",//关联的其他特殊作业及安全作业票编号
            risk:{		//风险辨识结果在下列画√
              numOne:false,
              numTwo:false,
              numThree:false,
              numFour:false,
              numFive:false,
              numSix:false,
              numSeven:false,
              numEight:false,
              numNine:false,
              numTen:false,
              numEleven:false,
              numTwelve:false,
              numThirteen:false,
              numFourteen:false,
              numFifteen:false
            },
            safetyMeasures:{//安全措施
              measuresOne: "",
              measuresOnePeople: "",
              measuresTwo: "",
              measuresTwoPeople: "",
              measuresThree: "",
              measuresThreePeople: "",
              measuresFour: "",
              measuresFourPeople: "",
              measuresFive: "",
              measuresFivePeople: "",
              measuresSix: "",
              measuresSixPeople: "",
              measuresSeven: "",
              measuresSevenPeople: "",
              measuresEight: "",
              measuresEightPeople: "",
              measuresNine: "",
              measuresNineoPeople: "",
              measuresTen: "",
              measuresTenPeople: "",
              measuresElevenDetail:"",//内容
              measuresElevenEdit:"",//编辑人
              measuresEleven: "",
              measuresElevenPeople: ""
            },
            discloser: "",//交底人
            recipient: "",//接收人
          },
          deptList:[],
          userList:[],
          leaderDeptId:"",
          workDeptId:"",
          auditDeptDeptId:"",
          approvalDeptId:"",
          completeDeptId:"",
          leaderAuditor:"",
          workAuditor:"",
          auditDeptAuditor:"",
          approvalAuditor:"",
          completeAuditor:"",
          specialWorkPermitSigns:[],
          specialWorkPermitId:"",
          sign:"",
          signOpen:false
        }
      },
      created(){
        this.getList();
        this.blindPlate.num = this.licenceNum;
      },
      methods:{
        /** 查询部门列表 */
        getList() {
          listDept().then(response => {
            this.deptList = response.data;
        });
        },
        //部门切换
        switchDept(deptId){
          listUser({ pageNum: 1,pageSize: 99999,deptId:deptId}).then(response => {
            this.userList = response.rows;
        });
        },
        //新增特殊作业单
        addSpecialWorkPermit(){
          let param = {};
          param.workPermitId = this.workPermitId;
          param.licenceNum = this.licenceNum;
          param.specialWorkType = "blindPlate"
          param.specialWorkData = JSON.stringify(this.blindPlate);
          param.signs = this.combinSign();
          return param;
        },
        //数据校验
        validateData(){
          if(typeof this.blindPlate.applyUnit== "undefined" || this.blindPlate.applyUnit== null || this.blindPlate.applyUnit== ""){
            this.msgError("盲板申请单位为空！");
            return true;
          }
          if(typeof this.blindPlate.taskUnit== "undefined" || this.blindPlate.taskUnit== null || this.blindPlate.taskUnit== ""){
            this.msgError("盲板作业单位为空！");
            return true;
          }
          if(typeof this.blindPlate.pipeName== "undefined" || this.blindPlate.pipeName== null || this.blindPlate.pipeName== ""){
            this.msgError("盲板设备管道为空！");
            return true;
          }
          if(typeof this.blindPlate.workStartTime== "undefined" || this.blindPlate.workStartTime== null || this.blindPlate.workStartTime== ""){
            this.msgError("盲板实施作业开始时间为空！");
            return true;
          }
          if(typeof this.leaderAuditor== "undefined" || this.leaderAuditor== null || this.leaderAuditor== ""){
            this.msgError("盲板作业负责人未选择！");
            return true;
          }
          if(typeof this.workAuditor== "undefined" || this.workAuditor== null || this.workAuditor== ""){
            this.msgError("盲板作业单位审核人未选择！");
            return true;
          }
          if(typeof this.auditDeptAuditor== "undefined" || this.auditDeptAuditor== null || this.auditDeptAuditor== ""){
            this.msgError("盲板审核部门审核人未选择！");
            return true;
          }
          if(typeof this.approvalAuditor== "undefined" || this.approvalAuditor== null || this.approvalAuditor== ""){
            this.msgError("盲板审批人未选择！");
            return true;
          }
          if(typeof this.completeAuditor== "undefined" || this.completeAuditor== null || this.completeAuditor== ""){
            this.msgError("盲板完工验收人未选择！");
            return true;
          }
        },
        //新增审核人
        combinSign(){
          let signs = [];
          signs.push({staffId:this.leaderAuditor,staffType:"leader"});
          signs.push({staffId:this.workAuditor,staffType:"workDept"});
          signs.push({staffId:this.auditDeptAuditor,staffType:"auditDept"});
          signs.push({staffId:this.approvalAuditor,staffType:"approval"});
          signs.push({staffId:this.completeAuditor,staffType:"complete"});
          return signs;
          //新增作业负责人
         /* addSign({permitId:permitId,staffId:this.leaderAuditor,staffType:"leader"});
          //新增单位意见
          addSign({permitId:permitId,staffId:this.workAuditor,staffType:"workDept"});
          //新增审核部门
          addSign({permitId:permitId,staffId:this.auditDeptAuditor,staffType:"auditDept"});
          //新增动火审批人
          addSign({permitId:permitId,staffId:this.approvalAuditor,staffType:"approval"});
          //新增完工验收
          addSign({permitId:permitId,staffId:this.completeAuditor,staffType:"complete"});*/
        },
        submitApproval(){
          let data =[];
          for(let key in this.specialWorkPermitSigns){
            if(this.specialWorkPermitSigns[key].staffId == this.$store.state.user.userId
              && '' != this.specialWorkPermitSigns[key].signName
              && null != this.specialWorkPermitSigns[key].signName){
              data.push(this.specialWorkPermitSigns[key]);
            }
          }
          if(data.length >0){
            batchUpdateSignWorkPermit(data).then(res =>{
              if(res.code == 200){
                this.updateWorkPermitStatus();
                this.msgSuccess("审核成功");
              }
            })
          }
        },
        //更新作业单状态
        async updateWorkPermitStatus(){
          await  judgeSignUpdateTWorkPermit({workPermitId:this.workPermitId,applyStatus:"2"});
          getSpecialWorkPermitByWorkPermitId({workPermitId:this.workPermitId}).then(res =>{
            let specialWorkPermits = res.data.specialWorkPermits;
            let flag = true;
            for(let key in specialWorkPermits){
              let signs = specialWorkPermits[key].signs;
              for(let signKey in signs){
                if(signs[signKey].staffId == this.$store.state.user.userId){
                  if("" == signs[signKey].signName || null == signs[signKey].signName){
                    flag = false;
                  }
                }
              }
            }
            if(flag){
              this.cancelApproval();
              this.$parent.$parent.getList();
            }
          })
        },
        cancelApproval(){
          this.$parent.$parent.cancelCertificateApproval();
        },
        signName(imageSrc){
          this.sign = imageSrc;
          this.signOpen = true;

        },
      }
    }
</script>

<style scoped lang="scss">
  table{
    border-collapse: collapse;
    table-layout: fixed;
    text-align: center;
    width: 100%;
  }
  table td, table th{
    border: 1px solid;
    height: 30px;
  }

  .editInput{
    border: none;
    width: 100%;
    height: 100%;
    text-align: center;
  }

  .editInput:focus{
    outline: none;
  }

  .editLine{
    border-bottom: 1px solid;
    border-top: none;
    border-left: none;
    border-right: none;
    text-align: center;
  }

  .editLine:focus{
    outline: none;
  }


  textarea{
    height: 100%;
    width: 100%;
    border: none;
    resize:none;
  }

  textarea:focus{
    outline: none;
  }
</style>
