update code style
This commit is contained in:
parent
4722a8ef9b
commit
1eda36201a
@ -73,18 +73,18 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import SearchMenu from './topBar/search.vue'
|
import SearchMenu from './topBar/search.vue';
|
||||||
import useAppStore from '@/store/modules/app'
|
import useAppStore from '@/store/modules/app';
|
||||||
import useUserStore from '@/store/modules/user'
|
import useUserStore from '@/store/modules/user';
|
||||||
import useSettingsStore from '@/store/modules/settings'
|
import useSettingsStore from '@/store/modules/settings';
|
||||||
import { getTenantList } from "@/api/login";
|
import { getTenantList } from "@/api/login";
|
||||||
import { dynamicClear, dynamicTenant } from "@/api/system/tenant";
|
import { dynamicClear, dynamicTenant } from "@/api/system/tenant";
|
||||||
import { ComponentInternalInstance } from "vue";
|
import { ComponentInternalInstance } from "vue";
|
||||||
import { TenantVO } from "@/api/types";
|
import { TenantVO } from "@/api/types";
|
||||||
|
|
||||||
const appStore = useAppStore()
|
const appStore = useAppStore();
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore();
|
||||||
const settingsStore = useSettingsStore()
|
const settingsStore = useSettingsStore();
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
|
|
||||||
@ -99,48 +99,48 @@ const tenantEnabled = ref(true);
|
|||||||
const searchMenuRef = ref<InstanceType<typeof SearchMenu>>();
|
const searchMenuRef = ref<InstanceType<typeof SearchMenu>>();
|
||||||
|
|
||||||
const openSearchMenu = () => {
|
const openSearchMenu = () => {
|
||||||
searchMenuRef.value?.openSearch()
|
searchMenuRef.value?.openSearch();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 动态切换
|
// 动态切换
|
||||||
const dynamicTenantEvent = async (tenantId: string) => {
|
const dynamicTenantEvent = async (tenantId: string) => {
|
||||||
if (companyName.value != null && companyName.value !== '') {
|
if (companyName.value != null && companyName.value !== '') {
|
||||||
await dynamicTenant(tenantId);
|
await dynamicTenant(tenantId);
|
||||||
dynamic.value = true;
|
dynamic.value = true;
|
||||||
proxy?.$tab.closeAllPage();
|
proxy?.$tab.closeAllPage();
|
||||||
proxy?.$router.push('/');
|
proxy?.$router.push('/');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const dynamicClearEvent = async () => {
|
const dynamicClearEvent = async () => {
|
||||||
await dynamicClear();
|
await dynamicClear();
|
||||||
dynamic.value = false;
|
dynamic.value = false;
|
||||||
proxy?.$tab.closeAllPage();
|
proxy?.$tab.closeAllPage();
|
||||||
proxy?.$router.push('/')
|
proxy?.$router.push('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 租户列表 */
|
/** 租户列表 */
|
||||||
const initTenantList = async () => {
|
const initTenantList = async () => {
|
||||||
const { data } = await getTenantList();
|
const { data } = await getTenantList();
|
||||||
tenantEnabled.value = data.tenantEnabled === undefined ? true : data.tenantEnabled;
|
tenantEnabled.value = data.tenantEnabled === undefined ? true : data.tenantEnabled;
|
||||||
if (tenantEnabled.value) {
|
if (tenantEnabled.value) {
|
||||||
tenantList.value = data.voList;
|
tenantList.value = data.voList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
initTenantList,
|
initTenantList,
|
||||||
})
|
})
|
||||||
|
|
||||||
const toggleSideBar = () => {
|
const toggleSideBar = () => {
|
||||||
appStore.toggleSideBar(false)
|
appStore.toggleSideBar(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
const logout = async () => {
|
const logout = async () => {
|
||||||
await ElMessageBox.confirm('确定注销并退出系统吗?', '提示', {
|
await ElMessageBox.confirm('确定注销并退出系统吗?', '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
})
|
})
|
||||||
await userStore.logout()
|
await userStore.logout()
|
||||||
location.href = import.meta.env.VITE_APP_CONTEXT_PATH + 'index';
|
location.href = import.meta.env.VITE_APP_CONTEXT_PATH + 'index';
|
||||||
|
@ -87,12 +87,12 @@ const generateRoutes = (routes: RouteOption[], basePath = '', prefixTitle: strin
|
|||||||
title: [...prefixTitle]
|
title: [...prefixTitle]
|
||||||
}
|
}
|
||||||
if (r.meta && r.meta.title) {
|
if (r.meta && r.meta.title) {
|
||||||
data.title = [...data.title, r.meta.title];
|
data.title = [...data.title, r.meta.title];
|
||||||
if (r.redirect !== 'noRedirect') {
|
if (r.redirect !== 'noRedirect') {
|
||||||
// only push the routes with title
|
// only push the routes with title
|
||||||
// special case: need to exclude parent router without redirect
|
// special case: need to exclude parent router without redirect
|
||||||
res.push(data);
|
res.push(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// recursive child routes
|
// recursive child routes
|
||||||
if (r.children) {
|
if (r.children) {
|
||||||
@ -114,11 +114,11 @@ const generateRoutes = (routes: RouteOption[], basePath = '', prefixTitle: strin
|
|||||||
const onHandleSelect = (val: any) => {
|
const onHandleSelect = (val: any) => {
|
||||||
const paths = val.path;
|
const paths = val.path;
|
||||||
if (isHttp(paths)) {
|
if (isHttp(paths)) {
|
||||||
// http(s):// 路径新窗口打开
|
// http(s):// 路径新窗口打开
|
||||||
const pindex = paths.indexOf("http");
|
const pindex = paths.indexOf("http");
|
||||||
window.open(paths.substring(pindex, paths.length), "_blank");
|
window.open(paths.substring(pindex, paths.length), "_blank");
|
||||||
} else {
|
} else {
|
||||||
router.push(paths)
|
router.push(paths);
|
||||||
}
|
}
|
||||||
state.menuQuery = ''
|
state.menuQuery = ''
|
||||||
closeSearch();
|
closeSearch();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user