detail.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <!--
  2. * @Author: zhanghaifeng
  3. * @Date: 2025-07-08 13:31:49
  4. * @LastEditors: zhanghaifeng
  5. * @LastEditTime: 2025-07-09 09:30:02
  6. * @Description:
  7. * @FilePath: /jiangbei-mini-h5/src/subPages/pages/reportProblems/detail.vue
  8. -->
  9. <script lang="ts" setup>
  10. import { getQuestionReportDetail } from '@/api/questionReqort';
  11. import { QuestionDetailRes } from '@/api/questionReqort/types';
  12. import { onLoad } from '@dcloudio/uni-app';
  13. import { computed, ref } from 'vue';
  14. const questDetail = ref<QuestionDetailRes>()
  15. const statusText = computed(() => {
  16. const status = questDetail.value?.status
  17. if (status === 1) return '已解答'
  18. if (status === 2) return '已上报'
  19. return '待解答'
  20. })
  21. const personListText = computed(() => {
  22. const personList = questDetail.value?.personList || ''
  23. return personList
  24. .split(/[,,、]+/)
  25. .map(item => item.trim())
  26. .filter(Boolean)
  27. .join('、')
  28. })
  29. const loadDetail = async (id: string) => {
  30. questDetail.value = undefined
  31. const { data } = await getQuestionReportDetail(id)
  32. questDetail.value = data
  33. }
  34. onLoad(async (option) => {
  35. if (option && option.id) {
  36. await loadDetail(String(option.id))
  37. }
  38. })
  39. </script>
  40. <template>
  41. <view class="p-[20px]">
  42. <view class="form-item">
  43. <view class="label">类型:</view>
  44. <view class="flex value">
  45. <view class="value">{{ questDetail?.questionType }}</view>
  46. <van-tag v-if="questDetail?.status === 0" color="red">待解答</van-tag>
  47. <van-tag v-if="questDetail?.status === 1" color="green">已解答</van-tag>
  48. <van-tag v-if="questDetail?.status === 2" color="#1989fa">已上报</van-tag>
  49. </view>
  50. </view>
  51. <!-- 问题标题 -->
  52. <!-- <view class="form-item">
  53. <view class="label">标题:</view>
  54. <view class="value">{{ questDetail?.questionTitle }}</view>
  55. </view> -->
  56. <!-- 问题内容 -->
  57. <view class="form-item">
  58. <view class="label">内容:</view>
  59. <view class="value">{{ questDetail?.questionContent }}</view>
  60. </view>
  61. <!-- 问题所在地 -->
  62. <view class="form-item">
  63. <view class="label">所在地:</view>
  64. <view class="value">{{ questDetail?.addrName }}</view>
  65. </view>
  66. <view class="form-item">
  67. <view class="label">状态:</view>
  68. <view class="value">{{ statusText }}</view>
  69. </view>
  70. <view class="form-item">
  71. <view class="label">当事人:</view>
  72. <view class="value" v-if="personListText">{{ personListText }}</view>
  73. <view class="value text-[#e3e3e3]" v-else>暂无</view>
  74. </view>
  75. <view class="form-item">
  76. <view class="label">联系人:</view>
  77. <view class="value" v-if="questDetail?.contactPerson">{{ questDetail?.contactPerson }}</view>
  78. <view class="value text-[#e3e3e3]" v-else>暂无</view>
  79. </view>
  80. <view class="form-item">
  81. <view class="label">联系电话:</view>
  82. <view class="value" v-if="questDetail?.contactPhone">{{ questDetail?.contactPhone }}</view>
  83. <view class="value text-[#e3e3e3]" v-else>暂无</view>
  84. </view>
  85. <van-divider></van-divider>
  86. <!-- 问题解答 -->
  87. <view class="form-item" v-if="questDetail?.status === 1">
  88. <view class="label">解答:</view>
  89. <view class="value" v-if="questDetail?.questionAnswer">{{ questDetail?.questionAnswer }}</view>
  90. <view class="value text-[#e3e3e3]" v-else>暂无</view>
  91. </view>
  92. </view>
  93. </template>
  94. <style lang="scss" scoped>
  95. .form-item {
  96. display: flex;
  97. // align-items: center;
  98. padding: 10px;
  99. .label {
  100. width: 80px;
  101. }
  102. .value {
  103. flex: 1;
  104. word-break: break-all;
  105. }
  106. }
  107. </style>