<template>
  <div class='default-main'>
    <el-descriptions :column='2' border>
      <el-descriptions-item label='填报人'>
        {{ detailData.reporter }}
      </el-descriptions-item>
      <el-descriptions-item label='填报日期'>
        {{ formatDate(detailData.reportDate, 'YYYY-MM-DD') }}
      </el-descriptions-item>
      <el-descriptions-item label='填报部门'>
        {{ detailData.orgName }}
      </el-descriptions-item>
      <el-descriptions-item label='工程预期投产日期'>
        {{ formatDate(detailData.expectedProductionDate, 'YYYY-MM-DD') }}
      </el-descriptions-item>
      <el-descriptions-item :span='2' label='用户性质'>
        {{ detailData.userType }}
      </el-descriptions-item>
      <el-descriptions-item label='所属地址'>
        {{ detailData.city }}
      </el-descriptions-item>
      <el-descriptions-item label='归口管理部门'>
        {{ detailData.responsibleDepartment }}
      </el-descriptions-item>
      <el-descriptions-item label='用户状态'>
        {{ detailData.userStatus }}
      </el-descriptions-item>
      <el-descriptions-item label='变电站'>
        {{ detailData.substation }}
      </el-descriptions-item>
      <el-descriptions-item :span='2' label='工程名'>
        {{ detailData.projectName }}
      </el-descriptions-item>
      <el-descriptions-item label='用户协议容量'>
        {{ detailData.reason }}
      </el-descriptions-item>
      <el-descriptions-item label='电压等级'>
        {{ detailData.voltageLevel }}
      </el-descriptions-item>
      <el-descriptions-item label='非线性设备类型'>
        {{ detailData.reason }}
      </el-descriptions-item>
      <el-descriptions-item label='预测评估单位'>
        {{ detailData.reason }}
      </el-descriptions-item>
      <el-descriptions-item :span='2' label='预测评估结论'>
        {{ detailData.reason }}
      </el-descriptions-item>
      <el-descriptions-item label='是否需要治理'>
        {{ detailData.reason }}
      </el-descriptions-item>
      <el-descriptions-item label='是否开展背景测试'>
        {{ detailData.reason }}
      </el-descriptions-item>
      <el-descriptions-item :span='2' label='可研报告'>
        {{ detailData.reason }}
      </el-descriptions-item>
      <el-descriptions-item :span='2' label='项目初步设计说明书'>
        {{ detailData.reason }}
      </el-descriptions-item>
      <el-descriptions-item :span='2' label='预测评估评审意见报告'>
        {{ detailData.reason }}
      </el-descriptions-item>
      <el-descriptions-item :span='2' label='其他附件'>
        {{ detailData.reason }}
      </el-descriptions-item>


    </el-descriptions>
  </div>
</template>
<script lang='ts' setup>
import { onMounted, provide, ref, getCurrentInstance, reactive, watch, unref, nextTick } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import { formatDate } from '@/utils/formatTime'
import { propTypes } from '@/utils/propTypes'
import { getUserReportById } from '@/api/supervision-boot/userReport/form'

defineOptions({ name: 'BpmOALeaveDetail' })

const { query } = useRoute() // 查询参数

const props = defineProps({
  id: propTypes.number.def(undefined)
})
const detailLoading = ref(false) // 表单的加载中
const detailData = ref<any>({}) // 详情数据
const queryId = query.id as unknown as number // 从 URL 传递过来的 id 编号

/** 获得数据 */
const getInfo = async () => {
  detailLoading.value = true
  try {
    await getUserReportById(props.id || queryId).then(res => {
      detailData.value = res.data
    })
  } finally {
    detailLoading.value = false
  }
}
defineExpose({ open: getInfo }) // 提供 open 方法，用于打开弹窗

/** 初始化 **/
onMounted(() => {
  getInfo()
})
</script>
