新增临时角色页面

This commit is contained in:
2025-02-24 21:25:49 +08:00
parent 53d1a19475
commit ec98add5b2
31 changed files with 194 additions and 66 deletions

View File

@@ -224,4 +224,13 @@ public class SysRoleController extends BaseController {
ajax.put("depts", deptService.selectDeptTreeList(new SysDept())); ajax.put("depts", deptService.selectDeptTreeList(new SysDept()));
return R.ok(ajax); return R.ok(ajax);
} }
/**
* 获取当前用户的role对象
*/
@GetMapping("/currentRole")
public R<SysRole> currentRole() {
return R.ok(roleService.getCurrentRole());
}
} }

View File

@@ -263,4 +263,18 @@ public class SysUserController extends BaseController {
return R.ok(deptService.selectDeptTreeList(dept)); return R.ok(deptService.selectDeptTreeList(dept));
} }
/**
* 用户授权角色
*
* @param userId 用户Id
*/
@SaCheckPermission("system:user:edit")
@Log(title = "用户管理", businessType = BusinessType.GRANT)
@GetMapping("/tempRole")
public R<Void> insertTempRole(Long userId) {
Long[] roleId = roleService.selectRoleByName();
userService.insertUserAuth(userId, roleId);
return R.ok();
}
} }

View File

@@ -59,4 +59,10 @@ public interface SysRoleMapper extends BaseMapperPlus<SysRoleMapper, SysRole, Sy
*/ */
List<SysRole> selectRolesByUserName(String userName); List<SysRole> selectRolesByUserName(String userName);
/**
* 获取当前用户角色对象
* @param userId
* @return
*/
SysRole getCurrentRole(Long userId);
} }

View File

@@ -178,4 +178,14 @@ public interface ISysRoleService {
int insertAuthUsers(Long roleId, Long[] userIds); int insertAuthUsers(Long roleId, Long[] userIds);
void cleanOnlineUserByRole(Long roleId); void cleanOnlineUserByRole(Long roleId);
/**
*
* @return
*/
Long[] selectRoleByName();
SysRole getCurrentRole();
} }

View File

@@ -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());
}
} }

View File

@@ -67,4 +67,14 @@
WHERE r.del_flag = '0' and u.user_name = #{userName} WHERE r.del_flag = '0' and u.user_name = #{userName}
</select> </select>
<select id="getCurrentRole" resultMap="SysRoleResult">
select distinct r.role_id,
r.role_name,
r.role_key
from sys_role r
join sys_user_role sur on sur.role_id = r.role_id
where #{userId} = sur.user_id
</select>
</mapper> </mapper>

View File

