From ed9826f92b2ed52a64de207996c827404809ca27 Mon Sep 17 00:00:00 2001
From: zlwu <704541015@qq.com>
Date: Mon, 11 Aug 2025 07:15:51 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
mobile/src/common/workflow-api.js | 6 +-
mobile/src/pages/task/myDocument.vue | 239 +++++++++++++++++----------
2 files changed, 156 insertions(+), 89 deletions(-)
diff --git a/mobile/src/common/workflow-api.js b/mobile/src/common/workflow-api.js
index d682b5dd..c4fb5c17 100644
--- a/mobile/src/common/workflow-api.js
+++ b/mobile/src/common/workflow-api.js
@@ -12,15 +12,15 @@ export const workflowApi = {
// 删除流程实例
deleteByInstanceIds: (instanceIds) =>
request({
- url: '/workflow/instance/deleteByInstanceIds',
+ url: `/workflow/instance/deleteByInstanceIds/${instanceIds}`,
method: 'DELETE',
- data: instanceIds,
+ // data: instanceIds,
}),
// 撤销流程申请
cancelProcessApply: (data) =>
request({
url: '/workflow/instance/cancelProcessApply',
- method: 'POST',
+ method: 'PUT',
data,
}),
// 获取流程分类树
diff --git a/mobile/src/pages/task/myDocument.vue b/mobile/src/pages/task/myDocument.vue
index 217b2547..068c09e9 100644
--- a/mobile/src/pages/task/myDocument.vue
+++ b/mobile/src/pages/task/myDocument.vue
@@ -69,53 +69,46 @@
{{ formatTime(item.createTime) }}
-
-
-
-
-
-
+
+
+
+
+
+ 查看
+
-
-
-
- 查看
-
+
+
+
+ 编辑
+
-
-
- 编辑
-
+
+
+
+ 撤销
+
-
-
- 撤销
-
-
-
-
- 删除
-
-
+
+
+
+ 删除
@@ -384,13 +377,53 @@ export default {
},
handleEdit(item) {
- this.routerJump({
- businessId: item.businessId,
- taskId: item.id,
- type: 'update',
- formCustom: item.formCustom,
- formPath: item.formPath,
- });
+ // 动态跳转到formPath对应的路径,携带businessId参数
+ if (item.formPath) {
+ // 确保路径以pages开头
+ let fullPath = item.formPath;
+
+ // 统一处理路径:去掉开头的/,然后添加pages前缀
+ if (!fullPath.startsWith('pages/')) {
+ // 如果以/开头,先去掉/
+ if (fullPath.startsWith('/')) {
+ fullPath = fullPath.substring(1);
+ }
+ // 添加pages前缀
+ fullPath = `pages/${fullPath}`;
+ }
+
+ const url = `/${fullPath}?id=${item.businessId}&type=update`;
+
+ // 添加调试信息
+ console.log('编辑页面 - 原始formPath:', item.formPath);
+ console.log('编辑页面 - 处理后的fullPath:', fullPath);
+ console.log('编辑页面 - 最终跳转URL:', url);
+
+ // 使用navigateTo进行跳转
+ uni.navigateTo({
+ url: url,
+ fail: (err) => {
+ console.error('编辑页面跳转失败:', err);
+ // 如果跳转失败,使用原有的routerJump方法作为备选
+ this.routerJump({
+ businessId: item.businessId,
+ taskId: item.id,
+ type: 'update',
+ formCustom: item.formCustom,
+ formPath: item.formPath,
+ });
+ },
+ });
+ } else {
+ // 如果没有formPath,使用原有的routerJump方法作为备选
+ this.routerJump({
+ businessId: item.businessId,
+ taskId: item.id,
+ type: 'update',
+ formCustom: item.formCustom,
+ formPath: item.formPath,
+ });
+ }
},
handleView(item) {
@@ -409,7 +442,7 @@ export default {
fullPath = `pages/${fullPath}`;
}
- const url = `/${fullPath}?id=${item.businessId}&type=${item.flowStatus}`;
+ const url = `/${fullPath}?id=${item.businessId}&type=update`;
// 添加调试信息
console.log('原始formPath:', item.formPath);
@@ -457,15 +490,19 @@ export default {
const deleteRes = await workflowApi.deleteByInstanceIds([item.id]);
if (deleteRes.code === 200) {
uni.showToast({ title: '删除成功', icon: 'success' });
- this.refreshData();
+ this.loading = false;
+ // 等待数据刷新完成
+ await this.refreshData();
} else {
uni.showToast({ title: deleteRes.msg || '删除失败', icon: 'error' });
+ this.loading = false;
}
+ } else {
+ this.loading = false;
}
} catch (e) {
console.error('删除失败:', e);
uni.showToast({ title: '删除失败', icon: 'error' });
- } finally {
this.loading = false;
}
},
@@ -488,15 +525,19 @@ export default {
const cancelRes = await workflowApi.cancelProcessApply(cancelData);
if (cancelRes.code === 200) {
uni.showToast({ title: '撤销成功', icon: 'success' });
- this.refreshData();
+ this.loading = false;
+ // 等待数据刷新完成
+ await this.refreshData();
} else {
uni.showToast({ title: cancelRes.msg || '撤销失败', icon: 'error' });
+ this.loading = false;
}
+ } else {
+ this.loading = false;
}
} catch (e) {
console.error('撤销失败:', e);
uni.showToast({ title: '撤销失败', icon: 'error' });
- } finally {
this.loading = false;
}
},
@@ -555,7 +596,11 @@ export default {
},
canEdit(item) {
- return item.flowStatus === 'draft' || item.flowStatus === 'back';
+ return (
+ item.flowStatus === 'draft' ||
+ item.flowStatus === 'cancel' ||
+ item.flowStatus === 'back'
+ );
},
canDelete(item) {
@@ -707,47 +752,69 @@ export default {
color: #999;
}
-/* 简洁卡片式样式 */
-.process-actions-card {
- border-radius: 12px;
-}
-
-.action-card-content {
+/* 操作按钮样式 - 参考index.vue设计 */
+.card-actions {
display: flex;
- justify-content: space-between;
- align-items: center;
+ justify-content: flex-end;
+ padding: 0 20rpx 0rpx 20rpx;
+ border-top: 1px solid #f0f0f0;
+ gap: 16rpx;
}
-.status-info {
+.action-btn {
display: flex;
flex-direction: column;
- gap: 4px;
-}
-
-.quick-actions {
- display: flex;
- gap: 16px;
- align-items: center;
-}
-
-.quick-btn {
- display: flex;
align-items: center;
justify-content: center;
- transition: all 0.2s ease;
- padding: 8px;
- gap: 4px;
+ padding: 16rpx 20rpx;
+ border-radius: 12rpx;
+ background-color: #f8f9fa;
+ min-width: 120rpx;
+ transition: all 0.3s ease;
+}
+
+.action-btn:active {
+ transform: scale(0.95);
+ opacity: 0.8;
}
.btn-text {
- font-size: 12px;
- color: #666;
- margin-left: 2px;
+ font-size: 24rpx;
+ margin-top: 8rpx;
+ color: #303133;
+ font-weight: 500;
}
-.quick-btn:active {
- transform: scale(0.9);
- opacity: 0.7;
+.info-btn {
+ background-color: rgba(60, 156, 255, 0);
+}
+
+.info-btn .btn-text {
+ color: #3c9cff;
+}
+
+.success-btn {
+ background-color: rgba(90, 199, 37, 0);
+}
+
+.success-btn .btn-text {
+ color: #5ac725;
+}
+
+.warning-btn {
+ background-color: rgba(255, 153, 0, 0);
+}
+
+.warning-btn .btn-text {
+ color: #ff9900;
+}
+
+.error-btn {
+ background-color: rgba(255, 77, 79, 0);
+}
+
+.error-btn .btn-text {
+ color: #ff4d4f;
}
.pagination {