feat: 添加审批历史页面,处于办公中心下

This commit is contained in:
2026-04-15 15:09:03 +08:00
parent f4dbe29d8e
commit 09f1adb63b
9 changed files with 105 additions and 50 deletions

View File

@@ -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'
})
/**
* 查询当前用户的审批历史
*/
}

View File

@@ -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
}
});

View File

@@ -108,8 +108,7 @@
</template>
<script>
import { getTodoTaskByBiz, listFlowAction, listFlowFormData, listHistoryFlowTask } from '@/views/hrm/js/History'
import { listHistoryFlowTask, listFlowAction, listFlowFormData } from '@/api/hrm/flow'
import { listByIds } from '@/api/system/oss'
import { listUser } from '@/api/system/user'
@@ -127,6 +126,7 @@ export default {
return {
query: { status: undefined, pageNum: 1, pageSize: 50 },
list: [],
total: 0,
loading: false,
detailTask: null,
actionList: [],
@@ -152,10 +152,18 @@ export default {
fetchList() {
this.loading = true
listHistoryFlowTask().then(res => {
this.list = res.data || res.rows || []
if (!this.detailTask && this.list.length) this.openDetail(this.list[0])
}).finally(() => { this.loading = false })
listHistoryFlowTask(this.query).then(res => {
this.list = res.rows || []
this.total = res.total || 0
if (!this.detailTask && this.list.length) {
this.openDetail(this.list[0])
}
}).finally(() => {
this.loading = false
})
},
async openDetail(row) {
@@ -165,9 +173,32 @@ export default {
this.loadFormData(row)
},
loadActions(row) { if (!row || !row.instId) return; this.actionLoading = true; listFlowAction({ instId: row.instId }).then(res => { this.actionList = res.rows || [] }).finally(() => { this.actionLoading = false }) },
loadFormData(row) { if (!row || !row.instId) return; this.formLoading = true; listFlowFormData({ instId: row.instId }).then(res => { this.formData = res.rows || [] }).finally(() => { this.formLoading = false }) },
copyTaskInfo() { if (!this.detailTask) return; const t = this.detailTask; const text = `任务ID:${t.taskId}\n实例:${t.instId}\n业务:${t.bizType}${t.bizId ? `#${t.bizId}` : ''}\n节点:${t.nodeId}\n状态:${t.status}`; navigator.clipboard.writeText(text).then(() => this.$message.success('已复制')) }
loadActions(row) {
if (!row || !row.instId) return;
this.actionLoading = true;
listFlowAction({ instId: row.instId }).then(res => {
this.actionList = res.rows || []
}).finally(() => {
this.actionLoading = false
})
},
loadFormData(row) {
if (!row || !row.instId) return;
this.formLoading = true;
listFlowFormData({ instId: row.instId }).then(res => {
this.formData = res.rows || []
}).finally(() => {
this.formLoading = false
})
},
copyTaskInfo() {
if (!this.detailTask) return;
const t = this.detailTask;
const text = `任务ID:${t.taskId}\n实例:${t.instId}\n业务:${t.bizType}${t.bizId ? `#${t.bizId}` : ''}\n节点:${t.nodeId}\n状态:${t.status}`;
navigator.clipboard.writeText(text).then(() => this.$message.success('已复制'))
}
}
}
</script>