🎉 增加多租户开关

This commit is contained in:
smallchill 2019-03-30 23:57:48 +08:00
parent 307fb464ed
commit f843875db4
5 changed files with 45 additions and 7 deletions

View File

@ -3,9 +3,10 @@
*/ */
export default { export default {
title: "saber", title: "saber",
indexTitle: 'Saber Admin',
tenantMode: true, // 是否开启租户模式
logo: "S", logo: "S",
key: 'saber',//配置主键,目前用于存储 key: 'saber',//配置主键,目前用于存储
indexTitle: 'Saber Admin',
lockPage: '/lock', lockPage: '/lock',
tokenTime: 6000, tokenTime: 6000,
//http的status默认放行不才用统一处理的, //http的status默认放行不才用统一处理的,

View File

@ -5,7 +5,7 @@
ref="loginForm" ref="loginForm"
:model="loginForm" :model="loginForm"
label-width="0"> label-width="0">
<el-form-item prop="tenantCode"> <el-form-item v-if="tenantMode" prop="tenantCode">
<el-input size="small" <el-input size="small"
@keyup.enter.native="handleLogin" @keyup.enter.native="handleLogin"
v-model="loginForm.tenantCode" v-model="loginForm.tenantCode"
@ -50,10 +50,12 @@
<script> <script>
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import website from '@/config/website';
export default { export default {
name: "userlogin", name: "userlogin",
data() { data() {
return { return {
tenantMode: website.tenantMode,
loginForm: { loginForm: {
tenantCode: "000000", tenantCode: "000000",
username: "admin", username: "admin",

View File

@ -44,6 +44,7 @@
getDeptTree getDeptTree
} from "@/api/system/dept"; } from "@/api/system/dept";
import {mapGetters} from "vuex"; import {mapGetters} from "vuex";
import website from '@/config/website';
export default { export default {
data() { data() {
@ -76,9 +77,11 @@
{ {
label: "租户编号", label: "租户编号",
prop: "tenantCode", prop: "tenantCode",
search: true, search: website.tenantMode,
hide: !website.tenantMode,
addDisplay: false, addDisplay: false,
editDisplay: false, editDisplay: false,
viewDisplay: website.tenantMode,
rules: [{ rules: [{
required: true, required: true,
message: "请输入租户编号", message: "请输入租户编号",

View File

@ -67,6 +67,7 @@ import {
getRoleTree getRoleTree
} from "@/api/system/role"; } from "@/api/system/role";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import website from '@/config/website';
export default { export default {
data() { data() {
@ -92,6 +93,8 @@ export default {
index: true, index: true,
selection: true, selection: true,
viewBtn: true, viewBtn: true,
dialogWidth: 300,
dialogHeight: 400,
column: [ column: [
{ {
label: "角色名称", label: "角色名称",
@ -109,9 +112,10 @@ export default {
{ {
label: "租户编号", label: "租户编号",
prop: "tenantCode", prop: "tenantCode",
search: true,
addDisplay: false, addDisplay: false,
editDisplay: false, editDisplay: false,
viewDisplay: website.tenantMode,
hide: !website.tenantMode,
span: 24, span: 24,
rules: [{ rules: [{
required: true, required: true,
@ -119,6 +123,27 @@ export default {
trigger: "blur" trigger: "blur"
}] }]
}, },
{
label: "所属租户",
prop: "tenantCode",
type: "tree",
dicUrl: "/api/blade-system/tenant/select",
addDisplay: false,
editDisplay: false,
viewDisplay: website.tenantMode,
span: 24,
props: {
label: "tenantName",
value: "tenantCode"
},
hide: !website.tenantMode,
search: website.tenantMode,
rules: [{
required: true,
message: "请输入所属租户",
trigger: "click"
}]
},
{ {
label: "角色别名", label: "角色别名",
prop: "roleAlias", prop: "roleAlias",

View File

@ -54,6 +54,7 @@
import {getDeptTree} from "@/api/system/dept"; import {getDeptTree} from "@/api/system/dept";
import {getRoleTree} from "@/api/system/role"; import {getRoleTree} from "@/api/system/role";
import {mapGetters} from "vuex"; import {mapGetters} from "vuex";
import website from '@/config/website';
export default { export default {
data() { data() {
@ -102,11 +103,13 @@
required: true, required: true,
message: "请输入登录账号", message: "请输入登录账号",
trigger: "blur" trigger: "blur"
}] }],
span: website.tenantMode ? 12 : 24,
}, },
{ {
label: "租户编号", label: "租户编号",
prop: "tenantCode", prop: "tenantCode",
hide: !website.tenantMode,
addDisplay: false, addDisplay: false,
editDisplay: false, editDisplay: false,
viewDisplay: false, viewDisplay: false,
@ -120,7 +123,11 @@
label: "tenantName", label: "tenantName",
value: "tenantCode" value: "tenantCode"
}, },
search: true, hide: !website.tenantMode,
addDisplay: website.tenantMode,
editDisplay: website.tenantMode,
viewDisplay: website.tenantMode,
search: website.tenantMode,
rules: [{ rules: [{
required: true, required: true,
message: "请输入所属租户", message: "请输入所属租户",
@ -274,7 +281,7 @@
ids.push(ele.id); ids.push(ele.id);
}); });
return ids.join(","); return ids.join(",");
} },
}, },
methods: { methods: {
rowSave(row, loading) { rowSave(row, loading) {