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

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

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

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

@ -40,6 +40,7 @@ const selfPermission = {
let query = { let query = {
id: infoData.userDto.cardId, id: infoData.userDto.cardId,
}; };
//这个好像是获取那个检查员的身份信息
getcarid(query).then((res) => { getcarid(query).then((res) => {
commit( commit(
"SET_INSPECTORID", "SET_INSPECTORID",
@ -53,14 +54,16 @@ const selfPermission = {
let menuButton = infoData.menuButton.filter( let menuButton = infoData.menuButton.filter(
(item) => item.appCode == "JCYGL" (item) => item.appCode == "JCYGL"
); );
console.log(menuButton);
commit("SET_PERMISSIONLIST", menuButton); commit("SET_PERMISSIONLIST", menuButton);
//过滤菜单 //过滤菜单
let menuTree = infoData.menuTree.filter( let menuTree = infoData.menuTree.filter(
(item) => item.appCode == "JCYGL" (item) => item.appCode == "JCYGL"
); );
console.log(menuTree);
let fileTreeOut = filterTree(menuTree[0].childMenuList, []); let fileTreeOut = filterTree(menuTree[0].childMenuList, []);
commit("SET_ROUTER", fileTreeOut); commit("SET_ROUTER", fileTreeOut);
console.log(fileTreeOut);
resolve(fileTreeOut.length > 0 ? fileTreeOut[0].path : []); resolve(fileTreeOut.length > 0 ? fileTreeOut[0].path : []);
}) })
.catch((error) => { .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> <myHeader></myHeader>
<div class="body-container"> <div class="body-container">
<div class="tree-menu"> <div class="tree-menu">
<router-link <!-- <router-link
tag="div" tag="div"
:to="{ path: item.path }" :to="{ path: item.path }"
v-for="(item, index) in myRouter" v-for="(item, index) in myRouter"
@ -11,10 +11,54 @@
active-class="routerActive" active-class="routerActive"
> >
<div class="view-child"> <div class="view-child">
<img :src="item.icon" alt="" class="router-icon" /> <img :src="item.icon" alt="" class="router-icon" />
{{ item.name }} {{ item.name }}
</div> </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>
<div class="view-box"> <div class="view-box">
<tags-view ref="tagsView" /> <tags-view ref="tagsView" />
@ -33,7 +77,64 @@ import router from "@/router";
export default { export default {
components: { myHeader, TagsView }, components: { myHeader, TagsView },
data() { 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: { computed: {
// //
@ -44,14 +145,40 @@ export default {
// )[0].children; // )[0].children;
// return staticRouter; // return staticRouter;
// return this.$store.state.myselfPermission.routerList; // return this.$store.state.myselfPermission.routerList;
console.log(this.$router.options.routes[6].children);
return this.$router.options.routes[6].children; return this.$router.options.routes[6].children;
}, },
get1(e) {
console.log(e);
},
}, },
created() {}, created() {},
}; };
</script> </script>
<style lang="scss" scoped> <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 { .container {
height: 100%; height: 100%;
.body-container { .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