ConstructionTaskCard.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <view
  3. class="task-card p-4 clickable"
  4. hover-class="scale-down"
  5. :class="{ 'is-emergency': (task.taskType || task.type) === 'emergency' }"
  6. @click="$emit('click', String((task as any).id ?? (task as any).taskId ?? ''))"
  7. >
  8. <view class="flex justify-between items-start mb-2">
  9. <view class="flex-1 min-w-0 mr-3">
  10. <text class="text-sm font-semibold text-gray-800 truncate block">{{ (task as any).taskName || task.projectName || '未命名任务' }}</text>
  11. </view>
  12. <StatusTag :status="task.status" />
  13. </view>
  14. <view class="flex flex-wrap gap-2 mb-3">
  15. <view v-if="task.urgent === 'high'" class="px-2 py-1 bg-danger-light text-danger rounded text-xs font-medium">
  16. 加急
  17. </view>
  18. <view v-if="task.coopType" class="chip-type px-2 py-1 rounded text-xs font-medium">
  19. {{ task.coopType }}
  20. </view>
  21. <view v-if="task.serviceMode" class="px-2 py-1 bg-success-light text-success rounded text-xs font-medium">
  22. {{ task.serviceMode }}
  23. </view>
  24. </view>
  25. <view class="gap-y-2 mb-3">
  26. <view class="flex items-center">
  27. <text class="uni-icons uniui-tools info-icon text-xs mr-1"></text>
  28. <text class="text-gray-500 text-xs">{{ task.serviceType || '施工服务' }}</text>
  29. </view>
  30. <view class="flex items-center">
  31. <text class="uni-icons uniui-clock-filled info-icon text-xs mr-1"></text>
  32. <text class="text-gray-500 text-xs">{{ task.serviceDate || task.scheduleDate || '待定' }} {{ task.serviceTime || task.scheduleTime || '' }}</text>
  33. </view>
  34. <view class="flex items-center">
  35. <text class="uni-icons uniui-location-filled info-icon text-xs mr-1"></text>
  36. <text class="text-gray-500 text-xs truncate">{{ task.address || '暂无地址' }}</text>
  37. </view>
  38. </view>
  39. <view class="pt-3 border-t border-gray-100">
  40. <view class="flow-row">
  41. <view
  42. v-for="(step, i) in steps"
  43. :key="step.key"
  44. class="flow-step"
  45. >
  46. <view class="flow-node-wrap">
  47. <view v-if="i !== 0" class="flow-line" :class="step.active ? 'flow-line-active' : ''" />
  48. <view class="flow-node" :class="step.active ? 'flow-node-active' : (step.current ? 'flow-node-current' : '')">
  49. <text v-if="step.active" class="uni-icons uniui-checkmarkempty flow-check"></text>
  50. <text v-else class="flow-node-text">{{ i + 1 }}</text>
  51. </view>
  52. </view>
  53. <text class="flow-label" :class="step.active ? 'flow-label-active' : ''">{{ step.label }}</text>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. </template>
  59. <script setup lang="ts">
  60. import { computed } from 'vue'
  61. import StatusTag from '../common/StatusTag.vue'
  62. import type { Task } from '@/types'
  63. import { SOP_STEPS } from '@/constants/sop'
  64. const props = defineProps<{
  65. task: Task
  66. }>()
  67. defineEmits<{
  68. click: [taskId: string]
  69. }>()
  70. const steps = computed(() => {
  71. const current = Number(props.task.currentStep) || 0
  72. return SOP_STEPS.map((s, i) => ({
  73. key: s.code,
  74. label: s.title.replace('任务', '').replace('准备', '出车').replace('现场', '到达').replace('签字', '验收'),
  75. active: current >= s.step,
  76. current: current + 1 === s.step,
  77. }))
  78. })
  79. </script>
  80. <style scoped>
  81. .task-card {
  82. background-color: rgba(255, 255, 255, 0.85);
  83. backdrop-filter: blur(14px);
  84. -webkit-backdrop-filter: blur(14px);
  85. border: 1px solid rgba(164, 216, 152, 0.35);
  86. border-radius: 24px;
  87. box-shadow: 0 18px 50px -12px rgba(54, 143, 111, 0.28);
  88. overflow: hidden;
  89. }
  90. .task-card.is-emergency {
  91. border-left: 4px solid #ef4444;
  92. }
  93. .info-icon {
  94. color: #368f6f;
  95. }
  96. .chip-type {
  97. background-color: rgba(164, 216, 152, 0.2);
  98. color: #368f6f;
  99. }
  100. /* 流程条:与任务详情 SOP 流程条一致 */
  101. .flow-row {
  102. display: flex;
  103. align-items: flex-start;
  104. justify-content: space-between;
  105. }
  106. .flow-step {
  107. flex: 1;
  108. display: flex;
  109. flex-direction: column;
  110. align-items: center;
  111. min-width: 0;
  112. }
  113. .flow-node-wrap {
  114. width: 100%;
  115. height: 24px;
  116. position: relative;
  117. display: flex;
  118. align-items: center;
  119. justify-content: center;
  120. }
  121. .flow-line {
  122. position: absolute;
  123. top: 50%;
  124. left: 0;
  125. right: 50%;
  126. height: 2px;
  127. background-color: #e5e7eb;
  128. transform: translateY(-50%);
  129. }
  130. .flow-line-active {
  131. background-color: #368f6f;
  132. }
  133. .flow-node {
  134. width: 22px;
  135. height: 22px;
  136. border-radius: 50%;
  137. background-color: #f3f4f6;
  138. border: 2px solid #e5e7eb;
  139. display: flex;
  140. align-items: center;
  141. justify-content: center;
  142. z-index: 1;
  143. }
  144. .flow-node-active {
  145. background-color: #368f6f;
  146. border-color: #368f6f;
  147. }
  148. .flow-node-current {
  149. background-color: #fff;
  150. border-color: #368f6f;
  151. box-shadow: 0 0 0 3px rgba(54, 143, 111, 0.2);
  152. }
  153. .flow-check {
  154. color: #fff;
  155. font-size: 11px;
  156. }
  157. .flow-node-text {
  158. font-size: 10px;
  159. color: #9ca3af;
  160. }
  161. .flow-node-current .flow-node-text {
  162. color: #368f6f;
  163. font-weight: 600;
  164. }
  165. .flow-label {
  166. margin-top: 6px;
  167. font-size: 10px;
  168. color: #9ca3af;
  169. text-align: center;
  170. }
  171. .flow-label-active {
  172. color: #368f6f;
  173. }
  174. .scale-down {
  175. transition: transform 0.15s ease;
  176. }
  177. .scale-down:active {
  178. transform: scale(0.95);
  179. }
  180. </style>