feat(oa): 完成审批历史页面全链路开发,含前后端接口、菜单配置
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user