| | |
| | | method: 'post' |
| | | }) |
| | | } |
| | | |
| | | // 检查任务是否上传了知情同意书 |
| | | export function checkTaskConsentAttachment(taskId) { |
| | | return request({ |
| | | url: '/task/attachment/sync/task/check/' + taskId, |
| | | method: 'post' |
| | | }) |
| | | } |
| | |
| | | |
| | | <script> |
| | | import { mapState } from "vuex"; |
| | | import { getMyTasks, changeTaskStatus } from "@/api/task"; |
| | | import { getMyTasks, changeTaskStatus, checkTaskConsentAttachment } from "@/api/task"; |
| | | import { getUserProfile } from "@/api/system/user"; |
| | | import { getUserBoundVehicle } from "@/api/vehicle"; |
| | | import { getUnreadCount } from "@/api/message"; |
| | |
| | | |
| | | case "complete": |
| | | // 已完成 -> 状态变为已完成 |
| | | this.$modal |
| | | .confirm("确认任务已完成?") |
| | | .then(() => { |
| | | this.updateTaskStatus(task.taskId, "COMPLETED", "任务已完成"); |
| | | }) |
| | | .catch(() => {}); |
| | | // 需要检查是否上传了知情同意书 |
| | | this.checkConsentAttachmentAndThen(task.taskId, "COMPLETED", "任务已完成"); |
| | | break; |
| | | } |
| | | }, |
| | |
| | | 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(() => { |
| | | // 跳转到任务详情页上传附件 |
| | | this.$tab.navigateTo(`/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) { |
| | | const that = this; |
| | |
| | | |
| | | <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"; |
| | |
| | | |
| | | case "complete": |
| | | // 已完成 -> 状态变为已完成 |
| | | this.$modal |
| | | .confirm("确认任务已完成?") |
| | | .then(() => { |
| | | this.updateTaskStatus(task.taskId, "COMPLETED", "任务已完成"); |
| | | }) |
| | | .catch(() => {}); |
| | | // 需要检查是否上传了知情同意书 |
| | | this.checkConsentAttachmentAndThen(task.taskId, "COMPLETED", "任务已完成"); |
| | | break; |
| | | } |
| | | }, |
| | |
| | | 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) { |
| | | const that = this; |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { getTask, changeTaskStatus, setAssigneeReady } from '@/api/task' |
| | | import { getTask, changeTaskStatus, setAssigneeReady, checkTaskConsentAttachment } from '@/api/task' |
| | | import { checkVehicleActiveTasks } from '@/api/task' |
| | | import { getPaymentInfo } from '@/api/payment' |
| | | import { formatDateTime } from '@/utils/common' |
| | |
| | | |
| | | // 更新任务状态 |
| | | updateTaskStatus(status, remark) { |
| | | // 如果是完成状态,需要检查是否上传了知情同意书 |
| | | if (status === 'COMPLETED') { |
| | | this.checkConsentAttachmentAndThen(status, remark); |
| | | } else { |
| | | // 获取GPS位置信息 |
| | | this.getLocationAndUpdateStatus(status, remark) |
| | | this.getLocationAndUpdateStatus(status, remark); |
| | | } |
| | | }, |
| | | |
| | | // 检查知情同意书附件并更新状态 |
| | | async checkConsentAttachmentAndThen(status, remark) { |
| | | try { |
| | | uni.showLoading({ |
| | | title: '检查附件...' |
| | | }); |
| | | |
| | | const response = await checkTaskConsentAttachment(this.taskId); |
| | | |
| | | uni.hideLoading(); |
| | | |
| | | if (response.code === 200) { |
| | | // 已上传知情同意书,继续更新状态 |
| | | this.getLocationAndUpdateStatus(status, remark); |
| | | } else { |
| | | // 未上传知情同意书,显示提示 |
| | | this.$modal.confirm('任务未上传知情同意书,无法完成任务。是否现在去上传?').then(() => { |
| | | // 滚动到附件上传区域 |
| | | this.$nextTick(() => { |
| | | uni.pageScrollTo({ |
| | | scrollTop: 9999, // 滚动到底部 |
| | | duration: 300 |
| | | }); |
| | | }); |
| | | }).catch(() => {}); |
| | | } |
| | | } catch (error) { |
| | | uni.hideLoading(); |
| | | console.error('检查附件失败:', error); |
| | | |
| | | // 如果检查失败,询问用户是否继续 |
| | | this.$modal.confirm('检查附件状态失败,是否继续完成任务?').then(() => { |
| | | this.getLocationAndUpdateStatus(status, remark); |
| | | }).catch(() => {}); |
| | | } |
| | | }, |
| | | |
| | | // 获取位置信息并更新状态 |
| | |
| | | } |
| | | } |
| | | |
| | | @PostMapping("/task/check/{taskId}") |
| | | public AjaxResult checkTaskAttachment(@PathVariable("taskId") Long taskId) { |
| | | try { |
| | | |
| | | Boolean ret=taskAttachmentSyncService.checkAttachment(taskId,"1"); |
| | | if(ret){ |
| | | return AjaxResult.success("已上传知情同意书"); |
| | | }else{ |
| | | return AjaxResult.error(-1,"未上传知情同意书"); |
| | | } |
| | | }catch (Exception e){ |
| | | return AjaxResult.error("检查失败:" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 检查附件是否已同步 |
| | |
| | | */ |
| | | public interface ITaskAttachmentSyncService { |
| | | |
| | | Boolean checkAttachment(Long taskId, String type); |
| | | |
| | | /** |
| | | * 同步单个附件到ImageData |
| | | * |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.ruoyi.common.annotation.DataSource; |
| | | import com.ruoyi.common.config.LegacySystemConfig; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.enums.DataSourceType; |
| | | import com.ruoyi.system.domain.ImageData; |
| | | import com.ruoyi.system.domain.SysTaskAttachment; |
| | | import com.ruoyi.system.domain.SysTaskEmergency; |
| | |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.io.File; |
| | |
| | | private RuoYiConfig ruoYiConfig; |
| | | |
| | | |
| | | /** |
| | | *检查附件是否已经上传 |
| | | * @param taskId |
| | | * @param type 1 知情同意书 |
| | | * 2 病人资料 |
| | | * 3 操作记录 |
| | | * 4 出车前 |
| | | * 5 出车后 |
| | | * 6 系安全带 |
| | | * @return Boolean |
| | | */ |
| | | @Override |
| | | public Boolean checkAttachment(Long taskId, String type){ |
| | | return taskAttachmentMapper.selectSysTaskAttachmentByTaskId(taskId).stream().anyMatch(attachment -> attachment.getAttachmentCategory().equals(type)); |
| | | } |
| | | |
| | | /** |
| | | * 同步单个附件到ImageData |