✨ 查询用户角色.
This commit is contained in:
@@ -40,4 +40,12 @@ public interface SystemRoleDAO extends IMapper<SystemRoleDO> {
|
|||||||
*/
|
*/
|
||||||
Long getRoleIdByUserIdAndRoleCode(@Param("userId") Long userId, @Param("code") String code);
|
Long getRoleIdByUserIdAndRoleCode(@Param("userId") Long userId, @Param("code") String code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户角色
|
||||||
|
*
|
||||||
|
* @param userId userId
|
||||||
|
* @return roles
|
||||||
|
*/
|
||||||
|
List<SystemRoleDO> selectRoleByUserId(@Param("userId") Long userId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import lombok.NoArgsConstructor;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户 视图响应对象
|
* 用户 视图响应对象
|
||||||
@@ -61,4 +62,7 @@ public class SystemUserVO implements Serializable {
|
|||||||
@Schema(description = "修改人")
|
@Schema(description = "修改人")
|
||||||
private String updater;
|
private String updater;
|
||||||
|
|
||||||
|
@Schema(description = "用户角色")
|
||||||
|
private List<SystemRoleVO> roles;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import type { DataGrid, Pagination } from '@/types/global';
|
import type { DataGrid, Pagination } from '@/types/global';
|
||||||
import type { TableData } from '@arco-design/web-vue/es/table/interface';
|
import type { TableData } from '@arco-design/web-vue/es/table/interface';
|
||||||
|
import type { RoleQueryResponse } from '@/api/user/role';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,6 +56,7 @@ export interface UserQueryResponse extends TableData {
|
|||||||
updateTime: number;
|
updateTime: number;
|
||||||
creator: string;
|
creator: string;
|
||||||
updater: string;
|
updater: string;
|
||||||
|
roles: Array<RoleQueryResponse>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<!-- <a-link target="_blank" href="https://github.com/lijiahangmax/orion-ops-pro">教程</a-link> -->
|
<!-- <a-link target="_blank" href="https://github.com/lijiahangmax/orion-ops-pro">教程</a-link> -->
|
||||||
<a-link target="_blank" href="https://github.com/lijiahangmax/orion-ops-pro">github</a-link>
|
<a-link target="_blank" href="https://github.com/lijiahangmax/orion-ops-pro">github</a-link>
|
||||||
<a-link target="_blank" href="https://gitee.com/lijiahangmax/orion-ops-pro">gitee</a-link>
|
<a-link target="_blank" href="https://gitee.com/lijiahangmax/orion-ops-pro">gitee</a-link>
|
||||||
<a-link target="_blank" href="https://lijiahangmax.gitee.io/orion-ops-pro">文档</a-link>
|
<a-link target="_blank" href="https://lijiahangmax.github.io/orion-ops-pro">文档</a-link>
|
||||||
<a-link target="_blank" href="https://github.com/lijiahangmax/orion-ops-pro/blob/main/LICENSE">License</a-link>
|
<a-link target="_blank" href="https://github.com/lijiahangmax/orion-ops-pro/blob/main/LICENSE">License</a-link>
|
||||||
<a-link target="_blank" :href="`https://github.com/lijiahangmax/orion-ops-pro/releases/tag/v${version}`">v{{ version }} 开源版</a-link>
|
<a-link target="_blank" :href="`https://github.com/lijiahangmax/orion-ops-pro/releases/tag/v${version}`">v{{ version }} 开源版</a-link>
|
||||||
</a-space>
|
</a-space>
|
||||||
|
|||||||
@@ -1,189 +0,0 @@
|
|||||||
<!--<script lang="tsx">-->
|
|
||||||
<!-- import type { RouteMeta, RouteRecordRaw } from 'vue-router';-->
|
|
||||||
<!-- import { useRoute, useRouter } from 'vue-router';-->
|
|
||||||
<!-- import { compile, computed, defineComponent, h, ref } from 'vue';-->
|
|
||||||
<!-- import { useAppStore } from '@/store';-->
|
|
||||||
<!-- import { listenerRouteChange } from '@/utils/route-listener';-->
|
|
||||||
<!-- import { openWindow, regexUrl } from '@/utils';-->
|
|
||||||
<!-- import { openNewRoute } from '@/router';-->
|
|
||||||
<!-- import useMenuTree from './use-menu-tree';-->
|
|
||||||
|
|
||||||
<!-- export default defineComponent({-->
|
|
||||||
<!-- name: 'menuTree',-->
|
|
||||||
<!-- emit: ['collapse'],-->
|
|
||||||
<!-- setup() {-->
|
|
||||||
<!-- const appStore = useAppStore();-->
|
|
||||||
<!-- const router = useRouter();-->
|
|
||||||
<!-- const route = useRoute();-->
|
|
||||||
<!-- const { menuTree } = useMenuTree();-->
|
|
||||||
<!-- const collapsed = computed({-->
|
|
||||||
<!-- get() {-->
|
|
||||||
<!-- if (appStore.device === 'desktop') return appStore.menuCollapse;-->
|
|
||||||
<!-- return false;-->
|
|
||||||
<!-- },-->
|
|
||||||
<!-- set(value: boolean) {-->
|
|
||||||
<!-- appStore.updateSettings({ menuCollapse: value });-->
|
|
||||||
<!-- },-->
|
|
||||||
<!-- });-->
|
|
||||||
|
|
||||||
<!-- const topMenu = computed(() => appStore.topMenu);-->
|
|
||||||
<!-- const openKeys = ref<string[]>([]);-->
|
|
||||||
<!-- const selectedKey = ref<string[]>([]);-->
|
|
||||||
|
|
||||||
<!-- // 跳转路由-->
|
|
||||||
<!-- const goto = (e: any, item: RouteRecordRaw) => {-->
|
|
||||||
<!-- // 打开外链-->
|
|
||||||
<!-- if (regexUrl.test(item.path)) {-->
|
|
||||||
<!-- openWindow(item.path);-->
|
|
||||||
<!-- return;-->
|
|
||||||
<!-- }-->
|
|
||||||
<!-- const { hideInMenu, activeMenu, newWindow } = item.meta as RouteMeta;-->
|
|
||||||
<!-- // 新页面打开-->
|
|
||||||
<!-- if (newWindow || e.ctrlKey) {-->
|
|
||||||
<!-- openNewRoute({-->
|
|
||||||
<!-- name: item.name,-->
|
|
||||||
<!-- });-->
|
|
||||||
<!-- return;-->
|
|
||||||
<!-- }-->
|
|
||||||
<!-- // 设置 selectedKey-->
|
|
||||||
<!-- if (route.name === item.name && !hideInMenu && !activeMenu) {-->
|
|
||||||
<!-- selectedKey.value = [item.name as string];-->
|
|
||||||
<!-- return;-->
|
|
||||||
<!-- }-->
|
|
||||||
<!-- // 触发跳转-->
|
|
||||||
<!-- router.push({-->
|
|
||||||
<!-- name: item.name,-->
|
|
||||||
<!-- });-->
|
|
||||||
<!-- };-->
|
|
||||||
|
|
||||||
<!-- const findMenuOpenKeys = (target: string) => {-->
|
|
||||||
<!-- const result: string[] = [];-->
|
|
||||||
<!-- let isFind = false;-->
|
|
||||||
<!-- const backtrack = (item: RouteRecordRaw, keys: string[]) => {-->
|
|
||||||
<!-- if (item.name === target) {-->
|
|
||||||
<!-- isFind = true;-->
|
|
||||||
<!-- result.push(...keys);-->
|
|
||||||
<!-- return;-->
|
|
||||||
<!-- }-->
|
|
||||||
<!-- if (item.children?.length) {-->
|
|
||||||
<!-- item.children.forEach((el) => {-->
|
|
||||||
<!-- backtrack(el, [...keys, el.name as string]);-->
|
|
||||||
<!-- });-->
|
|
||||||
<!-- }-->
|
|
||||||
<!-- };-->
|
|
||||||
<!-- menuTree.value.forEach((el: RouteRecordRaw) => {-->
|
|
||||||
<!-- if (isFind) return;-->
|
|
||||||
<!-- backtrack(el, [el.name as string]);-->
|
|
||||||
<!-- });-->
|
|
||||||
<!-- return result;-->
|
|
||||||
<!-- };-->
|
|
||||||
|
|
||||||
<!-- // 监听路由 设置打开的 key-->
|
|
||||||
<!-- listenerRouteChange((newRoute) => {-->
|
|
||||||
<!-- const { activeMenu, hideInMenu } = newRoute.meta;-->
|
|
||||||
<!-- if (!hideInMenu || activeMenu) {-->
|
|
||||||
<!-- const menuOpenKeys = findMenuOpenKeys(-->
|
|
||||||
<!-- (activeMenu || newRoute.name) as string-->
|
|
||||||
<!-- );-->
|
|
||||||
|
|
||||||
<!-- const keySet = new Set([...menuOpenKeys, ...openKeys.value]);-->
|
|
||||||
<!-- openKeys.value = [...keySet];-->
|
|
||||||
|
|
||||||
<!-- selectedKey.value = [-->
|
|
||||||
<!-- activeMenu || menuOpenKeys[menuOpenKeys.length - 1],-->
|
|
||||||
<!-- ];-->
|
|
||||||
<!-- }-->
|
|
||||||
<!-- }, true);-->
|
|
||||||
|
|
||||||
<!-- // 展开菜单-->
|
|
||||||
<!-- const setCollapse = (val: boolean) => {-->
|
|
||||||
<!-- if (appStore.device === 'desktop')-->
|
|
||||||
<!-- appStore.updateSettings({ menuCollapse: val });-->
|
|
||||||
<!-- };-->
|
|
||||||
|
|
||||||
<!-- // 渲染菜单-->
|
|
||||||
<!-- const renderSubMenu = () => {-->
|
|
||||||
<!-- function travel(_route: RouteRecordRaw[], nodes = []) {-->
|
|
||||||
<!-- if (_route) {-->
|
|
||||||
<!-- _route.forEach((element) => {-->
|
|
||||||
<!-- // This is demo, modify nodes as needed-->
|
|
||||||
<!-- const icon = element?.meta?.icon-->
|
|
||||||
<!-- ? () => h(compile(`<${element?.meta?.icon}/>`))-->
|
|
||||||
<!-- : null;-->
|
|
||||||
<!-- const node =-->
|
|
||||||
<!-- element?.children && element?.children.length !== 0 ? (-->
|
|
||||||
<!-- <a-sub-menu-->
|
|
||||||
<!-- key={element?.name}-->
|
|
||||||
<!-- v-slots={{-->
|
|
||||||
<!-- icon,-->
|
|
||||||
<!-- // 去除国际化 title: () => h(compile(t(element?.meta?.locale || ''))),-->
|
|
||||||
<!-- title: () => h(compile(element?.meta?.locale || '')),-->
|
|
||||||
<!-- }}-->
|
|
||||||
<!-- >-->
|
|
||||||
<!-- {travel(element?.children)}-->
|
|
||||||
<!-- </a-sub-menu>-->
|
|
||||||
<!-- ) : (-->
|
|
||||||
<!-- <a-menu-item-->
|
|
||||||
<!-- key={element?.name}-->
|
|
||||||
<!-- v-slots={{ icon }}-->
|
|
||||||
<!-- onClick={($event: any) => goto($event, element)}-->
|
|
||||||
<!-- >-->
|
|
||||||
<!-- {element?.meta?.locale || ''}-->
|
|
||||||
<!-- </a-menu-item>-->
|
|
||||||
<!-- );-->
|
|
||||||
<!-- nodes.push(node as never);-->
|
|
||||||
<!-- });-->
|
|
||||||
<!-- }-->
|
|
||||||
<!-- return nodes;-->
|
|
||||||
<!-- }-->
|
|
||||||
|
|
||||||
<!-- return travel(menuTree.value);-->
|
|
||||||
<!-- };-->
|
|
||||||
|
|
||||||
<!-- return () => (-->
|
|
||||||
<!-- <a-menu-->
|
|
||||||
<!-- mode={topMenu.value ? 'horizontal' : 'vertical'}-->
|
|
||||||
<!-- v-model:collapsed={collapsed.value}-->
|
|
||||||
<!-- v-model:open-keys={openKeys.value}-->
|
|
||||||
<!-- show-collapse-button={appStore.device !== 'mobile'}-->
|
|
||||||
<!-- auto-open={false}-->
|
|
||||||
<!-- selected-keys={selectedKey.value}-->
|
|
||||||
<!-- auto-open-selected={true}-->
|
|
||||||
<!-- level-indent={34}-->
|
|
||||||
<!-- style="height: 100%; width:100%;"-->
|
|
||||||
<!-- onCollapse={setCollapse}-->
|
|
||||||
<!-- >-->
|
|
||||||
<!-- {renderSubMenu()}-->
|
|
||||||
<!-- </a-menu>-->
|
|
||||||
<!-- );-->
|
|
||||||
<!-- },-->
|
|
||||||
<!-- });-->
|
|
||||||
<!--</script>-->
|
|
||||||
|
|
||||||
<!--<style lang="less" scoped>-->
|
|
||||||
<!-- :deep(.arco-menu-inner) {-->
|
|
||||||
<!-- .arco-menu-inline-header {-->
|
|
||||||
<!-- display: flex;-->
|
|
||||||
<!-- align-items: center;-->
|
|
||||||
<!-- }-->
|
|
||||||
|
|
||||||
<!-- .arco-icon {-->
|
|
||||||
<!-- &:not(.arco-icon-down) {-->
|
|
||||||
<!-- font-size: 18px;-->
|
|
||||||
<!-- }-->
|
|
||||||
<!-- }-->
|
|
||||||
|
|
||||||
<!-- .arco-menu-icon {-->
|
|
||||||
<!-- margin-right: 10px !important;-->
|
|
||||||
<!-- }-->
|
|
||||||
|
|
||||||
<!-- .arco-menu-indent-list {-->
|
|
||||||
<!-- width: 28px;-->
|
|
||||||
<!-- display: inline-block;-->
|
|
||||||
<!-- }-->
|
|
||||||
|
|
||||||
<!-- .arco-menu-title {-->
|
|
||||||
<!-- user-select: none;-->
|
|
||||||
<!-- }-->
|
|
||||||
<!-- }-->
|
|
||||||
<!--</style>-->
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-card class="general-card"
|
<a-card class="general-card"
|
||||||
title="帮助文档"
|
title="帮助文档"
|
||||||
:header-style="{ paddingBottom: '0' }"
|
:header-style="{ paddingBottom: '4px' }"
|
||||||
:body-style="{ padding: '8px 20px 8px 20px' }">
|
:body-style="{ padding: '0px 20px 8px 20px' }">
|
||||||
<a-row>
|
<a-row>
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
<a-link target="_blank" href="https://github.com/lijiahangmax/orion-ops-pro">github</a-link>
|
<a-link target="_blank" href="https://github.com/lijiahangmax/orion-ops-pro">github</a-link>
|
||||||
@@ -14,7 +14,13 @@
|
|||||||
<a-link target="_blank" href="https://github.com/lijiahangmax/orion-ops-pro/blob/main/LICENSE">License</a-link>
|
<a-link target="_blank" href="https://github.com/lijiahangmax/orion-ops-pro/blob/main/LICENSE">License</a-link>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
<a-link target="_blank" href="https://lijiahangmax.gitee.io/orion-ops-pro">操作文档</a-link>
|
<a-link target="_blank" href="https://github.com/lijiahangmax/orion-ops-pro/issues">上报 bug</a-link>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-link target="_blank" href="https://lijiahangmax.github.io/orion-ops-pro">操作文档</a-link>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-link target="_blank" href="https://lijiahangmax.github.io/orion-ops-pro/#/about/change-log">更新文档</a-link>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
</a-card>
|
</a-card>
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-card class="general-card"
|
<a-card class="general-card"
|
||||||
title="快捷操作"
|
title="快捷操作"
|
||||||
:header-style="{ paddingBottom: '0' }"
|
:body-style="{ padding: '0 20px' }">
|
||||||
:body-style="{ padding: '20px 20px 0 20px' }">
|
|
||||||
<a-row :gutter="8">
|
<a-row :gutter="8">
|
||||||
<a-col v-for="link in links"
|
<a-col v-for="link in links"
|
||||||
:key="link.meta.locale as string"
|
:key="link.meta.locale as string"
|
||||||
|
|||||||
@@ -12,8 +12,7 @@
|
|||||||
<!-- 操作日志 -->
|
<!-- 操作日志 -->
|
||||||
<a-card class="general-card"
|
<a-card class="general-card"
|
||||||
title="操作日志"
|
title="操作日志"
|
||||||
:header-style="{ paddingBottom: '0' }"
|
:body-style="{ padding: '0 20px 8px 20px' }">
|
||||||
:body-style="{ padding: '8px 20px 8px 20px' }">
|
|
||||||
<operator-log-simple-table :current="true"
|
<operator-log-simple-table :current="true"
|
||||||
:handle-column="false" />
|
:handle-column="false" />
|
||||||
</a-card>
|
</a-card>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-spin :loading="loading" style="width: 400px;">
|
<a-spin :loading="loading" style="width: 520px;">
|
||||||
<!-- 头像 -->
|
<!-- 头像 -->
|
||||||
<div class="avatar-container">
|
<div class="avatar-container">
|
||||||
<div class="avatar-wrapper">
|
<div class="avatar-wrapper">
|
||||||
@@ -33,6 +33,10 @@
|
|||||||
<a-form-item field="email" label="邮箱">
|
<a-form-item field="email" label="邮箱">
|
||||||
<a-input v-model="formModel.email" placeholder="请输入邮箱" />
|
<a-input v-model="formModel.email" placeholder="请输入邮箱" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<!-- 角色 -->
|
||||||
|
<a-form-item field="roles" label="角色" disabled>
|
||||||
|
<a-input-tag v-model="roles" placeholder="角色" />
|
||||||
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
<!-- 操作 -->
|
<!-- 操作 -->
|
||||||
<div class="handler-container">
|
<div class="handler-container">
|
||||||
@@ -68,6 +72,7 @@
|
|||||||
const nickname = ref('');
|
const nickname = ref('');
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
const formModel = ref<UserUpdateRequest>({});
|
const formModel = ref<UserUpdateRequest>({});
|
||||||
|
const roles = ref<Array<string>>([]);
|
||||||
|
|
||||||
// 修改用户信息
|
// 修改用户信息
|
||||||
const save = async () => {
|
const save = async () => {
|
||||||
@@ -103,6 +108,7 @@
|
|||||||
u = data;
|
u = data;
|
||||||
}
|
}
|
||||||
formModel.value = pick(u, 'id', 'username', 'nickname', 'mobile', 'email');
|
formModel.value = pick(u, 'id', 'username', 'nickname', 'mobile', 'email');
|
||||||
|
roles.value = (u.roles || []).map(s => `${s.name}(${s.code})`);
|
||||||
nickname.value = u.nickname?.substring(0, 1);
|
nickname.value = u.nickname?.substring(0, 1);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ const columns = [
|
|||||||
title: '角色名称',
|
title: '角色名称',
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
slotName: 'name',
|
slotName: 'name',
|
||||||
|
ellipsis: true,
|
||||||
|
tooltip: true,
|
||||||
}, {
|
}, {
|
||||||
title: '角色编码',
|
title: '角色编码',
|
||||||
dataIndex: 'code',
|
dataIndex: 'code',
|
||||||
|
|||||||
@@ -127,7 +127,6 @@
|
|||||||
<!-- 分配角色 -->
|
<!-- 分配角色 -->
|
||||||
<a-button type="text"
|
<a-button type="text"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="record.id === userStore.id"
|
|
||||||
v-permission="['infra:system-user:grant-role']"
|
v-permission="['infra:system-user:grant-role']"
|
||||||
@click="emits('openGrantRole', record)">
|
@click="emits('openGrantRole', record)">
|
||||||
分配角色
|
分配角色
|
||||||
|
|||||||
Reference in New Issue
Block a user