recordDetail.vue 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <div class="container">
  3. <Breadcrumb :items="['乐跑记录', '记录详情']" />
  4. <a-card title="记录详情">
  5. <a-skeleton animation :loading="loading">
  6. <a-space direction="vertical" :style="{ width: '100%' }" size="large">
  7. <a-skeleton-shape size="large" />
  8. <a-skeleton-line :rows="5" />
  9. </a-space>
  10. </a-skeleton>
  11. <a-descriptions :data="info" :column="2" />
  12. <MapContainer
  13. v-if="showMap"
  14. :point_list="pointListForMap"
  15. :log_list="logListForMap"
  16. :pathData="pathForMap"
  17. threeD
  18. style="margin-top: 10px;"
  19. />
  20. </a-card>
  21. </div>
  22. </template>
  23. <script setup>
  24. import { ref, computed, onMounted } from 'vue'
  25. import { adminGetRecordDetail } from '@/api/lepao'
  26. import { Notification } from '@arco-design/web-vue'
  27. import { useRoute } from 'vue-router'
  28. import MapContainer from '@/components/Map/MapContainer.vue'
  29. import {
  30. buildRecordDetailInfo,
  31. parseLepaoRecordRow,
  32. normalizePointData
  33. } from '@/utils/lepaoRecord'
  34. const route = useRoute()
  35. const loading = ref(false)
  36. const showMap = ref(false)
  37. const data = ref({})
  38. const info = ref([])
  39. const pathForMap = computed(() => {
  40. const poly = data.value.path_polyline
  41. if (Array.isArray(poly) && poly.length > 0) return poly
  42. return []
  43. })
  44. const pointListForMap = computed(() => {
  45. const row = parseLepaoRecordRow({
  46. result: data.value.result,
  47. jkes_record: data.value.jkes_record,
  48. run_zone_name: data.value.run_zone_name,
  49. path_run_zone_name: data.value.path_run_zone_name,
  50. path_distance: data.value.path_distance
  51. })
  52. return row.pointList || []
  53. })
  54. const logListForMap = computed(() => normalizePointData(data.value.point_data))
  55. const fetchDetail = async (id) => {
  56. try {
  57. loading.value = true
  58. showMap.value = false
  59. const res = await adminGetRecordDetail({ id })
  60. if (!res || res.code !== 0)
  61. return Notification.error({
  62. title: '获取路径数据失败!',
  63. content: res?.msg ?? '请稍后再试'
  64. })
  65. data.value = res.data
  66. showMap.value = true
  67. info.value = buildRecordDetailInfo(res.data, { isAdmin: true })
  68. } catch (error) {
  69. Notification.error({
  70. title: '获取路径数据失败!',
  71. content: error.message || '请稍后再试'
  72. })
  73. } finally {
  74. loading.value = false
  75. }
  76. }
  77. onMounted(() => {
  78. fetchDetail(route.params.id)
  79. })
  80. </script>
  81. <style scoped lang="less">
  82. .container {
  83. padding: 0 20px 20px 20px;
  84. }
  85. </style>