<template>
  <table class="detail-table" border="1" cellspacing="1">
    <colgroup>
      <col width="10%" />
      <col width="10%" />
      <col />
      <col width="10%" />
      <col width="40%" />
    </colgroup>
    <tbody>
      <!-- 土地使用权人展示 -->
      <!-- 其它 -->
      <tr class="ant-table-cell ant-table-cell-ellipsis" v-if="data?.tdsyqrlx == 4">
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">土地使用权人(其他)</td>
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">其他信息</td>
        <td class="ant-table-cell ant-table-cell-ellipsis" colspan="3">{{ data?.syqdwmc }}</td>
      </tr>
      <!-- 企业  -->
      <tr class="ant-table-cell ant-table-cell-ellipsis" v-if="data?.tdsyqrlx == 1">
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor" rowspan="2">土地使用权人(企业)</td>
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">企业名称</td>
        <td class="ant-table-cell ant-table-cell-ellipsis" colspan="3">{{ data?.syqdwmc }}</td>
      </tr>
      <tr class="ant-table-cell ant-table-cell-ellipsis" v-if="data?.tdsyqrlx == 1">
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">统一社会信用代码</td>
        <td class="ant-table-cell ant-table-cell-ellipsis">{{ gsyyzzh }}</td>
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">取得土地使用权日期</td>
        <td class="ant-table-cell ant-table-cell-ellipsis">{{ data?.qdHstdsqysj }}</td>
      </tr>
      <!-- 自然人 -->
      <tr class="ant-table-cell ant-table-cell-ellipsis" v-if="data?.tdsyqrlx == 2">
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor" rowspan="2">土地使用权人(自然人)</td>
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">自然人姓名</td>
        <td colspan="3" class="ant-table-cell ant-table-cell-ellipsis">{{ data?.syqdwmc }}</td>
      </tr>
      <tr class="ant-table-cell ant-table-cell-ellipsis" v-if="data?.tdsyqrlx == 2">
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">身份证号码</td>
        <td class="ant-table-cell ant-table-cell-ellipsis">{{ gsyyzzh }}</td>
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">取得土地使用权日期</td>
        <td class="ant-table-cell ant-table-cell-ellipsis">2023-11-16</td>
      </tr>
      <!-- 政府 -->
      <tr class="ant-table-cell ant-table-cell-ellipsis" v-if="data?.qrTdsyqrlx == 3">
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor" rowspan="2">前任土地使用权人(政府)</td>
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">政府名称</td>
        <td colspan="3" class="ant-table-cell ant-table-cell-ellipsis">{{ data?.qrTdsyqr }}</td>
      </tr>
      <tr class="ant-table-cell ant-table-cell-ellipsis" v-if="data?.qrTdsyqrlx == 3">
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">统一社会信用代码</td>
        <td class="ant-table-cell ant-table-cell-ellipsis" colspan="3">{{ qrGsyyzzh }}</td>
        <!-- <td class="ant-table-cell ant-table-cell-ellipsis bgColor">取得土地使用权日期</td>
        <td class="ant-table-cell ant-table-cell-ellipsis">{{ data?.qdHstdsqysj }}</td> -->
      </tr>
      <!-- 其它前任 -->
      <tr class="ant-table-cell ant-table-cell-ellipsis" v-if="data?.qrTdsyqrlx == 4">
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">前任土地使用权人(其他)</td>
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">其他信息</td>
        <td class="ant-table-cell ant-table-cell-ellipsis" colspan="3">{{ data?.qrTdsyqr }}</td>
      </tr>
      <!-- 企业前任  -->
      <tr class="ant-table-cell ant-table-cell-ellipsis" v-if="data?.qrTdsyqrlx == 1">
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor" rowspan="2">前任土地使用权人(企业)</td>
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">企业名称</td>
        <td colspan="3" class="ant-table-cell ant-table-cell-ellipsis">{{ data?.qrTdsyqr }}</td>
      </tr>
      <tr class="ant-table-cell ant-table-cell-ellipsis" v-if="data?.qrTdsyqrlx == 1">
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">统一社会信用代码</td>
        <td class="ant-table-cell ant-table-cell-ellipsis" colspan="3">{{ qrGsyyzzh }}</td>
        <!-- <td class="ant-table-cell ant-table-cell-ellipsis bgColor">取得土地使用权日期</td>
        <td class="ant-table-cell ant-table-cell-ellipsis">{{ data?.qdHstdsqysj }}</td> -->
      </tr>
      <!-- 前任自然人 -->
      <tr class="ant-table-cell ant-table-cell-ellipsis" v-if="data?.qrTdsyqrlx == 2">
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor" rowspan="2">前任土地使用权人(自然人)</td>
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">自然人姓名</td>
        <td colspan="3" class="ant-table-cell ant-table-cell-ellipsis">{{ data?.qrTdsyqr }}</td>
      </tr>
      <tr class="ant-table-cell ant-table-cell-ellipsis" v-if="data?.qrTdsyqrlx == 2">
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">身份证号码</td>
        <td class="ant-table-cell ant-table-cell-ellipsis" colspan="3">{{ qrGsyyzzh }}</td>
        <!-- <td class="ant-table-cell ant-table-cell-ellipsis bgColor">取得土地使用权日期</td>
        <td class="ant-table-cell ant-table-cell-ellipsis">{{ data?.qdHstdsqysj }}</td> -->
      </tr>
      <!-- 前任政府 -->
      <tr class="ant-table-cell ant-table-cell-ellipsis" v-if="data?.tdsyqrlx == 3">
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor" rowspan="2">土地使用权人(政府)</td>
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">政府名称</td>
        <td colspan="3" class="ant-table-cell ant-table-cell-ellipsis">{{ data?.syqdwmc }}</td>
      </tr>
      <tr class="ant-table-cell ant-table-cell-ellipsis" v-if="data?.tdsyqrlx == 3">
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">统一社会信用代码</td>
        <td class="ant-table-cell ant-table-cell-ellipsis">{{ gsyyzzh }}</td>
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">取得土地使用权日期</td>
        <td class="ant-table-cell ant-table-cell-ellipsis">{{ data?.qdHstdsqysj }}</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" colspan="2">
          <a-button v-if="data?.ismanyLanduser == 1" type="primary" @click="LandopenModal(true, '')">多土地使用权人查看</a-button>
        </td>
        <td class="ant-table-cell ant-table-cell-ellipsis colspan bgColor">前任多土地使用权人</td>
        <td class="ant-table-cell ant-table-cell-ellipsis" colspan="2">
          <a-button v-if="data?.isQrManyLanduser == 1" type="primary" @click="openModal(true, '')">多土地使用权人查看</a-button>
        </td>
      </tr>
      <tr class="ant-table-cell ant-table-cell-ellipsis">
        <td class="ant-table-cell ant-table-cell-ellipsis colspan bgColor" width="10%" rowspan="14">基本信息</td>
        <td class="ant-table-cell ant-table-cell-ellipsis colspan bgColor">
          行业类别
          <div style="color: #ff8f1f; font-size: 12px"> 地块开展调查之前的行业类别</div>
        </td>
        <td class="ant-table-cell ant-table-cell-ellipsis" colspan="3">{{ data?.hylb }} </td>
      </tr>
      <tr class="ant-table-cell ant-table-cell-ellipsis">
        <td class="ant-table-cell ant-table-cell-ellipsis colspan bgColor">
          现状用地类型
          <div style="color: #ff8f1f; font-size: 12px">地块开展调查之前的用地类型</div>
        </td>
        <td class="ant-table-cell ant-table-cell-ellipsis" id="xzydlx" colspan="3">
          <div v-if="data?.xzydlx == 1">建设用地 </div>
          <div v-if="data?.xzydlx == 2">农用地 </div>
          <div v-if="data?.xzydlx == 3">未利用地 </div>
          <div v-if="data?.xzydlx == 4">其他 </div>
          <!-- {{ dictName('xzydlx', data?.xzydlx) }} -->
        </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" colspan="3">{{ data?.wrdkdz }}</td>
      </tr>
      <tr class="ant-table-cell ant-table-cell-ellipsis">
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">地块占地面积(m<sup>2</sup>)</td>
        <td class="ant-table-cell ant-table-cell-ellipsis">{{ data?.zdmj }}</td>
        <td class="ant-table-cell ant-table-cell-ellipsis" bgColor>坐标系说明</td>
        <td class="ant-table-cell ant-table-cell-ellipsis">{{ data?.zbsm }}</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?.wrdkzxjd }}</td>
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">中心纬度</td>
        <td class="ant-table-cell ant-table-cell-ellipsis">{{ data?.wrdkzxwd }}</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" colspan="3">{{ data?.dkszfw }}</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?.syqdwlxr }}</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">{{ syqdwlxdh }} </td>
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">邮编</td>
        <td class="ant-table-cell ant-table-cell-ellipsis">{{ data?.yzbm }}</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" v-if="data?.qdyy" colspan="3">
          <div v-if="data?.qdyy?.includes('1')">生态环境部门责令调查</div>
          <div v-if="data?.qdyy?.includes('2')">用于变更为住宅公共管理与公共服务用地</div>
          <div v-if="data?.qdyy?.includes('3')">土壤污染重点监管单位用途变更</div>
          <div v-if="data?.qdyy?.includes('4')">重点监管单位使用权转让收回</div>
          <div v-if="data?.qdyy?.includes('5')">其它{{ data?.qyyyQt }}</div>
        </td>
        <td class="ant-table-cell ant-table-cell-ellipsis" v-else  colspan="3">
        </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?.dzgbj==1?'是':'否' }}</td>
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">是否需开展后期环境管理</td>
        <td class="ant-table-cell ant-table-cell-ellipsis">{{ data?.kzhqhjjg==1?'是':'' }}</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" colspan="3">
          <div v-if="data?.dkghytlx == 1">一类用地</div>
          <div v-if="data?.dkghytlx == 2">二类用地</div>
          <div v-if="data?.dkghytlx == 3">无规化</div>
          <div v-if="data?.dkghytlx == 4">其他</div>
          {{ data?.dkghytlx == 4?data?.dkghytqtlx:'' }}
          {{ data?.dkghytxm }}
        </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" colspan="3">{{ dictName('dk_zcyj', data?.faliYiju) }}</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">
          <div v-if="data?.gzlx == 1">危险化学品搬迁</div>
          <div v-if="data?.gzlx == 2">长江经济带整治</div>
          <div v-if="data?.gzlx == 3">黄河流域整治</div>
          <div v-if="data?.gzlx == 4">其他</div>
        </td>
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">涉及的重点区域</td>
        <td class="ant-table-cell ant-table-cell-ellipsis">
          <div v-if="data?.gzfw == 1">长江经济带</div>
          <div v-if="data?.gzfw == 2">黄河流域</div>
          <div v-if="data?.gzfw == 3">粤港澳大湾区</div>
          <div v-if="data?.gzfw == 4">其他</div>
        </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?.isnyd2yzlg == 1 ? '是' : '否' }}</td>
        <td class="ant-table-cell ant-table-cell-ellipsis bgColor">是否为未利用地转“一住两公”地块</td>
        <td class="ant-table-cell ant-table-cell-ellipsis">
          {{ data?.iswlyd2yzlg == 1 ? '是' : '否' }}
        </td>
      </tr> -->
      <!-- <tr class="ant-table-cell ant-table-cell-ellipsis" style="display: table-row;">
                <td class="ant-table-cell ant-table-cell-ellipsis bgColor">第一阶段调查情况</td>
                <td class="ant-table-cell ant-table-cell-ellipsis" colspan="3">
                    {{ data?.dyjddcqk }}
                </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"></td>
                <td class="ant-table-cell ant-table-cell-ellipsis bgColor">空间文件</td>
                <td class="ant-table-cell ant-table-cell-ellipsis"></td>
            </tr> -->
    </tbody>
  </table>
  <tableModal :type="'look'" :data="data?.xrList" @register="registerLandModal" ref="childrenLand" />
  <tableModal :type="'look'" :data="data?.qrList" @register="registerModal" ref="childrenModal" />
