<template>
  <div class="mobile">
    <van-collapse v-model="activeName" accordion>
      <van-collapse-item title="基本信息" name="1">
        <van-cell-group>
          <van-cell title="企业名称" :value="info.CORP_NAME" />
          <van-cell title="邮政编码" :value="info.POSTAL_CODE" />
          <van-cell title="统一社会信用代码" :value="info.CODE" />
          <van-cell title="属地" :value="info.COMPANY_AREA" />
          <van-cell title="经济类型" :value="info.ECO_TYPE_NAME" />
          <van-cell title="所属行业" :value="info.CORP_TYPE_NAME" />
          <van-cell title="企业状态" :value="info.CORP_STATE_NAME" />
          <van-cell title="经度" :value="info.LONGITUDE" />
          <van-cell title="纬度" :value="info.LATITUDE" />
          <van-cell title="主要负责人" :value="info.CONTACTS" />
          <van-cell title="主要负责人电话" :value="info.CONTACTS_PHONE" />
          <van-cell title="法定代表人" :value="info.LR_NAME" />
          <van-cell title="法人手机号" :value="info.LR_PHONE" />
          <van-cell title="占地面积（㎡）" :value="info.AREA_COVERED" />
          <van-cell title="职工人数（人）" :value="info.EMPLOYEES" />
          <van-cell title="成立时间" :value="info.CREATE_DATE" />
          <van-cell title="注册资金（万元）" :value="info.REGCAPITAL" />
          <van-cell title="资产总额（万元）" :value="info.TOTALASSETS" />
          <van-cell title="隶属关系" :value="info.SUBORDINATIONNAME" />
          <van-cell title="企业类型">
            {{ info.CORP_OF_TYPE_NAME ? info.CORP_OF_TYPE_NAME : "" }}
            {{ info.CORP_OF_TYPE_NAME && info.CORP_OF_TYPE_NAME2 ? "/" : "" }}
            {{ info.CORP_OF_TYPE_NAME2 ? info.CORP_OF_TYPE_NAME2 : "" }}
          </van-cell>
          <van-cell
            title="市行业监管部门"
            :value="info.INDUSTRY_DEPARTMENTName"
          />
          <van-cell title="规模" :value="info.SCALE_NAME" />
          <van-cell title="是否规模以上">
            {{ info.SCALE_TYPE === "0" ? "否" : "" }}
            {{ info.SCALE_TYPE === "1" ? "是" : "" }}
          </van-cell>
          <van-cell title="培训行业类型" :value="info.TRAINTYPE_NAME" />
          <van-cell title="企业可新建用户数量" :value="info.USERS_NUM" />
          <van-cell title="单位经营地址" :value="info.ADDRESS_BUSINESS" />
          <van-cell v-if="info.FOURTYPE === '1'" title="四色图">
            <template #label>
              <van-image
                v-for="(item, index) in four_images"
                :key="item"
                width="100"
                height="100"
                :src="item"
                @click="fnImagePreview(four_images, index)"
              />
            </template>
          </van-cell>
          <van-cell title="营业执照">
            <template #label>
              <van-image
                v-for="(item, index) in bus_images"
                :key="item"
                width="100"
                height="100"
                :src="item"
                @click="fnImagePreview(bus_images, index)"
              />
            </template>
          </van-cell>
        </van-cell-group>
      </van-collapse-item>
      <van-collapse-item title="安全负责人信息" name="2">
        <van-cell-group inset>
          <van-cell title="姓名" :value="info.SAFETY_NAME" />
          <van-cell title="职务" :value="info.SAFETY_POST" />
          <van-cell title="单位电话" :value="info.SAFETY_NUMBER" />
          <van-cell title="手机号码" :value="info.SAFETY_PHONE" />
        </van-cell-group>
      </van-collapse-item>
      <van-collapse-item title="企业相关属性" name="4">
        <van-cell-group inset>
          <van-cell title="有无职业卫生信息">
            {{
              info.WHETHER_HYGIENE === undefined
                ? ""
                : info.WHETHER_HYGIENE === 0
                ? "无"
                : "有"
            }}
          </van-cell>
          <van-cell title="有无重大危险源">
            {{
              info.WHETHER_HAZARDS === undefined
                ? ""
                : info.WHETHER_HAZARDS === 0
                ? "无"
                : "有"
            }}
          </van-cell>
          <van-cell title="是否有稀缺大型应急物资">
            {{
              info.WHETHER_SCARCE === undefined
                ? ""
                : info.WHETHER_SCARCE === 0
                ? "否"
                : "是"
            }}
          </van-cell>
          <van-cell title="是否涉及危化品">
            {{
              info.WHETHER_CHEMICALS === undefined
                ? ""
                : info.WHETHER_CHEMICALS === 0
                ? "否"
                : "是"
            }}
          </van-cell>
          <van-cell title="有无特种设备">
            {{
              info.WHETHER_SPECIALEQUIPMENT === undefined
                ? ""
                : info.WHETHER_SPECIALEQUIPMENT === 0
                ? "无"
                : "有"
            }}
          </van-cell>
          <van-cell title="有无特种作业人员">
            {{
              info.WHETHER_SPECIALPEOPLE === undefined
                ? ""
                : info.WHETHER_SPECIALPEOPLE === 0
                ? "无"
                : "有"
            }}
          </van-cell>
          <van-cell title="是否涉及煤气">
            {{
              info.WHETHER_COALGAS === undefined
                ? ""
                : info.WHETHER_COALGAS === 0
                ? "否"
                : "是"
            }}
          </van-cell>
          <van-cell title="是否属于消防重点单位">
            {{
              info.WHETHER_FIRE === undefined
                ? ""
                : info.WHETHER_FIRE === 0
                ? "否"
                : "是"
            }}
          </van-cell>
          <van-cell title="是否在受限空间作业">
            {{
              info.WHETHER_CONFINED === undefined
                ? ""
                : info.WHETHER_CONFINED === 0
                ? "否"
                : "是"
            }}
          </van-cell>
          <van-cell title="是否存在涉爆粉尘作业">
            {{
              info.WHETHER_POWDER === undefined
                ? ""
                : info.WHETHER_POWDER === 0
                ? "否"
                : "是"
            }}
          </van-cell>
          <van-cell title="是否涉及防雷防静电">
            {{
              info.WHETHER_LIGHTNING === undefined
                ? ""
                : info.WHETHER_LIGHTNING === 0
                ? "否"
                : "是"
            }}
          </van-cell>
          <van-cell title="是否持有放射源">
            {{
              info.WHETHER_ACTINOGEN === undefined
                ? ""
                : info.WHETHER_ACTINOGEN === 0
                ? "否"
                : "是"
            }}
          </van-cell>
          <van-cell title="是否涉及液氨制冷">
            {{
              info.WHETHER_LIQUIDAMMONIA === undefined
                ? ""
                : info.WHETHER_LIQUIDAMMONIA === 0
                ? "否"
                : "是"
            }}
          </van-cell>
          <van-cell title="是否涉及危化品管道">
            {{
              info.WHETHER_PIPELINE === undefined
                ? ""
                : info.WHETHER_PIPELINE === 0
                ? "否"
                : "是"
            }}
          </van-cell>
        </van-cell-group>
      </van-collapse-item>
    </van-collapse>
  </div>
</template>

<script setup>
import { ref } from "vue";
import { getInformationView } from "@/request/mobile.js";
import { useRoute } from "vue-router";
import { showImagePreview } from "vant";

const route = useRoute();
const { CORPINFO_ID } = route.query;
const VITE_FILE_URL = import.meta.env.VITE_FILE_URL;
const activeName = ref("1");
const info = ref({});
const bus_images = ref([]);
const four_images = ref([]);
const fnGetData = async () => {
  const resData = await getInformationView({ CORPINFO_ID });
  for (let i = 0; i < resData.fourImgs.length; i++) {
    four_images.value.push(VITE_FILE_URL + resData.fourImgs[i].FILEPATH);
  }
  for (let i = 0; i < resData.busImgs.length; i++) {
    bus_images.value.push(VITE_FILE_URL + resData.busImgs[i].FILEPATH);
  }
  info.value = resData.pd;
};
fnGetData();
const fnImagePreview = (images, startPosition) => {
  showImagePreview({
    images,
    startPosition,
  });
};
</script>

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