| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- <template>
- <div class="sidebar">
- <el-menu
- class="sidebar-el-menu"
- :default-active="onRoutes"
- :collapse="collapse"
- background-color="#000000"
- text-color="#bfcbd9"
- active-text-color="#20a0ff"
- unique-opened
- router
- >
- <template v-for="item in items">
- <template v-if="item.subs">
- <el-submenu :index="item.index" :key="item.index">
- <template #title>
- <i :class="item.icon"></i>
- <span>{{ item.title }}</span>
- </template>
- <template v-for="subItem in item.subs">
- <el-submenu v-if="subItem.subs" :index="subItem.index" :key="subItem.index">
- <template #title>{{ subItem.title }}</template>
- <el-menu-item v-for="(threeItem, i) in subItem.subs" :key="i" :index="threeItem.index">
- {{ threeItem.title }}</el-menu-item>
- </el-submenu>
- <el-menu-item v-else :index="subItem.index" :key="subItem.index">{{ subItem.title }}
- </el-menu-item>
- </template>
- </el-submenu>
- </template>
- <template v-else>
- <el-menu-item :index="item.index.toString()" :key="item.index">
- <i :class="item.icon"></i>
- <template #title>{{ item.title }}</template>
- </el-menu-item>
- </template>
- </template>
- </el-menu>
- </div>
- </template>
- <script>
- import { computed } from "vue";
- import { useStore } from "vuex";
- import { useRoute, useRouter } from "vue-router";
- export default {
- setup() {
- const items = [
- // {
- // icon: "el-icon-lx-file",
- // title: "我的文件",
- // index:3,
- // subs: [
- // {
- // index: "/fileList",
- // title: "我的文件"
- // },
- // {
- // index: "/fileDetail",
- // title: "文件详情",
- // },
- // {
- // index: "/upload",
- // title: "文件上传",
- // },
- // ]
- // },
- {
- icon: "el-icon-lx-file",
- index: "/fileList",
- title: "我的文件",
- },
- {
- icon: "el-icon-lx-cascades",
- title: "配置",
- index: 1,
- subs: [
- {
- index: "/config",
- title: "模型配置"
- },
- {
- index: "/analysisConfig",
- title: "数据统计配置",
- },
- ]
- },
- // {
- // icon: "el-icon-star-off",
- // index: "/modelDetail",
- // title: "模型训练",
- // },
- {
- icon: "el-icon-coin",
- index: "/modelList",
- title:"机器学习模型",
- },
- // {
- // icon: "el-icon-coin",
- // index: "/dlModelList",
- // title:"深度学习模型",
- // },
- // {
- // icon: "el-icon-data-board",
- // index: "/charts",
- // title: "预测结果",
- // },
- {
- icon: "el-icon-pie-chart",
- index: "/analysis",
- title: "数据分析",
- },
- {
- icon: "el-icon-odometer",
- title: "流水线",
- index: 2,
- subs: [
- {
- index: "/mlPipeline",
- title: "机器学习流水线"
- },
- {
- index: "/analysisPipeline",
- title: "数据分析流水线",
- },
- ]
- },
- {
- icon: "el-icon-office-building",
- index: "/square",
- title: "数据广场",
- },
- // 无用组件
- // {
- // icon: "el-icon-user",
- // index: "/user",
- // title: "个人中心",
- // },
- // {
- // icon: "el-icon-lx-calendar",
- // index: "3",
- // title: "表单相关",
- // subs: [
- // {
- // index: "/form",
- // title: "基本表单",
- // },
- // {
- // index: "/upload",
- // title: "文件上传",
- // },
- // {
- // index: "4",
- // title: "三级菜单",
- // subs: [
- // {
- // index: "/editor",
- // title: "富文本编辑器",
- // },
- // ],
- // },
- // ],
- // },
- // {
- // icon: "el-icon-lx-emoji",
- // index: "/icon",
- // title: "自定义图标",
- // },
- // {
- // icon: "el-icon-lx-global",
- // index: "/i18n",
- // title: "国际化功能",
- // },
- // {
- // icon: "el-icon-lx-warn",
- // index: "7",
- // title: "错误处理",
- // subs: [
- // {
- // index: "/permission",
- // title: "权限测试",
- // },
- // {
- // index: "/404",
- // title: "404页面",
- // },
- // ],
- // },
- // {
- // icon: "el-icon-lx-redpacket_fill",
- // index: "/donate",
- // title: "支持作者",
- // }
- ];
- const route = useRoute();
- //const router = useRouter();
- const onRoutes = computed(() => {
- return route.path;
- });
- // const onRouters = computed(() => {
- // return router.path;
- // });
- const store = useStore();
- const collapse = computed(() => store.state.collapse);
- return {
- items,
- onRoutes,
- //onRouters,
- collapse,
- };
- },
- };
- </script>
- <style scoped>
- .sidebar {
- display: block;
- position: absolute;
- left: 0;
- top: 70px;
- bottom: 0;
- overflow-y: scroll;
- }
- .sidebar::-webkit-scrollbar {
- width: 0;
- }
- .sidebar-el-menu:not(.el-menu--collapse) {
- width: 250px;
- }
- .sidebar > ul {
- height: 100%;
- }
- </style>
|