<template>
  <div>
    <div class="app-container">
      <div class="level-title">
        <h1>企业信息</h1>
      </div>
      <div class="mb-20">
        <table class="table-ui">
          <tr>
            <td class="wbg">企业名称</td>
            <td>{{ pd.CORP_NAME }}</td>
          </tr>
          <tr>
            <td class="wbg">统一社会信用代码</td>
            <td>{{ pd.CODE }}</td>
          </tr>
          <tr>
            <td class="wbg">法定代表人</td>
            <td>{{ pd.LR_NAME }}</td>
          </tr>
          <tr>
            <td class="wbg">法人手机号</td>
            <td>{{ pd.LR_MOBILE }}</td>
          </tr>
          <tr>
            <td class="wbg">归属地</td>
            <td>{{ pd.COUNTRY_NAME + '--' + pd.VILLAGE_NAME + '--' + pd.STREET_NAME }}</td>
          </tr>
          <tr>
            <td class="wbg">实际地址</td>
            <td>{{ pd.ADDRESS }}</td>
          </tr>

          <tr>
            <td class="wbg">营业执照(选填):</td>
            <td>
              <div class="img-flex">
                <viewer v-if="img1">
                  <img :src="config.fileUrl + img1" width="100" height="100">
                </viewer>
              </div>
            </td>
          </tr>

          <tr>
            <td class="wbg">商户牌照（门头照片）(选填):</td>
            <td>
              <div class="img-flex">
                <viewer v-if="img2">
                  <img :src="config.fileUrl + img2" width="100" height="100">
                </viewer>
              </div>
            </td>
          </tr>

          <tr>
            <td class="wbg">供气协议(选填):</td>
            <td>
              <div class="img-flex">
                <viewer v-if="img3">
                  <img :src="config.fileUrl + img3" width="100" height="100">
                </viewer>
              </div>
            </td>
          </tr>

          <tr>
            <td class="wbg">卫生许可证(选填):</td>
            <td>
              <div class="img-flex">
                <viewer v-if="img4">
                  <img :src="config.fileUrl + img4" width="100" height="100">
                </viewer>
              </div>
            </td>
          </tr>

          <tr>
            <td class="wbg">其他照片(选填):</td>
            <td>
              <div class="img-flex">
                <viewer v-if="img5">
                  <img :src="config.fileUrl + img5" width="100" height="100">
                </viewer>
              </div>
            </td>
          </tr>
        </table>
      </div>

      <div class="level-title">
        <h1>基本情况</h1>
      </div>
      <div class="mb-20">
        <table class="table-ui">
          <tr>
            <td class="tbg">单位类型</td>
            <td>{{ pd.SMALL_TYPE_NAME }} {{ pd.SMALL_TYPE2_NAME?'-'+pd.SMALL_TYPE2_NAME:'' }}</td>
          </tr>
          <!--          <tr>-->
          <!--            <td class="tbg">经济类型</td>-->
          <!--            <td>{{ pd.ECO_TYPE_NAME }}</td>-->
          <!--            <td>-->
          <!--              <el-radio-group >-->
          <!--                <el-radio v-if="upd.COUNTRY!=2" checke class="ui-radios-green">&nbsp;</el-radio>-->
          <!--                <el-radio v-if="upd.COUNTRY!=2" checke class="ui-radios-red">&nbsp;</el-radio>-->
          <!--              </el-radio-group>-->
          <!--            </td>-->
          <!--          </tr>-->
          <!--          <tr>-->
          <!--            <td class="tbg">纬度</td>-->
          <!--            <td>{{ pd.LATITUDE }}</td>-->
          <!--            <td>-->
          <!--              <el-radio-group >-->
          <!--                <el-radio v-if="upd.LATITUDE!=2" checke class="ui-radios-green">&nbsp;</el-radio>-->
          <!--                <el-radio v-if="upd.LATITUDE==2" checke class="ui-radios-red">&nbsp;</el-radio>-->
          <!--              </el-radio-group>-->
          <!--            </td>-->
          <!--          </tr>-->
          <!--          <tr>-->
          <!--            <td class="tbg">经度</td>-->
          <!--            <td>{{ pd.LONGITUDE }}</td>-->
          <!--            <td>-->
          <!--              <el-radio-group >-->
          <!--                <el-radio v-if="upd.LONGITUDE!=2" checke class="ui-radios-green">&nbsp;</el-radio>-->
          <!--                <el-radio v-if="upd.LONGITUDE==2" checke class="ui-radios-red">&nbsp;</el-radio>-->
          <!--              </el-radio-group>-->
          <!--            </td>-->
          <!--          </tr>-->
          <!--          <tr>-->
          <!--            <td class="tbg">建筑面积</td>-->
          <!--            <td>{{ dpd.ARCHITECTUREAREA }}</td>-->
          <!--            <td>-->
          <!--              <el-radio-group >-->
          <!--                <el-radio v-if="upd.ARCHITECTUREAREA!=2" checke class="ui-radios-green">&nbsp;</el-radio>-->
          <!--                <el-radio v-if="upd.ARCHITECTUREAREA==2" checke class="ui-radios-red">&nbsp;</el-radio>-->
          <!--              </el-radio-group>-->
          <!--            </td>-->
          <!--          </tr>-->
          <!--          <tr>-->
          <!--            <td class="tbg">占地面积</td>-->
          <!--            <td>{{ dpd.LANDAREA }}</td>-->
          <!--            <td>-->
          <!--              <el-radio-group >-->
          <!--                <el-radio v-if="upd.LANDAREA!=2" checke class="ui-radios-green">&nbsp;</el-radio>-->
          <!--                <el-radio v-if="upd.LANDAREA==2" checke class="ui-radios-red">&nbsp;</el-radio>-->
          <!--              </el-radio-group>-->
          <!--            </td>-->
          <!--          </tr>-->
          <!--          <tr>-->
          <!--            <td class="tbg">从业人数</td>-->
          <!--            <td>{{ dpd.EMPLOYEESNUMBER }}</td>-->
          <!--            <td>-->
          <!--              <el-radio-group >-->
          <!--                <el-radio v-if="upd.EMPLOYEESNUMBER!=2" checke class="ui-radios-green">&nbsp;</el-radio>-->
          <!--                <el-radio v-if="upd.EMPLOYEESNUMBER==2" checke class="ui-radios-red">&nbsp;</el-radio>-->
          <!--              </el-radio-group>-->
          <!--            </td>-->
          <!--          </tr>-->
          <!--          <tr>-->
          <!--            <td class="tbg">建筑数量</td>-->
          <!--            <td>{{ dpd.ARCHITECTURENUMBER }}</td>-->
          <!--            <td>-->
          <!--              <el-radio-group >-->
          <!--                <el-radio v-if="upd.ARCHITECTURENUMBER!=2" checke class="ui-radios-green">&nbsp;</el-radio>-->
          <!--                <el-radio v-if="upd.ARCHITECTURENUMBER==2" checke class="ui-radios-red">&nbsp;</el-radio>-->
          <!--              </el-radio-group>-->
          <!--            </td>-->
          <!--          </tr>-->
          <tr v-if="dpd.SMALL_TYPE_NAME=='小旅店'">
            <td class="tbg">楼层数量</td>
            <td>{{ dpd.FLOORS }}</td>
          </tr>
          <tr v-if="dpd.SMALL_TYPE_NAME=='小旅店'">
            <td class="tbg">房间数量</td>
            <td>{{ dpd.ROOMS }}</td>
          </tr>
          <!--          <tr>-->
          <!--            <td class="tbg">床位数量</td>-->
          <!--            <td>{{ dpd.BEDS }}</td>-->
          <!--            <td>-->
          <!--              <el-radio-group >-->
          <!--                <el-radio v-if="upd.BEDS!=2" checke class="ui-radios-green">&nbsp;</el-radio>-->
          <!--                <el-radio v-if="upd.BEDS==2" checke class="ui-radios-red">&nbsp;</el-radio>-->
          <!--              </el-radio-group>-->
          <!--            </td>-->
          <!--          </tr>-->
          <tr>
            <td class="tbg">安全出口数量：</td>
            <td>{{ dpd.OUTDOOR }}</td>
          </tr>
          <tr
            v-if=" dpd.SMALL_TYPE_NAME=='小餐饮'|| dpd.SMALL_TYPE_NAME=='小娱乐'||
              dpd.SMALL_TYPE_NAME=='小加工'|| dpd.SMALL_TYPE_NAME=='小康疗'||
            dpd.SMALL_TYPE_NAME=='小托教'||dpd.SMALL_TYPE_NAME=='小旅店'">
            <td class="tbg">火灾报警探测器数量：：</td>
            <td>{{ dpd.NETWORKEDSMOKE }}</td>
          </tr>
          <tr
            v-if=" dpd.SMALL_TYPE_NAME=='小餐饮'|| dpd.SMALL_TYPE_NAME=='小娱乐'||
              dpd.SMALL_TYPE_NAME=='小加工'|| dpd.SMALL_TYPE_NAME=='小康疗'||
            dpd.SMALL_TYPE_NAME=='小托教'||dpd.SMALL_TYPE_NAME=='小旅店'">
            <td class="tbg">喷淋系统：</td>
            <td>{{ dpd.SPRINKLERSYSTEM }}</td>
          </tr>
          <tr>
            <td class="tbg">消防栓：</td>
            <td>{{ dpd.FIREHYDRANT }}</td>
          </tr>
          <tr>
            <td class="tbg">灭火器数量：</td>
            <td>{{ dpd.EXTINGUISHERS }}</td>
          </tr>
          <!--          <tr>-->
          <!--            <td class="tbg">有无电梯：</td>-->
          <!--            <td>{{ dpd.ELEVATOR }}</td>-->
          <!--            <td>-->
          <!--              <el-radio-group >-->
          <!--                <el-radio v-if="upd.ELEVATOR!=2" checke class="ui-radios-green">&nbsp;</el-radio>-->
          <!--                <el-radio v-if="upd.ELEVATOR==2" checke class="ui-radios-red">&nbsp;</el-radio>-->
          <!--              </el-radio-group>-->
          <!--            </td>-->
          <!--          </tr>-->
          <tr>
            <td class="tbg">应急指示灯：</td>
            <td>{{ dpd.EMERGENCYINDICATOR }}</td>
          </tr>
          <tr>
            <td class="tbg">安全出口标识：</td>
            <td>{{ dpd.EXITMARK }}</td>
          </tr>
          <tr
            v-if=" dpd.SMALL_TYPE_NAME=='小餐饮'|| dpd.SMALL_TYPE_NAME=='小娱乐'||
              dpd.SMALL_TYPE_NAME=='小加工'|| dpd.SMALL_TYPE_NAME=='小康疗'||
            dpd.SMALL_TYPE_NAME=='小托教'||dpd.SMALL_TYPE_NAME=='小旅店'">
            <td class="tbg">燃气报警器：</td>
            <td>{{ dpd.GASALARM }}</td>
          </tr>
        </table>
      </div>

      <div class="level-title">
        <h1>燃料使用</h1>
      </div>
      <div class="mb-20">
        <table class="table-ui">
          <tr>
            <td class="tbg">燃料类别</td>
            <td>{{ fpd.FUELTYPE }}</td>
          </tr>

          <tr v-if="showView1">
            <td class="tbg">醇基燃料（公斤）</td>
            <td>{{ fpd.ALCOHOLBASEDKG }}</td>
          </tr>

          <tr v-if="showView1">
            <td class="tbg">最近加注时间</td>
            <td>{{ fpd.ALCOHOLBASEDTIME }}</td>
          </tr>

          <tr v-if="showView1">
            <td class="tbg">醇基燃料燃料供应商(企业)</td>
            <td>{{ fpd.FUELSUPPLIER }}</td>
          </tr>

          <tr v-if="showView1">
            <td class="tbg">醇基燃料供应商负责人</td>
            <td>{{ fpd.SUPPLIERPERSON }}</td>
          </tr>

          <tr v-if="showView1">
            <td class="tbg">醇基燃料供应商服务电话</td>
            <td>{{ fpd.SUPPLIERPHONE }}</td>
          </tr>

          <tr v-if="showView2">
            <td class="tbg">液化气(大)</td>
            <td>{{ fpd.LIQUEFIEDLARGE }}</td>
          </tr>

          <tr v-if="showView2">
            <td class="tbg">液化气(小)</td>
            <td>{{ fpd.LIQUEFIEDSMALL }}</td>
          </tr>

          <tr v-if="showView2">
            <td class="tbg">最近换罐日期</td>
            <td>{{ fpd.LIQUEFIEDTIME }}</td>
          </tr>

          <tr v-if="showView2">
            <td class="tbg">液化气燃料供应商(企业)</td>
            <td>{{ fpd.FUELSUPPLIER1 }}</td>
          </tr>

          <tr v-if="showView2">
            <td class="tbg">液化气供应商负责人</td>
            <td>{{ fpd.SUPPLIERPERSON1 }}</td>
          </tr>

          <tr v-if="showView2">
            <td class="tbg">液化气供应商服务电话</td>
            <td>{{ fpd.SUPPLIERPHONE1 }}</td>
          </tr>

          <tr v-if="showView3">
            <td class="tbg">天然气开通时间</td>
            <td>{{ fpd.NATURALGASTIME }}</td>
          </tr>

          <tr v-if="showView3">
            <td class="tbg">天然气燃料供应商(企业)</td>
            <td>{{ fpd.FUELSUPPLIER2 }}</td>
          </tr>

          <tr v-if="showView3">
            <td class="tbg">天然气供应商负责人</td>
            <td>{{ fpd.SUPPLIERPERSON2 }}</td>
          </tr>

          <tr v-if="showView3">
            <td class="tbg">天然气供应商服务电话</td>
            <td>{{ fpd.SUPPLIERPHONE2 }}</td>
          </tr>

          <tr v-if="showView4">
            <td class="tbg">电及其它</td>
            <td>{{ fpd.OTHER }}</td>
          </tr>

        </table>
      </div>

      <div class="level-title">
        <h1>安全承诺书</h1>
      </div>
      <div class="mb-20">
        <table class="table-ui">
          <tr>
            <td class="tbg">企业安全承诺书</td>
            <td>{{ safadpd.SAFETYTEXT }}</td>
          </tr>

          <tr>
            <td class="tbg">姓名</td>
            <td>{{ safadpd.NAME }}</td>
          </tr>

          <tr>
            <td class="tbg">签名</td>
            <td>
              <div class="img-flex">
                <viewer >
                  <img :src="config.fileUrl + safadpd.SIGNATURE" width="100" height="100">
                </viewer>
              </div>
            </td>
          </tr>

          <tr>
            <td class="tbg">日期</td>
            <td>{{ safadpd.COMMITMENTDATE }}</td>
          </tr>
        </table>
      </div>
    </div>

    <div class="ui-height" />
    <div class="ui-foot">
      <el-button plain type="info" @click="handlegoback">返 回</el-button>
    </div>
  </div>
