| | |
| | | </view> |
| | | <view class="info-item" v-if="taskDetail.emergencyInfo.patientCondition"> |
| | | <view class="label">病情描述</view> |
| | | <view class="value">{{ taskDetail.emergencyInfo.patientCondition }}</view> |
| | | <view class="value" style="white-space: pre-line;">{{ taskDetail.emergencyInfo.patientCondition }}</view> |
| | | </view> |
| | | </view> |
| | | |
| | |
| | | |
| | | <!-- 操作按钮区域 --> |
| | | <view class="action-buttons" v-if="taskDetail"> |
| | | <!-- 待处理状态: 显示出发、取消 --> |
| | | <!-- 待处理状态: 显示编辑、出发、取消 --> |
| | | <template v-if="taskDetail.taskStatus === 'PENDING'"> |
| | | <button |
| | | class="action-btn edit" |
| | | @click="handleEdit" |
| | | > |
| | | 修改 |
| | | </button> |
| | | <button |
| | | class="action-btn primary" |
| | | @click="handleTaskAction('depart')" |
| | |
| | | </button> |
| | | </template> |
| | | |
| | | <!-- 出发中状态: 显示已到达、强制结束 --> |
| | | <!-- 出发中状态: 显示编辑、已到达、强制结束 --> |
| | | <template v-else-if="taskDetail.taskStatus === 'DEPARTING'"> |
| | | <button |
| | | class="action-btn edit" |
| | | @click="handleEdit" |
| | | > |
| | | 修改 |
| | | </button> |
| | | <button |
| | | class="action-btn primary" |
| | | @click="handleTaskAction('arrive')" |
| | |
| | | </button> |
| | | </template> |
| | | |
| | | <!-- 已到达状态: 显示已返程 --> |
| | | <!-- 已到达状态: 显示编辑、已返程 --> |
| | | <template v-else-if="taskDetail.taskStatus === 'ARRIVED'"> |
| | | <button |
| | | class="action-btn edit" |
| | | @click="handleEdit" |
| | | > |
| | | 修改 |
| | | </button> |
| | | <button |
| | | class="action-btn primary" |
| | | @click="handleTaskAction('return')" |
| | |
| | | </button> |
| | | </template> |
| | | |
| | | <!-- 返程中状态: 显示已完成 --> |
| | | <!-- 返程中状态: 显示编辑、已完成 --> |
| | | <template v-else-if="taskDetail.taskStatus === 'RETURNING'"> |
| | | <button |
| | | class="action-btn edit" |
| | | @click="handleEdit" |
| | | > |
| | | 修改 |
| | | </button> |
| | | <button |
| | | class="action-btn primary" |
| | | @click="handleTaskAction('complete')" |
| | |
| | | this.taskId = options.id |
| | | this.loadTaskDetail() |
| | | }, |
| | | onShow() { |
| | | // 每次页面显示时重新加载数据,确保从编辑页面返回后能看到最新数据 |
| | | if (this.taskId) { |
| | | this.loadTaskDetail() |
| | | } |
| | | }, |
| | | methods: { |
| | | // 加载任务详情 |
| | | loadTaskDetail() { |
| | |
| | | getTask(this.taskId).then(response => { |
| | | this.taskDetail = response.data || response |
| | | // 调试:打印返回的数据 |
| | | // console.log('任务详情完整数据:', JSON.stringify(this.taskDetail, null, 2)) |
| | | // console.log('任务类型字段值:', this.taskDetail.taskType) |
| | | // console.log('任务状态字段值:', this.taskDetail.taskStatus) |
| | | // console.log('出发地址:', this.taskDetail.departureAddress) |
| | | // console.log('目的地址:', this.taskDetail.destinationAddress) |
| | | console.log('任务详情完整数据:', JSON.stringify(this.taskDetail, null, 2)) |
| | | console.log('任务类型字段值:', this.taskDetail.taskType) |
| | | console.log('任务状态字段值:', this.taskDetail.taskStatus) |
| | | console.log('出发地址:', this.taskDetail.departureAddress) |
| | | console.log('目的地址:', this.taskDetail.destinationAddress) |
| | | console.log('转运任务信息 (emergencyInfo):', this.taskDetail.emergencyInfo) |
| | | }).catch(error => { |
| | | console.error('加载任务详情失败:', error) |
| | | this.$modal.showToast('加载任务详情失败') |
| | |
| | | // 返回上一页 |
| | | goBack() { |
| | | uni.navigateBack() |
| | | }, |
| | | |
| | | // 处理编辑按钮 |
| | | handleEdit() { |
| | | if (!this.taskDetail) { |
| | | this.$modal.showToast('任务信息不存在') |
| | | return |
| | | } |
| | | |
| | | // 检查任务状态,已完成或已取消的任务不能编辑 |
| | | if (this.isTaskFinished) { |
| | | this.$modal.showToast('已完成或已取消的任务不能编辑') |
| | | return |
| | | } |
| | | |
| | | const taskType = this.taskDetail.taskType |
| | | const taskId = this.taskDetail.taskId |
| | | |
| | | // 根据任务类型跳转到不同的编辑页面 |
| | | if (taskType === 'EMERGENCY_TRANSFER') { |
| | | // 转运任务:跳转到转运任务编辑页面 |
| | | uni.navigateTo({ |
| | | url: `/pages/task/edit-emergency?id=${taskId}` |
| | | }) |
| | | } else if (taskType === 'WELFARE') { |
| | | // 福祗车任务:跳转到福祗车编辑页面 |
| | | uni.navigateTo({ |
| | | url: `/pages/task/edit-welfare?id=${taskId}` |
| | | }) |
| | | } else { |
| | | // 其他任务:跳转到通用任务编辑页面 |
| | | uni.navigateTo({ |
| | | url: `/pages/task/edit?id=${taskId}` |
| | | }) |
| | | } |
| | | }, |
| | | |
| | | // 获取状态文本 |
| | |
| | | background-color: #f0f0f0; |
| | | color: #333; |
| | | |
| | | &.edit { |
| | | background-color: #ff9500; |
| | | color: white; |
| | | } |
| | | |
| | | &.primary { |
| | | background-color: #007AFF; |
| | | color: white; |