<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 >{{ info.APPLY_DEPARTMENT_NAME }}</td>
        <td  class="bbg-transparent">作业单位</td>
        <td >{{ info.CONSTRUCTION_DEPARTMENT_NAME }}</td>
        <td  class="bbg-transparent">作业负责人</td>
        <td >{{ info.CONSTRUCTION_USER_NAME }}</td>
      </tr>
      <tr class="bgst-transparent">
        <td class="bbg-transparent">涉及相关单位（部门）</td>
        <td colspan="2">{{ info.OTHER_DEPT }}</td>
        <td class="bbg-transparent">监护人</td>
        <td colspan="2">
          <div v-if="info.GUARDIAN_USER_SIGNER_PATH" 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 class="bgst-transparent">
        <td class="bgst-transparent">断路原因</td>
        <td colspan="5">{{ info.WORK_REASON }}</td>
      </tr>
      <tr class="bgst-transparent">
        <td class="bgst-transparent">关联的其他特殊作业及安全作业票编号</td>
        <td colspan="5">{{ info.SPECIAL_WORK }}</td>
      </tr>
      <tr class="bgst-transparent">
        <td colspan="6">
          <div>断路地段示意图（可另附图）及相关说明：{{ info.WORK_CONTENT }}</div>
          <div style="display: flex;justify-content: space-between;margin-top: 20px;">
            <img v-viewer :src="config.fileUrl + info.CONTENT_IMG_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 class="bgst-transparent">风险辨识结果</td>
        <td colspan="5">{{ info.HAZARD_IDENTIFICATION.split(";_;")[0] }}</td>
      </tr>
      <tr>
        <td class="bgst-transparent">作业实施时间</td>
        <td colspan="5">{{ info.WORK_START_DATE }}至{{ info.WORK_END_DATE }}止</td>
      </tr>
      <tr>
        <td colspan="6">
          <table class="table-vi">
            <tr class="bbg-transparent">
              <td>序号</td>
              <td>安全措施</td>
              <td style="width: 100px">是否涉及</td>
              <td style="width: 100px">确认人</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.PRODUCTION_USER_MEASURES || info.SAFETY_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.PRODUCTION_USER_ID && info.PRODUCTION_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
                  <span>其他安全措施：{{ info.PRODUCTION_USER_MEASURES }}</span>
                  <span>编制人：{{ info.PRODUCTION_USER_NAME }}</span>
                </div>
                <div v-if="info.SAFETY_USER_ID && info.SAFETY_USER_MEASURES" style="display: flex;justify-content: space-between;margin-top: 10px;">
                  <span>其他安全措施：{{ info.SAFETY_USER_MEASURES }}</span>
                  <span>编制人：{{ info.SAFETY_USER_NAME }}</span>
                </div>
                <div v-if="info.LEADER_USER_ID && 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 class="bbg-transparent">安全交底人</td>
        <td colspan="5">
          <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>
      </tr>
      <tr>
        <td class="bbg-transparent">接受交底人</td>
        <td colspan="5">
          <div v-if="info.ACCEPT_CONFESS_USER_SIGNER_PATH" style="text-align: right">
            <span>签字：</span>
            <img v-viewer :src="config.fileUrl + info.ACCEPT_CONFESS_USER_SIGNER_PATH" alt="" width="100" height="100">
            <span>{{ info.ACCEPT_CONFESS_USER_SIGNER_TIME }}</span>
          </div>
        </td>
      </tr>
      <tr v-if="info.CONSTRUCTION_USER_SIGNER_PATH">
        <td class="bbg-transparent">作业负责人</td>
        <td colspan="5">
          <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.PRODUCTION_USER_SIGNER_PATH">
        <td class="bbg-transparent">所在单位</td>
        <td colspan="5">
          <div><span>确认意见：</span></div>
          <div class="disContent">
            {{ info.PRODUCTION_CONTENT }}
          </div>
          <div style="float: right">
            <div>
              签字：
              <span class="print-approval-img">
                <img v-if="info.PRODUCTION_USER_SIGNER_PATH" :src="config.fileUrl+info.PRODUCTION_USER_SIGNER_PATH">
              </span>
            </div>
            <div style="float: right">
              <span v-if="info.PRODUCTION_USER_SIGNER_TIME">{{ formatDate(info.PRODUCTION_USER_SIGNER_TIME,'YYYY年MM月DD日HH时mm分') }}</span>
            </div>
          </div>
        </td>
      </tr>
      <tr v-if="info.SAFETY_USER_SIGNER_PATH">
        <td class="bbg-transparent">消防、安全管理部门</td>
        <td colspan="5">
          <div><span>确认意见：</span></div>
          <div class="disContent">
            {{ info.SAFETY_CONTENT }}
          </div>
          <div style="float: right">
            <div>
              签字：
              <span class="print-approval-img">
                <img v-if="info.SAFETY_USER_SIGNER_PATH" :src="config.fileUrl+info.SAFETY_USER_SIGNER_PATH">
              </span>
            </div>
            <div style="float: right">
              <span v-if="info.SAFETY_USER_SIGNER_TIME">{{ formatDate(info.SAFETY_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="5">
          <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: []
    }
  },
  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.measuresList = data.measuresList
      }).catch((e) => {
      })
    }
  }
}
</script>
<style lang="scss" scoped>
</style>