</template>

<script>
import { requestFN } from '@/utils/request'
export default {
  data() {
    return {
      config: config,
      pd: [],
      bus_images: [],
      dpd: [],
      ipd: [],
      fpd: [],
      upd: [],
      safadpd: [],
      showView1: false,
      showView2: false,
      showView3: false,
      showView4: false,
      img1: '',
      img2: '',
      img3: '',
      img4: '',
      img5: ''
    }
  },
  created() {
    this.getData()
  },
  methods: {
    getData() {
      requestFN(
        '/corpinfo/getGldInfoById',
        {
          CORPINFO_ID: this.$parent.CORPINFO_ID
        }
      ).then((data) => {
        this.pd = data.pd
        this.bus_images = data.busImgs
        this.dpd = data.dpd
        this.ipd = data.ipd
        this.fpd = data.fpd
        this.upd = data.upd
        this.safadpd = data.safadpd

        if (this.fpd.FUELTYPE.indexOf('醇基燃料') > -1) {
          this.showView1 = true
        }
        if (this.fpd.FUELTYPE.indexOf('液化气') > -1) {
          this.showView2 = true
        }
        if (this.fpd.FUELTYPE.indexOf('天然气') > -1) {
          this.showView3 = true
        }
        if (this.fpd.FUELTYPE.indexOf('电') > -1) {
          this.showView4 = true
        }
        if (data.img1 && data.img1.length > 0) {
          this.img1 = data.img1[0].FILEPATH
        }
        if (data.img2 && data.img2.length > 0) {
          this.img2 = data.img2[0].FILEPATH
        }
        if (data.img3 && data.img3.length > 0) {
          this.img3 = data.img3[0].FILEPATH
        }
        if (data.img4 && data.img4.length > 0) {
          this.img4 = data.img4[0].FILEPATH
        }
        if (data.img5 && data.img5.length > 0) {
          this.img5 = data.img5[0].FILEPATH
        }
      }).catch((e) => {
        this.listLoading = false
      })
    },
    handlegoback() {
      this.$parent.activeName = 'CorpInfo'
    }
  }
}
</script>

<style lang="sass" scoped>
  .table-ui
    td
      line-height: 34px
    .tbg
      width: 200px
    .img-flex
      display: flex
      .img-ui
        width: 110px
        height: 110px
        margin-right: 20px
        & img
          width: 100%
          height: 100%
</style>
