init: 初始化 hgmj 后台管理项目

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 17:48:09 +08:00
co-authored by Claude Opus 4.7
commit 397398b746
645 changed files with 179153 additions and 0 deletions
+64
View File
@@ -0,0 +1,64 @@
<template>
<div>
<el-menu-item
:index="item.path"
@click="addRouterTag(item.path,item.title)"
v-if="item.level === 0 || !item.icon"
>
<i :class="item.icon + ' icon'" style="color:white"></i>
<span slot="title">{{item.title}}</span>
</el-menu-item>
<el-submenu :index="item.path" v-else>
<template slot="title">
<i :class="item.icon + ' icon'" style="color:white"></i>
<span>{{item.title}}</span>
</template>
<el-menu-item-group>
<siderbar-item v-for="(items,i) in visibleChildren" :key="i" :item="items"></siderbar-item>
</el-menu-item-group>
</el-submenu>
</div>
</template>
<script>
export default {
name: "siderbarItem",
props: ["item"],
computed: {
visibleChildren() {
const children = this.item.children || [];
return children.filter((c) => !(c.meta && c.meta.hideInMenu));
},
},
mounted() {
// 初始化路由tags显示
this.addRouterTag(this.$route.path, this.$route.meta.title);
},
methods: {
// 提交当前选中路由名称和路径到vuex
addRouterTag(router, routerName) {
if (router === "/welcome") {
return;
}
this.$store.dispatch("setRouterActive", router);
let routers = this.$store.state.routerTags;
let flag = true;
let index;
if (routers.length === 0) {
this.$store.dispatch("setRouterTag", { router, routerName });
return;
}
routers.forEach((item, i) => {
if (item.router === router) {
flag = false;
index = i;
}
});
if (flag) {
this.$store.dispatch("setRouterTag", { router, routerName });
} else {
this.$store.dispatch("setRouterIndex", index + 1);
}
}
}
};
</script>