diff --git a/src/assets/imgs/SubwayAdmin.jpg b/src/assets/imgs/SubwayAdmin.jpg new file mode 100644 index 0000000..177e8df Binary files /dev/null and b/src/assets/imgs/SubwayAdmin.jpg differ diff --git a/src/components/common/exception-base.vue b/src/components/common/exception-base.vue index 801bd26..df54836 100644 --- a/src/components/common/exception-base.vue +++ b/src/components/common/exception-base.vue @@ -28,14 +28,22 @@ const iconMap: Record = { '500': 'service-error' }; +const textMap: Record = { + '403': '403 Forbidden', + '404': '404 Not Found', + '500': '500 Internal Server Error' +}; + const icon = computed(() => iconMap[props.type]); +const text = computed(() => textMap[props.type]); diff --git a/src/components/custom/soybean-avatar.vue b/src/components/custom/soybean-avatar.vue index 8d3278a..fb246e7 100644 --- a/src/components/custom/soybean-avatar.vue +++ b/src/components/custom/soybean-avatar.vue @@ -6,7 +6,7 @@ defineOptions({ diff --git a/src/locales/langs/zh-cn.ts b/src/locales/langs/zh-cn.ts index 4259830..85d6320 100644 --- a/src/locales/langs/zh-cn.ts +++ b/src/locales/langs/zh-cn.ts @@ -192,7 +192,12 @@ const local: App.I18n.Schema = { exception: '异常页', exception_403: '403', exception_404: '404', - exception_500: '500' + exception_500: '500', + orders: "工单管理", + employee: "人员管理", + facility: "设施管理", + plan: "计划管理", + department: "部门管理" }, page: { login: { @@ -255,7 +260,7 @@ const local: App.I18n.Schema = { devDep: '开发依赖' }, home: { - greeting: '早安,{userName}, 今天又是充满活力的一天!', + greeting: '欢迎您,{userName}', weatherDesc: '今日多云转晴,20℃ - 25℃!', projectCount: '项目数', todo: '待办', diff --git a/src/router/elegant/imports.ts b/src/router/elegant/imports.ts index 5c9ebee..7de55d5 100644 --- a/src/router/elegant/imports.ts +++ b/src/router/elegant/imports.ts @@ -21,6 +21,9 @@ export const views: Record Promise import("@/views/_builtin/iframe-page/[url].vue"), login: () => import("@/views/_builtin/login/index.vue"), about: () => import("@/views/about/index.vue"), + department: () => import("@/views/department/index.vue"), + employee: () => import("@/views/employee/index.vue"), + facility: () => import("@/views/facility/index.vue"), "function_hide-child_one": () => import("@/views/function/hide-child/one/index.vue"), "function_hide-child_three": () => import("@/views/function/hide-child/three/index.vue"), "function_hide-child_two": () => import("@/views/function/hide-child/two/index.vue"), @@ -36,5 +39,7 @@ export const views: Record Promise import("@/views/manage/user/index.vue"), "multi-menu_first_child": () => import("@/views/multi-menu/first_child/index.vue"), "multi-menu_second_child_home": () => import("@/views/multi-menu/second_child_home/index.vue"), + orders: () => import("@/views/orders/index.vue"), + plan: () => import("@/views/plan/index.vue"), "user-center": () => import("@/views/user-center/index.vue"), }; diff --git a/src/router/elegant/routes.ts b/src/router/elegant/routes.ts index 822c0be..8ca4e4f 100644 --- a/src/router/elegant/routes.ts +++ b/src/router/elegant/routes.ts @@ -50,6 +50,33 @@ export const generatedRoutes: GeneratedRoute[] = [ order: 10 } }, + { + name: 'department', + path: '/department', + component: 'layout.base$view.department', + meta: { + title: 'department', + i18nKey: 'route.department' + } + }, + { + name: 'employee', + path: '/employee', + component: 'layout.base$view.employee', + meta: { + title: 'employee', + i18nKey: 'route.employee' + } + }, + { + name: 'facility', + path: '/facility', + component: 'layout.base$view.facility', + meta: { + title: 'facility', + i18nKey: 'route.facility' + } + }, { name: 'function', path: '/function', @@ -330,6 +357,24 @@ export const generatedRoutes: GeneratedRoute[] = [ } ] }, + { + name: 'orders', + path: '/orders', + component: 'layout.base$view.orders', + meta: { + title: 'orders', + i18nKey: 'route.orders' + } + }, + { + name: 'plan', + path: '/plan', + component: 'layout.base$view.plan', + meta: { + title: 'plan', + i18nKey: 'route.plan' + } + }, { name: 'user-center', path: '/user-center', diff --git a/src/router/elegant/transform.ts b/src/router/elegant/transform.ts index 203239b..6087e91 100644 --- a/src/router/elegant/transform.ts +++ b/src/router/elegant/transform.ts @@ -179,6 +179,9 @@ const routeMap: RouteMap = { "404": "/404", "500": "/500", "about": "/about", + "department": "/department", + "employee": "/employee", + "facility": "/facility", "function": "/function", "function_hide-child": "/function/hide-child", "function_hide-child_one": "/function/hide-child/one", @@ -203,6 +206,8 @@ const routeMap: RouteMap = { "multi-menu_second": "/multi-menu/second", "multi-menu_second_child": "/multi-menu/second/child", "multi-menu_second_child_home": "/multi-menu/second/child/home", + "orders": "/orders", + "plan": "/plan", "user-center": "/user-center" }; diff --git a/src/router/routes/index.ts b/src/router/routes/index.ts index 96322a9..9d5143f 100644 --- a/src/router/routes/index.ts +++ b/src/router/routes/index.ts @@ -9,49 +9,49 @@ 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 - }, - 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: 'exception', + // path: '/exception', + // component: 'layout.base', + // meta: { + // title: 'exception', + // i18nKey: 'route.exception', + // icon: 'ant-design:exception-outlined', + // order: 7 + // }, + // 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', diff --git a/src/router/routes/index_.ts b/src/router/routes/index_.ts new file mode 100644 index 0000000..96322a9 --- /dev/null +++ b/src/router/routes/index_.ts @@ -0,0 +1,193 @@ +import type { CustomRoute, ElegantConstRoute, ElegantRoute } from '@elegant-router/types'; +import { generatedRoutes } from '../elegant/routes'; +import { layouts, views } from '../elegant/imports'; +import { transformElegantRoutesToVueRoutes } from '../elegant/transform'; + +/** + * custom routes + * + * @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 + }, + 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, + 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' + } + } + ] + } +]; + +/** create routes when the auth route mode is static */ +export function createStaticRoutes() { + const constantRoutes: ElegantRoute[] = []; + + const authRoutes: ElegantRoute[] = []; + + [...customRoutes, ...generatedRoutes].forEach(item => { + if (item.meta?.constant) { + constantRoutes.push(item); + } else { + authRoutes.push(item); + } + }); + + return { + constantRoutes, + authRoutes + }; +} + +/** + * Get auth vue routes + * + * @param routes Elegant routes + */ +export function getAuthVueRoutes(routes: ElegantConstRoute[]) { + return transformElegantRoutesToVueRoutes(routes, layouts, views); +} diff --git a/src/typings/elegant-router.d.ts b/src/typings/elegant-router.d.ts index 267270b..dae88a7 100644 --- a/src/typings/elegant-router.d.ts +++ b/src/typings/elegant-router.d.ts @@ -33,6 +33,9 @@ declare module "@elegant-router/types" { "404": "/404"; "500": "/500"; "about": "/about"; + "department": "/department"; + "employee": "/employee"; + "facility": "/facility"; "function": "/function"; "function_hide-child": "/function/hide-child"; "function_hide-child_one": "/function/hide-child/one"; @@ -57,6 +60,8 @@ declare module "@elegant-router/types" { "multi-menu_second": "/multi-menu/second"; "multi-menu_second_child": "/multi-menu/second/child"; "multi-menu_second_child_home": "/multi-menu/second/child/home"; + "orders": "/orders"; + "plan": "/plan"; "user-center": "/user-center"; }; @@ -105,12 +110,17 @@ declare module "@elegant-router/types" { | "404" | "500" | "about" + | "department" + | "employee" + | "facility" | "function" | "home" | "iframe-page" | "login" | "manage" | "multi-menu" + | "orders" + | "plan" | "user-center" >; @@ -136,6 +146,9 @@ declare module "@elegant-router/types" { | "iframe-page" | "login" | "about" + | "department" + | "employee" + | "facility" | "function_hide-child_one" | "function_hide-child_three" | "function_hide-child_two" @@ -151,6 +164,8 @@ declare module "@elegant-router/types" { | "manage_user" | "multi-menu_first_child" | "multi-menu_second_child_home" + | "orders" + | "plan" | "user-center" >; diff --git a/src/views/department/index.vue b/src/views/department/index.vue new file mode 100644 index 0000000..138af6f --- /dev/null +++ b/src/views/department/index.vue @@ -0,0 +1,7 @@ + + + + + diff --git a/src/views/employee/index.vue b/src/views/employee/index.vue new file mode 100644 index 0000000..2cc3c34 --- /dev/null +++ b/src/views/employee/index.vue @@ -0,0 +1,7 @@ + + + + + diff --git a/src/views/facility/index.vue b/src/views/facility/index.vue new file mode 100644 index 0000000..bd71c09 --- /dev/null +++ b/src/views/facility/index.vue @@ -0,0 +1,7 @@ + + + + + diff --git a/src/views/home/modules/header-banner.vue b/src/views/home/modules/header-banner.vue index 8bab91c..e7b9195 100644 --- a/src/views/home/modules/header-banner.vue +++ b/src/views/home/modules/header-banner.vue @@ -40,13 +40,13 @@ const statisticData = computed(() => [
- +

{{ $t('page.home.greeting', { userName: authStore.userInfo.userName }) }}

-

{{ $t('page.home.weatherDesc') }}

+
diff --git a/src/views/orders/index.vue b/src/views/orders/index.vue new file mode 100644 index 0000000..116e0e0 --- /dev/null +++ b/src/views/orders/index.vue @@ -0,0 +1,7 @@ + + + + + diff --git a/src/views/plan/index.vue b/src/views/plan/index.vue new file mode 100644 index 0000000..a203daa --- /dev/null +++ b/src/views/plan/index.vue @@ -0,0 +1,7 @@ + + + + +