Lvtianfang
杜函宇 2 years ago
parent a2931feea2
commit 9bb8ee8f5d

@ -26,7 +26,7 @@
</div>
</router-link>
</scroll-pane>
<!-- <el-dropdown class="avatar-container" trigger="click">
<el-dropdown class="avatar-container" trigger="click">
<div class="avatar-wrapper">
<span class="user-name" style="margin-right: 3px">操作</span>
<i class="el-icon-caret-bottom" />
@ -39,7 +39,7 @@
<span>关闭当前</span>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown> -->
</el-dropdown>
<!-- <ul
v-show="visible"
:style="{ left: left + 'px', top: top + 'px' }"
@ -126,6 +126,7 @@ export default {
};
},
isAffix(tag) {
console.log(tag);
return tag.meta && tag.meta.affix;
},
isFirstView() {

@ -6,11 +6,11 @@ import "nprogress/nprogress.css";
import { getToken } from "@/utils/auth";
// 踢出系统
// function kickOut() {
// if (process.env.NODE_ENV === "production") {
// location.href = location.origin + "/login";
// }
// }
function kickOut() {
if (process.env.NODE_ENV === "production") {
location.href = location.origin + "/login";
}
}
NProgress.configure({ showSpinner: false });
const whiteList = [
"/login",
@ -21,10 +21,16 @@ const whiteList = [
"/personalData",
"/changePassword",
"/statistics",
"/administrative",
"/enterpriseMsg",
"/productsMsg",
"/logout",
];
router.beforeEach((to, from, next) => {
NProgress.start();
if (getToken()) {
console.log('有token');
to.meta.title && store.dispatch("settings/setTitle", to.meta.title);
/* has token*/
if (to.path === "/login") {
@ -36,39 +42,39 @@ router.beforeEach((to, from, next) => {
} else {
// 没有token
if (whiteList.indexOf(to.path) !== -1) {
next()
// let token = localStorage.getItem("MSSM-LIAONING__TOKEN");
// if (token) {
// if (store.state.myselfPermission.routerList.length > 0) {
// let current = store.state.myselfPermission.routerList.filter(
// (item) => item.path == to.path || from.path == "/"
// );
// if (current.length > 0) {
// next();
let token = localStorage.getItem("MSSM-LIAONING__TOKEN");
if (token) {
if (store.state.myselfPermission.routerList.length > 0) {
let current = store.state.myselfPermission.routerList.filter(
(item) => item.path == to.path || from.path == "/"
);
if (current.length > 0) {
next();
} else {
Message.error("无权限访问!");
}
} else {
store
.dispatch("GetPermission")
.then((res) => {
if (res.length > 0) {
next({ path: res });
} else {
// } else {
// next();
// // Message.error("无权限访问!");
// }
// } else {
// store
// .dispatch("GetPermission")
// .then((res) => {
// console.log(res);
// if (res.length > 0) {
// next({ path: res });
// } else {
// kickOut();
}
})
.catch((error) => {
// }
// })
// .catch((error) => {
// kickOut();
});
}
} else {
// });
// }
// } else {
// //没有token踢出去
// Message.error("获取令牌失败!");
// kickOut();
next();
}
// }
} else {
// kickOut();
NProgress.done();

@ -62,94 +62,74 @@ export const constantRoutes = [
hidden: true,
},
{
path: "",
component: Layout,
redirect: "index",
// children: [
// {
// path: "index",
// component: () => import("@/views/index"),
// name: "Index",
// meta: { title: "检查员统计", icon: "netWork", affix: true },
// path: "",
// component: Layout,
// redirect: "index",
// // children: [
// // {
// // path: "index",
// // component: () => import("@/views/index"),
// // name: "Index",
// // meta: { title: "检查员统计", icon: "netWork", affix: true },
// // },
// // ],
// },
// ],
},
{
path: "/index",
path: "",
component: () => import("@/views/index"),
name: "Index",
meta: { title: "首页", icon: "netWork", affix: true },
isDiy: true,
hidden: true,
redirect: "/netWorkStat",
redirect: "/administrative",
children: [
{
path: "/netWorkStat",
name: "检查员统计",
icon: require("@/assets/images/tree1.svg"),
component: () => import("@/views/netWorkStat/index"),
meta: { title: "检查员统计", icon: "netWork", affix: true },
},
{
path: "/censor",
name: "全局检查员信息",
icon: require("@/assets/images/tree2.svg"),
component: () => import("@/views/censor/index"),
meta: { title: "全局检查员信息", icon: "netWork" },
},
{
path: "/statistics",
name: "培训情况统计",
icon: require("@/assets/images/tree3.svg"),
component: () => import("@/views/statistics/index"),
meta: { title: "培训情况统计", icon: "netWork" },
},
{
path: "/personalData",
name: "检查员个人资料",
icon: require("@/assets/images/tree3.svg"),
component: () => import("@/views/personalData/index"),
meta: { title: "检查员个人资料", icon: "netWork" },
path: "/administrative",
name: "行政审批",
icon: require("@/assets/images/tree4.svg"),
component: () => import("@/views/administrative/index"),
meta: { title: "行政审批", icon: "netWork" },
},
{
path: "/changePassword",
name: "修改密码",
path: "/enterpriseMsg",
name: "企业档案",
icon: require("@/assets/images/tree4.svg"),
component: () => import("@/views/changePassword/index"),
meta: { title: "修改密码", icon: "netWork" },
component: () => import("@/views/enterpriseMsg/index"),
meta: { title: "企业档案", icon: "netWork" },
},
{
path: "/changePassword",
name: "行政审批",
path: "/drugArchives",
name: "药品档案",
icon: require("@/assets/images/tree4.svg"),
component: () => import("@/views/changePassword/index"),
meta: { title: "行政审批", icon: "netWork" },
component: () => import("@/views/productsMsg/components/drugArchives.vue"),
meta: { title: "药品档案", icon: "netWork" },
},
{
path: "/changePassword",
name: "企业档案",
path: "/cosmeticsArchives",
name: "化妆品档案",
icon: require("@/assets/images/tree4.svg"),
component: () => import("@/views/changePassword/index"),
meta: { title: "企业档案", icon: "netWork" },
component: () => import("@/views/productsMsg/components/cosmeticsArchives.vue"),
meta: { title: "化妆品档案", icon: "netWork" },
},
{
path: "/changePassword",
name: "产品档案",
path: "/health",
name: "医疗器械档案",
icon: require("@/assets/images/tree4.svg"),
component: () => import("@/views/changePassword/index"),
meta: { title: "产品档案", icon: "netWork" },
component: () => import("@/views/productsMsg/components/health.vue"),
meta: { title: "医疗器械档案", icon: "netWork" },
},
{
path: "/changePassword",
path: "/logout",
name: "依法注销",
icon: require("@/assets/images/tree4.svg"),
component: () => import("@/views/changePassword/index"),
component: () => import("@/views/logout/index"),
meta: { title: "依法注销", icon: "netWork" },
},
],
},
//可以按着若依的思路来写,把菜单全部都设置成一级路由,然后有下拉选择框的去进行区别判断设置成二级子路由
];
// 动态路由,基于用户权限动态去加载

@ -40,6 +40,7 @@ const selfPermission = {
let query = {
id: infoData.userDto.cardId,
};
//这个好像是获取那个检查员的身份信息
getcarid(query).then((res) => {
commit(
"SET_INSPECTORID",
@ -53,14 +54,16 @@ const selfPermission = {
let menuButton = infoData.menuButton.filter(
(item) => item.appCode == "JCYGL"
);
console.log(menuButton);
commit("SET_PERMISSIONLIST", menuButton);
//过滤菜单
let menuTree = infoData.menuTree.filter(
(item) => item.appCode == "JCYGL"
);
console.log(menuTree);
let fileTreeOut = filterTree(menuTree[0].childMenuList, []);
commit("SET_ROUTER", fileTreeOut);
console.log(fileTreeOut);
resolve(fileTreeOut.length > 0 ? fileTreeOut[0].path : []);
})
.catch((error) => {

@ -0,0 +1,3 @@
<template>
<div>00000</div>
</template>

@ -0,0 +1,3 @@
<template>
<div> 11111111</div>
</template>

@ -0,0 +1,3 @@
<template>
<div> 22222</div>
</template>

@ -3,7 +3,7 @@
<myHeader></myHeader>
<div class="body-container">
<div class="tree-menu">
<router-link
<!-- <router-link
tag="div"
:to="{ path: item.path }"
v-for="(item, index) in myRouter"
@ -14,7 +14,51 @@
<img :src="item.icon" alt="" class="router-icon" />
{{ item.name }}
</div>
</router-link>
<div></div>
</router-link> -->
<el-menu
:default-active="routerIndex"
class="el-menu-vertical-demo"
:router="true"
background-color="#465970"
text-color="#fff"
>
<div
:index="item.path"
v-for="(item, index) in routerList"
:key="index"
>
<div v-if="item.children && item.children.length > 0">
<el-submenu index="">
<template slot="title">
<img :src="item.icon" alt="" class="leftIcon" />
<span>{{ item.name }}</span>
</template>
<el-menu-item-group v-if="item.children">
<el-menu-item
:index="itemb.path + '66'"
v-for="(itemb, index) in item.children"
:key="index +'3'"
:route="itemb.path"
>{{ itemb.name }}</el-menu-item
>
</el-menu-item-group>
</el-submenu>
</div>
<div v-else>
<el-menu-item
:index="item.path + '2'"
:key="index"
:route="item.path"
>
<template slot="title">
<img :src="item.icon" alt="" class="leftIcon" />
<span>{{ item.name }}</span>
</template></el-menu-item
>
</div>
</div>
</el-menu>
</div>
<div class="view-box">
<tags-view ref="tagsView" />
@ -33,7 +77,64 @@ import router from "@/router";
export default {
components: { myHeader, TagsView },
data() {
return {};
return {
routerIndex: "1-1",
routerList: [
{
path: "/administrative",
name: "行政审批",
icon: require("@/assets/images/tree4.svg"),
component: () => import("@/views/administrative/index"),
meta: { title: "行政审批", icon: "netWork" },
},
{
path: "/enterpriseMsg",
name: "企业档案",
icon: require("@/assets/images/tree4.svg"),
component: () => import("@/views/enterpriseMsg/index"),
meta: { title: "企业档案", icon: "netWork" },
},
{
path: "/productsMsg",
name: "产品档案",
icon: require("@/assets/images/tree4.svg"),
meta: { title: "产品档案", icon: "netWork" },
children: [
{
path: "/drugArchives",
name: "药品档案",
icon: require("@/assets/images/tree4.svg"),
component: () =>
import("@/views/productsMsg/components/drugArchives"),
meta: { title: "药品档案", icon: "netWork" },
},
{
path: "/cosmeticsArchives",
name: "化妆品档案",
icon: require("@/assets/images/tree4.svg"),
component: () =>
import("@/views/productsMsg/components/cosmeticsArchives"),
meta: { title: "化妆品档案", icon: "netWork" },
},
{
path: "/health",
name: "医疗器械档案",
icon: require("@/assets/images/tree4.svg"),
component: () => import("@/views/productsMsg/components/health"),
meta: { title: "医疗器械档案", icon: "netWork" },
},
],
},
{
path: "/logout",
name: "依法注销",
icon: require("@/assets/images/tree4.svg"),
component: () => import("@/views/logout/index"),
meta: { title: "依法注销", icon: "netWork" },
},
],
};
},
computed: {
//
@ -44,14 +145,40 @@ export default {
// )[0].children;
// return staticRouter;
// return this.$store.state.myselfPermission.routerList;
console.log(this.$router.options.routes[6].children);
return this.$router.options.routes[6].children;
},
get1(e) {
console.log(e);
},
},
created() {},
};
</script>
<style lang="scss" scoped>
::v-deep .el-submenu {
margin-right: -1px;
}
.leftIcon {
display: inline-block;
height: 14px;
width: 14px;
margin-right: 10px;
}
::v-deep .el-submenu__title {
padding: 0 8px !important;
}
::v-deep .el-menu-item {
padding: 0 8px !important;
margin-right: -1px;
}
::v-deep .el-menu-item-group .el-menu-item {
padding-left: 35px !important;
}
::v-deep .el-menu-item-group__title {
padding: 0 !important;
}
.container {
height: 100%;
.body-container {

@ -0,0 +1,3 @@
<template>
<div> 4444</div>
</template>

@ -0,0 +1,5 @@
<template>
<div>
dsafasdfasdfasdfasd
</div>
</template>

@ -0,0 +1,3 @@
<template>
<div>77777777777</div>
</template>

@ -0,0 +1,5 @@
<template>
<div>
adsfadsfasdfasdfasdf
</div>
</template>

@ -0,0 +1,3 @@
<template>
<div> 3333</div>
</template>
Loading…
Cancel
Save