feat: 完成ruoyi、pure菜单兼容
This commit is contained in:
@@ -7,6 +7,72 @@ import { system, monitor } from "@/router/enums";
|
||||
* admin:管理员角色
|
||||
* common:普通角色
|
||||
*/
|
||||
const testRouter = [
|
||||
{
|
||||
id: "906c8094-21a1-1042-f151-3a14dab3cadb",
|
||||
parentId: "00000000-0000-0000-0000-000000000000",
|
||||
path: "/monitor",
|
||||
name: null,
|
||||
meta: {
|
||||
icon: "menus.pureSysMonitor",
|
||||
title: "系统监控",
|
||||
component: null,
|
||||
roles: null,
|
||||
auths: [null],
|
||||
frameSrc: null,
|
||||
frameLoading: null,
|
||||
keepAlive: null,
|
||||
showLink: true
|
||||
},
|
||||
children: [
|
||||
{
|
||||
id: "c765691a-32e4-4e88-6e8a-3a14dab3cadb",
|
||||
parentId: "906c8094-21a1-1042-f151-3a14dab3cadb",
|
||||
path: "/monitor/online-user",
|
||||
name: "OnlineUser",
|
||||
meta: {
|
||||
icon: "ri:user-voice-line",
|
||||
title: "在线用户",
|
||||
component: null,
|
||||
roles: null,
|
||||
auths: ["monitor:online:list"],
|
||||
frameSrc: null,
|
||||
frameLoading: null,
|
||||
keepAlive: null,
|
||||
showLink: true
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/monitor/operation-logs",
|
||||
name: "OperationLog",
|
||||
meta: {
|
||||
icon: "ri:history-fill",
|
||||
title: "操作日志",
|
||||
component: "monitor/logs/operation/index",
|
||||
showLink: true
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "580a7b97-15ab-6d43-d011-3a14dab3cadc",
|
||||
parentId: "906c8094-21a1-1042-f151-3a14dab3cadb",
|
||||
path: "/monitor/login-logs",
|
||||
name: "LoginLog",
|
||||
meta: {
|
||||
icon: "ri:window-line",
|
||||
title: "登录日志",
|
||||
component: "monitor/logs/login/index",
|
||||
roles: null,
|
||||
auths: ["monitor:logininfor:list"],
|
||||
frameSrc: null,
|
||||
frameLoading: null,
|
||||
keepAlive: null,
|
||||
showLink: true
|
||||
},
|
||||
children: null
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
const systemManagementRouter = {
|
||||
path: "/system",
|
||||
@@ -334,6 +400,7 @@ export default defineFakeRoute([
|
||||
url: `/dev-api/get-async-routes`,
|
||||
method: "get",
|
||||
response: () => {
|
||||
return testRouter;
|
||||
return [
|
||||
systemManagementRouter,
|
||||
systemMonitorRouter
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { http } from "@/utils/http";
|
||||
|
||||
type Result = {
|
||||
success: boolean;
|
||||
data: Array<any>;
|
||||
};
|
||||
import type { Result } from "@/api/result";
|
||||
|
||||
export const getAsyncRoutes = () => {
|
||||
return http.request<Result>("get", "/get-async-routes");
|
||||
};
|
||||
|
||||
export const getRoutes = () => {
|
||||
return http.request<Result>("get", "/account/Vue3Router/pure");
|
||||
};
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
import { http } from "@/utils/http";
|
||||
import type { Result, ResultList, ResultPage } from "./result.ts";
|
||||
|
||||
/** 新增角色 */
|
||||
export const addRole = (data: any) => {
|
||||
return http.request<Result>("post", `/role`, { data });
|
||||
};
|
||||
|
||||
/** 获取系统管理-角色管理列表 */
|
||||
export const getRoleList = (data?: object) => {
|
||||
return http.request<ResultPage>("post", "/role", { data });
|
||||
};
|
||||
|
||||
/** 获取系统管理-菜单管理列表 */
|
||||
export const getMenuList = (data?: object) => {
|
||||
return http.request<Result>("post", "/menu", { data });
|
||||
};
|
||||
|
||||
/** 获取系统监控-在线用户列表 */
|
||||
export const getOnlineLogsList = (data?: object) => {
|
||||
return http.request<ResultPage>("post", "/online-logs", { data });
|
||||
};
|
||||
|
||||
/** 获取系统监控-登录日志列表 */
|
||||
export const getLoginLogsList = (data?: object) => {
|
||||
return http.request<ResultPage>("post", "/login-logs", { data });
|
||||
};
|
||||
|
||||
/** 获取系统监控-操作日志列表 */
|
||||
export const getOperationLogsList = (data?: object) => {
|
||||
return http.request<ResultPage>("post", "/operation-logs", { data });
|
||||
};
|
||||
|
||||
/** 获取系统监控-系统日志列表 */
|
||||
export const getSystemLogsList = (data?: object) => {
|
||||
return http.request<ResultPage>("post", "/system-logs", { data });
|
||||
};
|
||||
|
||||
/** 获取系统监控-系统日志-根据 id 查日志详情 */
|
||||
export const getSystemLogsDetail = (data?: object) => {
|
||||
return http.request<ResultList>("post", "/system-logs-detail", { data });
|
||||
};
|
||||
|
||||
/** 获取角色管理-权限-菜单权限 */
|
||||
export const getRoleMenu = (data?: object) => {
|
||||
return http.request<ResultList>("post", "/role-menu", { data });
|
||||
};
|
||||
|
||||
/** 获取角色管理-权限-菜单权限-根据角色 id 查对应菜单 */
|
||||
export const getRoleMenuIds = (data?: object) => {
|
||||
return http.request<ResultList>("post", "/role-menu-ids", { data });
|
||||
};
|
||||
@@ -27,7 +27,8 @@ const IFrame = () => import("@/layout/frame.vue");
|
||||
const modulesRoutes = import.meta.glob("/src/views/**/*.{vue,tsx}");
|
||||
|
||||
// 动态路由
|
||||
import { getAsyncRoutes } from "@/api/routes";
|
||||
// getAsyncRoutes
|
||||
import { getRoutes,getAsyncRoutes } from "@/api/routes";
|
||||
|
||||
function handRank(routeInfo: any) {
|
||||
const { name, path, parentId, meta } = routeInfo;
|
||||
@@ -202,7 +203,7 @@ function initRouter() {
|
||||
});
|
||||
} else {
|
||||
return new Promise(resolve => {
|
||||
getAsyncRoutes().then(({ data }) => {
|
||||
getRoutes().then(({ data }) => {
|
||||
handleAsyncRoutes(cloneDeep(data));
|
||||
storageLocal().setItem(key, data);
|
||||
resolve(router);
|
||||
@@ -211,7 +212,7 @@ function initRouter() {
|
||||
}
|
||||
} else {
|
||||
return new Promise(resolve => {
|
||||
getAsyncRoutes().then(({ data }) => {
|
||||
getRoutes().then(({ data }) => {
|
||||
handleAsyncRoutes(cloneDeep(data));
|
||||
resolve(router);
|
||||
});
|
||||
@@ -303,6 +304,9 @@ function addAsyncRoutes(arrRoutes: Array<RouteRecordRaw>) {
|
||||
if (!arrRoutes || !arrRoutes.length) return;
|
||||
const modulesRoutesKeys = Object.keys(modulesRoutes);
|
||||
arrRoutes.forEach((v: RouteRecordRaw) => {
|
||||
if (v.children == null) {
|
||||
v.children = undefined;
|
||||
}
|
||||
// 将backstage属性加入meta,标识此路由为后端返回路由
|
||||
v.meta.backstage = true;
|
||||
// 父级的redirect属性取值:如果子级存在且父级的redirect属性不存在,默认取第一个子级的path;如果子级存在且父级的redirect属性存在,取存在的redirect属性,会覆盖默认值
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
getLogin,
|
||||
getUserInfo,
|
||||
refreshTokenApi
|
||||
} from "@/api/user";
|
||||
} from "@/api/account";
|
||||
import { useMultiTagsStoreHook } from "./multiTags";
|
||||
import { type DataInfo, setToken, removeToken, userKey } from "@/utils/auth";
|
||||
|
||||
|
||||
@@ -19,12 +19,11 @@ import LoginQrCode from "./components/LoginQrCode.vue";
|
||||
import { useUserStoreHook } from "@/store/modules/user";
|
||||
import { initRouter, getTopMenu } from "@/router/utils";
|
||||
import { bg, avatar, illustration } from "./utils/static";
|
||||
import { ReImageVerify } from "@/components/ReImageVerify";
|
||||
import { ref, toRaw, reactive, watch, computed } from "vue";
|
||||
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
||||
import { useTranslationLang } from "@/layout/hooks/useTranslationLang";
|
||||
import { useDataThemeChange } from "@/layout/hooks/useDataThemeChange";
|
||||
import { getCodeImg } from "@/api/user";
|
||||
import { getCodeImg } from "@/api/account";
|
||||
|
||||
import dayIcon from "@/assets/svg/day.svg?component";
|
||||
import darkIcon from "@/assets/svg/dark.svg?component";
|
||||
|
||||
@@ -42,12 +42,12 @@ const dataList = ref([
|
||||
{
|
||||
title: "响应体",
|
||||
name: "requestResult",
|
||||
data: (props.data[0] as any).requestResult
|
||||
data: (props.data[0] as any)?.requestResult
|
||||
},
|
||||
{
|
||||
title: "请求体",
|
||||
name: "requestParam",
|
||||
data: (props.data[0] as any).requestParam
|
||||
data: (props.data[0] as any)?.requestParam
|
||||
}
|
||||
]);
|
||||
</script>
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import dayjs from "dayjs";
|
||||
import Detail from "../detail.vue";
|
||||
import { message } from "@/utils/message";
|
||||
import { addDialog } from "@/components/ReDialog";
|
||||
import type { PaginationProps } from "@pureadmin/table";
|
||||
import { type Ref, reactive, ref, onMounted, toRaw } from "vue";
|
||||
import { type Ref, reactive, ref, onMounted } from "vue";
|
||||
import { getKeyList, useCopyToClipboard } from "@pureadmin/utils";
|
||||
import { getSystemLogsList, getSystemLogsDetail } from "@/api/system";
|
||||
import Info from "@iconify-icons/ri/question-line";
|
||||
|
||||
export function useRole(tableRef: Ref) {
|
||||
@@ -189,28 +186,29 @@ export function useRole(tableRef: Ref) {
|
||||
}
|
||||
|
||||
function onDetail(row) {
|
||||
getSystemLogsDetail({ id: row.id }).then(res => {
|
||||
addDialog({
|
||||
title: "系统日志详情",
|
||||
fullscreen: true,
|
||||
hideFooter: true,
|
||||
contentRenderer: () => Detail,
|
||||
props: {
|
||||
data: [res]
|
||||
}
|
||||
});
|
||||
});
|
||||
console.log(row);
|
||||
// getSystemLogsDetail({ id: row.id }).then(res => {
|
||||
// addDialog({
|
||||
// title: "系统日志详情",
|
||||
// fullscreen: true,
|
||||
// hideFooter: true,
|
||||
// contentRenderer: () => Detail,
|
||||
// props: {
|
||||
// data: [res]
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
}
|
||||
|
||||
async function onSearch() {
|
||||
loading.value = true;
|
||||
const { data } = await getSystemLogsList(toRaw(form));
|
||||
dataList.value = data.items;
|
||||
pagination.total = data.totalCount;
|
||||
|
||||
setTimeout(() => {
|
||||
loading.value = false;
|
||||
}, 500);
|
||||
// loading.value = true;
|
||||
// const { data } = await getSystemLogsList(toRaw(form));
|
||||
// dataList.value = data.items;
|
||||
// pagination.total = data.totalCount;
|
||||
//
|
||||
// setTimeout(() => {
|
||||
// loading.value = false;
|
||||
// }, 500);
|
||||
}
|
||||
|
||||
const resetForm = formEl => {
|
||||
|
||||
Reference in New Issue
Block a user