| | |
| | | <!-- 任务编号和开始时间在同一行显示,但分开一些 --> |
| | | <view class="task-code-row"> |
| | | <text class="task-code">{{ task.showTaskCode }}</text> |
| | | <text class="task-time">出发时间:{{ task.startTime }}</text> |
| | | <text class="task-time">{{ task.startTime }}</text> |
| | | </view> |
| | | |
| | | <!-- 任务详细信息 --> |
| | |
| | | |
| | | <script> |
| | | import uniDatetimePicker from "@/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue"; |
| | | import { listTask, changeTaskStatus } from "@/api/task"; |
| | | import { listTask, changeTaskStatus, checkTaskConsentAttachment } from "@/api/task"; |
| | | import { mapState } from "vuex"; |
| | | import { formatDateTime } from "@/utils/common"; |
| | | import { checkTaskCanDepart } from "@/utils/taskValidator"; |
| | |
| | | task.destinationAddress || task.endLocation || "未设置" |
| | | ), |
| | | startTime: task.plannedStartTime |
| | | ? formatDateTime(task.plannedStartTime, "YYYY-MM-DD HH:mm") |
| | | ? (task.plannedStartTime.startsWith('1900') || task.plannedStartTime.startsWith('1970') |
| | | ? '未分配时间' |
| | | : formatDateTime(task.plannedStartTime, "YYYY-MM-DD HH:mm")) |
| | | : "未设置", |
| | | assignee: task.assigneeName || "未分配", |
| | | }; |
| | |
| | | task.destinationAddress || task.endLocation || "未设置" |
| | | ), |
| | | startTime: task.plannedStartTime |
| | | ? formatDateTime(task.plannedStartTime, "YYYY-MM-DD HH:mm") |
| | | ? (task.plannedStartTime.startsWith('1900') || task.plannedStartTime.startsWith('1970') |
| | | ? '未分配时间' |
| | | : formatDateTime(task.plannedStartTime, "YYYY-MM-DD HH:mm")) |
| | | : "未设置", |
| | | assignee: task.assigneeName || "未分配", |
| | | }; |
| | |
| | | |
| | | case "complete": |
| | | // 已完成 -> 状态变为已完成 |
| | | this.$modal |
| | | .confirm("确认任务已完成?") |
| | | .then(() => { |
| | | this.updateTaskStatus(task.taskId, "COMPLETED", "任务已完成"); |
| | | }) |
| | | .catch(() => {}); |
| | | // 需要检查是否上传了知情同意书 |
| | | this.checkConsentAttachmentAndThen(task.taskId, "COMPLETED", "任务已完成"); |
| | | break; |
| | | } |
| | | }, |
| | |
| | | // 获取GPS位置信息 |
| | | this.getLocationAndUpdateStatus(taskId, status, remark); |
| | | }, |
| | | |
| | | // 检查知情同意书附件并更新状态 |
| | | async checkConsentAttachmentAndThen(taskId, status, remark) { |
| | | try { |
| | | uni.showLoading({ |
| | | title: '检查附件...' |
| | | }); |
| | | |
| | | const response = await checkTaskConsentAttachment(taskId); |
| | | |
| | | uni.hideLoading(); |
| | | |
| | | if (response.code === 200) { |
| | | // 已上传知情同意书,继续更新状态 |
| | | this.$modal |
| | | .confirm("确认任务已完成?") |
| | | .then(() => { |
| | | this.updateTaskStatus(taskId, status, remark); |
| | | }) |
| | | .catch(() => {}); |
| | | } else { |
| | | // 未上传知情同意书,显示提示 |
| | | this.$modal.confirm('任务未上传知情同意书,无法完成任务。是否现在去上传?').then(() => { |
| | | // 跳转到任务详情页上传附件 |
| | | uni.navigateTo({ |
| | | url: `/pagesTask/detail?id=${taskId}` |
| | | }); |
| | | }).catch(() => {}); |
| | | } |
| | | } catch (error) { |
| | | uni.hideLoading(); |
| | | console.error('检查附件失败:', error); |
| | | |
| | | // 如果检查失败,询问用户是否继续 |
| | | this.$modal.confirm('检查附件状态失败,是否继续完成任务?').then(() => { |
| | | this.updateTaskStatus(taskId, status, remark); |
| | | }).catch(() => {}); |
| | | } |
| | | }, |
| | | |
| | | // 获取位置信息并更新状态 |
| | | getLocationAndUpdateStatus(taskId, status, remark) { |