缓存(默认 false)
- title: 'title' // 设置该路由在侧边栏和面包屑中展示的名字
- icon: 'svg-name' // 设置该路由的图标,对应路径src/assets/icons/svg
- breadcrumb: false // 如果设置为false,则不会在breadcrumb面包屑中显示
- activeMenu: '/system/user' // 当路由设置了该属性,则会高亮相对应的侧边栏。
- }
- */
-
// 公共路由
export const constantRoutes = [
{
@@ -73,12 +51,10 @@ export const constantRoutes = [
name: "Index",
meta: { title: "工作台", icon: "dashboard", affix: true },
beforeEnter: (to, from, next) => {
- // 从本地存储获取角色信息
currentRole().then((res) => {
- console.log(res)
const role = res.data[0].roleKey;
if (role === "temp") {
- next("/temp"); // 重定向到临时页面
+ next("/temp");
} else {
next();
}
@@ -91,16 +67,15 @@ export const constantRoutes = [
path: "/temp",
component: () => import("@/views/temp"),
name: "Temp",
- hidden: true, // 隐藏路由
+ hidden: true,
meta: { title: "临时页面", icon: "dashboard" },
beforeEnter: (to, from, next) => {
- // 从本地存储获取角色信息
currentRole().then((res) => {
const role = res.data[0].roleKey;
if (role === "temp") {
next();
} else {
- next("/index"); // 重定向到工作台
+ next("/index");
}
});
},
@@ -144,14 +119,12 @@ export const constantRoutes = [
name: "updateOnboarding",
meta: { title: "更新入职数据", activeMenu: "/people/onboarding" },
},
-
{
path: "addOffboarding",
component: () => import("@/views/oa/offboarding/add"),
name: "addOffboarding",
meta: { title: "新增离职申请", activeMenu: "/people/offboarding" },
},
-
{
path: "updateOffboarding/:offboardingId(\\d+)",
component: () => import("@/views/oa/offboarding/update"),
@@ -174,7 +147,6 @@ export const constantRoutes = [
},
],
},
-
{
path: "/money",
component: Layout,
@@ -188,7 +160,6 @@ export const constantRoutes = [
},
],
},
-
{
path: "/claim",
component: Layout,
@@ -210,7 +181,6 @@ export const constantRoutes = [
},
];
-// 动态路由,基于用户权限动态去加载
export const dynamicRoutes = [
{
path: "/system/user-auth",
@@ -240,7 +210,6 @@ export const dynamicRoutes = [
},
],
},
-
{
path: "/system/dict-data",
component: Layout,
@@ -255,7 +224,6 @@ export const dynamicRoutes = [
},
],
},
-
{
path: "/oa/warehouse-data",
component: Layout,
@@ -348,23 +316,20 @@ export const dynamicRoutes = [
},
];
-// 防止连续点击多次路由报错
let routerPush = Router.prototype.push;
let routerReplace = Router.prototype.replace;
-// push
-Router.prototype.push = function push (location) {
+Router.prototype.push = function push(location) {
return routerPush.call(this, location).catch((err) => err);
};
-// replace
-Router.prototype.replace = function push (location) {
+Router.prototype.replace = function replace(location) {
return routerReplace.call(this, location).catch((err) => err);
};
const router = new Router({
base: process.env.VUE_APP_CONTEXT_PATH,
- mode: "history", // 去掉url中的#
+ mode: "history",
scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes,
});
-export default router;
+export default router;
\ No newline at end of file
diff --git a/ruoyi-ui/src/store/modules/permission.js b/ruoyi-ui/src/store/modules/permission.js
index 2287665..45f3259 100644
--- a/ruoyi-ui/src/store/modules/permission.js
+++ b/ruoyi-ui/src/store/modules/permission.js
@@ -34,6 +34,36 @@ const permission = {
return new Promise(resolve => {
// 向后端请求路由数据
getRouters().then(res => {
+
+ // ================= 新增拦截代码:将页面注入到办公中心开始 =================
+ // 寻找后端传来的“办公中心”节点(根据路径或标题匹配)
+ const oaMenu = res.data.find(item => item.path === '/oa' || (item.meta && item.meta.title === '办公中心'));
+
+ if (oaMenu) {
+ if (!oaMenu.children) oaMenu.children = [];
+
+ // 防重判断,避免代码热更新时重复添加导致菜单重复
+ const hasHistory = oaMenu.children.some(child => child.path === 'flowHistory');
+
+ if (!hasHistory) {
+ oaMenu.children.push({
+ name: 'FlowHistory',
+ path: 'flowHistory', // 浏览器地址后缀,点击后地址变为 /oa/flowHistory
+ hidden: false, // 确保在左侧菜单显示
+ // 【特别注意】:这里对应的是你存放 vue 文件的真实相对路径
+ // 根据你最初的代码,我推测在 hrm/flow 文件夹下。
+ // 如果你的文件名叫 taskHistory.vue,请把下面的 flowHistory 改成 taskHistory
+ component: 'hrm/flow/flowHistory',
+ meta: {
+ title: '审批历史',
+ icon: 'date-range', // 菜单图标,支持 element 图标
+ noCache: false
+ }
+ });
+ }
+ }
+ // ================= 新增拦截代码:将页面注入到办公中心结束 =================
+
const sdata = JSON.parse(JSON.stringify(res.data))
const rdata = JSON.parse(JSON.stringify(res.data))
const sidebarRoutes = filterAsyncRouter(sdata)
@@ -130,4 +160,4 @@ export const loadView = (view) => {
}
}
-export default permission
+export default permission
\ No newline at end of file
diff --git a/ruoyi-ui/src/views/hrm/flow/taskHistory.vue b/ruoyi-ui/src/views/hrm/flow/taskHistory.vue
new file mode 100644
index 0000000..5492357
--- /dev/null
+++ b/ruoyi-ui/src/views/hrm/flow/taskHistory.vue
@@ -0,0 +1,205 @@
+
+
+
+
+
+
+
+
+
+
+ {{ statusText(scope.row.status) }}
+
+
+
+
+ {{ bizTypeText(scope.row.bizType) }}
+ #{{ scope.row.bizId }}
+
+
+
+
+
+ 查看详情
+
+
+
+
+
+
+
+
+
+
+
请在左侧选择一条任务
+
将展示业务信息、表单字段、流转历史
+
+
+
+
+
+
{{ bizTypeText(detailTask.bizType) }} · 任务 #{{ detailTask.taskId }}
+
+ {{ statusText(detailTask.status) }}
+ 实例 {{ detailTask.instId }} · 节点 {{ detailTask.nodeId }}
+
+
+
+
+
办理人
+
{{ formatUser(detailTask.assigneeUserId, 'userId') }}
+
+
+
到期
+
{{ formatDate(detailTask.expireTime) || '-' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ actionText(a.action) }}
+ · 办理人:{{ formatUser(a.createBy, 'createBy') }}
+
+
+
+
+
+ 暂无流转记录
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ruoyi-ui/src/views/hrm/index.vue b/ruoyi-ui/src/views/hrm/index.vue
index b896cf6..1825d9c 100644
--- a/ruoyi-ui/src/views/hrm/index.vue
+++ b/ruoyi-ui/src/views/hrm/index.vue
@@ -17,6 +17,9 @@
薪酬与指标
+
+ 审批历史
+
diff --git a/ruoyi-ui/src/views/hrm/js/History b/ruoyi-ui/src/views/hrm/js/History
new file mode 100644
index 0000000..3028a36
--- /dev/null
+++ b/ruoyi-ui/src/views/hrm/js/History
@@ -0,0 +1,36 @@
+import request from '@/utils/request'
+
+// 获取审批历史(已完成)
+export function listHistoryFlowTask(query) {
+ return request({
+ url: '/workflow/task/historyList',
+ method: 'get',
+ params: query
+ })
+}
+
+// 任务详情
+export function getTodoTaskByBiz(taskId) {
+ return request({
+ url: '/workflow/task/getByTaskId/' + taskId,
+ method: 'get'
+ })
+}
+
+// 审批记录
+export function listFlowAction(query) {
+ return request({
+ url: '/workflow/instance/action/list',
+ method: 'get',
+ params: query
+ })
+}
+
+// 表单数据
+export function listFlowFormData(query) {
+ return request({
+ url: '/workflow/instance/form/data',
+ method: 'get',
+ params: query
+ })
+}
\ No newline at end of file
From 09f1adb63b401c2469da6a035edf072de49e8887 Mon Sep 17 00:00:00 2001
From: zuqijia <2924963185@qq.com>
Date: Wed, 15 Apr 2026 15:09:03 +0800
Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=AE=A1?=
=?UTF-8?q?=E6=89=B9=E5=8E=86=E5=8F=B2=E9=A1=B5=E9=9D=A2=EF=BC=8C=E5=A4=84?=
=?UTF-8?q?=E4=BA=8E=E5=8A=9E=E5=85=AC=E4=B8=AD=E5=BF=83=E4=B8=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../hrm/controller/HrmFlowTaskController.java | 11 +++++
.../hrm/service/IHrmFlowTaskService.java | 5 ++
.../service/impl/HrmFlowTaskServiceImpl.java | 24 +++++++++
.../controller/workflow/WfTaskController.java | 8 ---
.../workflow/service/IWfTaskService.java | 5 +-
.../service/impl/WfTaskServiceImpl.java | 18 ++-----
ruoyi-ui/src/api/hrm/flow.js | 12 +++++
ruoyi-ui/src/store/modules/permission.js | 23 ++++-----
ruoyi-ui/src/views/hrm/flow/taskHistory.vue | 49 +++++++++++++++----
9 files changed, 105 insertions(+), 50 deletions(-)
diff --git a/fad-hrm/src/main/java/com/ruoyi/hrm/controller/HrmFlowTaskController.java b/fad-hrm/src/main/java/com/ruoyi/hrm/controller/HrmFlowTaskController.java
index b7aaf50..07c299a 100644
--- a/fad-hrm/src/main/java/com/ruoyi/hrm/controller/HrmFlowTaskController.java
+++ b/fad-hrm/src/main/java/com/ruoyi/hrm/controller/HrmFlowTaskController.java
@@ -6,6 +6,7 @@ import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.helper.LoginHelper;
import com.ruoyi.hrm.domain.bo.HrmFlowTaskBo;
import com.ruoyi.hrm.domain.bo.HrmFlowTaskApproveBo;
import com.ruoyi.hrm.domain.bo.HrmSealStampBo;
@@ -112,4 +113,14 @@ public class HrmFlowTaskController extends BaseController {
@RequestParam(required = false) String remark) {
return toAjax(service.transfer(taskId, newAssigneeUserId, actionUserId, remark));
}
+ /**
+ * 审批历史列表:查询当前用户的审批历史,包含分页
+ */
+ @GetMapping("/historyList")
+ public TableDataInfo historyList(PageQuery pageQuery) {
+ // 使用若依自带的 LoginHelper 获取当前登录用户的 ID (类型是 Long)
+ Long userId = LoginHelper.getUserId();
+ // 调用 Service
+ return service.selectHistoryTaskList(userId, pageQuery);
+ }
}
diff --git a/fad-hrm/src/main/java/com/ruoyi/hrm/service/IHrmFlowTaskService.java b/fad-hrm/src/main/java/com/ruoyi/hrm/service/IHrmFlowTaskService.java
index 514d360..d2c5f60 100644
--- a/fad-hrm/src/main/java/com/ruoyi/hrm/service/IHrmFlowTaskService.java
+++ b/fad-hrm/src/main/java/com/ruoyi/hrm/service/IHrmFlowTaskService.java
@@ -2,6 +2,7 @@ package com.ruoyi.hrm.service;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.hrm.domain.HrmFlowTask;
import com.ruoyi.hrm.domain.bo.HrmFlowTaskBo;
import com.ruoyi.hrm.domain.vo.HrmFlowTaskVo;
@@ -42,6 +43,10 @@ public interface IHrmFlowTaskService {
*/
Boolean transfer(Long taskId, Long newAssigneeUserId, Long actionUserId, String remark);
+ /**
+ * 查询当前用户的审批历史,并回填业务数据
+ */
+ TableDataInfo selectHistoryTaskList(Long userId, PageQuery pageQuery);
/**
* 根据业务类型 + 业务ID 查询当前待办任务(pending),用于详情页自动带出 currentTaskId
*/
diff --git a/fad-hrm/src/main/java/com/ruoyi/hrm/service/impl/HrmFlowTaskServiceImpl.java b/fad-hrm/src/main/java/com/ruoyi/hrm/service/impl/HrmFlowTaskServiceImpl.java
index 3a09cd8..73a5ce4 100644
--- a/fad-hrm/src/main/java/com/ruoyi/hrm/service/impl/HrmFlowTaskServiceImpl.java
+++ b/fad-hrm/src/main/java/com/ruoyi/hrm/service/impl/HrmFlowTaskServiceImpl.java
@@ -38,6 +38,7 @@ public class HrmFlowTaskServiceImpl implements IHrmFlowTaskService {
private final FlowAssigneeHelper assigneeHelper;
private final BizStatusSyncHelper bizStatusSyncHelper;
+ private final HrmFlowTaskMapper hrmFlowTaskMapper;
// 注入五个业务Mapper
private final HrmLeaveReqMapper leaveReqMapper;
private final HrmTravelReqMapper travelReqMapper;
@@ -397,4 +398,27 @@ public class HrmFlowTaskServiceImpl implements IHrmFlowTaskService {
lqw.orderByDesc(HrmFlowTask::getCreateTime);
return lqw;
}
+ /**
+ * 查询当前用户的审批历史,回填业务数据以便前端复用页面
+ */
+ @Override
+ public TableDataInfo selectHistoryTaskList(Long userId, PageQuery pageQuery) {
+
+ LambdaQueryWrapper lqw = Wrappers.lambdaQuery();
+
+ lqw.eq(HrmFlowTask::getAssigneeUserId, userId);
+
+ lqw.ne(HrmFlowTask::getStatus, "pending");
+
+ lqw.orderByDesc(HrmFlowTask::getCreateTime);
+
+ Page result = baseMapper.selectVoPage(pageQuery.build(), lqw);
+
+ if (result.getRecords() != null && !result.getRecords().isEmpty()) {
+ fillBizData(result.getRecords());
+ }
+
+ return TableDataInfo.build(result);
+ }
+
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/workflow/WfTaskController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/workflow/WfTaskController.java
index c42b0b7..c1ab077 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/workflow/WfTaskController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/workflow/WfTaskController.java
@@ -174,12 +174,4 @@ public class WfTaskController {
}
}
}
- /**
- * 审批历史列表
- */
- @SaCheckPermission("workflow:task:historyList")
- @GetMapping("/historyList")
- public R historyList() {
- return R.ok(flowTaskService.selectHistoryTaskList());
- }
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/workflow/service/IWfTaskService.java b/ruoyi-system/src/main/java/com/ruoyi/workflow/service/IWfTaskService.java
index f2e0f2d..b94014a 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/workflow/service/IWfTaskService.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/workflow/service/IWfTaskService.java
@@ -1,5 +1,6 @@
package com.ruoyi.workflow.service;
+
import com.ruoyi.workflow.domain.FlowRecord;
import com.ruoyi.workflow.domain.bo.WfTaskBo;
import org.flowable.bpmn.model.FlowElement;
@@ -126,8 +127,4 @@ public interface IWfTaskService {
*/
Map checkTaskNodeType(String taskId);
- /**
- * 查询当前用户的审批历史(排除待审批状态)
- */
- List selectHistoryTaskList();
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/workflow/service/impl/WfTaskServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/workflow/service/impl/WfTaskServiceImpl.java
index b4a0e63..56083b0 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/workflow/service/impl/WfTaskServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/workflow/service/impl/WfTaskServiceImpl.java
@@ -4,6 +4,8 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.AbstractWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.core.service.UserService;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.helper.LoginHelper;
@@ -790,20 +792,6 @@ public class WfTaskServiceImpl extends FlowServiceFactory implements IWfTaskServ
return result;
}
- /**
- * 查询当前用户的审批历史(排除待办任务)
- */
- @Override
- public List selectHistoryTaskList() {
- // 获取当前登录用户ID
- String userId = TaskUtils.getUserId();
- // Flowable 原生查询:当前用户 + 已完成(排除待办pending)
- return historyService.createHistoricTaskInstanceQuery()
- .taskAssignee(userId) // 审批人是当前用户
- .finished() // 已完成(排除待办)
- .orderByHistoricTaskInstanceEndTime()
- .desc() // 按完成时间倒序,最新的在最前面
- .list();
- }
+
}
diff --git a/ruoyi-ui/src/api/hrm/flow.js b/ruoyi-ui/src/api/hrm/flow.js
index 9fda8de..a266cc3 100644
--- a/ruoyi-ui/src/api/hrm/flow.js
+++ b/ruoyi-ui/src/api/hrm/flow.js
@@ -238,6 +238,13 @@ export function delFlowInstance (instId) {
method: 'delete'
})
}
+export function listHistoryFlowTask(query) {
+ return request({
+ url: '/hrm/flow/task/historyList',
+ method: 'get',
+ params: query
+ })
+}
/**
* 查询实例对应的所有审批任务
@@ -247,4 +254,9 @@ export function listAssignTask (instId) {
url: `/hrm/flow/instance/tasks/${instId}`,
method: 'get'
})
+
+/**
+ * 查询当前用户的审批历史
+ */
+
}
diff --git a/ruoyi-ui/src/store/modules/permission.js b/ruoyi-ui/src/store/modules/permission.js
index 45f3259..766d105 100644
--- a/ruoyi-ui/src/store/modules/permission.js
+++ b/ruoyi-ui/src/store/modules/permission.js
@@ -29,34 +29,29 @@ const permission = {
},
},
actions: {
- // 生成路由
- GenerateRoutes({ commit }) {
+ GenerateRoutes({ commit }) {
return new Promise(resolve => {
- // 向后端请求路由数据
+
getRouters().then(res => {
- // ================= 新增拦截代码:将页面注入到办公中心开始 =================
- // 寻找后端传来的“办公中心”节点(根据路径或标题匹配)
+
const oaMenu = res.data.find(item => item.path === '/oa' || (item.meta && item.meta.title === '办公中心'));
if (oaMenu) {
if (!oaMenu.children) oaMenu.children = [];
- // 防重判断,避免代码热更新时重复添加导致菜单重复
+
const hasHistory = oaMenu.children.some(child => child.path === 'flowHistory');
if (!hasHistory) {
oaMenu.children.push({
- name: 'FlowHistory',
- path: 'flowHistory', // 浏览器地址后缀,点击后地址变为 /oa/flowHistory
- hidden: false, // 确保在左侧菜单显示
- // 【特别注意】:这里对应的是你存放 vue 文件的真实相对路径
- // 根据你最初的代码,我推测在 hrm/flow 文件夹下。
- // 如果你的文件名叫 taskHistory.vue,请把下面的 flowHistory 改成 taskHistory
- component: 'hrm/flow/flowHistory',
+ name: 'HrmFlowHistory',
+ path: 'flowHistory',
+ hidden: false,
+ component: 'hrm/flow/taskHistory',
meta: {
title: '审批历史',
- icon: 'date-range', // 菜单图标,支持 element 图标
+ icon: 'date-range',
noCache: false
}
});
diff --git a/ruoyi-ui/src/views/hrm/flow/taskHistory.vue b/ruoyi-ui/src/views/hrm/flow/taskHistory.vue
index 5492357..05db498 100644
--- a/ruoyi-ui/src/views/hrm/flow/taskHistory.vue
+++ b/ruoyi-ui/src/views/hrm/flow/taskHistory.vue
@@ -108,8 +108,7 @@