提交修改

This commit is contained in:
zlwu committed 2025-08-11 07:15:51 +08:00
1 parent 544162d8c6
commit ed9826f92b
2 files changed
+156 -89

No files matched your search

+3 -3
View File
@@ -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,
}),
// 获取流程分类树
+153 -86
View File
@@ -69,53 +69,46 @@
<text class="process-time">{{ formatTime(item.createTime) }}</text>
</view>
<!-- 操作按钮 - 方案三:简洁卡片式 -->
<view class="process-actions-card" @click.stop>
<view class="action-card-content">
<view class="status-info">
<!-- 状态信息可以在这里添加 -->
</view>
<!-- 操作按钮 -->
<view class="card-actions" @click.stop>
<!-- 查看按钮:只在不能编辑时显示 -->
<view
v-if="!canEdit(item)"
class="action-btn info-btn"
@click="handleView(item)"
>
<u-icon name="eye" size="16" color="#3c9cff"></u-icon>
<text class="btn-text">查看</text>
</view>
<view class="quick-actions">
<view class="quick-btn" @click="handleView(item)">
<u-icon name="eye" size="20" color="#666"></u-icon>
<text class="btn-text">查看</text>
</view>
<!-- 编辑按钮:在draft、cancel、back状态时显示 -->
<view
v-if="canEdit(item)"
class="action-btn success-btn"
@click="handleEdit(item)"
>
<u-icon name="edit-pen" size="16" color="#5ac725"></u-icon>
<text class="btn-text">编辑</text>
</view>
<view
v-if="canEdit(item)"
class="quick-btn"
@click="handleEdit(item)"
>
<u-icon name="edit-pen" size="20" color="#666"></u-icon>
<text class="btn-text">编辑</text>
</view>
<!-- 撤销按钮:只在waiting状态时显示 -->
<view
v-if="item.flowStatus === 'waiting'"
class="action-btn warning-btn"
@click="handleCancel(item)"
>
<u-icon name="reload" size="16" color="#ff9900"></u-icon>
<text class="btn-text">撤销</text>
</view>
<view
v-if="item.flowStatus === 'waiting'"
class="quick-btn"
@click="handleCancel(item)"
>
<text
class="iconfont icon-chexiao"
style="
font-size: 20px;
color: #faad14;
background-color: transparent;
"
></text>
<text class="btn-text" style="color: #faad14">撤销</text>
</view>
<view
v-if="canDelete(item)"
class="quick-btn"
@click="handleDelete(item)"
>
<u-icon name="close" size="20" color="#ff4d4f"></u-icon>
<text class="btn-text" style="color: #ff4d4f">删除</text>
</view>
</view>
<!-- 删除按钮:在可删除状态时显示 -->
<view
v-if="canDelete(item)"
class="action-btn error-btn"
@click="handleDelete(item)"
>
<u-icon name="close" size="16" color="#ff4d4f"></u-icon>
<text class="btn-text">删除</text>
</view>
</view>
</view>
@@ -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 {