From 06f42fa0eae9b0769b9921157aa1159381c161cb Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期一, 27 二月 2023 15:41:35 +0800
Subject: [PATCH] fix 修复 租户管理被过滤数据权限问题
---
ruoyi-ui/src/layout/components/Navbar.vue | 64 ++++++++++++++++++++++++++++++-
1 files changed, 61 insertions(+), 3 deletions(-)
diff --git a/ruoyi-ui/src/layout/components/Navbar.vue b/ruoyi-ui/src/layout/components/Navbar.vue
index e6721b7..85fb1b5 100644
--- a/ruoyi-ui/src/layout/components/Navbar.vue
+++ b/ruoyi-ui/src/layout/components/Navbar.vue
@@ -5,8 +5,25 @@
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" v-if="!topNav"/>
<top-nav id="topmenu-container" class="topmenu-container" v-if="topNav"/>
- <div class="right-menu">
- <template v-if="device!=='mobile'">
+ <div class="right-menu flex align-center">
+ <template v-if="device!=='mobile' ">
+ <el-select v-model="companyName"
+ clearable
+ filterable
+ reserve-keyword
+ placeholder="璇烽�夋嫨绉熸埛"
+ v-if="userId === 1"
+ @change="dynamicTenantEvent"
+ @clear="dynamicClearEvent">
+ <el-option
+ v-for="item in tenantList"
+ :key="item.tenantId"
+ :label="item.companyName"
+ :value="item.tenantId">
+ </el-option>
+ <svg-icon slot="prefix" icon-class="company" class="el-input__icon input-icon" />
+ </el-select>
+
<search id="header-search" class="right-menu-item" />
<el-tooltip content="婧愮爜鍦板潃" effect="dark" placement="bottom">
@@ -56,8 +73,19 @@
import Search from '@/components/HeaderSearch'
import RuoYiGit from '@/components/RuoYi/Git'
import RuoYiDoc from '@/components/RuoYi/Doc'
+import { tenantList } from "@/api/login";
+import { dynamicClear, dynamicTenant } from "@/api/system/tenant";
export default {
+ data() {
+ return {
+ userId: this.$store.getters.userId,
+ tenantId: undefined,
+ companyName: undefined,
+ tenantList: [],
+ userList: []
+ }
+ },
components: {
Breadcrumb,
TopNav,
@@ -92,6 +120,27 @@
}
},
methods: {
+ // 鍔ㄦ�佸垏鎹�
+ dynamicTenantEvent(tenantId) {
+ if (this.companyName != null && this.companyName !== '') {
+ dynamicTenant(tenantId).then(res => {
+ this.$tab.closeAllPage()
+ this.$router.push('/')
+ });
+ }
+ },
+ dynamicClearEvent() {
+ dynamicClear().then(res => {
+ this.$tab.closeAllPage()
+ this.$router.push('/')
+ });
+ },
+ // 绉熸埛鍒楄〃
+ getTenantList() {
+ tenantList().then(res => {
+ this.tenantList = res.data;
+ });
+ },
toggleSideBar() {
this.$store.dispatch('app/toggleSideBar')
},
@@ -102,7 +151,7 @@
type: 'warning'
}).then(() => {
this.$store.dispatch('LogOut').then(() => {
- location.href = this.$router.options.base + '/index';
+ location.href = process.env.VUE_APP_CONTEXT_PATH + "index";
})
}).catch(() => {});
}
@@ -111,6 +160,15 @@
</script>
<style lang="scss" scoped>
+
+.flex {
+ display: flex;
+}
+
+.align-center {
+ align-items: center;
+}
+
.navbar {
height: 50px;
overflow: hidden;
--
Gitblit v1.9.3