<template>
  <table class="" style="width: 100%" border="1" cellspacing="1">
    <tbody> </tbody
    ><colgroup>
      <col width="15%" />
      <col width="40%" />
      <col width="15%" />
      <col />
    </colgroup>
    <tbody>
      <tr class="ant-table-cell ant-table-cell-ellipsis">
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">单位名称</td>
        <td class="ant-table-cell ant-table-cell-ellipsis">{{ data?.syqdwmc }}</td>
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">统一社会信用代码</td>
        <td class="ant-table-cell ant-table-cell-ellipsis">{{ data?.gsyyzzh }}</td>
      </tr>
      <tr class="ant-table-cell ant-table-cell-ellipsis">
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">法定代表人（负责人）姓名</td>
        <td class="ant-table-cell ant-table-cell-ellipsis">{{ data?.frdb }}</td>
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">住所</td>
        <td class="ant-table-cell ant-table-cell-ellipsis">{{ data?.wrdkdz }}</td>
      </tr>
      <tr class="ant-table-cell ant-table-cell-ellipsis">
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">联系人</td>
        <td class="ant-table-cell ant-table-cell-ellipsis">{{ data?.lxr }}</td>
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">联系电话</td>
        <td class="ant-table-cell ant-table-cell-ellipsis">{{ lxdh }}</td>
      </tr>

      <tr class="ant-table-cell ant-table-cell-ellipsis">
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">直接负责的主管人员</td>
        <td class="ant-table-cell ant-table-cell-ellipsis">{{ data?.zjzgfzry }}</td>
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">其他直接责任人员</td>
        <td class="ant-table-cell ant-table-cell-ellipsis">{{ data?.qtzgfzry }}</td>
      </tr>
      <tr class="ant-table-cell ant-table-cell-ellipsis">
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">委托调查合同金额(万元)</td>
        <td class="ant-table-cell ant-table-cell-ellipsis">{{ data?.wthtje }}</td>
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor" v-if="data.bglj">{{ title }}</td>
        <td class="ant-table-cell ant-table-cell-ellipsis" v-if="data.bglj">
          <a-button @click="down(data.bglj, title)" preIcon="ant-design:vertical-align-bottom-outlined" type="primary"> 下载 </a-button>
        </td>
      </tr>
    </tbody>
  </table>
</template>

<script lang="ts" setup>
  import { defineProps, ref } from 'vue';
  import { downloadFile } from '/@/api/common/api';
  import { decrypts } from '@/utils/checkTip';

  const lxdh = ref();
  const props = defineProps({
    labelFirst: {
      type: String,
      default: '初步',
    },
    data: {
      type: Object,
      default: () => {},
    },
    title: {
      type: String,
      defualt: '',
    },
  });

  async function init() {
    lxdh.value = await decrypts(props.data.lxdh, true);
  }
  function down(url, name) {
    let fileExtension = url.split('.').pop();
    downloadFile('/sys/common/static' + url, `${name}.${fileExtension}`);
  }
  init();
</script>

<style scoped>
  table {
    border-collapse: collapse;
    border: 1px #dfe6ec solid;
  }

  tbody tr td {
    padding: 6px;
    height: 40px;
  }

  .bgColor {
    background-color: rgba(244, 247, 249, 0.8);
    text-align: center;
  }
</style>
