mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-09-21 21:06:39 +08:00
v1.0.7 优化权限的单词命名,以及中文命名
This commit is contained in:
parent
f9a4917086
commit
07f4bbf291
@ -0,0 +1,148 @@
|
||||
package com.gangquan360.smartadmin.common.domain;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author: zhuoda
|
||||
* @create: 2020-02-03 17:37 PM from win10
|
||||
*/
|
||||
public class ValidateList<E> implements List<E> {
|
||||
|
||||
@Valid
|
||||
@NotEmpty(message = "数据长度请大于0!")
|
||||
private List<E> list;
|
||||
|
||||
public ValidateList() {
|
||||
this.list = new ArrayList<>();
|
||||
}
|
||||
|
||||
public ValidateList(List<E> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
public List<E> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(List<E> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return list.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
return list.contains(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<E> iterator() {
|
||||
return list.iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] toArray() {
|
||||
return list.toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T[] toArray(T[] a) {
|
||||
return list.toArray(a);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(E e) {
|
||||
return list.add(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(Object o) {
|
||||
return list.remove(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsAll(Collection<?> c) {
|
||||
return list.containsAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(Collection<? extends E> c) {
|
||||
return list.addAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(int index, Collection<? extends E> c) {
|
||||
return list.addAll(index, c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeAll(Collection<?> c) {
|
||||
return list.removeAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean retainAll(Collection<?> c) {
|
||||
return list.retainAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
list.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public E get(int index) {
|
||||
return list.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public E set(int index, E element) {
|
||||
return list.set(index, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(int index, E element) {
|
||||
list.add(index, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public E remove(int index) {
|
||||
return list.remove(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int indexOf(Object o) {
|
||||
return list.indexOf(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int lastIndexOf(Object o) {
|
||||
return list.lastIndexOf(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListIterator<E> listIterator() {
|
||||
return list.listIterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListIterator<E> listIterator(int index) {
|
||||
return list.listIterator(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<E> subList(int fromIndex, int toIndex) {
|
||||
return list.subList(fromIndex, toIndex);
|
||||
}
|
||||
|
||||
}
|
@ -78,6 +78,7 @@ public class EmployeeController {
|
||||
public ResponseDTO<String> updatePwd(@Valid @RequestBody EmployeeUpdatePwdDTO updatePwdDTO) {
|
||||
RequestTokenBO requestToken = SmartRequestTokenUtil.getRequestUser();
|
||||
return employeeService.updatePwd(updatePwdDTO, requestToken);
|
||||
// return ResponseDTO.succ();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过部门id获取当前部门的人员&没有部门的人", notes = "@author yandanyang")
|
||||
|
@ -195,6 +195,7 @@ public class LoginService {
|
||||
public LoginDetailVO getSession(RequestTokenBO requestUser) {
|
||||
LoginDetailVO loginDTO = SmartBeanUtil.copy(requestUser.getEmployeeBO(), LoginDetailVO.class);
|
||||
List<PrivilegeEntity> privilegeEntityList = privilegeEmployeeService.getEmployeeAllPrivilege(requestUser.getRequestUserId());
|
||||
//====== 开启缓存 ======
|
||||
if (privilegeEntityList == null) {
|
||||
List<LoginPrivilegeDTO> loginPrivilegeDTOS = initEmployeePrivilege(requestUser.getRequestUserId());
|
||||
loginDTO.setPrivilegeList(loginPrivilegeDTOS);
|
||||
@ -202,6 +203,10 @@ public class LoginService {
|
||||
loginDTO.setPrivilegeList(SmartBeanUtil.copyList(privilegeEntityList, LoginPrivilegeDTO.class));
|
||||
}
|
||||
|
||||
//====== 不开启缓存 ======
|
||||
// List<LoginPrivilegeDTO> loginPrivilegeDTOS = initEmployeePrivilege(requestUser.getRequestUserId());
|
||||
// loginDTO.setPrivilegeList(loginPrivilegeDTOS);
|
||||
|
||||
//判断是否为超管
|
||||
Boolean isSuperman = privilegeEmployeeService.isSuperman(loginDTO.getId());
|
||||
loginDTO.setIsSuperMan(isSuperman);
|
||||
|
@ -2,6 +2,7 @@ package com.gangquan360.smartadmin.module.privilege.controller;
|
||||
|
||||
import com.gangquan360.smartadmin.common.anno.OperateLog;
|
||||
import com.gangquan360.smartadmin.common.domain.ResponseDTO;
|
||||
import com.gangquan360.smartadmin.common.domain.ValidateList;
|
||||
import com.gangquan360.smartadmin.constant.SwaggerTagConst;
|
||||
import com.gangquan360.smartadmin.module.privilege.domain.dto.*;
|
||||
import com.gangquan360.smartadmin.module.privilege.service.PrivilegeService;
|
||||
@ -39,11 +40,12 @@ public class PrivilegeController {
|
||||
|
||||
@ApiOperation(value = "菜单批量保存")
|
||||
@PostMapping("/privilege/menu/batchSaveMenu")
|
||||
public ResponseDTO<String> menuBatchSave(@Valid @RequestBody List<PrivilegeMenuDTO> menuList) {
|
||||
public ResponseDTO<String> menuBatchSave(@Valid @RequestBody ValidateList<PrivilegeMenuDTO> menuList) {
|
||||
return privilegeService.menuBatchSave(menuList);
|
||||
// return ResponseDTO.succ();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "查询所有菜单项")
|
||||
@PostMapping("/privilege/menu/queryAll")
|
||||
public ResponseDTO<List<PrivilegeMenuVO>> queryAll() {
|
||||
|
@ -4,8 +4,8 @@ export default {
|
||||
inserted: function (el, binding, vnode) {
|
||||
// 获取当前路由name
|
||||
// 如果页面为同一模块下的子页面则取最上级权限
|
||||
let routeName = vnode.context.$route.meta.group
|
||||
? vnode.context.$route.meta.group
|
||||
let routeName = vnode.context.$route.meta.privilegeExtend
|
||||
? vnode.context.$route.meta.privilegeExtend
|
||||
: vnode.context.$route.name;
|
||||
// 超级管理员
|
||||
if (store.state.user.userLoginInfo.isSuperMan) {
|
||||
|
@ -5,37 +5,7 @@ const { title, useI18n } = config;
|
||||
export const hasChild = item => {
|
||||
return item.children && item.children.length !== 0;
|
||||
};
|
||||
const showThisMenuEle = (item, access) => {
|
||||
if (item.meta && item.meta.access && item.meta.access.length) {
|
||||
if (hasOneOf(item.meta.access, access)) return true;
|
||||
else return false;
|
||||
} else return true;
|
||||
};
|
||||
/**
|
||||
* @param {Array} list 通过路由列表得到菜单列表
|
||||
* @returns {Array}
|
||||
*/
|
||||
export const getMenuByRouter = (list, access) => {
|
||||
let res = [];
|
||||
forEach(list, item => {
|
||||
if (!item.meta || (item.meta && !item.meta.hideInMenu)) {
|
||||
let obj = {
|
||||
icon: (item.meta && item.meta.icon) || '',
|
||||
name: item.name,
|
||||
meta: item.meta
|
||||
};
|
||||
if (
|
||||
(hasChild(item) || (item.meta && item.meta.showAlways)) &&
|
||||
showThisMenuEle(item, access)
|
||||
) {
|
||||
obj.children = getMenuByRouter(item.children, access);
|
||||
}
|
||||
if (item.meta && item.meta.href) obj.href = item.meta.href;
|
||||
if (showThisMenuEle(item, access)) res.push(obj);
|
||||
}
|
||||
});
|
||||
return res;
|
||||
};
|
||||
|
||||
/**
|
||||
* 通过权限过滤菜单
|
||||
* @param {Object} map 权限对象
|
||||
|
@ -51,7 +51,6 @@ Router.prototype.closeCurrentPageAndPush = function (pushParam) {
|
||||
};
|
||||
let storeSelf = store;
|
||||
router.beforeEach((to, from, next) => {
|
||||
console.log(to);
|
||||
iView.LoadingBar.start();
|
||||
const token = cookie.getToken();
|
||||
if (!token && to.name !== LOGIN_PAGE_NAME) {
|
||||
@ -73,7 +72,13 @@ router.beforeEach((to, from, next) => {
|
||||
window.scrollTo(0, 0);
|
||||
} else {
|
||||
// 特殊页面直接放行
|
||||
if (to.meta.access) {
|
||||
if (to.meta.noValidatePrivilege) {
|
||||
next();
|
||||
return;
|
||||
}
|
||||
|
||||
//如果是超管,直接放行
|
||||
if (store.state.user.userLoginInfo.isSuperMan) {
|
||||
next();
|
||||
return;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ export const emailSetting = [
|
||||
name: 'EmailList',
|
||||
meta: {
|
||||
title: '邮件管理',
|
||||
childrenPoints: [
|
||||
privilege: [
|
||||
{ title: '查询', name: 'email-query' },
|
||||
{ title: '新增', name: 'email-add' },
|
||||
{ title: '编辑', name: 'email-update' },
|
||||
@ -31,7 +31,7 @@ export const emailSetting = [
|
||||
name: 'SendMail',
|
||||
meta: {
|
||||
title: '发送邮件',
|
||||
childrenPoints: [{ title: '发送', name: 'email-send' }]
|
||||
privilege: [{ title: '发送', name: 'email-send' }]
|
||||
},
|
||||
component: () => import('@/views/email/send-mail.vue')
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ export const employee = [
|
||||
name: 'RoleManage',
|
||||
meta: {
|
||||
title: '角色管理',
|
||||
childrenPoints: [
|
||||
privilege: [
|
||||
{
|
||||
title: '添加角色',
|
||||
name: 'add-role'
|
||||
@ -67,7 +67,7 @@ export const employee = [
|
||||
name: 'PositionList',
|
||||
meta: {
|
||||
title: '岗位管理',
|
||||
childrenPoints: [
|
||||
privilege: [
|
||||
{
|
||||
title: '查询',
|
||||
name: 'search-position'
|
||||
@ -94,7 +94,7 @@ export const employee = [
|
||||
name: 'RoleEmployeeManage',
|
||||
meta: {
|
||||
title: '员工管理',
|
||||
childrenPoints: [
|
||||
privilege: [
|
||||
{
|
||||
title: '添加部门',
|
||||
name: 'add-department'
|
||||
|
@ -5,7 +5,7 @@ export const error = [
|
||||
name: 'Error401',
|
||||
meta: {
|
||||
hideInMenu: true,
|
||||
access: true
|
||||
noValidatePrivilege: true
|
||||
},
|
||||
component: () => import('@/views/error-page/401.vue')
|
||||
},
|
||||
@ -14,7 +14,7 @@ export const error = [
|
||||
name: 'Error500',
|
||||
meta: {
|
||||
hideInMenu: true,
|
||||
access: true
|
||||
noValidatePrivilege: true
|
||||
},
|
||||
component: () => import('@/views/error-page/500.vue')
|
||||
},
|
||||
@ -23,7 +23,7 @@ export const error = [
|
||||
name: 'http://localhost:8080/#employee/role-employee-manage',
|
||||
meta: {
|
||||
hideInMenu: true,
|
||||
access: true
|
||||
noValidatePrivilege: true
|
||||
},
|
||||
component: () => import('@/views/error-page/404.vue')
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ export const file = [
|
||||
meta: {
|
||||
title: '文件列表',
|
||||
icon: 'ios-cloud-upload',
|
||||
childrenPoints: [
|
||||
privilege: [
|
||||
{ title: '查询', name: 'file-filePage-query' },
|
||||
{ title: '上传', name: 'file-filePage-upload' },
|
||||
{ title: '下载', name: 'file-filePage-download' }
|
||||
|
@ -17,7 +17,7 @@ export const heartBeat = [
|
||||
meta: {
|
||||
title: '心跳服务',
|
||||
icon: 'icon iconfont icondingshirenwu',
|
||||
childrenPoints: [
|
||||
privilege: [
|
||||
{
|
||||
title: '查询任务',
|
||||
name: 'heart-beat-query'
|
||||
|
@ -7,9 +7,10 @@ export const home = [
|
||||
redirect: '/home',
|
||||
component: Main,
|
||||
meta: {
|
||||
title: '首页',
|
||||
noKeepAlive: true,
|
||||
hideInMenu: true,
|
||||
access: true,
|
||||
noValidatePrivilege: true,
|
||||
icon: 'icon iconfont iconxitongshezhi'
|
||||
},
|
||||
children: [
|
||||
@ -18,7 +19,7 @@ export const home = [
|
||||
name: 'Home',
|
||||
meta: {
|
||||
title: '首页',
|
||||
access: true,
|
||||
noValidatePrivilege: true,
|
||||
noKeepAlive: true
|
||||
},
|
||||
component: () => import('@/views/home')
|
||||
|
@ -10,12 +10,13 @@ export const monitor = [
|
||||
icon: 'icon iconfont iconxitongjiankong'
|
||||
},
|
||||
children: [
|
||||
// 在线人数
|
||||
{
|
||||
path: '/monitor/online-user',
|
||||
name: 'OnlineUser',
|
||||
meta: {
|
||||
title: '在线人数',
|
||||
childrenPoints: [{ title: '查询', name: 'online-user-search' }]
|
||||
privilege: [{ title: '查询', name: 'online-user-search' }]
|
||||
},
|
||||
component: () => import('@/views/monitor/online-user.vue')
|
||||
},
|
||||
|
@ -15,7 +15,7 @@ export const notice = [
|
||||
name: 'NoticeList',
|
||||
meta: {
|
||||
title: '通知管理',
|
||||
childrenPoints: [
|
||||
privilege: [
|
||||
{ title: '查询', name: 'notice-query' },
|
||||
{ title: '添加', name: 'notice-add' },
|
||||
{ title: '修改', name: 'notice-edit' },
|
||||
@ -31,12 +31,21 @@ export const notice = [
|
||||
name: 'PersonNotice',
|
||||
meta: {
|
||||
title: '个人消息',
|
||||
childrenPoints: [
|
||||
privilege: [
|
||||
{ title: '查询', name: 'person-notice-query' },
|
||||
{ title: '详情', name: 'person-notice-detail' }
|
||||
]
|
||||
},
|
||||
component: () => import('@/views/notice/person-notice.vue')
|
||||
},
|
||||
{
|
||||
path: '/notice/notice-detail',
|
||||
name: 'NoticeDetail',
|
||||
meta: {
|
||||
title: '消息详情',
|
||||
hideInMenu:true
|
||||
},
|
||||
component: () => import('@/views/notice/notice-detail.vue')
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ export const reload = [
|
||||
meta: {
|
||||
title: 'SmartReload',
|
||||
icon: 'icon iconfont icondongtaijiazai',
|
||||
childrenPoints: [
|
||||
privilege: [
|
||||
{
|
||||
title: '查询',
|
||||
name: 'smart-reload-search'
|
||||
|
@ -16,7 +16,7 @@ export const systemSetting = [
|
||||
name: 'SystemConfig',
|
||||
meta: {
|
||||
title: '系统参数',
|
||||
childrenPoints: [
|
||||
privilege: [
|
||||
{
|
||||
title: '查询系统参数',
|
||||
name: 'system-params-search'
|
||||
@ -42,8 +42,8 @@ export const systemSetting = [
|
||||
path: '/system-setting/system-privilege',
|
||||
name: 'SystemPrivilege',
|
||||
meta: {
|
||||
title: '菜单管理',
|
||||
childrenPoints: [
|
||||
title: '菜单权限',
|
||||
privilege: [
|
||||
{
|
||||
title: '编辑',
|
||||
name: 'privilege-main-update'
|
||||
|
@ -17,7 +17,7 @@ export const task = [
|
||||
meta: {
|
||||
title: '任务管理',
|
||||
icon: 'icon iconfont icondingshirenwu',
|
||||
childrenPoints: [
|
||||
privilege: [
|
||||
{
|
||||
title: '查询任务',
|
||||
name: 'task-search'
|
||||
|
@ -24,7 +24,7 @@ export const threeRouter = [
|
||||
name: 'RoleOneTwo',
|
||||
meta: {
|
||||
title: '三级A',
|
||||
childrenPoints: [
|
||||
privilege: [
|
||||
{ title: '添加', name: 'roleOneTwo-add' },
|
||||
{ title: '删除', name: 'roleOneTwo-delete' }
|
||||
]
|
||||
@ -36,7 +36,7 @@ export const threeRouter = [
|
||||
name: 'RoleTwoTwo',
|
||||
meta: {
|
||||
title: '三级B',
|
||||
childrenPoints: [
|
||||
privilege: [
|
||||
{ title: '添加', name: 'roleTwoTwo-add' },
|
||||
{ title: '删除', name: 'roleTwoTwo-delete' }
|
||||
]
|
||||
@ -50,7 +50,7 @@ export const threeRouter = [
|
||||
name: 'RoleOneOne',
|
||||
meta: {
|
||||
title: '二级菜单',
|
||||
childrenPoints: [
|
||||
privilege: [
|
||||
{ title: '添加', name: 'roleOneOne-add' },
|
||||
{ title: '删除', name: 'roleOneOne-delete' }
|
||||
]
|
||||
|
@ -16,7 +16,7 @@ export const userLog = [
|
||||
name: 'UserOperateLog',
|
||||
meta: {
|
||||
title: '用户操作日志',
|
||||
childrenPoints: [
|
||||
privilege: [
|
||||
{ title: '查询', name: 'user-operate-log-search' },
|
||||
{ title: '详情', name: 'user-operate-log-detail' },
|
||||
{ title: '删除', name: 'user-operate-log-delete' }
|
||||
@ -30,7 +30,7 @@ export const userLog = [
|
||||
name: 'UserLoginLog',
|
||||
meta: {
|
||||
title: '用户登录日志',
|
||||
childrenPoints: [
|
||||
privilege: [
|
||||
{ title: '查询', name: 'user-login-log-search' },
|
||||
{ title: '删除', name: 'user-login-log-delete' }
|
||||
]
|
||||
|
@ -24,9 +24,9 @@ import { file } from './module/file';
|
||||
* 可以传入一个回调函数,参数是当前路由对象,例子看动态路由和带参路由
|
||||
* hideInBread: (false) 设为true后此级路由将不会出现在面包屑中,示例看QQ群路由配置
|
||||
* hideInMenu: (false) 设为true后在左侧菜单不会显示该页面选项,
|
||||
* group:{String} 同一功能模块下子页面的功能点权限继承菜单模块创建的路由权限 by lihaifan&lipeng
|
||||
* privilegeExtend:{String} 同一功能模块下子页面的功能点权限继承菜单模块创建的路由权限 by lihaifan&lipeng
|
||||
* noKeepAlive: (false) 设为true后页面在切换标签后不会缓存,如果需要缓存,无需设置这个字段,而且需要设置页面组件name属性和路由配置的name一致
|
||||
* access: (null) 可访问该页面的权限数组,当前路由设置的权限会影响子路由
|
||||
* noValidatePrivilege: (true) 表示此路由不需要验证权限
|
||||
* }
|
||||
*/
|
||||
// 登录模块
|
||||
@ -35,7 +35,8 @@ export const login = {
|
||||
name: 'login',
|
||||
meta: {
|
||||
hideInMenu: true,
|
||||
title: 'Login - 登录'
|
||||
title: 'Login - 登录',
|
||||
noValidatePrivilege:true
|
||||
},
|
||||
component: () => import('@/views/login/login.vue')
|
||||
};
|
||||
|
@ -40,9 +40,7 @@ export default {
|
||||
hasReadErrorPage: false
|
||||
},
|
||||
getters: {
|
||||
// 左侧菜单
|
||||
menuList: (state, getters, rootState) =>
|
||||
getMenuByRouter(routers, rootState.user.access),
|
||||
|
||||
errorCount: state => state.errorList.length
|
||||
},
|
||||
mutations: {
|
||||
|
@ -273,9 +273,9 @@ export const canvasParticle = (function () {
|
||||
if (i != j) {
|
||||
dist = Math.round(canvas.points[i].x - canvas.points[j].x) * Math.round(canvas.points[i].x - canvas.points[j].x) +
|
||||
Math.round(canvas.points[i].y - canvas.points[j].y) * Math.round(canvas.points[i].y - canvas.points[j].y); if (dist <= canvas.config.dist && canvas.points[i].max_conn < canvas.config.max_conn) {
|
||||
canvas.points[i].max_conn++; context.lineWidth = 0.5 - dist / canvas.config.dist; context.strokeStyle = 'rgba(' + canvas.config.stroke + ',' + (1 - dist / canvas.config.dist) + ')'
|
||||
context.beginPath(); context.moveTo(canvas.points[i].x, canvas.points[i].y); context.lineTo(canvas.points[j].x, canvas.points[j].y); context.stroke()
|
||||
}
|
||||
canvas.points[i].max_conn++; context.lineWidth = 0.5 - dist / canvas.config.dist; context.strokeStyle = 'rgba(' + canvas.config.stroke + ',' + (1 - dist / canvas.config.dist) + ')'
|
||||
context.beginPath(); context.moveTo(canvas.points[i].x, canvas.points[i].y); context.lineTo(canvas.points[j].x, canvas.points[j].y); context.stroke()
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mouse) {
|
||||
|
@ -18,7 +18,7 @@
|
||||
<Button :loading="btnLoading" @click="login" long type="primary">登录</Button>
|
||||
</FormItem>
|
||||
<div class="other-way">
|
||||
<p class="inline" style="float:left">其他方式登陆</p>
|
||||
<p class="inline" style="float:left">其他方式登陆(账号:demo/123456 demo1/123456)</p>
|
||||
<div class="inline align" style="float:right">
|
||||
<img alt class="marginLeft" src="../../../assets/images/login-taobao.png" />
|
||||
<img alt class="marginLeft" src="../../../assets/images/login-alipay.png" />
|
||||
@ -63,7 +63,7 @@ export default {
|
||||
formData: {
|
||||
code: '',
|
||||
codeUuid: '',
|
||||
loginName: 'sa',
|
||||
loginName: 'demo',
|
||||
loginPwd: '123456'
|
||||
},
|
||||
codeUrl: ''
|
||||
|
@ -28,7 +28,7 @@ export default {
|
||||
LoginForm
|
||||
},
|
||||
data () {
|
||||
return {};
|
||||
return {}
|
||||
},
|
||||
computed: {},
|
||||
watch: {},
|
||||
|
49
smart-admin-web/src/views/notice/notice-detail.vue
Normal file
49
smart-admin-web/src/views/notice/notice-detail.vue
Normal file
@ -0,0 +1,49 @@
|
||||
<template>
|
||||
<div>
|
||||
<Card>
|
||||
<p slot="title">{{notice.title}}</p>
|
||||
<p>{{content}}</p>
|
||||
<p>{{notice.updateTime}}</p>
|
||||
</Card>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { noticeApi } from '@/api/notice';
|
||||
export default {
|
||||
name: 'NoticeList',
|
||||
components: {},
|
||||
props: {},
|
||||
data() {
|
||||
//消息信息
|
||||
return {
|
||||
notice: {},
|
||||
content: ''
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.notice = this.$route.params.notice;
|
||||
this.getNoticeDetail(this.notice.id);
|
||||
},
|
||||
methods: {
|
||||
// 获取通知详情
|
||||
async getNoticeDetail(id) {
|
||||
try {
|
||||
let result = await noticeApi.getNoticeDetail(id);
|
||||
this.content = result.data.content;
|
||||
} catch (e) {
|
||||
//TODO zhuoda sentry
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.detail {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.time {
|
||||
text-align: right;
|
||||
color: #999;
|
||||
}
|
||||
</style>
|
@ -65,22 +65,8 @@
|
||||
></Input>
|
||||
</FormItem>
|
||||
</Form>
|
||||
</Modal>
|
||||
<!-- 添加修改消息 -->
|
||||
<!-- 消息详情 -->
|
||||
</Modal>
|
||||
<Modal
|
||||
:loading="saveLoading"
|
||||
:title="formData.title"
|
||||
class="detail-modal"
|
||||
v-model="detailModal"
|
||||
>
|
||||
<div class="detail">{{formData.content}}</div>
|
||||
<p class="time">{{formData.updateTime}}</p>
|
||||
<div slot="footer">
|
||||
<Button @click="cancelSave" size="large" type="primary">知道了</Button>
|
||||
</div>
|
||||
</Modal>
|
||||
<!-- 消息详情 -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -93,7 +79,6 @@ export default {
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
detailModal: false,
|
||||
searchData: {
|
||||
title: ''
|
||||
},
|
||||
@ -158,7 +143,10 @@ export default {
|
||||
}
|
||||
],
|
||||
action: () => {
|
||||
this.openModal('detail', params.row);
|
||||
this.$router.push({
|
||||
name:'NoticeDetail',
|
||||
params:{notice:params.row}
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -289,10 +277,6 @@ export default {
|
||||
this.getNoticeDetail(data.id);
|
||||
this.editModal = true;
|
||||
break;
|
||||
case 'detail':
|
||||
this.getNoticeDetail(data.id);
|
||||
this.detailModal = true;
|
||||
break;
|
||||
}
|
||||
},
|
||||
// 分页
|
||||
@ -371,7 +355,6 @@ export default {
|
||||
// 取消添加/修改
|
||||
cancelSave() {
|
||||
this.editModal = false;
|
||||
this.detailModal = false;
|
||||
this.$refs['formRef'].resetFields();
|
||||
},
|
||||
// 重置
|
||||
@ -384,14 +367,3 @@ export default {
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.detail-modal {
|
||||
.detail {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.time {
|
||||
text-align: right;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -26,20 +26,39 @@
|
||||
<template v-for="(item, i) in menuTree">
|
||||
<Submenu :key="i" :name="item.menuKey">
|
||||
<template slot="title">
|
||||
<span>{{item.menuName}}</span>
|
||||
<span><Icon type="md-menu" />{{item.menuName}}</span>
|
||||
</template>
|
||||
<!--遍历得到子模块-->
|
||||
<template v-for="(children, j) in item.children">
|
||||
<Submenu :key="j" :name="children.menuKey" v-if="children.children.length > 0">
|
||||
<template slot="title">
|
||||
<span>{{children.menuName}}</span>
|
||||
<template v-if="children.hideInMenu">
|
||||
<Icon type="md-open" /><i style="font-size:0.85rem"> {{children.menuName}}</i>
|
||||
</template>
|
||||
<template v-else>
|
||||
<Icon type="md-menu" /> {{children.menuName}}
|
||||
</template>
|
||||
</template>
|
||||
<!--遍历得到子模块页面-->
|
||||
<template v-for="(childrenPages, k) in children.children">
|
||||
<MenuItem :key="k" :name="childrenPages.menuKey">{{childrenPages.menuName}}</MenuItem>
|
||||
<MenuItem :key="k" :name="childrenPages.menuKey">
|
||||
<template v-if="childrenPages.hideInMenu">
|
||||
<Icon type="md-open" /><i style="font-size:0.85rem"> {{childrenPages.menuName}}</i>
|
||||
</template>
|
||||
<template v-else>
|
||||
<Icon type="md-menu" /> {{childrenPages.menuName}}
|
||||
</template>
|
||||
</MenuItem>
|
||||
</template>
|
||||
</Submenu>
|
||||
<MenuItem :key="j" :name="children.menuKey" v-else>{{children.menuName}}</MenuItem>
|
||||
<MenuItem :key="j" :name="children.menuKey" v-else>
|
||||
<template v-if="children.hideInMenu">
|
||||
<Icon type="md-open" /><i style="font-size:0.85rem"> {{children.menuName}}</i>
|
||||
</template>
|
||||
<template v-else>
|
||||
<Icon type="md-menu" /> {{children.menuName}}
|
||||
</template>
|
||||
</MenuItem>
|
||||
</template>
|
||||
</Submenu>
|
||||
</template>
|
||||
@ -166,17 +185,10 @@ export default {
|
||||
|
||||
for (const router of routers) {
|
||||
//过滤非菜单
|
||||
if (!router.meta.hideInMenu) {
|
||||
if (!router.meta.noValidatePrivilege) {
|
||||
this.routerMap.set(router.name, router);
|
||||
let menu = {
|
||||
type: PRIVILEGE_TYPE_ENUM.MENU.value,
|
||||
menuName: router.meta.title,
|
||||
menuKey: router.name,
|
||||
parentKey: null,
|
||||
url: router.path,
|
||||
children: [],
|
||||
sort: 0
|
||||
};
|
||||
let menu = this.convert2Menu(router,null);
|
||||
console.log('change menu : ', JSON.stringify(menu))
|
||||
privilegeTree.push(menu);
|
||||
privilegeList.push(menu);
|
||||
//判断是否有更新菜单
|
||||
@ -188,7 +200,7 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
if (privilegeList.length !== serverMenuList.length) {
|
||||
if (privilegeList.length < serverMenuList.length) {
|
||||
this.menusChange = true;
|
||||
this.menusChangeNum =
|
||||
this.menusChangeNum +
|
||||
@ -200,21 +212,26 @@ export default {
|
||||
this.$Spin.hide();
|
||||
},
|
||||
|
||||
recursion(children, parentMenu, menuList, serverMenuMap) {
|
||||
for (const router of children) {
|
||||
//过滤非菜单
|
||||
if (!router.meta.hideInMenu) {
|
||||
this.routerMap.set(router.name, router);
|
||||
let menu = {
|
||||
convert2Menu(router, parent){
|
||||
return {
|
||||
type: PRIVILEGE_TYPE_ENUM.MENU.value,
|
||||
menuName: router.meta.title,
|
||||
menuKey: router.name,
|
||||
parentKey: parentMenu.menuKey,
|
||||
parentKey: parent,
|
||||
url: router.path,
|
||||
children: [],
|
||||
sort: 0
|
||||
sort: 0,
|
||||
hideInMenu:router.meta.hideInMenu
|
||||
};
|
||||
|
||||
},
|
||||
|
||||
recursion(children, parentMenu, menuList, serverMenuMap) {
|
||||
for (const router of children) {
|
||||
//过滤非需要权限的
|
||||
if (!router.meta.noValidatePrivilege) {
|
||||
this.routerMap.set(router.name, router);
|
||||
let menu = this.convert2Menu(router,parentMenu.menuKey);
|
||||
parentMenu.children.push(menu);
|
||||
menuList.push(menu);
|
||||
//判断是否有更新菜单
|
||||
@ -248,6 +265,7 @@ export default {
|
||||
}
|
||||
|
||||
if (isChange) {
|
||||
console.log('============== change menu : ', menu, serverMenu,' ===================')
|
||||
this.menusChange = true;
|
||||
this.menusChangeNum = this.menusChangeNum + 1;
|
||||
}
|
||||
@ -295,8 +313,8 @@ export default {
|
||||
// 点击菜单事件
|
||||
loadPrivilegeTableData(name) {
|
||||
let router = this.routerMap.get(name);
|
||||
if (!_.isUndefined(router) && router.meta && router.meta.childrenPoints) {
|
||||
this.privilegeTableData = router.meta.childrenPoints.map(e =>
|
||||
if (!_.isUndefined(router) && router.meta && router.meta.privilege) {
|
||||
this.privilegeTableData = router.meta.privilege.map(e =>
|
||||
Object.assign({}, e, { parentKey: name })
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user