<template>
  <div class="app-container print-work">
    <div class="level-title">
      <h1>盲板抽堵作业许可证</h1>
      <div class="level-btns">编号:{{ pd.CHECK_NO }}</div>
    </div>
    <table class="table-ui">
      <tr>
        <td class="bbg-transparent">申请单位</td>
        <td colspan="2">{{ pd.APPLY_DEPARTMENT_NAME }}</td>
        <td class="bbg-transparent">作业单位</td>
        <td colspan="2">{{ pd.CONSTRUCTION_DEPARTMENT_NAME }}</td>
        <td class="bbg-transparent">作业类别</td>
        <td>
          <input :checked="pd.WORK_TYPE=='1'" type="checkbox" disabled>堵盲板
          <input :checked="pd.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 v-for="(item,index) in boardList" :key="index">
        <td v-if="index == 0" :rowspan="boardList.length">{{ pd.NAME }}</td>
        <td v-if="index == 0" :rowspan="boardList.length">{{ pd.MEDIUM }}</td>
        <td v-if="index == 0" :rowspan="boardList.length">{{ pd.TEMPERATURE }}</td>
        <td v-if="index == 0" :rowspan="boardList.length">{{ pd.PRESSURE }}</td>
        <td>{{ item.BOARD_MATERIAL }}</td>
        <td>{{ item.BOARD_SPECIFICATION }}</td>
        <td>{{ item.BOARD_NO }}</td>
        <td v-if="index == 0" :rowspan="boardList.length">{{ pd.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.cfdfileUrl + pd.BOARD_PATH" alt="" width="100" height="100">
            <div>
              编制人：
              <img v-viewer :src="config.cfdfileUrl + pd.APPLY_USER_SIGNER_PATH" alt="" width="100" height="100">
              {{ pd.APPLY_USER_SIGNER_TIME }}
            </div>
          </div>
        </td>
      </tr>
      <tr>
        <td colspan="2" class="bbg-transparent">作业负责人</td>
        <td colspan="2">{{ pd.CONSTRUCTION_USER_NAME }}</td>
        <td class="bbg-transparent">作业人</td>
        <td>{{ pd.WORK_USER }}</td>
        <td class="bbg-transparent">监护人</td>
        <td v-if="pd.GUARDIAN_USER_SIGNER_PATH" colspan="5">
          <div style="text-align: right">
            <span>签字：</span>
            <img v-viewer :src="config.cfdfileUrl + pd.GUARDIAN_USER_SIGNER_PATH" alt="" width="100" height="100">
            <span>{{ pd.GUARDIAN_USER_SIGNER_TIME }}</span>
          </div>
        </td>
      </tr>
      <tr>
        <td colspan="2" class="bbg-transparent">关联的其他特殊作业及安全作业票编号</td>
        <td colspan="6">{{ pd.SPECIAL_WORK }}</td>
      </tr>
      <tr>
        <td colspan="2" class="bbg-transparent">风险辨识结果</td>
        <td colspan="6">{{ pd.BOARD_HARM }}</td>
      </tr>
      <tr>
        <td colspan="8">
          <table class="table-ui">
            <tr>
              <td>序号</td>
              <td>安全措施</td>
              <td style="width: 80px; text-align: center">是否涉及</td>
              <td style="width: 60px">确认人</td>
            </tr>
            <tr v-for="(item,index) in measuresList" :key="index">
              <td>{{ index + 1 }}</td>
              <td>{{ item.PROTECTIVE_MEASURES }}</td>
              <td>
                <span v-if="item.STATUS=='1'"><input type="radio" disabled checked>涉&nbsp;&nbsp;&nbsp;及</span>
                <span v-if="item.STATUS=='-1'"><input type="radio" disabled checked>不涉及</span>
              </td>
              <td>
                {{ item.CONFIRM_NAME }}
              </td>
            </tr>
            <tr v-if="pd.APPLY_USER_MEASURES || pd.CONSTRUCTION_USER_MEASURES || pd.LEADER_USER_MEASURES">
              <td>{{ measuresList.length + 1 }}</td>
              <td colspan="3">
                <div v-if="pd.APPLY_USER_MEASURES" style="display: flex;justify-content: space-between;">
                  <span>其他安全措施：{{ pd.APPLY_USER_MEASURES }}</span>
                  <span>编制人：{{ pd.APPLY_USER_NAME }}</span>
                </div>
                <div v-if="pd.CONSTRUCTION_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
                  <span>其他安全措施：{{ pd.CONSTRUCTION_USER_MEASURES }}</span>
                  <span>编制人：{{ pd.CONSTRUCTION_USER_NAME }}</span>
                </div>
                <div v-if="pd.LEADER_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
                  <span>其他安全措施：{{ pd.LEADER_USER_MEASURES }}</span>
                  <span>编制人：{{ pd.LEADER_USER_NAME }}</span>
                </div>
              </td>
            </tr>
          </table>
        </td>
      </tr>
      <tr>
        <td class="bbg-transparent">安全交底人</td>
        <td colspan="10">
          <div v-if="pd.CONFESS_USER_SIGNER_PATH" style="text-align: right">
            <span>签字：</span>
            <img v-viewer :src="config.cfdfileUrl + pd.CONFESS_USER_SIGNER_PATH" alt="" width="100" height="100">
            <span>{{ pd.CONFESS_USER_SIGNER_TIME }}</span>
          </div>
        </td>
      </tr>
      <tr>
        <td class="bbg-transparent">接受交底人</td>
        <td colspan="10">
          <div v-for="item in imgList" :key="item.ACCEPT_CONFESS_ID" style="text-align: right">
            <span>签字：</span>
            <img v-viewer :src="config.cfdfileUrl + item.ACCEPT_CONFESS_USER_SIGNER_PATH" alt="" width="100" height="100">
            <span>{{ item.ACCEPT_CONFESS_USER_SIGNER_TIME }}</span>
          </div>
        </td>
      </tr>
      <tr v-if="pd.CONSTRUCTION_USER_SIGNER_PATH">
        <td colspan="8">
          <div>作业负责人意见：{{ pd.CONSTRUCTION_CONTENT }}</div>
          <div style="text-align: right">
            <span>签字：</span>
            <img v-viewer :src="config.cfdfileUrl + pd.CONSTRUCTION_USER_SIGNER_PATH" alt="" width="100" height="100">
            <span>{{ pd.CONSTRUCTION_USER_SIGNER_TIME }}</span>
          </div>
        </td>
      </tr>
      <tr v-if="pd.LEADER_USER_SIGNER_PATH">
        <td colspan="8">
          <div>所在单位意见：{{ pd.LEADER_CONTENT }}</div>
          <div style="text-align: right">
            <span>签字：</span>
            <img v-viewer :src="config.cfdfileUrl + pd.LEADER_USER_SIGNER_PATH" alt="" width="100" height="100">
            <span>{{ pd.LEADER_USER_SIGNER_TIME }}</span>
          </div>
        </td>
      </tr>
      <tr v-if="imgList1.length>0">
        <td colspan="10">
          <div>完工验收：{{ pd.ACCEPT_CONTENT }}</div>
          <div v-for="item in imgList1" :key="item.ACCEPT_CONFESS_ID" style="text-align: right">
            <span>签字：</span>
            <img v-viewer :src="config.cfdfileUrl + item.ACCEPT_USER_SIGNER_PATH" alt="" width="100" height="100">
            <span>{{ item.ACCEPT_USER_SIGNER_TIME }}</span>
          </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 ''
      }
    }
  },
  data() {
    return {
      config: config,
      info: {},
      ImgList: [],
      boardList: [],
      imgList: [],
      imgList1: [],
      measuresList: [],
      pd: []
    }
  },
  created() {
    this.getData()
  },
  methods: {
    formatTime(date, column) {
      if (date) {
        return dateformat(date, 'YYYY年MM月DD日HH时mm分')
      } else {
        return ''
      }
    },
    formatDate(date, column) {
      if (date) {
        return dateformat(date, 'YYYY-MM-DD')
      } else {
        return ''
      }
    },
    getRowKey(row) {
      return row.BLINDBOARD_ID
    },
    getData() {
      this.listLoading = true
      requestFN(
        '/map/Eight/getByIdCfdD',
        {
          id: this.id,
          TYPE: this.type,
          BLINDBOARD_ID: this.id
        }
      ).then((data) => {
        this.listLoading = false
        this.pd = data.pd // 参数map
        this.imgList = data.imgList
        this.imgList1 = data.imgList1
        this.boardList = data.boardList // 参数map
        this.measuresList = data.measuresList // 参数map
        this.pd.APPLY_USER_MEASURES = this.pd.OTHER_PROTECTIVE_MEASURES.split(';_;')[0]
        this.pd.CONSTRUCTION_USER_MEASURES = this.pd.OTHER_PROTECTIVE_MEASURES.split(';_;')[1]
        this.pd.LEADER_USER_MEASURES = this.pd.OTHER_PROTECTIVE_MEASURES.split(';_;')[2]
      }).catch((e) => {
        this.listLoading = false
      })
    }
  }
}
</script>
<style lang="scss" scoped>
</style>
