diff --git a/.env.develop b/.env.develop index c8349cd4..8ace0858 100644 --- a/.env.develop +++ b/.env.develop @@ -1,2 +1,3 @@ ENV=develop -VITE_APP_BASE_API=/api \ No newline at end of file +VITE_APP_BASE_API=/api +VITE_TOKEN_KEY = X-Access-Token diff --git a/.env.production b/.env.production index 990e0635..73450e9f 100644 --- a/.env.production +++ b/.env.production @@ -1,2 +1,3 @@ ENV=production -VITE_APP_BASE_API=/api \ No newline at end of file +VITE_APP_BASE_API=/api +VITE_TOKEN_KEY = X-Access-Token diff --git a/src/utils/menu.ts b/src/utils/menu.ts index 28c4d182..cc591920 100644 --- a/src/utils/menu.ts +++ b/src/utils/menu.ts @@ -172,17 +172,25 @@ const handleButtons = (buttons?: Buttons) => { } const handleMeta = (item: MenuItem, isApp: boolean) => { + const meta = item.meta return { icon: item.icon, - title: item.name, - hideInMenu: item.isShow === false, + title: meta?.title || item.name, + hideInMenu: meta?.hideInMenu ?? item.isShow === false, buttons: handleButtons(item.buttons), isApp } } -const findComponents = (code: string, level: number, isApp: boolean, components: any, mate: any, hasChildren: boolean) => { - const myComponents = components[code] +const findComponents = (code: string, level: number, isApp: boolean, components: any, mate: any, hasChildren: boolean, extraModules = {}) => { + + const allComponents = { + ...components, + ...extraModules + } + + const myComponents = allComponents[code] + if (level === 1) { // BasicLayoutPage if (myComponents && !hasChildren) { return mate?.hasLayout === false ? () => myComponents() : h(BasicLayoutPage, {}, () => [h(defineAsyncComponent(() => myComponents()), {})]) @@ -197,6 +205,8 @@ const findComponents = (code: string, level: number, isApp: boolean, components: return myComponents ? () => myComponents() : BlankLayoutPage } else if(myComponents) { // components return () => myComponents() + } else if(myComponents) { // components + return () => myComponents() } // return components['demo'] // 开发测试用 return undefined @@ -268,7 +278,7 @@ export const handleMenus = (menuData: any[], components: any, level: number = 1, children: item.children } - route.component = findComponents(item.code, level, isApp, components, item.meta, !!item.chidlren?.length) + route.component = findComponents(item.code, level, isApp, components, item.meta, !!item.chidlren?.length, extraModules) const extraRoute = hasExtraChildren(item, extraRouteObj) const detail_components = findDetailRouteItem(item, components) @@ -285,7 +295,7 @@ export const handleMenus = (menuData: any[], components: any, level: number = 1, } if (route.children && route.children.length) { - route.children = handleMenus(route.children, components, level + 1) + route.children = handleMenus(route.children, components, level + 1, extraModules) } const showChildren = route.children?.filter(r => !r.meta?.hideInMenu) || [] @@ -318,7 +328,13 @@ const hideInMenu = (code: string) => { export const handleSiderMenu = (menuData: any[]) => { if (menuData && menuData.length) { - return menuData.map(item => { + return menuData.filter(item => { + + if (('isShow' in item.options && item.options.isShow === false) || item.meta?.hideInMenu === true) { + return false + } + return true + }).map(item => { const { isApp, appUrl } = hasAppID(item) // 是否为第三方程序 if ( item.options?.isShow !== undefined && item.isShow === undefined) { item.isShow = item.options.isShow diff --git a/src/views/init-home/data/baseMenu.ts b/src/views/init-home/data/baseMenu.ts index 89008db8..118c2b2a 100644 --- a/src/views/init-home/data/baseMenu.ts +++ b/src/views/init-home/data/baseMenu.ts @@ -4667,11 +4667,47 @@ export default [ "value": "unsupported" }, "indirectMenus": [], - "children": [ + // { + // "path": "3nkE-n7lJ", + // "sortIndex": 1, + // "level": 2, + // "name": "工作流", + // "code": "process/home", + // "describe": "", + // "url": "/workflow/home", + // "icon": "UpCircleOutlined", + // showPage: ["process-form"], + // "permissions": [ + // { + // "permission": "process-form", + // "actions": [ + // "query" + // ] + // }, + // { + // "permission": "low-code-info", + // "actions": [ + // "query" + // ] + // }, + // ], + // "accessSupport": { + // "text": "不支持", + // "value": "unsupported" + // }, + // "indirectMenus": [], + // "buttons": [], + // "options": { + // "show": true + // }, + // "creatorId": "1199596756811550720", + // "createTime": 1699263818795, + // "supportDataAccess": false + // }, { "path": "3nkE-n7lJ", - "sortIndex": 1, + "sortIndex": 2, "level": 2, "name": "表单", "code": "process/form", @@ -4695,6 +4731,18 @@ export default [ "buttons": [ { "id": "add", + "name": "新增", + "permissions": [ + { + "permission": "process-form", + "actions": [ + "save" + ] + } + ] + }, + { + "id": "save", "name": "保存", "permissions": [ { @@ -4739,7 +4787,7 @@ export default [ }, { "path": "3nkE-ysKb", - "sortIndex": 2, + "sortIndex": 3, "level": 2, "name": "流程模型", "code": "process/model", @@ -4831,7 +4879,7 @@ export default [ }, { "path": "3nkE-fJkR", - "sortIndex": 3, + "sortIndex": 4, "level": 2, "name": "流程实例", "code": "process/instance", @@ -4900,7 +4948,7 @@ export default [ }, { "path": "3nkE-i2nG", - "sortIndex": 4, + "sortIndex": 5, "level": 2, "name": "发起流程", "code": "process/initiate", @@ -4908,7 +4956,38 @@ export default [ "url": "/workflow/initiate", "icon": "UpOutlined", showPage: ["process-runtime"], - "permissions": [], + "permissions": [ + { + "permission": "process-definition", + "actions": [ + "query" + ] + }, + { + "permission": "process-deployment", + "actions": [ + "query" + ] + }, + { + "permission": "process-form", + "actions": [ + "query" + ] + }, + { + "permission": "process-runtime", + "actions": [ + "reject", + "start", + "self", + "claim", + "complete", + "createAndStart", + "repeal" + ] + } + ], "accessSupport": { "text": "不支持", "value": "unsupported" @@ -4923,7 +5002,7 @@ export default [ }, { "path": "3nkE-4T1D", - "sortIndex": 5, + "sortIndex": 6, "level": 2, "name": "待办事项", "code": "process/me/todo", @@ -4931,7 +5010,38 @@ export default [ "url": "/workflow/me/todo", "icon": "UpCircleOutlined", showPage: ["process-runtime"], - "permissions": [], + "permissions": [ + { + "permission": "process-definition", + "actions": [ + "query" + ] + }, + { + "permission": "process-deployment", + "actions": [ + "query" + ] + }, + { + "permission": "process-form", + "actions": [ + "query" + ] + }, + { + "permission": "process-runtime", + "actions": [ + "reject", + "start", + "self", + "claim", + "complete", + "createAndStart", + "repeal" + ] + } + ], "accessSupport": { "text": "不支持", "value": "unsupported" @@ -4946,7 +5056,7 @@ export default [ }, { "path": "3nkE-RXP3", - "sortIndex": 6, + "sortIndex": 7, "level": 2, "name": "已办事项", "code": "process/me", @@ -4954,7 +5064,38 @@ export default [ "url": "/workflow/me", "icon": "UpCircleOutlined", showPage: ["process-runtime"], - "permissions": [], + "permissions": [ + { + "permission": "process-definition", + "actions": [ + "query" + ] + }, + { + "permission": "process-deployment", + "actions": [ + "query" + ] + }, + { + "permission": "process-form", + "actions": [ + "query" + ] + }, + { + "permission": "process-runtime", + "actions": [ + "reject", + "start", + "self", + "claim", + "complete", + "createAndStart", + "repeal" + ] + } + ], "accessSupport": { "text": "不支持", "value": "unsupported" @@ -4969,7 +5110,7 @@ export default [ }, { "path": "3nkE-ibau", - "sortIndex": 7, + "sortIndex": 8, "level": 2, "name": "我发起的", "code": "process/me/initiate", @@ -4977,7 +5118,38 @@ export default [ "url": "/workflow/me/initiate", "icon": "UpCircleOutlined", showPage: ["process-runtime"], - "permissions": [], + "permissions": [ + { + "permission": "process-definition", + "actions": [ + "query" + ] + }, + { + "permission": "process-deployment", + "actions": [ + "query" + ] + }, + { + "permission": "process-form", + "actions": [ + "query" + ] + }, + { + "permission": "process-runtime", + "actions": [ + "reject", + "start", + "self", + "claim", + "complete", + "createAndStart", + "repeal" + ] + } + ], "accessSupport": { "text": "不支持", "value": "unsupported" @@ -4989,6 +5161,61 @@ export default [ "creatorId": "1199596756811550720", "createTime": 1699269488928, "supportDataAccess": false + }, + { + "path": "3nkE-vCQb", + "sortIndex": 10, + "level": 2, + "name": "抄送给我", + "code": "process/me/cc", + "describe": "", + "url": "/workflow/me/cc", + "icon": "BorderInnerOutlined", + "status": 1, + showPage: ["process-runtime"], + "permissions": [ + { + "permission": "process-definition", + "actions": [ + "query" + ] + }, + { + "permission": "process-runtime", + "actions": [ + "reject", + "start", + "self", + "claim", + "complete", + "createAndStart", + "repeal" + ] + }, + { + "permission": "process-deployment", + "actions": [ + "query" + ] + }, + { + "permission": "process-form", + "actions": [ + "query" + ] + } + ], + "accessSupport": { + "text": "不支持", + "value": "unsupported" + }, + "indirectMenus": [], + "options": { + "show": true + }, + "creatorId": "1199596756811550720", + "createTime": 1699348851779, + "supportDataAccess": false } ], "creatorId": "8004214f8141f29cb951befdca3615f0",