Initial commit: OneOS frontend based on yudao-ui-admin-vben
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / CI OK (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Deploy Website on push / Rerun on failure (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / CI OK (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Deploy Website on push / Rerun on failure (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
This commit is contained in:
41
apps/web-antd/src/router/access.ts
Normal file
41
apps/web-antd/src/router/access.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import type {
|
||||
AppRouteRecordRaw,
|
||||
ComponentRecordType,
|
||||
GenerateMenuAndRoutesOptions,
|
||||
} from '@vben/types';
|
||||
|
||||
import { generateAccessible } from '@vben/access';
|
||||
import { preferences } from '@vben/preferences';
|
||||
import { useAccessStore } from '@vben/stores';
|
||||
import { convertServerMenuToRouteRecordStringComponent } from '@vben/utils';
|
||||
|
||||
import { BasicLayout, IFrameView } from '#/layouts';
|
||||
|
||||
const forbiddenComponent = () => import('#/views/_core/fallback/forbidden.vue');
|
||||
|
||||
async function generateAccess(options: GenerateMenuAndRoutesOptions) {
|
||||
const pageMap: ComponentRecordType = import.meta.glob('../views/**/*.vue');
|
||||
const accessStore = useAccessStore();
|
||||
|
||||
const layoutMap: ComponentRecordType = {
|
||||
BasicLayout,
|
||||
IFrameView,
|
||||
};
|
||||
|
||||
return await generateAccessible(preferences.app.accessMode, {
|
||||
...options,
|
||||
fetchMenuListAsync: async () => {
|
||||
// 由于 yudao 通过 accessStore 读取,所以不在进行 message.loading 提示
|
||||
// 补充说明:accessStore.accessMenus 一开始是 AppRouteRecordRaw 类型(后端加载),后面被赋值成 MenuRecordRaw 类型(前端转换)
|
||||
const accessMenus = accessStore.accessMenus as AppRouteRecordRaw[];
|
||||
return convertServerMenuToRouteRecordStringComponent(accessMenus);
|
||||
},
|
||||
// 可以指定没有权限跳转403页面
|
||||
forbiddenComponent,
|
||||
// 如果 route.meta.menuVisibleWithForbidden = true
|
||||
layoutMap,
|
||||
pageMap,
|
||||
});
|
||||
}
|
||||
|
||||
export { generateAccess };
|
||||
156
apps/web-antd/src/router/guard.ts
Normal file
156
apps/web-antd/src/router/guard.ts
Normal file
@@ -0,0 +1,156 @@
|
||||
import type { Router } from 'vue-router';
|
||||
|
||||
import { LOGIN_PATH } from '@vben/constants';
|
||||
import { $t } from '@vben/locales';
|
||||
import { preferences } from '@vben/preferences';
|
||||
import { useAccessStore, useDictStore, useUserStore } from '@vben/stores';
|
||||
import { startProgress, stopProgress } from '@vben/utils';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { getSimpleDictDataList } from '#/api/system/dict/data';
|
||||
import { accessRoutes, coreRouteNames } from '#/router/routes';
|
||||
import { useAuthStore } from '#/store';
|
||||
|
||||
import { generateAccess } from './access';
|
||||
|
||||
/**
|
||||
* 通用守卫配置
|
||||
* @param router
|
||||
*/
|
||||
function setupCommonGuard(router: Router) {
|
||||
// 记录已经加载的页面
|
||||
const loadedPaths = new Set<string>();
|
||||
|
||||
router.beforeEach((to) => {
|
||||
to.meta.loaded = loadedPaths.has(to.path);
|
||||
|
||||
// 页面加载进度条
|
||||
if (!to.meta.loaded && preferences.transition.progress) {
|
||||
startProgress();
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
router.afterEach((to) => {
|
||||
// 记录页面是否加载,如果已经加载,后续的页面切换动画等效果不在重复执行
|
||||
|
||||
loadedPaths.add(to.path);
|
||||
|
||||
// 关闭页面加载进度条
|
||||
if (preferences.transition.progress) {
|
||||
stopProgress();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 权限访问守卫配置
|
||||
* @param router
|
||||
*/
|
||||
function setupAccessGuard(router: Router) {
|
||||
router.beforeEach(async (to, from) => {
|
||||
const accessStore = useAccessStore();
|
||||
const userStore = useUserStore();
|
||||
const authStore = useAuthStore();
|
||||
const dictStore = useDictStore();
|
||||
|
||||
// 基本路由,这些路由不需要进入权限拦截
|
||||
if (coreRouteNames.includes(to.name as string)) {
|
||||
if (to.path === LOGIN_PATH && accessStore.accessToken) {
|
||||
return decodeURIComponent(
|
||||
(to.query?.redirect as string) ||
|
||||
userStore.userInfo?.homePath ||
|
||||
preferences.app.defaultHomePath,
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// accessToken 检查
|
||||
if (!accessStore.accessToken) {
|
||||
// 明确声明忽略权限访问权限,则可以访问
|
||||
if (to.meta.ignoreAccess) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// 没有访问权限,跳转登录页面
|
||||
if (to.fullPath !== LOGIN_PATH) {
|
||||
return {
|
||||
path: LOGIN_PATH,
|
||||
// 如不需要,直接删除 query
|
||||
query:
|
||||
to.fullPath === preferences.app.defaultHomePath
|
||||
? {}
|
||||
: { redirect: encodeURIComponent(to.fullPath) },
|
||||
// 携带当前跳转的页面,登录后重新跳转该页面
|
||||
replace: true,
|
||||
};
|
||||
}
|
||||
return to;
|
||||
}
|
||||
|
||||
// 是否已经生成过动态路由
|
||||
if (accessStore.isAccessChecked) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// 加载字典数据(不阻塞加载)
|
||||
dictStore.setDictCacheByApi(getSimpleDictDataList);
|
||||
|
||||
// 生成路由表
|
||||
// 当前登录用户拥有的角色标识列表
|
||||
let userInfo = userStore.userInfo;
|
||||
if (!userInfo) {
|
||||
// add by 芋艿:由于 yudao 是 fetchUserInfo 统一加载用户 + 权限信息,所以将 fetchMenuListAsync
|
||||
const loading = message.loading({
|
||||
content: `${$t('common.loadingMenu')}...`,
|
||||
});
|
||||
try {
|
||||
const authPermissionInfo = await authStore.fetchUserInfo();
|
||||
if (authPermissionInfo) {
|
||||
userInfo = authPermissionInfo.user;
|
||||
}
|
||||
} finally {
|
||||
loading();
|
||||
}
|
||||
}
|
||||
const userRoles = userStore.userRoles ?? [];
|
||||
|
||||
// 生成菜单和路由
|
||||
const { accessibleMenus, accessibleRoutes } = await generateAccess({
|
||||
roles: userRoles,
|
||||
router,
|
||||
// 则会在菜单中显示,但是访问会被重定向到403
|
||||
routes: accessRoutes,
|
||||
});
|
||||
|
||||
// 保存菜单信息和路由信息
|
||||
accessStore.setAccessMenus(accessibleMenus);
|
||||
accessStore.setAccessRoutes(accessibleRoutes);
|
||||
accessStore.setIsAccessChecked(true);
|
||||
userStore.setUserRoles(userRoles);
|
||||
const redirectPath = (from.query.redirect ??
|
||||
(to.path === preferences.app.defaultHomePath
|
||||
? userInfo?.homePath || preferences.app.defaultHomePath
|
||||
: to.fullPath)) as string;
|
||||
|
||||
return {
|
||||
...router.resolve(decodeURIComponent(redirectPath)),
|
||||
replace: true,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 项目守卫配置
|
||||
* @param router
|
||||
*/
|
||||
function createRouterGuard(router: Router) {
|
||||
/** 通用 */
|
||||
setupCommonGuard(router);
|
||||
/** 权限访问 */
|
||||
setupAccessGuard(router);
|
||||
}
|
||||
|
||||
export { createRouterGuard };
|
||||
40
apps/web-antd/src/router/index.ts
Normal file
40
apps/web-antd/src/router/index.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import {
|
||||
createRouter,
|
||||
createWebHashHistory,
|
||||
createWebHistory,
|
||||
} from 'vue-router';
|
||||
|
||||
import { resetStaticRoutes } from '@vben/utils';
|
||||
|
||||
import { createRouterGuard } from './guard';
|
||||
import { routes } from './routes';
|
||||
import { setupBaiduTongJi } from './tongji';
|
||||
|
||||
/**
|
||||
* @zh_CN 创建vue-router实例
|
||||
*/
|
||||
const router = createRouter({
|
||||
history:
|
||||
import.meta.env.VITE_ROUTER_HISTORY === 'hash'
|
||||
? createWebHashHistory(import.meta.env.VITE_BASE)
|
||||
: createWebHistory(import.meta.env.VITE_BASE),
|
||||
// 应该添加到路由的初始路由列表。
|
||||
routes,
|
||||
scrollBehavior: (to, _from, savedPosition) => {
|
||||
if (savedPosition) {
|
||||
return savedPosition;
|
||||
}
|
||||
return to.hash ? { behavior: 'smooth', el: to.hash } : { left: 0, top: 0 };
|
||||
},
|
||||
// 是否应该禁止尾部斜杠。
|
||||
// strict: true,
|
||||
});
|
||||
|
||||
const resetRoutes = () => resetStaticRoutes(router, routes);
|
||||
|
||||
// 创建路由守卫
|
||||
createRouterGuard(router);
|
||||
// 设置百度统计
|
||||
setupBaiduTongJi(router);
|
||||
|
||||
export { resetRoutes, router };
|
||||
129
apps/web-antd/src/router/routes/core.ts
Normal file
129
apps/web-antd/src/router/routes/core.ts
Normal file
@@ -0,0 +1,129 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
|
||||
import { LOGIN_PATH } from '@vben/constants';
|
||||
import { preferences } from '@vben/preferences';
|
||||
|
||||
import { $t } from '#/locales';
|
||||
|
||||
const BasicLayout = () => import('#/layouts/basic.vue');
|
||||
const AuthPageLayout = () => import('#/layouts/auth.vue');
|
||||
/** 全局404页面 */
|
||||
const fallbackNotFoundRoute: RouteRecordRaw = {
|
||||
component: () => import('#/views/_core/fallback/not-found.vue'),
|
||||
meta: {
|
||||
hideInBreadcrumb: true,
|
||||
hideInMenu: true,
|
||||
hideInTab: true,
|
||||
title: '404',
|
||||
},
|
||||
name: 'FallbackNotFound',
|
||||
path: '/:path(.*)*',
|
||||
};
|
||||
|
||||
/** 基本路由,这些路由是必须存在的 */
|
||||
const coreRoutes: RouteRecordRaw[] = [
|
||||
/**
|
||||
* 根路由
|
||||
* 使用基础布局,作为所有页面的父级容器,子级就不必配置BasicLayout。
|
||||
* 此路由必须存在,且不应修改
|
||||
*/
|
||||
{
|
||||
component: BasicLayout,
|
||||
meta: {
|
||||
hideInBreadcrumb: true,
|
||||
title: 'Root',
|
||||
},
|
||||
name: 'Root',
|
||||
path: '/',
|
||||
redirect: preferences.app.defaultHomePath,
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
component: AuthPageLayout,
|
||||
meta: {
|
||||
hideInTab: true,
|
||||
title: 'Authentication',
|
||||
},
|
||||
name: 'Authentication',
|
||||
path: '/auth',
|
||||
redirect: LOGIN_PATH,
|
||||
children: [
|
||||
{
|
||||
name: 'Login',
|
||||
path: 'login',
|
||||
component: () => import('#/views/_core/authentication/login.vue'),
|
||||
meta: {
|
||||
title: $t('page.auth.login'),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'CodeLogin',
|
||||
path: 'code-login',
|
||||
component: () => import('#/views/_core/authentication/code-login.vue'),
|
||||
meta: {
|
||||
title: $t('page.auth.codeLogin'),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'QrCodeLogin',
|
||||
path: 'qrcode-login',
|
||||
component: () =>
|
||||
import('#/views/_core/authentication/qrcode-login.vue'),
|
||||
meta: {
|
||||
title: $t('page.auth.qrcodeLogin'),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'ForgetPassword',
|
||||
path: 'forget-password',
|
||||
component: () =>
|
||||
import('#/views/_core/authentication/forget-password.vue'),
|
||||
meta: {
|
||||
title: $t('page.auth.forgetPassword'),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Register',
|
||||
path: 'register',
|
||||
component: () => import('#/views/_core/authentication/register.vue'),
|
||||
meta: {
|
||||
title: $t('page.auth.register'),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'SocialLogin',
|
||||
path: 'social-login',
|
||||
component: () =>
|
||||
import('#/views/_core/authentication/social-login.vue'),
|
||||
meta: {
|
||||
title: $t('page.auth.login'),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'SSOLogin',
|
||||
path: 'sso-login',
|
||||
component: () => import('#/views/_core/authentication/sso-login.vue'),
|
||||
meta: {
|
||||
title: $t('page.auth.login'),
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
/**
|
||||
* 用于 bpm 移动端流程表单 web-view 的嵌入
|
||||
*/
|
||||
{
|
||||
component: () => import('#/views/bpm/form/mobile/index.vue'),
|
||||
meta: {
|
||||
hideInBreadcrumb: true,
|
||||
hideInMenu: true,
|
||||
hideInTab: true,
|
||||
ignoreAccess: true,
|
||||
title: '移动端流程表单展示',
|
||||
},
|
||||
name: 'BpmMobileFormPreview',
|
||||
path: '/bpm/mobile/form-preview',
|
||||
},
|
||||
];
|
||||
|
||||
export { coreRoutes, fallbackNotFoundRoute };
|
||||
47
apps/web-antd/src/router/routes/index.ts
Normal file
47
apps/web-antd/src/router/routes/index.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
|
||||
import { mergeRouteModules, traverseTreeValues } from '@vben/utils';
|
||||
|
||||
import { coreRoutes, fallbackNotFoundRoute } from './core';
|
||||
|
||||
const dynamicRouteFiles = import.meta.glob('./modules/**/*.ts', {
|
||||
eager: true,
|
||||
});
|
||||
|
||||
// 有需要可以自行打开注释,并创建文件夹
|
||||
// const externalRouteFiles = import.meta.glob('./external/**/*.ts', { eager: true });
|
||||
// const staticRouteFiles = import.meta.glob('./static/**/*.ts', { eager: true });
|
||||
|
||||
/** 动态路由 */
|
||||
const dynamicRoutes: RouteRecordRaw[] = mergeRouteModules(dynamicRouteFiles);
|
||||
|
||||
/** 外部路由列表,访问这些页面可以不需要Layout,可能用于内嵌在别的系统(不会显示在菜单中) */
|
||||
// const externalRoutes: RouteRecordRaw[] = mergeRouteModules(externalRouteFiles);
|
||||
// const staticRoutes: RouteRecordRaw[] = mergeRouteModules(staticRouteFiles);
|
||||
const staticRoutes: RouteRecordRaw[] = [];
|
||||
const externalRoutes: RouteRecordRaw[] = [];
|
||||
|
||||
/** 路由列表,由基本路由、外部路由和404兜底路由组成
|
||||
* 无需走权限验证(会一直显示在菜单中) */
|
||||
const routes: RouteRecordRaw[] = [
|
||||
...coreRoutes,
|
||||
...externalRoutes,
|
||||
fallbackNotFoundRoute,
|
||||
];
|
||||
|
||||
/** 基本路由列表,这些路由不需要进入权限拦截 */
|
||||
const coreRouteNames = traverseTreeValues(coreRoutes, (route) => route.name);
|
||||
|
||||
/** 有权限校验的路由列表,包含动态路由和静态路由 */
|
||||
const accessRoutes = [...dynamicRoutes, ...staticRoutes];
|
||||
|
||||
// add by 芋艿:from https://github.com/vbenjs/vue-vben-admin/blob/main/playground/src/router/routes/index.ts#L38-L45
|
||||
const componentKeys: string[] = Object.keys(
|
||||
import.meta.glob('../../views/**/*.vue'),
|
||||
)
|
||||
.filter((item) => !item.includes('/modules/'))
|
||||
.map((v) => {
|
||||
const path = v.replace('../../views/', '/');
|
||||
return path.endsWith('.vue') ? path.slice(0, -4) : path;
|
||||
});
|
||||
export { accessRoutes, componentKeys, coreRouteNames, routes };
|
||||
113
apps/web-antd/src/router/routes/modules/ai.ts
Normal file
113
apps/web-antd/src/router/routes/modules/ai.ts
Normal file
@@ -0,0 +1,113 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
|
||||
const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
path: '/ai',
|
||||
name: 'Ai',
|
||||
meta: {
|
||||
title: 'Ai',
|
||||
hideInMenu: true,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'image/square',
|
||||
component: () => import('#/views/ai/image/square/index.vue'),
|
||||
name: 'AiImageSquare',
|
||||
meta: {
|
||||
noCache: true,
|
||||
hidden: true,
|
||||
canTo: true,
|
||||
title: '绘图作品',
|
||||
activePath: '/ai/image',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'knowledge/document',
|
||||
component: () => import('#/views/ai/knowledge/document/index.vue'),
|
||||
name: 'AiKnowledgeDocument',
|
||||
meta: {
|
||||
noCache: true,
|
||||
hidden: true,
|
||||
canTo: true,
|
||||
title: '知识库文档',
|
||||
activePath: '/ai/knowledge',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'knowledge/document/create',
|
||||
component: () => import('#/views/ai/knowledge/document/form/index.vue'),
|
||||
name: 'AiKnowledgeDocumentCreate',
|
||||
meta: {
|
||||
noCache: true,
|
||||
hidden: true,
|
||||
canTo: true,
|
||||
title: '创建文档',
|
||||
activePath: '/ai/knowledge',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'knowledge/document/update',
|
||||
component: () => import('#/views/ai/knowledge/document/form/index.vue'),
|
||||
name: 'AiKnowledgeDocumentUpdate',
|
||||
meta: {
|
||||
noCache: true,
|
||||
hidden: true,
|
||||
canTo: true,
|
||||
title: '修改文档',
|
||||
activePath: '/ai/knowledge',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'knowledge/retrieval',
|
||||
component: () =>
|
||||
import('#/views/ai/knowledge/knowledge/retrieval/index.vue'),
|
||||
name: 'AiKnowledgeRetrieval',
|
||||
meta: {
|
||||
noCache: true,
|
||||
hidden: true,
|
||||
canTo: true,
|
||||
title: '文档召回测试',
|
||||
activePath: '/ai/knowledge',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'knowledge/segment',
|
||||
component: () => import('#/views/ai/knowledge/segment/index.vue'),
|
||||
name: 'AiKnowledgeSegment',
|
||||
meta: {
|
||||
noCache: true,
|
||||
hidden: true,
|
||||
canTo: true,
|
||||
title: '知识库分段',
|
||||
activePath: '/ai/knowledge',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: String.raw`workflow/create/:id(\d+)/:type(update|create)`,
|
||||
component: () => import('#/views/ai/workflow/form/index.vue'),
|
||||
name: 'AiWorkflowCreate',
|
||||
meta: {
|
||||
noCache: true,
|
||||
hidden: true,
|
||||
canTo: true,
|
||||
title: '设计 AI 工作流',
|
||||
activePath: '/ai/workflow',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'console/workflow/:type/:id',
|
||||
component: () => import('#/views/ai/workflow/form/index.vue'),
|
||||
name: 'AiWorkflowUpdate',
|
||||
meta: {
|
||||
noCache: true,
|
||||
hidden: true,
|
||||
canTo: true,
|
||||
title: '设计 AI 工作流',
|
||||
activePath: '/ai/workflow',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
export default routes;
|
||||
99
apps/web-antd/src/router/routes/modules/bpm.ts
Normal file
99
apps/web-antd/src/router/routes/modules/bpm.ts
Normal file
@@ -0,0 +1,99 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
|
||||
const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
path: '/bpm',
|
||||
name: 'bpm',
|
||||
meta: {
|
||||
title: '工作流',
|
||||
hideInMenu: true,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'process-instance/detail',
|
||||
component: () => import('#/views/bpm/processInstance/detail/index.vue'),
|
||||
name: 'BpmProcessInstanceDetail',
|
||||
meta: {
|
||||
title: '流程详情',
|
||||
activePath: '/bpm/task/my',
|
||||
icon: 'ant-design:history-outlined',
|
||||
keepAlive: false,
|
||||
hideInMenu: true,
|
||||
},
|
||||
props: (route) => {
|
||||
return {
|
||||
id: route.query.id,
|
||||
taskId: route.query.taskId,
|
||||
activityId: route.query.activityId,
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/bpm/manager/form/edit',
|
||||
name: 'BpmFormEditor',
|
||||
component: () => import('#/views/bpm/form/designer/index.vue'),
|
||||
meta: {
|
||||
title: '设计流程表单',
|
||||
activePath: '/bpm/manager/form',
|
||||
},
|
||||
props: (route) => {
|
||||
return {
|
||||
id: route.query.id,
|
||||
type: route.query.type,
|
||||
copyId: route.query.copyId,
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'manager/model/create',
|
||||
component: () => import('#/views/bpm/model/form/index.vue'),
|
||||
name: 'BpmModelCreate',
|
||||
meta: {
|
||||
title: '创建流程',
|
||||
activePath: '/bpm/manager/model',
|
||||
icon: 'carbon:flow-connection',
|
||||
hideInMenu: true,
|
||||
keepAlive: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'manager/model/:type/:id',
|
||||
component: () => import('#/views/bpm/model/form/index.vue'),
|
||||
name: 'BpmModelUpdate',
|
||||
meta: {
|
||||
title: '修改流程',
|
||||
activePath: '/bpm/manager/model',
|
||||
icon: 'carbon:flow-connection',
|
||||
hideInMenu: true,
|
||||
keepAlive: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'manager/definition',
|
||||
component: () => import('#/views/bpm/model/definition/index.vue'),
|
||||
name: 'BpmProcessDefinition',
|
||||
meta: {
|
||||
title: '流程定义',
|
||||
activePath: '/bpm/manager/model',
|
||||
icon: 'carbon:flow-modeler',
|
||||
hideInMenu: true,
|
||||
keepAlive: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'process-instance/report',
|
||||
component: () => import('#/views/bpm/processInstance/report/index.vue'),
|
||||
name: 'BpmProcessInstanceReport',
|
||||
meta: {
|
||||
title: '数据报表',
|
||||
activePath: '/bpm/manager/model',
|
||||
icon: 'carbon:data-2',
|
||||
hideInMenu: true,
|
||||
keepAlive: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
export default routes;
|
||||
90
apps/web-antd/src/router/routes/modules/crm.ts
Normal file
90
apps/web-antd/src/router/routes/modules/crm.ts
Normal file
@@ -0,0 +1,90 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
|
||||
const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
path: '/crm',
|
||||
name: 'CrmCenter',
|
||||
meta: {
|
||||
title: '客户管理',
|
||||
icon: 'simple-icons:civicrm',
|
||||
keepAlive: true,
|
||||
hideInMenu: true,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'clue/detail/:id',
|
||||
name: 'CrmClueDetail',
|
||||
meta: {
|
||||
title: '线索详情',
|
||||
activePath: '/crm/clue',
|
||||
},
|
||||
component: () => import('#/views/crm/clue/detail/index.vue'),
|
||||
},
|
||||
{
|
||||
path: 'customer/detail/:id',
|
||||
name: 'CrmCustomerDetail',
|
||||
meta: {
|
||||
title: '客户详情',
|
||||
activePath: '/crm/customer',
|
||||
},
|
||||
component: () => import('#/views/crm/customer/detail/index.vue'),
|
||||
},
|
||||
{
|
||||
path: 'business/detail/:id',
|
||||
name: 'CrmBusinessDetail',
|
||||
meta: {
|
||||
title: '商机详情',
|
||||
activePath: '/crm/business',
|
||||
},
|
||||
component: () => import('#/views/crm/business/detail/index.vue'),
|
||||
},
|
||||
{
|
||||
path: 'contract/detail/:id',
|
||||
name: 'CrmContractDetail',
|
||||
meta: {
|
||||
title: '合同详情',
|
||||
activePath: '/crm/contract',
|
||||
},
|
||||
component: () => import('#/views/crm/contract/detail/index.vue'),
|
||||
},
|
||||
{
|
||||
path: 'receivable-plan/detail/:id',
|
||||
name: 'CrmReceivablePlanDetail',
|
||||
meta: {
|
||||
title: '回款计划详情',
|
||||
activePath: '/crm/receivable-plan',
|
||||
},
|
||||
component: () => import('#/views/crm/receivable/plan/detail/index.vue'),
|
||||
},
|
||||
{
|
||||
path: 'receivable/detail/:id',
|
||||
name: 'CrmReceivableDetail',
|
||||
meta: {
|
||||
title: '回款详情',
|
||||
activePath: '/crm/receivable',
|
||||
},
|
||||
component: () => import('#/views/crm/receivable/detail/index.vue'),
|
||||
},
|
||||
{
|
||||
path: 'contact/detail/:id',
|
||||
name: 'CrmContactDetail',
|
||||
meta: {
|
||||
title: '联系人详情',
|
||||
activePath: '/crm/contact',
|
||||
},
|
||||
component: () => import('#/views/crm/contact/detail/index.vue'),
|
||||
},
|
||||
{
|
||||
path: 'product/detail/:id',
|
||||
name: 'CrmProductDetail',
|
||||
meta: {
|
||||
title: '产品详情',
|
||||
activePath: '/crm/product',
|
||||
},
|
||||
component: () => import('#/views/crm/product/detail/index.vue'),
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
export default routes;
|
||||
48
apps/web-antd/src/router/routes/modules/dashboard.ts
Normal file
48
apps/web-antd/src/router/routes/modules/dashboard.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
|
||||
import { $t } from '#/locales';
|
||||
|
||||
const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
meta: {
|
||||
icon: 'lucide:layout-dashboard',
|
||||
order: -1,
|
||||
title: $t('page.dashboard.title'),
|
||||
},
|
||||
name: 'Dashboard',
|
||||
path: '/dashboard',
|
||||
children: [
|
||||
{
|
||||
name: 'Workspace',
|
||||
path: '/workspace',
|
||||
component: () => import('#/views/dashboard/workspace/index.vue'),
|
||||
meta: {
|
||||
icon: 'carbon:workspace',
|
||||
title: $t('page.dashboard.workspace'),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Analytics',
|
||||
path: '/analytics',
|
||||
component: () => import('#/views/dashboard/analytics/index.vue'),
|
||||
meta: {
|
||||
affixTab: true,
|
||||
icon: 'lucide:area-chart',
|
||||
title: $t('page.dashboard.analytics'),
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Profile',
|
||||
path: '/profile',
|
||||
component: () => import('#/views/_core/profile/index.vue'),
|
||||
meta: {
|
||||
icon: 'ant-design:profile-outlined',
|
||||
title: $t('ui.widgets.profile'),
|
||||
hideInMenu: true,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export default routes;
|
||||
30
apps/web-antd/src/router/routes/modules/infra.ts
Normal file
30
apps/web-antd/src/router/routes/modules/infra.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
|
||||
const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
path: '/infra/job/log',
|
||||
component: () => import('#/views/infra/job/logger/index.vue'),
|
||||
name: 'InfraJobLog',
|
||||
meta: {
|
||||
title: '调度日志',
|
||||
icon: 'ant-design:history-outlined',
|
||||
activePath: '/infra/job',
|
||||
keepAlive: false,
|
||||
hideInMenu: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/infra/codegen/edit',
|
||||
component: () => import('#/views/infra/codegen/edit/index.vue'),
|
||||
name: 'InfraCodegenEdit',
|
||||
meta: {
|
||||
title: '生成配置修改',
|
||||
icon: 'ic:baseline-view-in-ar',
|
||||
activePath: '/infra/codegen',
|
||||
keepAlive: true,
|
||||
hideInMenu: true,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export default routes;
|
||||
46
apps/web-antd/src/router/routes/modules/iot.ts
Normal file
46
apps/web-antd/src/router/routes/modules/iot.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
|
||||
const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
path: '/iot',
|
||||
name: 'IoTCenter',
|
||||
meta: {
|
||||
title: 'IoT 物联网',
|
||||
icon: 'lucide:cpu',
|
||||
keepAlive: true,
|
||||
hideInMenu: true,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'product/detail/:id',
|
||||
name: 'IoTProductDetail',
|
||||
meta: {
|
||||
title: '产品详情',
|
||||
activePath: '/iot/device/product',
|
||||
},
|
||||
component: () => import('#/views/iot/product/product/detail/index.vue'),
|
||||
},
|
||||
{
|
||||
path: 'device/detail/:id',
|
||||
name: 'IoTDeviceDetail',
|
||||
meta: {
|
||||
title: '设备详情',
|
||||
activePath: '/iot/device/device',
|
||||
},
|
||||
component: () => import('#/views/iot/device/device/detail/index.vue'),
|
||||
},
|
||||
{
|
||||
path: 'ota/firmware/detail/:id',
|
||||
name: 'IoTOtaFirmwareDetail',
|
||||
meta: {
|
||||
title: '固件详情',
|
||||
activePath: '/iot/ota',
|
||||
},
|
||||
component: () =>
|
||||
import('#/views/iot/ota/modules/firmware-detail/index.vue'),
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
export default routes;
|
||||
45
apps/web-antd/src/router/routes/modules/leave.ts
Normal file
45
apps/web-antd/src/router/routes/modules/leave.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
|
||||
// OA 请假相关路由配置
|
||||
const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
path: '/bpm/oa',
|
||||
name: 'OALeave',
|
||||
meta: {
|
||||
title: 'OA请假',
|
||||
hideInMenu: true,
|
||||
redirect: '/bpm/oa/leave/index',
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'leave',
|
||||
name: 'OALeaveIndex',
|
||||
component: () => import('#/views/bpm/oa/leave/index.vue'),
|
||||
meta: {
|
||||
title: '请假列表',
|
||||
activePath: '/bpm/oa/leave',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'leave/create',
|
||||
name: 'OALeaveCreate',
|
||||
component: () => import('#/views/bpm/oa/leave/create.vue'),
|
||||
meta: {
|
||||
title: '创建请假',
|
||||
activePath: '/bpm/oa/leave',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'leave/detail',
|
||||
name: 'OALeaveDetail',
|
||||
component: () => import('#/views/bpm/oa/leave/detail.vue'),
|
||||
meta: {
|
||||
title: '请假详情',
|
||||
activePath: '/bpm/oa/leave',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
export default routes;
|
||||
110
apps/web-antd/src/router/routes/modules/mall.ts
Normal file
110
apps/web-antd/src/router/routes/modules/mall.ts
Normal file
@@ -0,0 +1,110 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
|
||||
const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
path: '/mall/product',
|
||||
name: 'ProductCenter',
|
||||
meta: {
|
||||
title: '商品中心',
|
||||
icon: 'lucide:shopping-bag',
|
||||
keepAlive: true,
|
||||
hideInMenu: true,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'spu/add',
|
||||
name: 'ProductSpuAdd',
|
||||
meta: {
|
||||
title: '商品添加',
|
||||
activePath: '/mall/product/spu',
|
||||
},
|
||||
component: () => import('#/views/mall/product/spu/form/index.vue'),
|
||||
},
|
||||
{
|
||||
path: String.raw`spu/edit/:id(\d+)`,
|
||||
name: 'ProductSpuEdit',
|
||||
meta: {
|
||||
title: '商品编辑',
|
||||
activePath: '/mall/product/spu',
|
||||
},
|
||||
component: () => import('#/views/mall/product/spu/form/index.vue'),
|
||||
},
|
||||
{
|
||||
path: String.raw`spu/detail/:id(\d+)`,
|
||||
name: 'ProductSpuDetail',
|
||||
meta: {
|
||||
title: '商品详情',
|
||||
activePath: '/mall/product/spu',
|
||||
},
|
||||
component: () => import('#/views/mall/product/spu/form/index.vue'),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/mall/trade',
|
||||
name: 'TradeCenter',
|
||||
meta: {
|
||||
title: '交易中心',
|
||||
icon: 'lucide:shopping-cart',
|
||||
keepAlive: true,
|
||||
hideInMenu: true,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: String.raw`order/detail/:id(\d+)`,
|
||||
name: 'TradeOrderDetail',
|
||||
meta: {
|
||||
title: '订单详情',
|
||||
activePath: '/mall/trade/order',
|
||||
},
|
||||
component: () => import('#/views/mall/trade/order/detail/index.vue'),
|
||||
},
|
||||
{
|
||||
path: String.raw`after-sale/detail/:id(\d+)`,
|
||||
name: 'TradeAfterSaleDetail',
|
||||
meta: {
|
||||
title: '退款详情',
|
||||
activePath: '/mall/trade/after-sale',
|
||||
},
|
||||
component: () =>
|
||||
import('#/views/mall/trade/afterSale/detail/index.vue'),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/diy',
|
||||
name: 'DiyCenter',
|
||||
meta: {
|
||||
title: '营销中心',
|
||||
icon: 'lucide:shopping-bag',
|
||||
keepAlive: true,
|
||||
hideInMenu: true,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: String.raw`template/decorate/:id(\d+)`,
|
||||
name: 'DiyTemplateDecorate',
|
||||
meta: {
|
||||
title: '模板装修',
|
||||
activePath: '/mall/promotion/diy-template/diy-template',
|
||||
},
|
||||
component: () =>
|
||||
import('#/views/mall/promotion/diy/template/decorate/index.vue'),
|
||||
},
|
||||
{
|
||||
path: 'page/decorate/:id',
|
||||
name: 'DiyPageDecorate',
|
||||
meta: {
|
||||
title: '页面装修',
|
||||
noCache: false,
|
||||
hidden: true,
|
||||
activePath: '/mall/promotion/diy-template/diy-page',
|
||||
},
|
||||
component: () =>
|
||||
import('#/views/mall/promotion/diy/page/decorate/index.vue'),
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
export default routes;
|
||||
17
apps/web-antd/src/router/routes/modules/member.ts
Normal file
17
apps/web-antd/src/router/routes/modules/member.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
|
||||
const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
path: '/member/user/detail',
|
||||
component: () => import('#/views/member/user/detail/index.vue'),
|
||||
name: 'MemberUserDetail',
|
||||
meta: {
|
||||
title: '会员详情',
|
||||
icon: 'lucide:user',
|
||||
activePath: '/member/user',
|
||||
hideInMenu: true,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export default routes;
|
||||
16
apps/web-antd/src/router/routes/modules/pay.ts
Normal file
16
apps/web-antd/src/router/routes/modules/pay.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
|
||||
const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
path: '/pay/cashier',
|
||||
component: () => import('#/views/pay/cashier/index.vue'),
|
||||
name: 'PayCashier',
|
||||
meta: {
|
||||
title: '收银台',
|
||||
icon: 'lucide:badge-japanese-yen',
|
||||
hideInMenu: true,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export default routes;
|
||||
16
apps/web-antd/src/router/routes/modules/system.ts
Normal file
16
apps/web-antd/src/router/routes/modules/system.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
|
||||
const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
path: '/system/notify-message',
|
||||
component: () => import('#/views/system/notify/my/index.vue'),
|
||||
name: 'MyNotifyMessage',
|
||||
meta: {
|
||||
title: '我的站内信',
|
||||
icon: 'ant-design:message-filled',
|
||||
hideInMenu: true,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export default routes;
|
||||
30
apps/web-antd/src/router/tongji.ts
Normal file
30
apps/web-antd/src/router/tongji.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import type { Router } from 'vue-router';
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
_hmt: any[];
|
||||
}
|
||||
}
|
||||
|
||||
const HM_ID = import.meta.env.VITE_APP_BAIDU_CODE;
|
||||
|
||||
/**
|
||||
* 设置百度统计
|
||||
* @param router
|
||||
*/
|
||||
function setupBaiduTongJi(router: Router) {
|
||||
// 如果没有配置百度统计的 ID,则不进行设置
|
||||
if (!HM_ID) {
|
||||
return;
|
||||
}
|
||||
|
||||
// _hmt:用于 router push
|
||||
window._hmt = window._hmt || [];
|
||||
|
||||
router.afterEach((to) => {
|
||||
// 添加到 _hmt 中
|
||||
window._hmt.push(['_trackPageview', to.fullPath]);
|
||||
});
|
||||
}
|
||||
|
||||
export { setupBaiduTongJi };
|
||||
Reference in New Issue
Block a user