实验台权限、员工组织样式

dev_2022-05-11
yujialong 3 years ago
parent 6c6fa0c92f
commit 1b6d765269
  1. 6
      src/pages/system/list/staff.vue
  2. 15
      src/router/index.js

@ -601,12 +601,12 @@ export default {
.wrap { .wrap {
display: flex; display: flex;
padding: 24px; padding: 24px;
.side { .side {
width: 350px; width: 300px;
padding-right: 10px;
margin-right: 24px; margin-right: 24px;
border-right: 1px solid rgba(0, 0, 0, 0.06);
} }
.right { .right {
width: calc(100% - 374px); width: calc(100% - 374px);
padding: 24px; padding: 24px;

@ -54,7 +54,7 @@ function getPermission() {
// 取得路由的值,使用addRouter添加进路由里 // 取得路由的值,使用addRouter添加进路由里
// 该项目的路由实际上做了两层处理,一层指向了默认的路由,对应模块,用于基础布局的nav,下面一层才是实际上的路由跳转, // 该项目的路由实际上做了两层处理,一层指向了默认的路由,对应模块,用于基础布局的nav,下面一层才是实际上的路由跳转,
// 所以需要默认进行赋值,实际操作时根据path去禁用掉对应的nav即可。 // 所以需要默认进行赋值,实际操作时根据path去禁用掉对应的nav即可。
const arr = ['station', 'achievement','assessment','course',"evaluation",'information','match','project','setting','student','system']; const arr = ['achievement','assessment','course',"evaluation",'information','match','project','setting','student', 'station','system'];
let permissionRouters = []; // 最后处理好的路由数组 let permissionRouters = []; // 最后处理好的路由数组
let data = res.permissionMenu[0].children; let data = res.permissionMenu[0].children;
@ -76,7 +76,6 @@ function getPermission() {
let children = []; let children = [];
// 第二级是按钮级数据,一级归属当前页的同级页面,实际上一共就一级路由 // 第二级是按钮级数据,一级归属当前页的同级页面,实际上一共就一级路由
if (e.children && e.children.length > 0) { if (e.children && e.children.length > 0) {
console.log(e.children)
e.children.forEach(i => { e.children.forEach(i => {
// 避免重复生成路由 // 避免重复生成路由
if (i.path && permissionRouters[index] && !permissionRouters[index].children.some(e => i.path === e.path)) { if (i.path && permissionRouters[index] && !permissionRouters[index].children.some(e => i.path === e.path)) {
@ -228,13 +227,23 @@ function getPermission() {
} }
}); });
console.log(permissionRouters, "处理好的"); console.log(permissionRouters, "处理好的");
const station = permissionRouters.findIndex(e => e.name === 'station')
console.log(333, station)
if (station) {
permissionRouters[station].children.push({
name: `stationPreview`,
path: `/station/preview`,
component: () => import("@/pages/station/preview"),
meta: { title: "实验台" }
})
}
// 把处理完成的路由,add到router里 // 把处理完成的路由,add到router里
// 记录一下路由的名称,用于nav // 记录一下路由的名称,用于nav
let nav = data.map(e => e.path); let nav = data.map(e => e.path);
router.app.$options.store.commit("routers", nav); router.app.$options.store.commit("routers", nav);
let redirect = [{ let redirect = [{
path: "/index", path: "/index",
redirect: permissionRouters.find(e => e.name === 'station') ? '/station' : permissionRouters[0].path redirect: station ? '/station' : permissionRouters[0].path
}]; }];
router.addRoutes(redirect); router.addRoutes(redirect);
router.addRoutes(permissionRouters); router.addRoutes(permissionRouters);

Loading…
Cancel
Save