feat: 工作空间.

This commit is contained in:
lijiahangmax
2023-12-05 00:01:18 +08:00
parent f26b90ba34
commit c5120463d9
6 changed files with 99 additions and 26 deletions

View File

@@ -0,0 +1,41 @@
<template>
<a-layout class="host-workspace-layout">
<!-- 页面 -->
<a-layout-content>
<!-- 水印 -->
<a-watermark :grayscale="true"
:alpha=".6"
:z-index="9999"
style="width: 100%; height: 100%;"
:content="userStore.username || ''">
<PageLayout />
</a-watermark>
</a-layout-content>
</a-layout>
</template>
<script lang="ts">
export default {
name: 'hos-workspace-layout'
};
</script>
<script lang="ts" setup>
import { useUserStore } from '@/store';
import PageLayout from './page-layout.vue';
const userStore = useUserStore();
</script>
<style lang="less" scoped>
.host-workspace-layout {
height: 100vh;
width: 100%;
.arco-layout-content {
height: 100%;
width: 100%;
}
}
</style>

View File

@@ -7,28 +7,23 @@ import {
NOT_FOUND_ROUTER_NAME,
} from '@/router/constants';
// 默认布局
export const DEFAULT_LAYOUT = () => import('@/layout/default-layout.vue');
/**
* 根页面
*/
// 根页面
export const ROOT_ROUTER: RouteRecordRaw = {
path: '/',
redirect: DEFAULT_ROUTE_FULL_PATH,
};
/**
* 登录页面
*/
// 登录页面
export const LOGIN_ROUTER: RouteRecordRaw = {
path: '/login',
name: LOGIN_ROUTE_NAME,
component: () => import('@/views/authentication/login/index.vue'),
};
/**
* 重定向页面
*/
// 重定向页面
export const REDIRECT_ROUTER: RouteRecordRaw = {
path: '/redirect',
name: 'redirectWrapper',
@@ -49,18 +44,14 @@ export const REDIRECT_ROUTER: RouteRecordRaw = {
],
};
/**
* 403 页面
*/
// 403 页面
export const FORBIDDEN_ROUTE: RouteRecordRaw = {
path: '/403',
name: FORBIDDEN_ROUTER_NAME,
component: () => import('@/views/base/status/forbidden/index.vue'),
};
/**
* 404 页面
*/
// 404 页面
export const NOT_FOUND_ROUTE: RouteRecordRaw = {
// path: '/:pathMatch(.*)*',
path: '/404',

View File

@@ -3,6 +3,10 @@ import type { RouteRecordNormalized } from 'vue-router';
// 应用模块
const modules = import.meta.glob('./modules/*.ts', { eager: true });
// 应用路由
export const appRoutes: RouteRecordNormalized[] = formatModules(modules, []);
// 格式化模块
function formatModules(_modules: any, result: RouteRecordNormalized[]) {
Object.keys(_modules).forEach((key) => {
const defaultModule = _modules[key].default;
@@ -14,8 +18,3 @@ function formatModules(_modules: any, result: RouteRecordNormalized[]) {
});
return result;
}
/**
* 应用路由
*/
export const appRoutes: RouteRecordNormalized[] = formatModules(modules, []);

View File

@@ -0,0 +1,16 @@
import type { AppRouteRecordRaw } from '../types';
const DASHBOARD: AppRouteRecordRaw = {
name: 'hostWorkspace',
path: '/host-workspace',
component: () => import('@/layout/host-workspace-layout.vue'),
children: [
{
name: 'hostTerminal',
path: '/host-workspace/terminal',
component: () => import('@/views/host-workspace/terminal/index.vue'),
},
],
};
export default DASHBOARD;

View File

@@ -0,0 +1,21 @@
<template>
<div>
<div></div>
<div></div>
<div></div>
</div>
</template>
<script lang="ts">
export default {
name: 'index'
};
</script>
<script lang="ts" setup>
</script>
<style lang="less" scoped>
</style>

View File

@@ -236,6 +236,7 @@
}
}
}
cacheStore.reset('menus');
Message.success('删除成功');
} catch (e) {
} finally {
@@ -245,12 +246,12 @@
// 添加后回调
const addedCallback = () => {
loadMenuData();
loadMenuData(true);
};
// 更新后回调
const updatedCallback = () => {
loadMenuData();
loadMenuData(true);
};
defineExpose({
@@ -258,11 +259,15 @@
});
// 加载菜单
const loadMenuData = async () => {
const loadMenuData = async (all: any = undefined) => {
try {
setFetchLoading(true);
const { data } = await getMenuList(formModel);
const { data } = await getMenuList(all === true ? {} : formModel);
tableRenderData.value = data as MenuQueryResponse[];
// 重设缓存
if (all) {
cacheStore.set('menus', data);
}
} catch (e) {
} finally {
setFetchLoading(false);
@@ -270,13 +275,13 @@
};
onMounted(() => {
loadMenuData();
loadMenuData(true);
});
// 重置菜单
const resetForm = () => {
formRef.value.resetFields();
loadMenuData();
loadMenuData(true);
};
// 切换展开/折叠