<template>
  <ContentWrap>
    <el-descriptions :column="1" border>

      <el-descriptions-item label="处理状态">
        <dict-tag :type="DICT_TYPE.BPM_PROCESS_INSTANCE_STATUS" :value="detailData.status" />
      </el-descriptions-item>


      <el-descriptions-item label="客户姓名">
        {{ detailData.customerName }}
      </el-descriptions-item>

      <el-descriptions-item label="反馈问题">
        {{ detailData.feedbackProblem }}
      </el-descriptions-item>

      <el-descriptions-item label="建议">
        {{ detailData.suggestion }}
      </el-descriptions-item>


      <el-descriptions-item label="反馈人">
        {{ detailData.feedbackUserName }}
      </el-descriptions-item>

      <el-descriptions-item label="反馈部门">
        {{ detailData.feedbackDeptName }}
      </el-descriptions-item>

      <el-descriptions-item label="创建人">
        {{ detailData.creatorName }}
      </el-descriptions-item>

      <el-descriptions-item label="创建时间">
        {{ formatDate(detailData.createTime, 'YYYY-MM-DD HH:mm:ss') }}
      </el-descriptions-item>

      <el-descriptions-item label="ID">
        {{ detailData.id }}
      </el-descriptions-item>

      <el-descriptions-item label="流程编号">
        {{ detailData.processInstanceId }}
      </el-descriptions-item>

    </el-descriptions>
  </ContentWrap>
</template>
<script lang="ts" setup>
import { DICT_TYPE } from '@/utils/dict'
import { formatDate } from '@/utils/formatTime'
import { propTypes } from '@/utils/propTypes'
import * as CustomerSuggestionApi from '@/api/crm/customer-suggestion'

defineOptions({ name: 'CustomerSuggestionDetail' })

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 {
    detailData.value = await CustomerSuggestionApi.getCustomerSuggestion(props.id || queryId)
  } finally {
    detailLoading.value = false
  }
}
defineExpose({ open: getInfo }) // 提供 open 方法，用于打开弹窗

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