<template>
  <layout-card>
    <el-divider content-position="left">基本信息</el-divider>
    <el-descriptions :column="2" border>
      <el-descriptions-item label="企业名称">
        {{ data.info.CORP_NAME }}
      </el-descriptions-item>
      <el-descriptions-item label="邮政编码">
        {{ data.info.POSTAL_CODE }}
      </el-descriptions-item>
      <el-descriptions-item label="统一社会信用代码">
        {{ data.info.CODE }}
      </el-descriptions-item>
      <el-descriptions-item label="市行业监管部门">
        {{ data.info.INDUSTRY_DEPARTMENTName }}
      </el-descriptions-item>
      <el-descriptions-item label="属地">
        {{ data.info.COMPANY_AREA }}
      </el-descriptions-item>
      <el-descriptions-item label="监管类型">
        {{ data.info.REGULARTYPE_NAME }}
      </el-descriptions-item>
      <el-descriptions-item label="经济类型">
        {{ data.info.ECO_TYPE_NAME }}
      </el-descriptions-item>
      <el-descriptions-item label="所属行业">
        {{ data.info.CORP_TYPE_NAME }}
      </el-descriptions-item>
      <el-descriptions-item label="企事业单位经营地址">
        {{ data.info.ADDRESS_BUSINESS }}
      </el-descriptions-item>
      <el-descriptions-item label="企业状态">
        {{ data.info.CORP_STATE_NAME }}
      </el-descriptions-item>
      <el-descriptions-item label="经度">
        {{ data.info.LONGITUDE }}
      </el-descriptions-item>
      <el-descriptions-item label="纬度">
        {{ data.info.LATITUDE }}
      </el-descriptions-item>
      <el-descriptions-item label="主要负责人">
        {{ data.info.CONTACTS }}
      </el-descriptions-item>
      <el-descriptions-item label="主要负责人电话">
        {{ data.info.CONTACTS_PHONE }}
      </el-descriptions-item>
      <el-descriptions-item label="法定代表人">
        {{ data.info.LR_NAME }}
      </el-descriptions-item>
      <el-descriptions-item label="法人手机号">
        {{ data.info.LR_PHONE }}
      </el-descriptions-item>
      <el-descriptions-item label="占地面积（㎡）">
        {{ data.info.AREA_COVERED }}
      </el-descriptions-item>
      <el-descriptions-item label="职工人数（人）">
        {{ data.info.EMPLOYEES }}
      </el-descriptions-item>
      <el-descriptions-item label="成立时间">
        {{ data.info.CREATE_DATE }}
      </el-descriptions-item>
      <el-descriptions-item label="注册资金（万元）">
        {{ data.info.REGCAPITAL }}
      </el-descriptions-item>
      <el-descriptions-item label="资产总额（万元）">
        {{ data.info.TOTALASSETS }}
      </el-descriptions-item>
      <el-descriptions-item label="隶属关系">
        {{ data.info.SUBORDINATIONNAME }}
      </el-descriptions-item>
      <el-descriptions-item label="规模">
        {{ data.info.SCALE_NAME }}
      </el-descriptions-item>
      <el-descriptions-item label="是否规模以上">
        <template v-if="data.info.SCALE_TYPE === 0">否</template>
        <template v-if="data.info.SCALE_TYPE === 1">是</template>
      </el-descriptions-item>
      <el-descriptions-item label="培训行业类型">
        {{ data.info.TRAINTYPE_NAME }}
      </el-descriptions-item>
      <el-descriptions-item label="企业可新建用户数量">
        {{ data.info.USERS_NUM }}
      </el-descriptions-item>
      <el-descriptions-item
        label="四色图"
        v-if="data.info.FOURTYPE === 1"
        :span="2"
      >
        <img
          v-viewer
          v-for="item in data.four_images"
          :src="item.url"
          :key="item.IMGFILES_ID"
          width="100"
          height="100"
          class="ml-10"
        />
      </el-descriptions-item>
      <el-descriptions-item label="营业执照" :span="2">
        <img
          v-viewer
          v-for="item in data.bus_images"
          :src="item.url"
          :key="item.IMGFILES_ID"
          width="100"
          height="100"
          class="ml-10"
        />
      </el-descriptions-item>
    </el-descriptions>
    <el-divider content-position="left">安全负责人信息</el-divider>
    <el-descriptions :column="2" border>
      <el-descriptions-item label="姓名">
        {{ data.info.SAFETY_NAME }}
      </el-descriptions-item>
      <el-descriptions-item label="职务">
        {{ data.info.SAFETY_POST }}
      </el-descriptions-item>
      <el-descriptions-item label="单位电话">
        {{ data.info.SAFETY_NUMBER }}
      </el-descriptions-item>
      <el-descriptions-item label="手机号码">
        {{ data.info.SAFETY_PHONE }}
      </el-descriptions-item>
    </el-descriptions>
    <el-divider content-position="left">企业相关属性</el-divider>
    <el-descriptions :column="2" border>
      <el-descriptions-item label="有无职业卫生信息">
        <template v-if="data.info.WHETHER_HYGIENE === 0">无</template>
        <template v-if="data.info.WHETHER_HYGIENE === 1">有</template>
      </el-descriptions-item>
      <el-descriptions-item label="有无重大危险源">
        <template v-if="data.info.WHETHER_HAZARDS === 0">无</template>
        <template v-if="data.info.WHETHER_HAZARDS === 1">有</template>
      </el-descriptions-item>
      <el-descriptions-item label="是否有稀缺大型应急物资或设施">
        <template v-if="data.info.WHETHER_SCARCE === 0">否</template>
        <template v-if="data.info.WHETHER_SCARCE === 1">是</template>
      </el-descriptions-item>
      <el-descriptions-item label="是否涉及危化品">
        <template v-if="data.info.WHETHER_CHEMICALS === 0">否</template>
        <template v-if="data.info.WHETHER_CHEMICALS === 1">是</template>
      </el-descriptions-item>
      <el-descriptions-item label="有无特种设备">
        <template v-if="data.info.WHETHER_SPECIALEQUIPMENT === 0">无</template>
        <template v-if="data.info.WHETHER_SPECIALEQUIPMENT === 1">有</template>
      </el-descriptions-item>
      <el-descriptions-item label="有无特种作业人员">
        <template v-if="data.info.WHETHER_SPECIALPEOPLE === 0">无</template>
        <template v-if="data.info.WHETHER_SPECIALPEOPLE === 1">有</template>
      </el-descriptions-item>
      <el-descriptions-item label="是否涉及煤气">
        <template v-if="data.info.WHETHER_COALGAS === 0">否</template>
        <template v-if="data.info.WHETHER_COALGAS === 1">是</template>
      </el-descriptions-item>
      <el-descriptions-item label="是否属于消防重点单位">
        <template v-if="data.info.WHETHER_FIRE === 0">否</template>
        <template v-if="data.info.WHETHER_FIRE === 1">是</template>
      </el-descriptions-item>
      <el-descriptions-item label="是否在受限空间作业">
        <template v-if="data.info.WHETHER_CONFINED === 0">否</template>
        <template v-if="data.info.WHETHER_CONFINED === 1">是</template>
      </el-descriptions-item>
      <el-descriptions-item label="是否存在涉爆粉尘作业">
        <template v-if="data.info.WHETHER_POWDER === 0">否</template>
        <template v-if="data.info.WHETHER_POWDER === 1">是</template>
      </el-descriptions-item>
      <el-descriptions-item label="是否涉及防雷防静电">
        <template v-if="data.info.WHETHER_LIGHTNING === 0">否</template>
        <template v-if="data.info.WHETHER_LIGHTNING === 1">是</template>
      </el-descriptions-item>
      <el-descriptions-item label="是否持有放射源">
        <template v-if="data.info.WHETHER_ACTINOGEN === 0">否</template>
        <template v-if="data.info.WHETHER_ACTINOGEN === 1">是</template>
      </el-descriptions-item>
      <el-descriptions-item label="是否涉及液氨制冷">
        <template v-if="data.info.WHETHER_LIQUIDAMMONIA === 0">否</template>
        <template v-if="data.info.WHETHER_LIQUIDAMMONIA === 1">是</template>
      </el-descriptions-item>
      <el-descriptions-item label="是否涉及危化品管道">
        <template v-if="data.info.WHETHER_PIPELINE === 0">否</template>
        <template v-if="data.info.WHETHER_PIPELINE === 1">是</template>
      </el-descriptions-item>
    </el-descriptions>
    <div class="tc mt-10">
      <el-button
        type="primary"
        @click="
          router.push({ path: '/enterprise_management/information/info/edit' })
        "
      >
        修改
      </el-button>
      <el-button @click="data.qrCodeDialogVisible = true">二维码</el-button>
    </div>
    <qr-code :info="data.info" v-model:visible="data.qrCodeDialogVisible" />
  </layout-card>
</template>

<script setup>
import { getEnterpriseInfo } from "@/request/enterprise_management.js";
import { addingPrefixToFile } from "@/assets/js/utils.js";
import { reactive } from "vue";
import { useRouter } from "vue-router";
import QrCode from "./components/qr_code.vue";

const router = useRouter();
const data = reactive({
  info: {},
  bus_images: [],
  four_images: [],
  qrCodeDialogVisible: false,
});
const fnGetData = async () => {
  const resData = await getEnterpriseInfo();
  data.info = resData.pd;
  data.bus_images = addingPrefixToFile(resData.busImgs);
  data.four_images = addingPrefixToFile(resData.fourImgs);
};
fnGetData();
</script>

<style scoped lang="scss"></style>
