taskDetail.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <view class="app-container">
  3. <TopBar title="任务详情" show-back />
  4. <view class="px-4 py-4 pb-8">
  5. <!-- 任务状态卡片 -->
  6. <view class="card p-4">
  7. <view class="flex justify-between items-start mb-3">
  8. <view>
  9. <text class="text-base font-bold text-gray-800">{{ task.projectName }}</text>
  10. <view class="mt-2">
  11. <StatusTag :status="task.status" />
  12. <text v-if="task.isEmergency" class="tag-danger ml-2 px-2 py-1 rounded text-xs">应急</text>
  13. </view>
  14. </view>
  15. <text class="text-xs text-gray-400">{{ task.taskNo }}</text>
  16. </view>
  17. <view class="flex items-center text-sm text-gray-600 mb-2">
  18. <text class="uni-icons uniui-location-filled text-gray-400 mr-2"></text>
  19. <text>{{ task.address }}</text>
  20. </view>
  21. <view class="flex items-center text-sm text-gray-600">
  22. <text class="uni-icons uniui-clock-filled text-gray-400 mr-2"></text>
  23. <text>{{ task.scheduleDate }} {{ task.scheduleTime }}</text>
  24. </view>
  25. </view>
  26. <!-- 基本信息 -->
  27. <view class="card">
  28. <view class="detail-section-title">
  29. <text class="uni-icons uniui-info-filled text-primary mr-2"></text>
  30. <text>基本信息</text>
  31. </view>
  32. <view class="detail-row">
  33. <text class="detail-label">服务类型</text>
  34. <text class="detail-value">{{ task.serviceType }}</text>
  35. </view>
  36. <view class="detail-row">
  37. <text class="detail-label">客户名称</text>
  38. <text class="detail-value">{{ task.customerName }}</text>
  39. </view>
  40. <view class="detail-row">
  41. <text class="detail-label">联系电话</text>
  42. <text class="detail-value">{{ task.customerPhone }}</text>
  43. </view>
  44. <view class="detail-row">
  45. <text class="detail-label">项目地址</text>
  46. <text class="detail-value">{{ task.address }}</text>
  47. </view>
  48. <view class="detail-row">
  49. <text class="detail-label">预约时间</text>
  50. <text class="detail-value">{{ task.scheduleDate }} {{ task.scheduleTime }}</text>
  51. </view>
  52. <view class="detail-row">
  53. <text class="detail-label">紧急程度</text>
  54. <view class="detail-value">
  55. <text :class="task.isEmergency ? 'text-danger' : 'text-success'">
  56. {{ task.isEmergency ? '紧急' : '普通' }}
  57. </text>
  58. </view>
  59. </view>
  60. </view>
  61. <!-- 服务点信息 -->
  62. <view v-if="task.servicePoints && task.servicePoints.length > 0" class="card">
  63. <view class="detail-section-title">
  64. <text class="uni-icons uniui-location-filled text-primary mr-2"></text>
  65. <text>服务点信息</text>
  66. </view>
  67. <view
  68. v-for="(point, index) in task.servicePoints"
  69. :key="index"
  70. class="service-point-card"
  71. >
  72. <view class="flex justify-between items-center mb-2">
  73. <text class="text-sm font-semibold text-gray-800">{{ point.name }}</text>
  74. <text class="tag-blue px-2 py-1 rounded text-xs">{{ point.serviceType }}</text>
  75. </view>
  76. <view class="flex items-center text-xs text-gray-500">
  77. <text class="uni-icons uniui-location-filled text-gray-400 mr-1"></text>
  78. <text>{{ point.address }}</text>
  79. </view>
  80. </view>
  81. </view>
  82. <!-- 处理记录 -->
  83. <view class="card">
  84. <view class="detail-section-title">
  85. <text class="uni-icons uniui-compose-filled text-primary mr-2"></text>
  86. <text>处理记录</text>
  87. </view>
  88. <Timeline :records="timelineRecords" />
  89. </view>
  90. </view>
  91. </view>
  92. </template>
  93. <script setup lang="ts">
  94. import { ref, computed } from 'vue'
  95. import { useTaskStore } from '@/stores/task'
  96. import TopBar from '@/components/common/TopBar.vue'
  97. import StatusTag from '@/components/common/StatusTag.vue'
  98. import Timeline from '@/components/common/Timeline.vue'
  99. import type { TimelineRecord } from '@/components/common/Timeline.vue'
  100. const taskStore = useTaskStore()
  101. const task = computed(() => taskStore.currentTask || {})
  102. const timelineRecords = ref<TimelineRecord[]>([
  103. {
  104. action: '任务已创建,等待调度',
  105. time: '2026-04-20 09:00',
  106. operator: '销售-李明',
  107. role: 'sales',
  108. isCurrent: false
  109. },
  110. {
  111. action: '任务已排班,分配工程一班',
  112. time: '2026-04-20 10:30',
  113. operator: '调度-王调度',
  114. role: 'dispatch',
  115. isCurrent: false
  116. },
  117. {
  118. action: '工程人员已出发',
  119. time: '2026-04-20 11:00',
  120. operator: '施工-张师傅',
  121. role: 'worker',
  122. isCurrent: true
  123. }
  124. ])
  125. </script>
  126. <style scoped>
  127. /* 仅保留组件特有样式 */
  128. .service-point-card {
  129. background: #f9fafb;
  130. border-radius: 8px;
  131. padding: 12px;
  132. margin: 8px 16px;
  133. }
  134. .tag-blue {
  135. background: #e6f0ff;
  136. color: #2563eb;
  137. }
  138. </style>