<template>
  <div class="app-container print-work">
    <div class="level-title">
      <h1>盲板抽堵作业许可证</h1>
      <div class="level-btns">编号:{{ info.CHECK_NO }}</div>
    </div>
    <table class="table-ui">
      <tr>
        <td class="bbg-transparent">申请单位</td>
        <td colspan="2">{{ info.APPLY_DEPARTMENT_NAME }}</td>
        <td class="bbg-transparent">作业单位</td>
        <td colspan="2">{{ info.CONSTRUCTION_DEPARTMENT_NAME }}</td>
        <td class="bbg-transparent">作业类别</td>
        <td>
          <input :checked="info.WORK_TYPE=='1'" type="checkbox" disabled>堵盲板
          <input :checked="info.WORK_TYPE=='2'" type="checkbox" disabled>抽盲板
        </td>
      </tr>
      <tr>
        <td rowspan="2" class="bbg-transparent">设备、管道名称</td>
        <td colspan="3" class="bbg-transparent">管道参数</td>
        <td colspan="3" class="bbg-transparent">盲板参数</td>
        <td rowspan="2" class="bbg-transparent">实际作业开始时间</td>
      </tr>
      <tr>
        <td class="bbg-transparent">介质</td>
        <td class="bbg-transparent">温度</td>
        <td class="bbg-transparent">压力</td>
        <td class="bbg-transparent">材质</td>
        <td class="bbg-transparent">规格</td>
        <td class="bbg-transparent">编号</td>
      </tr>
      <tr>
        <td>{{ info.NAME }}</td>
        <td>{{ info.MEDIUM }}</td>
        <td>{{ info.TEMPERATURE }}</td>
        <td>{{ info.PRESSURE }}</td>
        <td>{{ info.BOARD_MATERIAL }}</td>
        <td>{{ info.BOARD_SPECIFICATION }}</td>
        <td>{{ info.BOARD_NO }}</td>
        <td>{{ info.BOARD_INSTALL_TIME }}</td>
      </tr>

      <tr>
        <td colspan="8">
          <div>盲板位置图（可另附图）及编号：</div>
          <div style="display: flex;justify-content: space-between;margin-top: 20px;">
            <img v-viewer :src="config.fileUrl + info.BOARD_PATH" alt="" width="100" height="100">
            <div>
              编制人：
              <img v-viewer :src="config.fileUrl + info.APPLY_USER_SIGNER_PATH" alt="" width="100" height="100">
              {{ info.APPLY_USER_SIGNER_TIME }}
            </div>
          </div>
        </td>
      </tr>
      <tr>
        <td colspan="2" class="bbg-transparent">作业负责人</td>
        <td colspan="2">{{ info.CONSTRUCTION_USER_NAME }}</td>
        <td class="bbg-transparent">作业人</td>
        <td>{{ info.WORK_USER }}</td>
        <td class="bbg-transparent">监护人</td>
        <td v-if="info.GUARDIAN_USER_SIGNER_PATH" colspan="5">
          <div style="text-align: right">
            <span>签字：</span>
            <img v-viewer :src="config.fileUrl + info.GUARDIAN_USER_SIGNER_PATH" alt="" width="100" height="100">
            <span>{{ info.GUARDIAN_USER_SIGNER_TIME }}</span>
          </div>
        </td>
      </tr>
      <tr>
        <td colspan="2" class="bbg-transparent">关联的其他特殊作业及安全作业票编号</td>
        <td colspan="6">{{ info.SPECIAL_WORK }}</td>
      </tr>
      <tr>
        <td colspan="2" class="bbg-transparent">风险辨识结果</td>
        <td colspan="6">{{ info.BOARD_HARM }}</td>
      </tr>
      <tr>
        <td colspan="8">
          <table class="table-vi">
            <tr class="bbg-transparent">
              <td>序号</td>
              <td>安全措施</td>
              <td>是否涉及</td>
              <td>确认人</td>
            </tr>
            <tr v-for="(item,index) in measuresList" :key="index">
              <td style="text-align: center">{{ index + 1 }}</td>
              <td>{{ item.PROTECTIVE_MEASURES }}</td>
              <td style="text-align: center">
                <span v-if="item.STATUS=='1'"><input type="radio" disabled checked>涉&nbsp;&nbsp;&nbsp;&nbsp;及</span>
                <span v-if="item.STATUS=='-1'"><input type="radio" disabled checked>不涉及</span>
              </td>
              <td style="text-align: center">
                {{ item.CONFIRM_NAME }}
              </td>
            </tr>
            <tr v-if="info.APPLY_USER_MEASURES || info.CONSTRUCTION_USER_MEASURES || info.LEADER_USER_MEASURES">
              <td>{{ measuresList.length + 1 }}</td>
              <td colspan="3">
                <div v-if="info.APPLY_USER_MEASURES" style="display: flex;justify-content: space-between;">
                  <span>其他安全措施：{{ info.APPLY_USER_MEASURES }}</span>
                  <span>编制人：{{ info.APPLY_USER_NAME }}</span>
                </div>
                <div v-if="info.CONSTRUCTION_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
                  <span>其他安全措施：{{ info.CONSTRUCTION_USER_MEASURES }}</span>
                  <span>编制人：{{ info.CONSTRUCTION_USER_NAME }}</span>
                </div>
                <div v-if="info.LEADER_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
                  <span>其他安全措施：{{ info.LEADER_USER_MEASURES }}</span>
                  <span>编制人：{{ info.LEADER_USER_NAME }}</span>
                </div>
              </td>
            </tr>
          </table>
        </td>
      </tr>
      <tr>
        <td v-if="info.CONFESS_USER_SIGNER_PATH" class="bbg-transparent">安全交底人</td>
        <td v-if="info.CONFESS_USER_SIGNER_PATH" colspan="3">
          <div v-if="info.CONFESS_USER_SIGNER_PATH" style="text-align: right">
            <span>签字：</span>
            <img v-viewer :src="config.fileUrl + info.CONFESS_USER_SIGNER_PATH" alt="" width="100" height="100">
            <span>{{ info.CONFESS_USER_SIGNER_TIME }}</span>
          </div>
        </td>
        <td v-if="imgList.length>0" class="bbg-transparent">接受交底人</td>
        <td v-if="imgList.length>0" colspan="3">
          <div v-if="imgList[0].ACCEPT_CONFESS_USER_SIGNER_PATH" style="text-align: right">
            <span>签字：</span>
            <img v-viewer :src="config.fileUrl + imgList[0].ACCEPT_CONFESS_USER_SIGNER_PATH" alt="" width="100" height="100">
            <span>{{ imgList[0].ACCEPT_CONFESS_USER_SIGNER_TIME }}</span>
          </div>
        </td>
      </tr>

      <tr v-if="info.CONSTRUCTION_USER_SIGNER_PATH">
        <td class="bbg-transparent">作业负责人</td>
        <td colspan="7">
          <div><span>确认意见：</span></div>
          <div class="disContent">
            {{ info.CONSTRUCTION_CONTENT }}
          </div>
          <div style="float: right">
            <div>
              签字：
              <span class="print-approval-img">
                <img v-if="info.CONSTRUCTION_USER_SIGNER_PATH" :src="config.fileUrl+info.CONSTRUCTION_USER_SIGNER_PATH">
              </span>
            </div>
            <div style="float: right">
              <span v-if="info.CONSTRUCTION_USER_SIGNER_TIME">{{ formatDate(info.CONSTRUCTION_USER_SIGNER_TIME,'YYYY年MM月DD日HH时mm分') }}</span>
            </div>
          </div>
        </td>
      </tr>
      <tr v-if="info.LEADER_USER_SIGNER_PATH">
        <td class="bbg-transparent">所在单位</td>
        <td colspan="7">
          <div><span>确认意见：</span></div>
          <div class="disContent">
            {{ info.LEADER_CONTENT }}
          </div>
          <div style="float: right">
            <div>
              签字：
              <span class="print-approval-img">
                <img v-if="info.LEADER_USER_SIGNER_PATH" :src="config.fileUrl+info.LEADER_USER_SIGNER_PATH">
              </span>
            </div>
            <div style="float: right">
              <span v-if="info.LEADER_USER_SIGNER_TIME">{{ formatDate(info.LEADER_USER_SIGNER_TIME,'YYYY年MM月DD日HH时mm分') }}</span>
            </div>
          </div>
        </td>
      </tr>
    </table>
  </div>
