多租户自定义主页
This commit is contained in:
@@ -1794,6 +1794,10 @@ export default {
|
|||||||
reset: "System Reset",
|
reset: "System Reset",
|
||||||
resetInstruction: "A system reset will erase all data in the current system, please proceed with caution!!!!",
|
resetInstruction: "A system reset will erase all data in the current system, please proceed with caution!!!!",
|
||||||
resetTipContent: 'Are you sure you want to clear all data from the current system and insist on continuing?',
|
resetTipContent: 'Are you sure you want to clear all data from the current system and insist on continuing?',
|
||||||
|
homeInstruction:'Set the system home page',
|
||||||
|
home: 'System home page',
|
||||||
|
homeTip:'Do you want to submit the current interface as the system interface?',
|
||||||
|
homeSet:'System home page Settings',
|
||||||
},
|
},
|
||||||
role:{
|
role:{
|
||||||
allScopeOptions:'All data permissions',
|
allScopeOptions:'All data permissions',
|
||||||
|
|||||||
@@ -1794,6 +1794,10 @@ export default {
|
|||||||
reset: "系统重置",
|
reset: "系统重置",
|
||||||
resetInstruction: "系统重置将会清除当前系统内所有数据,请谨慎操作!!!",
|
resetInstruction: "系统重置将会清除当前系统内所有数据,请谨慎操作!!!",
|
||||||
resetTipContent: '确认要清除当前系统内所有数据并坚持继续吗?',
|
resetTipContent: '确认要清除当前系统内所有数据并坚持继续吗?',
|
||||||
|
homeInstruction:'设置系统首页界面',
|
||||||
|
home: '系统首页',
|
||||||
|
homeTip:'确认要提交当前界面为系统界面吗?',
|
||||||
|
homeSet:'系统首页设置',
|
||||||
},
|
},
|
||||||
role:{
|
role:{
|
||||||
allScopeOptions:'全部数据权限',
|
allScopeOptions:'全部数据权限',
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Index from '@/views/index/tenantIndex.vue';
|
import Index from '@/views/index/tenantIndex.vue';
|
||||||
import defalutIndex from '@/views/index/defaultIndex.vue';
|
|
||||||
import Dash from '@/views/dashboard/overview/index.vue';
|
|
||||||
import Gold from '@/views/perfManage/goldTarget/index.vue';
|
|
||||||
import { getConfigKey } from '@/api/system/config';
|
import { getConfigKey } from '@/api/system/config';
|
||||||
|
|
||||||
import { defineAsyncComponent, onMounted, shallowRef } from 'vue';
|
import { defineAsyncComponent, onMounted, shallowRef } from 'vue';
|
||||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||||
import useUserStore from '@/store/modules/user';
|
import useUserStore from '@/store/modules/user';
|
||||||
@@ -16,12 +12,24 @@ const currentComponent = shallowRef(
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (useUserStore().roles.includes('tenant')) {
|
if (useUserStore().roles.includes('tenant')) {
|
||||||
|
//租户
|
||||||
currentComponent.value = Index;
|
currentComponent.value = Index;
|
||||||
useLayoutStore().changeConf('layout', 'top');
|
useLayoutStore().changeConf('layout', 'top');
|
||||||
useLayoutStore().changeConf('menuTheme', 'light');
|
useLayoutStore().changeConf('menuTheme', 'light');
|
||||||
useLayoutStore().changeConf('tabRender', false);
|
useLayoutStore().changeConf('tabRender', false);
|
||||||
} else {
|
} else {
|
||||||
useLayoutStore().changeConf('layout', 'mix');
|
useLayoutStore().changeConf('layout', 'mix');
|
||||||
|
//获取当前系统设置的首页路径
|
||||||
|
getConfigKey('sys.homePage').then(res => {
|
||||||
|
if (res.code === RESULT_CODE_SUCCESS && res.data) {
|
||||||
|
console.log(res.data);
|
||||||
|
if (res.data) {
|
||||||
|
currentComponent.value = defineAsyncComponent(
|
||||||
|
() => import(`./${res.data}.vue`)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
104
src/views/system/setting/components/change-home-index.vue
Normal file
104
src/views/system/setting/components/change-home-index.vue
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import { Modal, message } from 'ant-design-vue/lib';
|
||||||
|
import { onMounted, reactive, toRaw } from 'vue';
|
||||||
|
import useAppStore from '@/store/modules/app';
|
||||||
|
import useI18n from '@/hooks/useI18n';
|
||||||
|
import { listMenu } from '@/api/system/menu';
|
||||||
|
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||||
|
import { getConfig, getConfigKey, changeValue } from '@/api/system/config';
|
||||||
|
|
||||||
|
const appStore = useAppStore();
|
||||||
|
const { t, optionsLocale } = useI18n();
|
||||||
|
|
||||||
|
type StateType = {
|
||||||
|
edite: boolean;
|
||||||
|
loading: boolean;
|
||||||
|
open: boolean;
|
||||||
|
default: any;
|
||||||
|
options: any;
|
||||||
|
};
|
||||||
|
|
||||||
|
let state: StateType = reactive({
|
||||||
|
edite: false,
|
||||||
|
loading: false,
|
||||||
|
open: false,
|
||||||
|
default: '',
|
||||||
|
options: [],
|
||||||
|
});
|
||||||
|
|
||||||
|
/**提交保存 */
|
||||||
|
function fnSave() {
|
||||||
|
Modal.confirm({
|
||||||
|
title: t('common.tipTitle'),
|
||||||
|
content: t('views.system.setting.homeTip'),
|
||||||
|
onOk() {
|
||||||
|
// 发送请求
|
||||||
|
const hide = message.loading(t('common.loading'), 0);
|
||||||
|
state.loading = true;
|
||||||
|
changeValue({ key: 'sys.homePage', value: state.default })
|
||||||
|
.then(res => {
|
||||||
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
|
message.success(t('views.system.setting.saveSuccess'), 3);
|
||||||
|
} else {
|
||||||
|
message.error(res.msg, 3);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
state.loading = false;
|
||||||
|
hide();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
listMenu(toRaw({ status: 1 })).then(res => {
|
||||||
|
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) {
|
||||||
|
// 过滤旧前端菜单以及不是菜单类型以及路径为空
|
||||||
|
res.data = res.data
|
||||||
|
.filter(i => i.perms !== 'page' && i.menuType === 'M' && i.component)
|
||||||
|
.map((item: any) => {
|
||||||
|
state.options.push({
|
||||||
|
label: item.menuName,
|
||||||
|
value: item.component,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//获取当前系统设置的首页路径 111为configID
|
||||||
|
getConfigKey('sys.homePage').then(res => {
|
||||||
|
if (res.code === RESULT_CODE_SUCCESS && res.data) {
|
||||||
|
state.default = res.data;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<a-row :gutter="16">
|
||||||
|
<a-col :lg="12" :md="12" :xs="24" style="margin-bottom: 30px">
|
||||||
|
<a-form-item :label="t('views.system.setting.home')">
|
||||||
|
<a-select
|
||||||
|
ref="select"
|
||||||
|
v-model:value="state.default"
|
||||||
|
style="width: 240px"
|
||||||
|
:options="state.options"
|
||||||
|
></a-select>
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
<a-button type="primary" @click="fnSave">
|
||||||
|
{{ t('views.system.setting.saveSubmit') }}
|
||||||
|
</a-button>
|
||||||
|
</a-col>
|
||||||
|
<a-col :lg="12" :md="12" :xs="24">
|
||||||
|
<a-typography>
|
||||||
|
<a-typography-paragraph>
|
||||||
|
{{ t('views.system.setting.homeInstruction') }}
|
||||||
|
</a-typography-paragraph>
|
||||||
|
</a-typography>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
@@ -7,6 +7,7 @@ import ChangeCopyright from './components/change-copyright.vue';
|
|||||||
import ChangeHelpDoc from './components/change-help-doc.vue';
|
import ChangeHelpDoc from './components/change-help-doc.vue';
|
||||||
import ChangeOfficialUrl from './components/change-official-url.vue';
|
import ChangeOfficialUrl from './components/change-official-url.vue';
|
||||||
import ChangeI18n from './components/change-i18n.vue';
|
import ChangeI18n from './components/change-i18n.vue';
|
||||||
|
import ChangeHome from './components/change-home-index.vue';
|
||||||
import SystemReset from './components/system-reset.vue';
|
import SystemReset from './components/system-reset.vue';
|
||||||
import useI18n from '@/hooks/useI18n';
|
import useI18n from '@/hooks/useI18n';
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
@@ -49,6 +50,10 @@ const { t } = useI18n();
|
|||||||
</a-divider>
|
</a-divider>
|
||||||
<ChangeI18n></ChangeI18n>
|
<ChangeI18n></ChangeI18n>
|
||||||
</div>
|
</div>
|
||||||
|
<a-divider orientation="left">
|
||||||
|
{{ t('views.system.setting.homeSet') }}
|
||||||
|
</a-divider>
|
||||||
|
<ChangeHome></ChangeHome>
|
||||||
<a-divider orientation="left">
|
<a-divider orientation="left">
|
||||||
{{ t('views.system.setting.reset') }}
|
{{ t('views.system.setting.reset') }}
|
||||||
</a-divider>
|
</a-divider>
|
||||||
|
|||||||
Reference in New Issue
Block a user