@@ -17,6 +17,14 @@ export function getRole(roleId) {
}) })
} }
// 查询角色详细
export function currentRole() {
return request({
url: '/system/role/currentRole',
method: 'get'
})
}
// 新增角色 // 新增角色
export function addRole(data) { export function addRole(data) {
return request({ return request({

View File

@@ -182,7 +182,6 @@ export default {
"updateCrontabValue", name, value, from; "updateCrontabValue", name, value, from;
this.crontabValueObj[name] = value; this.crontabValueObj[name] = value;
if (from && from !== name) { if (from && from !== name) {
console.log(`来自组件 ${from} 改变了 ${name} ${value}`);
this.changeRadio(name, value); this.changeRadio(name, value);
} }
}, },

View File

@@ -46,7 +46,6 @@ export default {
this.loading = true; this.loading = true;
listOaOutWarehouse(this.queryParams).then(res => { listOaOutWarehouse(this.queryParams).then(res => {
this.outWareHouseList = res.rows this.outWareHouseList = res.rows
console.log(res.rows)
this.total = res.total this.total = res.total
this.loading = false this.loading = false
}) })

View File

@@ -47,7 +47,6 @@ export default {
//路由跳转 //路由跳转
goTarget(href) { goTarget(href) {
this.$router.push({ path: href}); this.$router.push({ path: href});
console.log(999,href)
}, },
/** 查询流程定义列表 */ /** 查询流程定义列表 */
getList() { getList() {

View File

@@ -77,7 +77,6 @@ export default {
methods: { methods: {
// 打开聊天窗口 // 打开聊天窗口
openChat() { openChat() {
console.log("窗口打开")
this.drawerVisible = true; this.drawerVisible = true;
}, },
@@ -91,7 +90,6 @@ export default {
selectContact(contact) { selectContact(contact) {
this.selectedContact = contact; this.selectedContact = contact;
this.chatHistory = []; // 清空当前聊天记录 this.chatHistory = []; // 清空当前聊天记录
console.log(contact);
this.loadMessage(contact.id); this.loadMessage(contact.id);
}, },
@@ -121,7 +119,6 @@ export default {
this.msgListLoading = true; this.msgListLoading = true;
getContact(concatId).then(response => { getContact(concatId).then(response => {
if (response.code === 200) { if (response.code === 200) {
console.log(response.data)
this.currentContact = response.data; this.currentContact = response.data;
this.contactUser = response.data.user; this.contactUser = response.data.user;
this.chatHistory = response.data.messages; this.chatHistory = response.data.messages;

View File

@@ -193,7 +193,7 @@ export default {
this.currentContact = response.data; this.currentContact = response.data;
this.contactUser = response.data.user; this.contactUser = response.data.user;
this.msgList = response.data.messages; this.msgList = response.data.messages;
console.log(this.msgList);
} }
this.msgListLoading = false; this.msgListLoading = false;
this.fleshScroll(); this.fleshScroll();
@@ -243,12 +243,9 @@ export default {
this.msgList.push(message); this.msgList.push(message);
this.fleshLastMsg(); this.fleshLastMsg();
this.fleshScroll(); this.fleshScroll();
} }
}, },
fleshLastMsg() { fleshLastMsg() {
console.log(this.contactList)
const index = this.contactList.findIndex(e => e.id === this.currentContact.id); const index = this.contactList.findIndex(e => e.id === this.currentContact.id);
this.contactList[index].endMsg = this.msgList[this.msgList.length - 1].content; this.contactList[index].endMsg = this.msgList[this.msgList.length - 1].content;
}, },

View File

@@ -1,12 +1,12 @@
import router from './router' import router from './router'
import store from './store' import store from './store'
import { Message } from 'element-ui' import {Message} from 'element-ui'
import NProgress from 'nprogress' import NProgress from 'nprogress'
import 'nprogress/nprogress.css' import 'nprogress/nprogress.css'
import { getToken } from '@/utils/auth' import {getToken} from '@/utils/auth'
import { isRelogin } from '@/utils/request' import {isRelogin} from '@/utils/request'
NProgress.configure({ showSpinner: false }) NProgress.configure({showSpinner: false})
const whiteList = ['/login', '/register'] const whiteList = ['/login', '/register']
@@ -16,25 +16,25 @@ router.beforeEach((to, from, next) => {
to.meta.title && store.dispatch('settings/setTitle', to.meta.title) to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
/* has token*/ /* has token*/
if (to.path === '/login') { if (to.path === '/login') {
next({ path: '/' }) next({path: '/'})
NProgress.done() NProgress.done()
} else { } else {
if (store.getters.roles.length === 0) { if (store.getters.roles.length === 0) {
isRelogin.show = true isRelogin.show = true
// 判断当前用户是否已拉取完user_info信息 // 判断当前用户是否已拉取完user_info信息
store.dispatch('GetInfo').then(() => { store.dispatch('GetInfo').then(res => {
isRelogin.show = false isRelogin.show = false
store.dispatch('GenerateRoutes').then(accessRoutes => { store.dispatch('GenerateRoutes').then(accessRoutes => {
// 根据roles权限生成可访问的路由表 // 根据roles权限生成可访问的路由表
router.addRoutes(accessRoutes) // 动态添加可访问路由表 router.addRoutes(accessRoutes) // 动态添加可访问路由表
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 next({...to, replace: true}) // hack方法 确保addRoutes已完成
}) })
}).catch(err => { }).catch(err => {
store.dispatch('LogOut').then(() => { store.dispatch('LogOut').then(() => {
Message.error(err) Message.error(err)
next({ path: '/' }) next({path: '/'})
})
}) })
})
} else { } else {
next() next()
} }

View File

@@ -27,9 +27,7 @@ export default {
}) })
}, },
resource(resource) { resource(resource) {
console.log(resource)
var url = baseURL + "/common/download/resource?resource=" + encodeURIComponent(resource); var url = baseURL + "/common/download/resource?resource=" + encodeURIComponent(resource);
console.log(url)
axios({ axios({
method: 'get', method: 'get',
url: url, url: url,
@@ -63,7 +61,6 @@ export default {
} }
downloadLoadingInstance.close(); downloadLoadingInstance.close();
}).catch((r) => { }).catch((r) => {
console.error(r)
Message.error('下载文件出现错误,请联系管理员!') Message.error('下载文件出现错误,请联系管理员!')
downloadLoadingInstance.close(); downloadLoadingInstance.close();
}) })

View File

@@ -172,7 +172,6 @@ export default {
type: ${activatedElement.businessObject.$type} type: ${activatedElement.businessObject.$type}
---------- ----------
`); `);
console.log("businessObject: ", activatedElement.businessObject);
window.bpmnInstances.bpmnElement = activatedElement; window.bpmnInstances.bpmnElement = activatedElement;
this.bpmnElement = activatedElement; this.bpmnElement = activatedElement;
this.elementId = activatedElement.id; this.elementId = activatedElement.id;

View File

@@ -71,7 +71,7 @@ export const constantRoutes = [
component: () => import('@/views/index'), component: () => import('@/views/index'),
name: 'Index', name: 'Index',
meta: { title: '工作台', icon: 'dashboard', affix: true } meta: { title: '工作台', icon: 'dashboard', affix: true }
} },
] ]
}, },
{ {

View File

@@ -54,7 +54,6 @@ const user = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getInfo().then(res => { getInfo().then(res => {
const user = res.data.user const user = res.data.user
console.log(user)
const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/profile.jpg") : user.avatar; const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/profile.jpg") : user.avatar;
if (res.data.roles && res.data.roles.length > 0) { // 验证返回的roles是否是一个非空数组 if (res.data.roles && res.data.roles.length > 0) { // 验证返回的roles是否是一个非空数组
commit('SET_ROLES', res.data.roles) commit('SET_ROLES', res.data.roles)

View File

@@ -91,7 +91,7 @@ const webSocketOnError = (e) => {
//服务器返回的数据 //服务器返回的数据
const webSocketOnMessage = (e)=> { const webSocketOnMessage = (e)=> {
//判断是否登录 //判断是否登录
console.log(JSON.parse(e?.data)) // console.log(JSON.parse(e?.data))
if (getToken()) { if (getToken()) {
//window自定义事件 //window自定义事件
window.dispatchEvent( window.dispatchEvent(

View File

@@ -1,23 +1,61 @@
<template> <template>
<div class="home"> <div class="home">
<el-container style="height: 100vh;"> <div v-if="currentRole.roleKey==='temp'">
<el-main> <div class="onboarding-homepage">
<el-row :gutter="20"> <!-- 提示信息 -->
<!-- 右侧展示区域 --> <el-alert
<el-col :span="18" class="content-area"> title="欢迎加入,请尽快补充您的必要信息!"
<announcements /> type="info"
<financial-charts /> show-icon>
</el-col> </el-alert>
<!-- 数据补充表单 -->
<el-form :model="employeeData" class="employee-form" label-width="80px">
<el-form-item label="姓名">
<el-input v-model="employeeData.name"></el-input>
</el-form-item>
<el-form-item label="邮箱">
<el-input v-model="employeeData.email"></el-input>
</el-form-item>
<!-- 根据实际需求添加更多字段 -->
<el-form-item>
<el-button type="primary" @click="submitForm">提交</el-button>
</el-form-item>
</el-form>
<!-- 流程图 -->
<div class="flow-chart">
<el-steps :active="activeStep" finish-status="success">
<el-step title="填写信息"></el-step>
<el-step title="审批中"></el-step>
<el-step title="完成"></el-step>
</el-steps>
</div>
</div>
</div>
<div v-else>
<el-container style="height: 100vh;">
<el-main>
<el-row :gutter="20">
<!-- 右侧展示区域 -->
<el-col :span="18" class="content-area">
<announcements />
<financial-charts />
</el-col>
<!-- 左侧功能区域 -->
<el-col :span="6" class="sidebar">
<quick-access />
<inventory />
<project-management />
</el-col>
</el-row>
</el-main>
<!-- 左侧功能区域 -->
<el-col :span="6" class="sidebar">
<quick-access />
<inventory />
<project-management />
</el-col>
</el-row>
</el-main>
</el-container> </el-container>
</div>
</div> </div>
</template> </template>
@@ -30,6 +68,7 @@ import Inventory from "../components/Inventory/index.vue";
import Announcements from "../components/Announcements/index.vue"; import Announcements from "../components/Announcements/index.vue";
import ProjectManagement from "../components/ProjectManagement/index.vue"; import ProjectManagement from "../components/ProjectManagement/index.vue";
import FinancialCharts from "../components/FinancialCharts/index.vue"; import FinancialCharts from "../components/FinancialCharts/index.vue";
import {currentRole} from "@/api/system/role";
export default { export default {
name: "Index", name: "Index",
@@ -42,6 +81,14 @@ export default {
}, },
data() { data() {
return { return {
// 新员工填写的信息
employeeData: {
name: "",
email: "",
// 其他必要字段
},
// 当前步骤,从 0 开始计数
activeStep: 0,
version: "0.8.3", version: "0.8.3",
commandstats: null, commandstats: null,
usedmemory: null, usedmemory: null,
@@ -53,13 +100,29 @@ export default {
noticeTitle: '', noticeTitle: '',
noticeContent: '', noticeContent: '',
drawer: false, drawer: false,
currentRole:{}
}; };
}, },
created() { created() {
this.getCurrentUserRole();
this.getList(); this.getList();
this.getListNotice(); this.getListNotice();
}, },
methods: { methods: {
submitForm() {
// 这里可以加入表单验证与提交逻辑
// 模拟提交后进入下一流程(例如审批中)
this.activeStep = 1;
this.$message({
message: "表单提交成功,进入审批流程!",
type: "success"
});
},
getCurrentUserRole(){
currentRole().then(res => {
this.currentRole = res.data;
})
},
getList() { getList() {
getCache().then((response) => { getCache().then((response) => {
this.cache = response.data; this.cache = response.data;
@@ -88,7 +151,18 @@ export default {
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.onboarding-homepage {
max-width: 800px;
margin: 20px auto;
padding: 20px;
}
.employee-form {
margin-top: 20px;
margin-bottom: 30px;
}
.flow-chart {
margin-top: 30px;
}
/* 栅格列样式 */ /* 栅格列样式 */
.content-area { .content-area {
background: #fff; background: #fff;

View File

@@ -575,7 +575,6 @@ export default {
this.loading = true; this.loading = true;
listOaAttendance(this.queryParams).then(res => { listOaAttendance(this.queryParams).then(res => {
this.userList = res.rows; this.userList = res.rows;
console.log(this.userList);
this.dateLength = res.total; this.dateLength = res.total;
this.loading = false; this.loading = false;
}); });

View File

@@ -251,7 +251,7 @@ export default {
}) })
}, },
co(){ co(){
console.log(this.files)
}, },
// 添加新的一行 // 添加新的一行

View File

@@ -403,7 +403,6 @@ export default {
getOaClaim(this.$route.params.claimId).then(res => { getOaClaim(this.$route.params.claimId).then(res => {
this.form = res.data; this.form = res.data;
this.detailList = res.data.detailList this.detailList = res.data.detailList
console.log(this.detailList)
this.initData(); this.initData();
this.loading=false this.loading=false
}) })

View File

@@ -237,7 +237,6 @@ export default {
getList() { getList() {
this.loading = true; this.loading = true;
listOaClaim(this.queryParams).then(response => { listOaClaim(this.queryParams).then(response => {
console.log(response.rows)
this.oaClaimList = response.rows; this.oaClaimList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;

View File

@@ -89,7 +89,6 @@ export default {
//排序 //排序
this.stepsList = res.data.data.taskList.sort((a, b) => parseInt(a.dictValue) - parseInt(b.dictValue)); this.stepsList = res.data.data.taskList.sort((a, b) => parseInt(a.dictValue) - parseInt(b.dictValue));
this.active = res.data.data.active; this.active = res.data.data.active;
console.log(this.stepsList)
}) })
}, },
} }

View File

@@ -891,7 +891,7 @@ export default {
//核算弹出层 //核算弹出层
handleCheck(row) { handleCheck(row) {
console.log(3333, row)
this.openCheck = true; this.openCheck = true;
this.titleCheck = "项目核算"; this.titleCheck = "项目核算";
this.projectName = row.projectName; this.projectName = row.projectName;

View File

@@ -1,7 +1,7 @@
<template> <template>
<div> <div v-loading="loading">
<el-tabs v-model="activeName" style="margin-left: 10px;"> <el-tabs v-model="activeName" style="margin-left: 10px;">
<el-tab-pane label="休假日历" name="first"> <el-tab-pane label="休假日历" name="first" >
<el-calendar> <el-calendar>
<template slot="dateCell" slot-scope="{date, data}"> <template slot="dateCell" slot-scope="{date, data}">
<div :class="{'is-selected': data.isSelected, 'blue-background': isHoliday(data.day)}" style="height: 100%" <div :class="{'is-selected': data.isSelected, 'blue-background': isHoliday(data.day)}" style="height: 100%"
@@ -99,6 +99,7 @@
<script> <script>
import {listOaHoliday, updateOaHoliday,queryListHoliday} from "@/api/oa/oaHoliday"; import {listOaHoliday, updateOaHoliday,queryListHoliday} from "@/api/oa/oaHoliday";
import {currentRole} from "@/api/system/role";
export default { export default {
data() { data() {
@@ -135,6 +136,7 @@ export default {
holidayTime: undefined, holidayTime: undefined,
name: undefined, name: undefined,
}, },
currentRole:{},
// 表单参数 // 表单参数
form: {}, form: {},
// 表单校验 // 表单校验
@@ -161,6 +163,11 @@ export default {
}; };
}, },
methods: { methods: {
getCurrentUserRole() {
currentRole().then(res => {
this.currentRole = res.data;
})
},
fetchHolidayData() { fetchHolidayData() {
this.loading = true; this.loading = true;
listOaHoliday({}).then(response => { listOaHoliday({}).then(response => {
@@ -172,7 +179,6 @@ export default {
})); }));
this.loading = false; this.loading = false;
}).catch(error => { }).catch(error => {
this.loading = false; this.loading = false;
}); });
}, },
@@ -185,11 +191,11 @@ export default {
return holiday ? holiday.name : ''; return holiday ? holiday.name : '';
}, },
handleCellClick(data) { handleCellClick(data) {
if (this.currentRole.roleKey==='doctor'){
const holiday = this.holidays.find(holiday => holiday.date === data.day); const holiday = this.holidays.find(holiday => holiday.date === data.day);
this.currentHoliday = {...holiday.fullData, type: holiday.type}; this.currentHoliday = {...holiday.fullData, type: holiday.type};
this.dialogVisible = true; this.dialogVisible = true;
}
}, },
updateHoliday() { updateHoliday() {
updateOaHoliday(this.currentHoliday).then(response => { updateOaHoliday(this.currentHoliday).then(response => {
@@ -198,7 +204,6 @@ export default {
this.$message.success("假期类型更新成功"); this.$message.success("假期类型更新成功");
}).catch(error => { }).catch(error => {
console.error("Error updating holiday data:", error);
this.$message.error("更新失败"); this.$message.error("更新失败");
}); });
}, },
@@ -314,6 +319,7 @@ export default {
}, },
created() { created() {
this.getCurrentUserRole();
this.fetchHolidayData(); this.fetchHolidayData();
this.getList(); this.getList();
} }

View File

@@ -334,7 +334,7 @@ export default {
this.loading = true; this.loading = true;
listOnboarding(this.queryParams).then(response => { listOnboarding(this.queryParams).then(response => {
this.onboardingList = response.rows; this.onboardingList = response.rows;
console.log(this.onboardingList)
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
}); });

View File

@@ -822,7 +822,7 @@ export default {
} }
listProject(this.queryParams).then(response => { listProject(this.queryParams).then(response => {
this.projectList = response.rows; this.projectList = response.rows;
console.log(this.projectList)
//项目周期 //项目周期
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;

View File

@@ -1390,7 +1390,7 @@ export default {
getTaskByDictType(pid).then(res => { getTaskByDictType(pid).then(res => {
//排序 //排序
this.stepsList = res.data.data.taskList.sort((a, b) => parseInt(b.dictValue) - parseInt(a.dictValue)); this.stepsList = res.data.data.taskList.sort((a, b) => parseInt(b.dictValue) - parseInt(a.dictValue));
console.log(this.stepsList)
this.active = res.data.data.active; this.active = res.data.data.active;
}) })
}, },
@@ -1576,7 +1576,7 @@ export default {
getProject(projectId).then(response => { getProject(projectId).then(response => {
this.loading = false; this.loading = false;
this.form = response.data; this.form = response.data;
console.log(this.form)
this.bail = response.data.bail == null ? this.bail : JSON.parse(response.data.bail); this.bail = response.data.bail == null ? this.bail : JSON.parse(response.data.bail);
let period = []; let period = [];
period.push(response.data.beginTime); period.push(response.data.beginTime);

View File

@@ -153,7 +153,6 @@ export default {
}else { }else {
this.finishedList =response.rows; this.finishedList =response.rows;
} }
console.log(this.finishedList)
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
}); });

View File

@@ -165,7 +165,6 @@ export default {
}, },
// 跳转到处理页面 // 跳转到处理页面
handleProcess(row) { handleProcess(row) {
console.log(row)
this.$router.push({ this.$router.push({
path: '/workflow/process/detail/' + row.procInsId, path: '/workflow/process/detail/' + row.procInsId,
query: { query: {