</template>

<script>
import { requestFN } from '@/utils/request'
import moment from 'moment/moment'

export default {
  props: {
    id: {
      type: String,
      default() {
        return ''
      }
    },
    type: {
      type: String,
      default() {
        return ''
      }
    },
    gangkou: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      config: config,
      info: {},
      ImgList: [],
      measuresList: [],
      imgList: []
    }
  },
  created() {
    this.getData()
  },
  methods: {
    formatDate(date, format) {
      if (date) {
        return moment(date).format(format)
      } else {
        return ''
      }
    },
    getData() {
      requestFN(
        '/map/Eight/getByIdOrder',
        {
          id: this.id,
          TYPE: this.type,
          GANGKOU: this.gangkou
        }
      ).then((data) => {
        this.info = { ...data.pd, ...data.Info }
        this.ImgList = data.ImgList
        this.imgList = data.imgList
        this.measuresList = data.measuresList
        this.info.APPLY_USER_MEASURES = this.info.OTHER_PROTECTIVE_MEASURES.split(';_;')[0]
        this.info.CONSTRUCTION_USER_MEASURES = this.info.OTHER_PROTECTIVE_MEASURES.split(';_;')[1]
        this.info.LEADER_USER_MEASURES = this.info.OTHER_PROTECTIVE_MEASURES.split(';_;')[2]
      }).catch((e) => {
      })
    }
  }
}
</script>
<style lang="scss" scoped>
</style>
