<template>
  <div>
    <el-descriptions :column="1" border label-width="90px" class="w-full">
      <el-descriptions-item label="会议主题">{{ meetingInfo.meetingSubject }}</el-descriptions-item>
      <el-descriptions-item label="会议时间">{{ meetingInfo.startTime }}</el-descriptions-item>
      <el-descriptions-item label="发起人">{{ meetingInfo.creatorName }}</el-descriptions-item>
      <el-descriptions-item label="会议纪要">
        <div v-dompurify-html="meetingInfo.meetingSummary"></div>
      </el-descriptions-item>
    </el-descriptions>
  </div>
</template>

<script setup name="MeettingSummary">
import { getMeetingDetail } from '@/api/okr/meeting'
import { formatDate } from '@/utils/formatTime'

const route = useRoute()

onMounted(() => {
  if (route.query.id && route.query.id != 0) {
    // 这里可以调用API获取会议详情数据
    getMeetingInfo(route.query.id)
  } else {
    console.error('会议不存在')
  }
})

const meetingInfo = ref({})
const getMeetingInfo = async (meetingId) => {
  try {
    // 调用API获取会议详情
    const resp = await getMeetingDetail({ meetingId })
    if (resp) {
      meetingInfo.value = {
        meetingSubject: resp.meetingSubject,
        meetingSummary: resp.meetingSummary,
        startTime: formatDate(resp.startTime, 'YYYY-MM-DD HH:mm'),
        creatorName: resp.creatorName
      }
    }
  } catch (error) {
    console.error('获取会议详情失败:', error)
  }
}
</script>

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