<template>
  <!-- 地块调查 风险评估 
       最后一列操作列不要 action
    -->
  <a-table :columns="opinionColumns.slice(0, -1)" :data-source="localData" :pagination="false" bordered size="middle">
    <template #headerCell="{ column }">
      <span :class="{ required: dcjdPsfs === 1 && !['mail', 'bz'].includes(column.dataIndex) }">
        {{ column.title }}
      </span>
    </template>
    <template #bodyCell="{ column, record }">
      <template v-if="column.dataIndex === 'isHead'">
        <span>{{ record[column.dataIndex] == 1 ? '是' : '否' }}</span>
      </template>
    </template>
  </a-table>
</template>
<script lang="ts" setup>
  import { ref, watch } from 'vue';
  import { opinionColumns } from '@/views/dkgl/investigate/data';
  import { decrypts } from '@/utils/checkTip';
  const props = defineProps({
    data: {
      type: Object,
    },
    dcjdPsfs: {
      type: Number,
    },
  });
  const localData = ref([]);
  watch(
    () => props?.data,
    async (val: any) => {
      if (val) {
        localData.value = val.map((item) => ({ ...item }));
        localData.value.forEach(async (item: any) => {
          item.lxdh = await decrypts(item.lxdh, true);
        });
      }
    },
    { deep: true, immediate: true }
  );
</script>
