<template>
  <Modal
    width="1200px"
    :title="title"
    @cancel="router.push({ name: RoutesName.show })"
    :open="router.currentRoute.value.name === RoutesName.fireInfo"
    :footer="null"
  >
    <Info
      title="案件信息"
      :data="caseProject.tmProject"
      :label-map="tmLabelMap1"
      v-if="caseProject?.tmProject"
    />
    <Info
      title="勘验信息"
      :data="caseProject.tmProject"
      :label-map="tmLabelMap2"
      v-if="caseProject?.tmProject"
    />
  </Modal>
</template>

<script setup lang="ts">
import { Modal } from "ant-design-vue";
import Info from "./info.vue";
import { showRightPanoStack } from "@/env";
import { useViewStack } from "@/hook";
import router, { RoutesName } from "@/router";
import { title } from "@/store";
import { caseProject } from "@/store/case";
import { ref } from "vue";

type LabelMap = Record<string, string | [string, (v: any) => any]>;

const tmLabelMap1 = {
  projectSn: "案件名称",
  projectAddress: "立案编号",
  projectSite: "案件类别",
  organizerDeptName: "案发时间",
  projectName: ["是否命案", (v: any) => (v === undefined ? "" : v ? "是" : "否")],
  organizerUsers: ["是否刑案", (v: any) => {
    console.error(v)
    return v === undefined ? "" : v ? "是" : "否"
  }],
  accidentDate: "案发区域",
  fireReason: "案发地点",
  statusDesc: "经纬度",
} as LabelMap;

const tmLabelMap2 = {
  creatorName: "指挥中心电话时间",
  editorName: "报警时间",
  createTime: "现场勘验单位",
  editTime: "指派方式",
  statusDesc: "勘验地点",
  fireReason: "勘验时间",
} as LabelMap;

useViewStack(() => showRightPanoStack.push(ref(false)));
</script>

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