From b30c1ebb0e46e734e70f8731484764f449f48818 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期三, 24 十二月 2025 00:04:30 +0800
Subject: [PATCH] feat:已完成时,增加知情同意书的上传判断
---
app/api/task.js | 8 ++
app/pages/index.vue | 47 ++++++++++-
ruoyi-system/src/main/java/com/ruoyi/system/service/ITaskAttachmentSyncService.java | 4
ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskAttachmentSyncController.java | 14 +++
app/pagesTask/detail.vue | 48 +++++++++++
app/pages/task/index.vue | 49 ++++++++++-
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TaskAttachmentSyncServiceImpl.java | 18 +++
7 files changed, 167 insertions(+), 21 deletions(-)
diff --git a/app/api/task.js b/app/api/task.js
index 742c650..f958fc0 100644
--- a/app/api/task.js
+++ b/app/api/task.js
@@ -157,3 +157,11 @@
method: 'post'
})
}
+
+// 妫�鏌ヤ换鍔℃槸鍚︿笂浼犱簡鐭ユ儏鍚屾剰涔�
+export function checkTaskConsentAttachment(taskId) {
+ return request({
+ url: '/task/attachment/sync/task/check/' + taskId,
+ method: 'post'
+ })
+}
diff --git a/app/pages/index.vue b/app/pages/index.vue
index 46ca76b..7f37adb 100644
--- a/app/pages/index.vue
+++ b/app/pages/index.vue
@@ -237,7 +237,7 @@
<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";
@@ -748,12 +748,8 @@
case "complete":
// 宸插畬鎴� -> 鐘舵�佸彉涓哄凡瀹屾垚
- this.$modal
- .confirm("纭浠诲姟宸插畬鎴愶紵")
- .then(() => {
- this.updateTaskStatus(task.taskId, "COMPLETED", "浠诲姟宸插畬鎴�");
- })
- .catch(() => {});
+ // 闇�瑕佹鏌ユ槸鍚︿笂浼犱簡鐭ユ儏鍚屾剰涔�
+ this.checkConsentAttachmentAndThen(task.taskId, "COMPLETED", "浠诲姟宸插畬鎴�");
break;
}
},
@@ -763,6 +759,43 @@
// 鑾峰彇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(() => {
+ // 璺宠浆鍒颁换鍔¤鎯呴〉涓婁紶闄勪欢
+ 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) {
diff --git a/app/pages/task/index.vue b/app/pages/task/index.vue
index 4a9c45c..a0432b3 100644
--- a/app/pages/task/index.vue
+++ b/app/pages/task/index.vue
@@ -275,7 +275,7 @@
<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";
@@ -825,12 +825,8 @@
case "complete":
// 宸插畬鎴� -> 鐘舵�佸彉涓哄凡瀹屾垚
- this.$modal
- .confirm("纭浠诲姟宸插畬鎴愶紵")
- .then(() => {
- this.updateTaskStatus(task.taskId, "COMPLETED", "浠诲姟宸插畬鎴�");
- })
- .catch(() => {});
+ // 闇�瑕佹鏌ユ槸鍚︿笂浼犱簡鐭ユ儏鍚屾剰涔�
+ this.checkConsentAttachmentAndThen(task.taskId, "COMPLETED", "浠诲姟宸插畬鎴�");
break;
}
},
@@ -840,6 +836,45 @@
// 鑾峰彇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) {
diff --git a/app/pagesTask/detail.vue b/app/pagesTask/detail.vue
index 4034c6a..6e0fdee 100644
--- a/app/pagesTask/detail.vue
+++ b/app/pagesTask/detail.vue
@@ -464,7 +464,7 @@
</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'
@@ -948,8 +948,50 @@
// 鏇存柊浠诲姟鐘舵��
updateTaskStatus(status, remark) {
- // 鑾峰彇GPS浣嶇疆淇℃伅
- this.getLocationAndUpdateStatus(status, remark)
+ // 濡傛灉鏄畬鎴愮姸鎬侊紝闇�瑕佹鏌ユ槸鍚︿笂浼犱簡鐭ユ儏鍚屾剰涔�
+ if (status === 'COMPLETED') {
+ this.checkConsentAttachmentAndThen(status, remark);
+ } else {
+ // 鑾峰彇GPS浣嶇疆淇℃伅
+ 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(() => {});
+ }
},
// 鑾峰彇浣嶇疆淇℃伅骞舵洿鏂扮姸鎬�
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskAttachmentSyncController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskAttachmentSyncController.java
index 88187c7..5bd04aa 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskAttachmentSyncController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskAttachmentSyncController.java
@@ -87,6 +87,20 @@
}
}
+ @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());
+ }
+ }
/**
* 妫�鏌ラ檮浠舵槸鍚﹀凡鍚屾
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ITaskAttachmentSyncService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ITaskAttachmentSyncService.java
index 8be9b6e..faeaed4 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ITaskAttachmentSyncService.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ITaskAttachmentSyncService.java
@@ -11,7 +11,9 @@
* @author ruoyi
*/
public interface ITaskAttachmentSyncService {
-
+
+ Boolean checkAttachment(Long taskId, String type);
+
/**
* 鍚屾鍗曚釜闄勪欢鍒癐mageData
*
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TaskAttachmentSyncServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TaskAttachmentSyncServiceImpl.java
index 19ceac4..81bc722 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TaskAttachmentSyncServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TaskAttachmentSyncServiceImpl.java
@@ -1,9 +1,7 @@
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;
@@ -16,7 +14,6 @@
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;
@@ -50,6 +47,21 @@
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));
+ }
/**
* 鍚屾鍗曚釜闄勪欢鍒癐mageData
--
Gitblit v1.9.1