diff --git a/build/plugins/router.ts b/build/plugins/router.ts index f7c20f2..35c338a 100644 --- a/build/plugins/router.ts +++ b/build/plugins/router.ts @@ -9,18 +9,7 @@ export function setupElegantRouter() { blank: 'src/layouts/blank-layout/index.vue' }, customRoutes: { - names: [ - 'exception_403', - 'exception_404', - 'exception_500', - 'document_project', - 'document_project-link', - 'document_vue', - 'document_vite', - 'document_unocss', - 'document_naive', - 'document_antd' - ] + names: [] }, routePathTransformer(routeName, routePath) { const key = routeName as RouteKey; diff --git a/src/locales/langs/en-us.ts b/src/locales/langs/en-us.ts index 30c7a5c..dbaf956 100644 --- a/src/locales/langs/en-us.ts +++ b/src/locales/langs/en-us.ts @@ -301,14 +301,6 @@ const local: App.I18n.Schema = { 500: 'Server Error', 'iframe-page': 'Iframe', home: 'Home', - document: 'Document', - document_project: 'Project Document', - 'document_project-link': 'Project Document(External Link)', - document_vue: 'Vue Document', - document_vite: 'Vite Document', - document_unocss: 'UnoCSS Document', - document_naive: 'Naive UI Document', - document_antd: 'Ant Design Vue Document', about: 'About', pods: 'Online Machine', namespace: 'Namespace', @@ -326,13 +318,14 @@ const local: App.I18n.Schema = { workflow_task: 'Workflow Task', workflow_batch: 'Workflow Batch', workflow_form: 'Workflow', + workflow_form_copy: 'Copy Workflow', + workflow_form_batch: 'Workflow Batch Detail', + workflow_form_detail: 'Workflow Detail', + workflow_form_edit: 'Edit Workflow', + workflow_form_add: 'Add Workflow', job: 'Schedule Task Management', job_task: 'Schedule Task List', job_batch: 'Schedule Task Batch List', - exception: 'Exception', - exception_403: '403', - exception_404: '404', - exception_500: '500', group: 'Group Config' }, page: { @@ -431,17 +424,7 @@ const local: App.I18n.Schema = { pie: { title: 'Success scale chart' } - }, - projectNews: { - title: 'Project News', - moreNews: 'More News', - desc1: 'Soybean created the open source project soybean-admin on May 28, 2021!', - desc2: 'Yanbowe submitted a bug to soybean-admin, the multi-tab bar will not adapt.', - desc3: 'Soybean is ready to do sufficient preparation for the release of soybean-admin!', - desc4: 'Soybean is busy writing project documentation for soybean-admin!', - desc5: 'Soybean just wrote some of the workbench pages casually, and it was enough to see!' - }, - creativity: 'Creativity' + } }, pods: { title: 'Online Machine', diff --git a/src/locales/langs/zh-cn.ts b/src/locales/langs/zh-cn.ts index 819ba6c..5fba7fc 100644 --- a/src/locales/langs/zh-cn.ts +++ b/src/locales/langs/zh-cn.ts @@ -301,14 +301,6 @@ const local: App.I18n.Schema = { 500: '服务器错误', 'iframe-page': '外链页面', home: '首页', - document: '文档', - document_project: '项目文档', - 'document_project-link': '项目文档(外链)', - document_vue: 'Vue文档', - document_vite: 'Vite文档', - document_unocss: 'UnoCSS文档', - document_naive: 'Naive UI文档', - document_antd: 'Ant Design Vue文档', about: '关于', pods: '在线机器', namespace: '命名空间', @@ -327,13 +319,14 @@ const local: App.I18n.Schema = { workflow_task: '任务管理', workflow_batch: '执行批次', workflow_form: '工作流', + workflow_form_copy: '复制工作流', + workflow_form_batch: '工作流批次详情', + workflow_form_detail: '工作流详情', + workflow_form_edit: '编辑工作流', + workflow_form_add: '新增工作流', job: '定时任务', job_task: '任务管理', - job_batch: '执行批次', - exception: '异常页', - exception_403: '403', - exception_404: '404', - exception_500: '500' + job_batch: '执行批次' }, page: { common: { @@ -442,17 +435,7 @@ const local: App.I18n.Schema = { pie: { title: '成功比例图' } - }, - projectNews: { - title: '项目动态', - moreNews: '更多动态', - desc1: 'Soybean 在2021年5月28日创建了开源项目 soybean-admin!', - desc2: 'Yanbowe 向 soybean-admin 提交了一个bug,多标签栏不会自适应。', - desc3: 'Soybean 准备为 soybean-admin 的发布做充分的准备工作!', - desc4: 'Soybean 正在忙于为soybean-admin写项目说明文档!', - desc5: 'Soybean 刚才把工作台页面随便写了一些,凑合能看了!' - }, - creativity: '创意' + } }, pods: { title: '在线机器', diff --git a/src/router/elegant/imports.ts b/src/router/elegant/imports.ts index 314af84..953936a 100644 --- a/src/router/elegant/imports.ts +++ b/src/router/elegant/imports.ts @@ -35,6 +35,10 @@ export const views: Record Promise import("@/views/retry/task/index.vue"), user_manager: () => import("@/views/user/manager/index.vue"), workflow_batch: () => import("@/views/workflow/batch/index.vue"), - workflow_form: () => import("@/views/workflow/form/[type].vue"), + workflow_form_add: () => import("@/views/workflow/form/add/index.vue"), + workflow_form_batch: () => import("@/views/workflow/form/batch/index.vue"), + workflow_form_copy: () => import("@/views/workflow/form/copy/index.vue"), + workflow_form_detail: () => import("@/views/workflow/form/detail/index.vue"), + workflow_form_edit: () => import("@/views/workflow/form/edit/index.vue"), workflow_task: () => import("@/views/workflow/task/index.vue"), }; diff --git a/src/router/elegant/routes.ts b/src/router/elegant/routes.ts index fd77ff5..f518d7a 100644 --- a/src/router/elegant/routes.ts +++ b/src/router/elegant/routes.ts @@ -295,13 +295,64 @@ export const generatedRoutes: GeneratedRoute[] = [ }, { name: 'workflow_form', - path: '/workflow/form/:type', - component: 'view.workflow_form', + path: '/workflow/form', meta: { title: 'workflow_form', hideInMenu: true, i18nKey: 'route.workflow_form' - } + }, + children: [ + { + name: 'workflow_form_add', + path: '/workflow/form/add', + component: 'view.workflow_form_add', + meta: { + hideInMenu: true, + title: 'workflow_form_add', + i18nKey: 'route.workflow_form_add' + } + }, + { + name: 'workflow_form_batch', + path: '/workflow/form/batch', + component: 'view.workflow_form_batch', + meta: { + hideInMenu: true, + title: 'workflow_form_batch', + i18nKey: 'route.workflow_form_batch' + } + }, + { + name: 'workflow_form_copy', + path: '/workflow/form/copy', + component: 'view.workflow_form_copy', + meta: { + title: 'workflow_form_copy', + hideInMenu: true, + i18nKey: 'route.workflow_form_copy' + } + }, + { + name: 'workflow_form_detail', + path: '/workflow/form/detail', + component: 'view.workflow_form_detail', + meta: { + title: 'workflow_form_detail', + hideInMenu: true, + i18nKey: 'route.workflow_form_detail' + } + }, + { + name: 'workflow_form_edit', + path: '/workflow/form/edit', + component: 'view.workflow_form_edit', + meta: { + title: 'workflow_form_edit', + hideInMenu: true, + i18nKey: 'route.workflow_form_edit' + } + } + ] }, { name: 'workflow_task', diff --git a/src/router/routes/index.ts b/src/router/routes/index.ts index b7fc637..5a295d8 100644 --- a/src/router/routes/index.ts +++ b/src/router/routes/index.ts @@ -8,162 +8,7 @@ import { transformElegantRoutesToVueRoutes } from '../elegant/transform'; * * @link https://github.com/soybeanjs/elegant-router?tab=readme-ov-file#custom-route */ -const customRoutes: CustomRoute[] = [ - { - name: 'exception', - path: '/exception', - component: 'layout.base', - meta: { - title: 'exception', - i18nKey: 'route.exception', - icon: 'ant-design:exception-outlined', - order: 7, - hideInMenu: true - }, - children: [ - { - name: 'exception_403', - path: '/exception/403', - component: 'view.403', - meta: { - title: 'exception_403', - i18nKey: 'route.exception_403', - icon: 'ic:baseline-block' - } - }, - { - name: 'exception_404', - path: '/exception/404', - component: 'view.404', - meta: { - title: 'exception_404', - i18nKey: 'route.exception_404', - icon: 'ic:baseline-web-asset-off' - } - }, - { - name: 'exception_500', - path: '/exception/500', - component: 'view.500', - meta: { - title: 'exception_500', - i18nKey: 'route.exception_500', - icon: 'ic:baseline-wifi-off' - } - } - ] - }, - { - name: 'document', - path: '/document', - component: 'layout.base', - meta: { - title: 'document', - i18nKey: 'route.document', - order: 2, - hideInMenu: true, - icon: 'mdi:file-document-multiple-outline' - }, - children: [ - { - name: 'document_antd', - path: '/document/antd', - component: 'view.iframe-page', - props: { - url: 'https://antdv.com/components/overview-cn' - }, - meta: { - title: 'document_antd', - i18nKey: 'route.document_antd', - order: 7, - icon: 'logos:ant-design' - } - }, - { - name: 'document_naive', - path: '/document/naive', - component: 'view.iframe-page', - props: { - url: 'https://www.naiveui.com/zh-CN/os-theme/docs/introduction' - }, - meta: { - title: 'document_naive', - i18nKey: 'route.document_naive', - order: 6, - icon: 'logos:naiveui' - } - }, - { - name: 'document_project', - path: '/document/project', - component: 'view.iframe-page', - props: { - url: 'https://docs.soybeanjs.cn/zh' - }, - meta: { - title: 'document_project', - i18nKey: 'route.document_project', - order: 1, - localIcon: 'logo' - } - }, - { - name: 'document_project-link', - path: '/document/project-link', - component: 'view.iframe-page', - meta: { - title: 'document_project-link', - i18nKey: 'route.document_project-link', - order: 2, - localIcon: 'logo', - href: 'https://docs.soybeanjs.cn/zh' - } - }, - { - name: 'document_unocss', - path: '/document/unocss', - component: 'view.iframe-page', - props: { - url: 'https://unocss.dev/' - }, - meta: { - title: 'document_unocss', - i18nKey: 'route.document_unocss', - order: 5, - icon: 'logos:unocss' - } - }, - { - name: 'document_vite', - path: '/document/vite', - component: 'view.iframe-page', - props: { - url: 'https://cn.vitejs.dev/' - }, - meta: { - title: 'document_vite', - i18nKey: 'route.document_vite', - order: 4, - icon: 'logos:vitejs' - } - }, - { - name: 'document_vue', - path: '/document/vue', - component: 'view.iframe-page', - props: { - url: 'https://cn.vuejs.org/' - }, - meta: { - title: 'document_vue', - i18nKey: 'route.document_vue', - order: 3, - icon: 'logos:vue' - } - } - ] - } -]; +const customRoutes: CustomRoute[] = []; /** create routes when the auth route mode is static */ export function createStaticRoutes() { diff --git a/src/store/modules/route/shared.ts b/src/store/modules/route/shared.ts index eccb154..b74ddb3 100644 --- a/src/store/modules/route/shared.ts +++ b/src/store/modules/route/shared.ts @@ -72,15 +72,17 @@ export function getGlobalMenusByAuthRoutes(routes: ElegantConstRoute[]) { const menus: App.Global.Menu[] = []; routes.forEach(route => { - if (!route.meta?.hideInMenu) { - const menu = getGlobalMenuByBaseRoute(route); + const menu = getGlobalMenuByBaseRoute(route); - if (route.children?.some(child => !child.meta?.hideInMenu)) { - menu.children = getGlobalMenusByAuthRoutes(route.children); - } - - menus.push(menu); + if (route.children) { + menu.children = getGlobalMenusByAuthRoutes(route.children); } + + if (route.meta?.hideInMenu) { + menu.show = false; + } + + menus.push(menu); }); return menus; diff --git a/src/typings/app.d.ts b/src/typings/app.d.ts index f679fa6..c165336 100644 --- a/src/typings/app.d.ts +++ b/src/typings/app.d.ts @@ -167,6 +167,8 @@ declare namespace App { icon?: () => VNode; /** The menu children */ children?: Menu[]; + /** The menu show */ + show?: boolean; } type Breadcrumb = Omit & { @@ -608,16 +610,6 @@ declare namespace App { title: string; }; }; - projectNews: { - title: string; - moreNews: string; - desc1: string; - desc2: string; - desc3: string; - desc4: string; - desc5: string; - }; - creativity: string; }; pods: { title: string; diff --git a/src/views/workflow/form/[type].vue b/src/views/workflow/form/[type].vue deleted file mode 100644 index a55eebf..0000000 --- a/src/views/workflow/form/[type].vue +++ /dev/null @@ -1,40 +0,0 @@ - - - - - diff --git a/src/views/workflow/form/modules/add.vue b/src/views/workflow/form/add/index.vue similarity index 95% rename from src/views/workflow/form/modules/add.vue rename to src/views/workflow/form/add/index.vue index d887638..f33f3f5 100644 --- a/src/views/workflow/form/modules/add.vue +++ b/src/views/workflow/form/add/index.vue @@ -2,14 +2,10 @@ import { onMounted, ref } from 'vue'; import { useRouter } from 'vue-router'; import Workflow from '@/components/workflow'; -import { $t } from '@/locales'; import { useWorkflowStore } from '@/store/modules/workflow'; +import { $t } from '@/locales'; import { fetchAddWorkflow } from '@/service/api'; -defineOptions({ - name: 'WorkflowFormAdd' -}); - const store = useWorkflowStore(); const router = useRouter(); diff --git a/src/views/workflow/form/modules/batch.vue b/src/views/workflow/form/batch/index.vue similarity index 94% rename from src/views/workflow/form/modules/batch.vue rename to src/views/workflow/form/batch/index.vue index 920a368..a603717 100644 --- a/src/views/workflow/form/modules/batch.vue +++ b/src/views/workflow/form/batch/index.vue @@ -5,10 +5,6 @@ import Workflow from '@/components/workflow'; import { useWorkflowStore } from '@/store/modules/workflow'; import { fetchWorkflowBatchInfo } from '@/service/api'; -defineOptions({ - name: 'WorkflowFormBatch' -}); - const store = useWorkflowStore(); const route = useRoute(); diff --git a/src/views/workflow/form/modules/copy.vue b/src/views/workflow/form/copy/index.vue similarity index 96% rename from src/views/workflow/form/modules/copy.vue rename to src/views/workflow/form/copy/index.vue index 72356e3..8dd510b 100644 --- a/src/views/workflow/form/modules/copy.vue +++ b/src/views/workflow/form/copy/index.vue @@ -6,10 +6,6 @@ import { $t } from '@/locales'; import { useWorkflowStore } from '@/store/modules/workflow'; import { fetchAddWorkflow, fetchWorkflowInfo } from '@/service/api'; -defineOptions({ - name: 'WorkflowFormCopy' -}); - const store = useWorkflowStore(); const route = useRoute(); const router = useRouter(); diff --git a/src/views/workflow/form/modules/detail.vue b/src/views/workflow/form/detail/index.vue similarity index 94% rename from src/views/workflow/form/modules/detail.vue rename to src/views/workflow/form/detail/index.vue index 7053647..91fbae1 100644 --- a/src/views/workflow/form/modules/detail.vue +++ b/src/views/workflow/form/detail/index.vue @@ -2,12 +2,8 @@ import { onMounted, ref } from 'vue'; import { useRoute } from 'vue-router'; import Workflow from '@/components/workflow'; -import { useWorkflowStore } from '@/store/modules/workflow'; import { fetchWorkflowInfo } from '@/service/api'; - -defineOptions({ - name: 'WorkflowFormDetail' -}); +import { useWorkflowStore } from '@/store/modules/workflow'; const store = useWorkflowStore(); const route = useRoute(); diff --git a/src/views/workflow/form/modules/edit.vue b/src/views/workflow/form/edit/index.vue similarity index 96% rename from src/views/workflow/form/modules/edit.vue rename to src/views/workflow/form/edit/index.vue index 5cdb5b7..62ea6ac 100644 --- a/src/views/workflow/form/modules/edit.vue +++ b/src/views/workflow/form/edit/index.vue @@ -2,14 +2,10 @@ import { onMounted, ref } from 'vue'; import { useRoute, useRouter } from 'vue-router'; import Workflow from '@/components/workflow'; -import { useWorkflowStore } from '@/store/modules/workflow'; import { $t } from '@/locales'; +import { useWorkflowStore } from '@/store/modules/workflow'; import { fetchUpdateWorkflow, fetchWorkflowInfo } from '@/service/api'; -defineOptions({ - name: 'WorkflowFormEdit' -}); - const store = useWorkflowStore(); const route = useRoute(); const router = useRouter();