<template>
  <a-descriptions bordered :column="2" size="small" :labelStyle="labelStyle">
    <a-descriptions-item label="核查人">{{
      caseHandleInfo.info.createusername
    }}</a-descriptions-item>
    <a-descriptions-item label="核查时间">
      {{ caseHandleInfo.info.createtime }}
    </a-descriptions-item>
    <a-descriptions-item label="处理进度">
      {{ caseHandleInfo.info.verifystatusname }}
    </a-descriptions-item>
    <a-descriptions-item label="是否违法">
      {{ caseHandleInfo.is_illegal }}
    </a-descriptions-item>
    <a-descriptions-item label="处理措施" v-if="caseHandleInfo.is_illegal == '是'">
      {{ caseHandleInfo.info.measure_name }}
    </a-descriptions-item>

    <!-- 合法 -->
    <a-descriptions-item label="项目名称" v-if="caseHandleInfo.is_illegal == '合法'">
      {{ caseHandleInfo.info.result_name }}
    </a-descriptions-item>
    <a-descriptions-item label="当事人" v-if="caseHandleInfo.is_illegal == '合法'">
      {{ caseHandleInfo.info.contacts_people }}
    </a-descriptions-item>
    <a-descriptions-item label="联系电话" v-if="caseHandleInfo.is_illegal == '合法'">
      {{ caseHandleInfo.info.contacts_phone }}
    </a-descriptions-item>
    <a-descriptions-item label="建设情况" v-if="caseHandleInfo.is_illegal == '合法'">
      {{ caseHandleInfo.info.actual_scene_case }}
    </a-descriptions-item>
    <a-descriptions-item label="实际用途" v-if="caseHandleInfo.is_illegal == '合法'">
      {{ caseHandleInfo.info.actual_use_to }}
    </a-descriptions-item>

    <!-- 伪变化 -->
    <a-descriptions-item label="伪变化原因" v-if="caseHandleInfo.is_illegal == '伪变化'">
      {{ caseHandleInfo.info.pseudo_change_reason }}
    </a-descriptions-item>
    <a-descriptions-item label="实际用途" v-if="caseHandleInfo.is_illegal == '伪变化'">
      {{ caseHandleInfo.info.actual_use_to }}
    </a-descriptions-item>
    <a-descriptions-item label="实际面积" v-if="caseHandleInfo.is_illegal == '伪变化'">
      {{ caseHandleInfo.info.actual_area }}
    </a-descriptions-item>
    <a-descriptions-item label="是否有建筑物" v-if="caseHandleInfo.is_illegal == '伪变化'">
      {{ caseHandleInfo.info.is_have_build == 1 ? '是' : '否' }}
    </a-descriptions-item>
    <a-descriptions-item label="是否永久性建筑" v-if="caseHandleInfo.is_illegal == '伪变化'">
      {{ caseHandleInfo.info.is_forever_build == 1 ? '是' : '否' }}
    </a-descriptions-item>

    <!-- 案件违法 - 拆除 -->
    <a-descriptions-item
      label="处理办法"
      v-if="caseHandleInfo.is_illegal == '违法' && caseHandleInfo.info.measure_name == '拟拆除'"
    >
      {{ caseHandleInfo.info.measure_name }}
    </a-descriptions-item>
    <a-descriptions-item
      label="实际用途"
      v-if="caseHandleInfo.is_illegal == '违法' && caseHandleInfo.info.measure_name == '拟拆除'"
    >
      {{ caseHandleInfo.info.actual_use_to }}
    </a-descriptions-item>
    <a-descriptions-item
      label="当事人"
      v-if="caseHandleInfo.is_illegal == '违法' && caseHandleInfo.info.measure_name == '拟拆除'"
    >
      {{ caseHandleInfo.info.illegal_contact }}
    </a-descriptions-item>
    <a-descriptions-item
      label="联系电话"
      v-if="caseHandleInfo.is_illegal == '违法' && caseHandleInfo.info.measure_name == '拟拆除'"
    >
      {{ caseHandleInfo.info.illegal_contact_phone }}
    </a-descriptions-item>
    <a-descriptions-item
      label="建设情况"
      v-if="caseHandleInfo.is_illegal == '违法' && caseHandleInfo.info.measure_name == '拟拆除'"
    >
      {{ caseHandleInfo.info.is_build_complete == 1 ? '已建成' : '建设中' }}
    </a-descriptions-item>
    <a-descriptions-item
      label="建筑结构"
      v-if="caseHandleInfo.is_illegal == '违法' && caseHandleInfo.info.measure_name == '拟拆除'"
    >
      {{ caseHandleInfo.info.build_structure }}
    </a-descriptions-item>

    <!-- 案件违法 查处 -->
    <a-descriptions-item
      label="处理办法"
      v-if="caseHandleInfo.is_illegal == '违法' && caseHandleInfo.info.measure_name == '查处'"
    >
      {{ caseHandleInfo.info.measure_name }}
    </a-descriptions-item>
    <a-descriptions-item
      label="实际用途"
      v-if="caseHandleInfo.is_illegal == '违法' && caseHandleInfo.info.measure_name == '查处'"
    >
      {{ caseHandleInfo.info.actual_use_to }}
    </a-descriptions-item>
    <a-descriptions-item
      label="当事人"
      v-if="caseHandleInfo.is_illegal == '违法' && caseHandleInfo.info.measure_name == '查处'"
    >
      {{ caseHandleInfo.info.illegal_contact }}
    </a-descriptions-item>
    <a-descriptions-item
      label="联系电话"
      v-if="caseHandleInfo.is_illegal == '违法' && caseHandleInfo.info.measure_name == '查处'"
    >
      {{ caseHandleInfo.info.illegal_contact_phone }}
    </a-descriptions-item>
    <a-descriptions-item
      label="建筑结构"
      v-if="caseHandleInfo.is_illegal == '违法' && caseHandleInfo.info.measure_name == '查处'"
    >
      {{ caseHandleInfo.info.build_structure }}
    </a-descriptions-item>
    <a-descriptions-item
      label="违法类型"
      v-if="caseHandleInfo.is_illegal == '违法' && caseHandleInfo.info.measure_name == '查处'"
    >
      {{ caseHandleInfo.info.illegal_type }}
    </a-descriptions-item>

    <!-- 案件违法 完善手续 -->
    <a-descriptions-item
      label="处理办法"
      v-if="caseHandleInfo.is_illegal == '违法' && caseHandleInfo.info.measure_name == '拟完善手续'"
    >
      {{ caseHandleInfo.info.measure_name }}
    </a-descriptions-item>
    <a-descriptions-item
      label="实际用途"
      v-if="caseHandleInfo.is_illegal == '违法' && caseHandleInfo.info.measure_name == '拟完善手续'"
    >
      {{ caseHandleInfo.info.actual_use_to }}
    </a-descriptions-item>
    <a-descriptions-item
      label="当事人"
      v-if="caseHandleInfo.is_illegal == '违法' && caseHandleInfo.info.measure_name == '拟完善手续'"
    >
      {{ caseHandleInfo.info.illegal_contact }}
    </a-descriptions-item>
    <a-descriptions-item
      label="联系电话"
      v-if="caseHandleInfo.is_illegal == '违法' && caseHandleInfo.info.measure_name == '拟完善手续'"
    >
      {{ caseHandleInfo.info.illegal_contact_phone }}
    </a-descriptions-item>
    <a-descriptions-item
      label="拟完善手续名称"
      v-if="caseHandleInfo.is_illegal == '违法' && caseHandleInfo.info.measure_name == '拟完善手续'"
    >
      {{ caseHandleInfo.info.result_name }}
    </a-descriptions-item>
    <a-descriptions-item
      label="是否具备完善手续条件"
      v-if="caseHandleInfo.is_illegal == '违法' && caseHandleInfo.info.measure_name == '拟完善手续'"
    >
      {{ caseHandleInfo.info.is_have_checkout_condition == 1 ? '是' : '否' }}
    </a-descriptions-item>

    <a-descriptions-item label="备注">
      {{ caseHandleInfo.info.remark }}
    </a-descriptions-item>

    <a-descriptions-item label="现场照片">
      <div>
        <ImagePreview :imageList="imgList" />
      </div>
    </a-descriptions-item>
    <a-descriptions-item label="现场视频">
      <div v-if="playerOptions.length > 0">
        <video-player
          class="video-player vjs-custom-skin"
          v-for="(item, index) in playerOptions"
          :key="index"
          ref="videoPlayer"
          :playsinline="true"
          :options="item"
          style="width: 200px"
        ></video-player>
      </div>
    </a-descriptions-item>
  </a-descriptions>
