From ec98add5b258c5f0ad67dbc74df6e105d7f66813 Mon Sep 17 00:00:00 2001 From: wangyu <823267011@qq.com> Date: Mon, 24 Feb 2025 21:25:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=B4=E6=97=B6=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/system/SysRoleController.java | 9 ++ .../controller/system/SysUserController.java | 14 +++ .../ruoyi/system/mapper/SysRoleMapper.java | 6 + .../ruoyi/system/service/ISysRoleService.java | 10 ++ .../service/impl/SysRoleServiceImpl.java | 11 ++ .../resources/mapper/system/SysRoleMapper.xml | 10 ++ ruoyi-ui/src/api/system/role.js | 8 ++ ruoyi-ui/src/components/Crontab/index.vue | 1 - ruoyi-ui/src/components/Inventory/index.vue | 1 - ruoyi-ui/src/components/QuickAccess/index.vue | 1 - .../layout/components/ChatComponent/index.vue | 3 - ruoyi-ui/src/layout/components/Navbar.vue | 5 +- ruoyi-ui/src/permission.js | 22 ++-- ruoyi-ui/src/plugins/download.js | 3 - .../plugins/package/penal/PropertiesPanel.vue | 1 - ruoyi-ui/src/router/index.js | 2 +- ruoyi-ui/src/store/modules/user.js | 1 - ruoyi-ui/src/utils/websocket.js | 2 +- ruoyi-ui/src/views/index.vue | 108 +++++++++++++++--- ruoyi-ui/src/views/oa/attendance/index.vue | 1 - ruoyi-ui/src/views/oa/claim/add.vue | 2 +- ruoyi-ui/src/views/oa/claim/detail.vue | 1 - ruoyi-ui/src/views/oa/claim/index.vue | 1 - ruoyi-ui/src/views/oa/closure/index.vue | 1 - ruoyi-ui/src/views/oa/costing/list.vue | 2 +- ruoyi-ui/src/views/oa/holidaycal/index.vue | 24 ++-- ruoyi-ui/src/views/oa/onboarding/index.vue | 2 +- ruoyi-ui/src/views/oa/proContract/index.vue | 2 +- ruoyi-ui/src/views/oa/project/index.vue | 4 +- ruoyi-ui/src/views/workflow/work/finished.vue | 1 - ruoyi-ui/src/views/workflow/work/todo.vue | 1 - 31 files changed, 194 insertions(+), 66 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java index f8edb5d..e9919dd 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java @@ -224,4 +224,13 @@ public class SysRoleController extends BaseController { ajax.put("depts", deptService.selectDeptTreeList(new SysDept())); return R.ok(ajax); } + + + /** + * 获取当前用户的role对象 + */ + @GetMapping("/currentRole") + public R currentRole() { + return R.ok(roleService.getCurrentRole()); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java index 713c543..279ce53 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java @@ -263,4 +263,18 @@ public class SysUserController extends BaseController { return R.ok(deptService.selectDeptTreeList(dept)); } + + /** + * 用户授权角色 + * + * @param userId 用户Id + */ + @SaCheckPermission("system:user:edit") + @Log(title = "用户管理", businessType = BusinessType.GRANT) + @GetMapping("/tempRole") + public R insertTempRole(Long userId) { + Long[] roleId = roleService.selectRoleByName(); + userService.insertUserAuth(userId, roleId); + return R.ok(); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMapper.java index e2b3c01..d0a34f5 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMapper.java @@ -59,4 +59,10 @@ public interface SysRoleMapper extends BaseMapperPlus selectRolesByUserName(String userName); + /** + * 获取当前用户角色对象 + * @param userId + * @return + */ + SysRole getCurrentRole(Long userId); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java index d046984..e9a0f14 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java @@ -178,4 +178,14 @@ public interface ISysRoleService { int insertAuthUsers(Long roleId, Long[] userIds); void cleanOnlineUserByRole(Long roleId); + + /** + * + * @return + */ + Long[] selectRoleByName(); + + + SysRole getCurrentRole(); + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java index b28df9e..cd38bbf 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java @@ -440,4 +440,15 @@ public class SysRoleServiceImpl implements ISysRoleService { } }); } + + @Override + public Long[] selectRoleByName() { + return new Long[0]; + } + + @Override + public SysRole getCurrentRole() { + + return baseMapper.getCurrentRole(LoginHelper.getUserId()); + } } diff --git a/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml index 90dff50..5ec3af9 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml @@ -67,4 +67,14 @@ WHERE r.del_flag = '0' and u.user_name = #{userName} + + + diff --git a/ruoyi-ui/src/api/system/role.js b/ruoyi-ui/src/api/system/role.js index f13e6f4..3f80042 100644 --- a/ruoyi-ui/src/api/system/role.js +++ b/ruoyi-ui/src/api/system/role.js @@ -17,6 +17,14 @@ export function getRole(roleId) { }) } +// 查询角色详细 +export function currentRole() { + return request({ + url: '/system/role/currentRole', + method: 'get' + }) +} + // 新增角色 export function addRole(data) { return request({ diff --git a/ruoyi-ui/src/components/Crontab/index.vue b/ruoyi-ui/src/components/Crontab/index.vue index 3963df2..9e1fa48 100644 --- a/ruoyi-ui/src/components/Crontab/index.vue +++ b/ruoyi-ui/src/components/Crontab/index.vue @@ -182,7 +182,6 @@ export default { "updateCrontabValue", name, value, from; this.crontabValueObj[name] = value; if (from && from !== name) { - console.log(`来自组件 ${from} 改变了 ${name} ${value}`); this.changeRadio(name, value); } }, diff --git a/ruoyi-ui/src/components/Inventory/index.vue b/ruoyi-ui/src/components/Inventory/index.vue index 5a9c3dd..2261609 100644 --- a/ruoyi-ui/src/components/Inventory/index.vue +++ b/ruoyi-ui/src/components/Inventory/index.vue @@ -46,7 +46,6 @@ export default { this.loading = true; listOaOutWarehouse(this.queryParams).then(res => { this.outWareHouseList = res.rows - console.log(res.rows) this.total = res.total this.loading = false }) diff --git a/ruoyi-ui/src/components/QuickAccess/index.vue b/ruoyi-ui/src/components/QuickAccess/index.vue index 8d9ef68..e32631f 100644 --- a/ruoyi-ui/src/components/QuickAccess/index.vue +++ b/ruoyi-ui/src/components/QuickAccess/index.vue @@ -47,7 +47,6 @@ export default { //路由跳转 goTarget(href) { this.$router.push({ path: href}); - console.log(999,href) }, /** 查询流程定义列表 */ getList() { diff --git a/ruoyi-ui/src/layout/components/ChatComponent/index.vue b/ruoyi-ui/src/layout/components/ChatComponent/index.vue index 72b57cc..5ef091e 100644 --- a/ruoyi-ui/src/layout/components/ChatComponent/index.vue +++ b/ruoyi-ui/src/layout/components/ChatComponent/index.vue @@ -77,7 +77,6 @@ export default { methods: { // 打开聊天窗口 openChat() { - console.log("窗口打开") this.drawerVisible = true; }, @@ -91,7 +90,6 @@ export default { selectContact(contact) { this.selectedContact = contact; this.chatHistory = []; // 清空当前聊天记录 - console.log(contact); this.loadMessage(contact.id); }, @@ -121,7 +119,6 @@ export default { this.msgListLoading = true; getContact(concatId).then(response => { if (response.code === 200) { - console.log(response.data) this.currentContact = response.data; this.contactUser = response.data.user; this.chatHistory = response.data.messages; diff --git a/ruoyi-ui/src/layout/components/Navbar.vue b/ruoyi-ui/src/layout/components/Navbar.vue index 1232bd3..3612fcf 100644 --- a/ruoyi-ui/src/layout/components/Navbar.vue +++ b/ruoyi-ui/src/layout/components/Navbar.vue @@ -193,7 +193,7 @@ export default { this.currentContact = response.data; this.contactUser = response.data.user; this.msgList = response.data.messages; - console.log(this.msgList); + } this.msgListLoading = false; this.fleshScroll(); @@ -243,12 +243,9 @@ export default { this.msgList.push(message); this.fleshLastMsg(); this.fleshScroll(); - - } }, fleshLastMsg() { - console.log(this.contactList) const index = this.contactList.findIndex(e => e.id === this.currentContact.id); this.contactList[index].endMsg = this.msgList[this.msgList.length - 1].content; }, diff --git a/ruoyi-ui/src/permission.js b/ruoyi-ui/src/permission.js index 609d215..2584ad2 100644 --- a/ruoyi-ui/src/permission.js +++ b/ruoyi-ui/src/permission.js @@ -1,12 +1,12 @@ import router from './router' import store from './store' -import { Message } from 'element-ui' +import {Message} from 'element-ui' import NProgress from 'nprogress' import 'nprogress/nprogress.css' -import { getToken } from '@/utils/auth' -import { isRelogin } from '@/utils/request' +import {getToken} from '@/utils/auth' +import {isRelogin} from '@/utils/request' -NProgress.configure({ showSpinner: false }) +NProgress.configure({showSpinner: false}) const whiteList = ['/login', '/register'] @@ -16,25 +16,25 @@ router.beforeEach((to, from, next) => { to.meta.title && store.dispatch('settings/setTitle', to.meta.title) /* has token*/ if (to.path === '/login') { - next({ path: '/' }) + next({path: '/'}) NProgress.done() } else { if (store.getters.roles.length === 0) { isRelogin.show = true // 判断当前用户是否已拉取完user_info信息 - store.dispatch('GetInfo').then(() => { + store.dispatch('GetInfo').then(res => { isRelogin.show = false store.dispatch('GenerateRoutes').then(accessRoutes => { // 根据roles权限生成可访问的路由表 router.addRoutes(accessRoutes) // 动态添加可访问路由表 - next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 + next({...to, replace: true}) // hack方法 确保addRoutes已完成 }) }).catch(err => { - store.dispatch('LogOut').then(() => { - Message.error(err) - next({ path: '/' }) - }) + store.dispatch('LogOut').then(() => { + Message.error(err) + next({path: '/'}) }) + }) } else { next() } diff --git a/ruoyi-ui/src/plugins/download.js b/ruoyi-ui/src/plugins/download.js index 354f9c4..a3dc2c2 100644 --- a/ruoyi-ui/src/plugins/download.js +++ b/ruoyi-ui/src/plugins/download.js @@ -27,9 +27,7 @@ export default { }) }, resource(resource) { - console.log(resource) var url = baseURL + "/common/download/resource?resource=" + encodeURIComponent(resource); - console.log(url) axios({ method: 'get', url: url, @@ -63,7 +61,6 @@ export default { } downloadLoadingInstance.close(); }).catch((r) => { - console.error(r) Message.error('下载文件出现错误,请联系管理员!') downloadLoadingInstance.close(); }) diff --git a/ruoyi-ui/src/plugins/package/penal/PropertiesPanel.vue b/ruoyi-ui/src/plugins/package/penal/PropertiesPanel.vue index e33c803..522166e 100644 --- a/ruoyi-ui/src/plugins/package/penal/PropertiesPanel.vue +++ b/ruoyi-ui/src/plugins/package/penal/PropertiesPanel.vue @@ -172,7 +172,6 @@ export default { type: ${activatedElement.businessObject.$type} ---------- `); - console.log("businessObject: ", activatedElement.businessObject); window.bpmnInstances.bpmnElement = activatedElement; this.bpmnElement = activatedElement; this.elementId = activatedElement.id; diff --git a/ruoyi-ui/src/router/index.js b/ruoyi-ui/src/router/index.js index b4f5a0a..c772484 100644 --- a/ruoyi-ui/src/router/index.js +++ b/ruoyi-ui/src/router/index.js @@ -71,7 +71,7 @@ export const constantRoutes = [ component: () => import('@/views/index'), name: 'Index', meta: { title: '工作台', icon: 'dashboard', affix: true } - } + }, ] }, { diff --git a/ruoyi-ui/src/store/modules/user.js b/ruoyi-ui/src/store/modules/user.js index 01389f1..77d0e6c 100644 --- a/ruoyi-ui/src/store/modules/user.js +++ b/ruoyi-ui/src/store/modules/user.js @@ -54,7 +54,6 @@ const user = { return new Promise((resolve, reject) => { getInfo().then(res => { const user = res.data.user - console.log(user) const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/profile.jpg") : user.avatar; if (res.data.roles && res.data.roles.length > 0) { // 验证返回的roles是否是一个非空数组 commit('SET_ROLES', res.data.roles) diff --git a/ruoyi-ui/src/utils/websocket.js b/ruoyi-ui/src/utils/websocket.js index 545d0f4..9b61423 100644 --- a/ruoyi-ui/src/utils/websocket.js +++ b/ruoyi-ui/src/utils/websocket.js @@ -91,7 +91,7 @@ const webSocketOnError = (e) => { //服务器返回的数据 const webSocketOnMessage = (e)=> { //判断是否登录 - console.log(JSON.parse(e?.data)) + // console.log(JSON.parse(e?.data)) if (getToken()) { //window自定义事件 window.dispatchEvent( diff --git a/ruoyi-ui/src/views/index.vue b/ruoyi-ui/src/views/index.vue index 591aebe..cea9fe3 100644 --- a/ruoyi-ui/src/views/index.vue +++ b/ruoyi-ui/src/views/index.vue @@ -1,23 +1,61 @@ @@ -30,6 +68,7 @@ import Inventory from "../components/Inventory/index.vue"; import Announcements from "../components/Announcements/index.vue"; import ProjectManagement from "../components/ProjectManagement/index.vue"; import FinancialCharts from "../components/FinancialCharts/index.vue"; +import {currentRole} from "@/api/system/role"; export default { name: "Index", @@ -42,6 +81,14 @@ export default { }, data() { return { + // 新员工填写的信息 + employeeData: { + name: "", + email: "", + // 其他必要字段 + }, + // 当前步骤,从 0 开始计数 + activeStep: 0, version: "0.8.3", commandstats: null, usedmemory: null, @@ -53,13 +100,29 @@ export default { noticeTitle: '', noticeContent: '', drawer: false, + currentRole:{} }; }, created() { + this.getCurrentUserRole(); this.getList(); this.getListNotice(); }, methods: { + submitForm() { + // 这里可以加入表单验证与提交逻辑 + // 模拟提交后进入下一流程(例如审批中) + this.activeStep = 1; + this.$message({ + message: "表单提交成功,进入审批流程!", + type: "success" + }); + }, + getCurrentUserRole(){ + currentRole().then(res => { + this.currentRole = res.data; + }) + }, getList() { getCache().then((response) => { this.cache = response.data; @@ -88,7 +151,18 @@ export default {