</template>

<script lang="ts" setup>
  import { ref, watch } from 'vue';
  import { dictName } from '/@/utils/domUtils';
  import tableModal from './tableModal.vue';
  import { useModal } from '/@/components/Modal';
  import { decrypts } from '@/utils/checkTip';

  const [registerLandModal, { openModal: LandopenModal }] = useModal();
  const [registerModal, { openModal }] = useModal();
  const props: any = defineProps({
    data: Object,
  });
  const syqdwlxdh = ref('');
  const qrGsyyzzh = ref();
  const gsyyzzh = ref();

  async function init() {
    console.log(props.data, 'syqdwlxdh.value');
    // syqdwlxdh.value = await decrypts(props.data.syqdwlxdh);
    syqdwlxdh.value = props.data.syqdwlxdh;
    // 暂时不加密 如果解密  修改页面的值的显示即可
    // if (props.data?.tdsyqrlx == 2) {
    if (props.data.gsyyzzh) gsyyzzh.value = await decrypts(props.data.gsyyzzh, false);
    // }
    // if (props.data?.qrTdsyqrlx == 2) {
    if (props.data.qrGsyyzzh) qrGsyyzzh.value = await decrypts(props.data.qrGsyyzzh, false);
    // }
  }

  watch(
    () => props?.data,
    async () => {
      init();
    },
    { deep: true, immediate: true }
  );
</script>
