|
|
@@ -13,6 +13,28 @@
|
|
|
<div class="ele-admin-header-tool-item">
|
|
|
<i18n-icon />
|
|
|
</div>
|
|
|
+ <div class="ele-admin-header-tool-item">
|
|
|
+ <el-select v-model="groupId" @change="groupIdChange">
|
|
|
+ <el-option
|
|
|
+ v-for="item in loginChangeGroupVOList"
|
|
|
+ :key="item.groupId"
|
|
|
+ :label="item.groupName"
|
|
|
+ :value="item.groupId"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ <div class="ele-admin-header-tool-item">
|
|
|
+ <el-select v-model="roleId" @change="roleChange">
|
|
|
+ <el-option
|
|
|
+ v-for="item in loginChangeRoleVOList"
|
|
|
+ :key="item.roleId"
|
|
|
+ :label="item.roleName"
|
|
|
+ :value="item.roleId"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
<!-- 消息通知 -->
|
|
|
<div class="ele-admin-header-tool-item">
|
|
|
<header-notice />
|
|
|
@@ -66,6 +88,7 @@
|
|
|
import I18nIcon from './i18n-icon.vue';
|
|
|
import { logout } from '@/utils/page-tab-util';
|
|
|
import { userLogout } from '@/api/system/user';
|
|
|
+ import router from '@/router/index';
|
|
|
|
|
|
export default {
|
|
|
components: { HeaderNotice, PasswordModal, SettingDrawer, I18nIcon },
|
|
|
@@ -78,16 +101,51 @@
|
|
|
// 是否显示修改密码弹窗
|
|
|
passwordVisible: false,
|
|
|
// 是否显示主题设置抽屉
|
|
|
- settingVisible: false
|
|
|
+ settingVisible: false,
|
|
|
+ groupId: '',
|
|
|
+ roleId: '',
|
|
|
+ currentUser:{
|
|
|
+ currentGroupId:'',
|
|
|
+ currentRoleId:''
|
|
|
+ }
|
|
|
};
|
|
|
},
|
|
|
+ created() {
|
|
|
+ this.currentUser = JSON.parse(sessionStorage['currentUser']);
|
|
|
+ this.groupId = this.currentUser.currentGroupId;
|
|
|
+ this.roleId = this.currentUser.currentRoleId;
|
|
|
+ },
|
|
|
computed: {
|
|
|
// 当前用户信息
|
|
|
loginUser() {
|
|
|
return this.$store.state.user.info;
|
|
|
- }
|
|
|
+ },
|
|
|
+ // 部门下拉
|
|
|
+ loginChangeGroupVOList() {
|
|
|
+ return this.$store.state.user?.info?.loginChangeGroupVOList;
|
|
|
+ },
|
|
|
+ // 角色下拉
|
|
|
+ loginChangeRoleVOList() {
|
|
|
+ return this.$store.state.user?.info?.loginChangeGroupVOList.find(
|
|
|
+ (item) => item.groupId == this.groupId
|
|
|
+ )?.loginChangeRoleVOList;
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
+ groupIdChange(val) {
|
|
|
+ this.roleChange(this.loginChangeRoleVOList[0].roleId);
|
|
|
+ },
|
|
|
+ roleChange(val) {
|
|
|
+ this.roleId = val;
|
|
|
+ this.currentUser.currentGroupId = this.groupId;
|
|
|
+ this.currentUser.currentRoleId = val;
|
|
|
+ sessionStorage['currentUser']=JSON.stringify(this.currentUser)
|
|
|
+ this.$store
|
|
|
+ .dispatch('user/fetchUserInfo')
|
|
|
+ .then(({ menus, homePath, authoritiesRouter }) => {
|
|
|
+ router.roleChange({ menus, homePath, authoritiesRouter });
|
|
|
+ });
|
|
|
+ },
|
|
|
/* 用户信息下拉点击事件 */
|
|
|
onUserDropClick(command) {
|
|
|
if (command === 'password') {
|