</template>
<script lang="ts" setup>
  import { reactive, watch, ref } from 'vue';
  import { ImagePreview } from '@/components/Preview';
  import { caseHandleInfoObj } from '../model';
  const labelStyle = ref({
    width: '100px',
  });
  const caseHandleInfo = ref<caseHandleInfoObj>({
    info: {},
  });
  const playerOptions: any = ref([]);
  const threadImageList: any = ref([]);
  const props = defineProps({
    data: {
      type: Object,
      default: () => {
        return {};
      },
    },
    playerOptions: {
      type: Object,
      default: () => {
        return {};
      },
    },
    threadImageList: {
      type: Object,
      default: () => {
        return {};
      },
    },
  });
  console.log(props)
  caseHandleInfo.value = props.data;
  playerOptions.value = props.playerOptions;
  threadImageList.value = props.threadImageList;
  const imgList = ref([
    'https://picsum.photos/id/66/346/216',
    'https://picsum.photos/id/67/346/216',
    'https://picsum.photos/id/68/346/216',
  ]);

  watch(
    () => props.data,
    (newVal, oldVal) => {
      caseHandleInfo.value = newVal;
      playerOptions.value = props.playerOptions;
      threadImageList.value = props.threadImageList;
    },
  );
</script>
<style lang="less" scoped>
  ::v-deep .ant-image .ant-image-img {
    width: 85px;
    margin-bottom: 10px;
  }
</style>
