sunlupeng 8 kuukautta sitten
vanhempi
commit
ff46dbcd94

+ 52 - 0
src/api/dept.js

@@ -0,0 +1,52 @@
+import request from '@/utils/request'
+
+// 查询部门列表
+export function listDept(query) {
+  return request({
+    url: '/system/dept/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询部门列表(排除节点)
+export function listDeptExcludeChild(deptId) {
+  return request({
+    url: '/system/dept/list/exclude/' + deptId,
+    method: 'get'
+  })
+}
+
+// 查询部门详细
+export function getDept(deptId) {
+  return request({
+    url: '/system/dept/' + deptId,
+    method: 'get'
+  })
+}
+
+// 新增部门
+export function addDept(data) {
+  return request({
+    url: '/system/dept',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改部门
+export function updateDept(data) {
+  return request({
+    url: '/system/dept',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除部门
+export function delDept(deptId) {
+  return request({
+    url: '/system/dept/' + deptId,
+    method: 'delete'
+  })
+}

BIN
src/assets/avatar.gif


+ 9 - 3
src/permission.js

@@ -110,7 +110,13 @@ const myRoles = [
   'yearLottoNotice',
   'bannerManage',
   'activeUsers',
-  'pointsLottery'
+  'pointsLottery',
+
+  'sysManage',
+  'admin',
+  'dept',
+  'role'
+
 ]
 
 router.beforeEach((to, from, next) => {
@@ -132,8 +138,8 @@ router.beforeEach((to, from, next) => {
       if (store.getters.roles.length === 0) { // 判断当前用户是否已拉取完user_info信息
         store.dispatch('GetUserInfo').then(res => {
           store.dispatch('GetUserMenus').then(res => { // 拉取user_info
-            const roles = res.data.data // note: roles must be a array! such as: ['editor','develop']
-            // const roles = myRoles;
+            // const roles = res.data.data // note: roles must be a array! such as: ['editor','develop']
+            const roles = myRoles;
             store.dispatch('GenerateRoutes', { roles }).then(() => { // 根据roles权限生成可访问的路由表
               router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表
               next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record

+ 475 - 0
src/router/index copy.js

@@ -0,0 +1,475 @@
+import Vue from 'vue'
+import Router from 'vue-router'
+const _import = require('./_import_' + process.env.NODE_ENV)
+// in development-env not use lazy-loading, because lazy-loading too many pages will cause webpack hot update too slow. so only in production use lazy-loading;
+// detail: https://panjiachen.github.io/vue-element-admin-site/#/lazy-loading
+
+Vue.use(Router)
+
+/* Layout */
+import Layout from '../views/layout/Layout'
+
+/** note: submenu only apppear when children.length>=1
+*   detail see  https://panjiachen.github.io/vue-element-admin-site/#/router-and-nav?id=sidebar
+**/
+
+/**
+* hidden: true                   if `hidden:true` will not show in the sidebar(default is false)
+* alwaysShow: true               if set true, will always show the root menu, whatever its child routes length
+*                                if not set alwaysShow, only more than one route under the children
+*                                it will becomes nested mode, otherwise not show the root menu
+* redirect: noredirect           if `redirect:noredirect` will no redirct in the breadcrumb
+* name:'router-name'             the name is used by <keep-alive> (must set!!!)
+* meta : {
+    roles: ['admin','editor']     will control the page roles (you can set multiple roles)
+    title: 'title'               the name show in submenu and breadcrumb (recommend set)
+    icon: 'svg-name'             the icon show in the sidebar,
+    noCache: true                if fasle ,the page will no be cached(default is false)
+  }
+**/
+export const constantRouterMap = [
+  { path: '/login', component: _import('login/index'), hidden: true },
+  { path: '/authredirect', component: _import('login/authredirect'), hidden: true },
+  { path: '/404', component: _import('error/404'), hidden: true },
+  { path: '/401', component: _import('error/401'), hidden: true },
+  {
+    path: '',
+    component: Layout,
+    redirect: 'dashboard',
+    children: [{
+      path: 'dashboard',
+      component: _import('dashboard/index'),
+      name: 'dashboard',
+      meta: { title: '首页', icon: 'dashboard', noCache: true }
+    }]
+  }
+]
+
+export default new Router({
+  // mode: 'history', // require service support
+  scrollBehavior: () => ({ y: 0 }),
+  routes: constantRouterMap
+})
+
+export const asyncRouterMap = [
+  {
+    path: '/activeUsers',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'activeUsers',
+    meta: {
+      title: '活跃用户',
+      icon: 'paihang'
+    },
+    children: [
+      { path: 'activeUsers', component: _import('activeUsers/index'), name: 'activeUsers', meta: { title: '活跃用户', icon: 'paihang', noCache: true }},
+    ]
+  },
+  {
+    path: '/pointsLottery',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'pointsLottery',
+    meta: {
+      title: '积分抽奖',
+      icon: 'paihang'
+    },
+    children: [
+      { path: 'pointsLottery', component: _import('pointsLottery/index'), name: 'pointsLottery', meta: { title: '积分抽奖', icon: 'paihang', noCache: true }},
+    ]
+  },
+  {
+    path: '/pointManage',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'pointManage',
+    meta: {
+      title: '积分管理',
+      icon: 'jifen'
+    },
+    children: [
+      { path: 'pointInstructions', component: _import('pointManage/pointInstructions'), name: 'pointInstructions', meta: { title: '积分规则说明书', noCache: true }},
+      { path: 'pointRulesList', component: _import('pointManage/pointRulesList'), name: 'pointRulesList', meta: { title: '积分规则列表', noCache: true }},
+      { path: 'pointIndateList', component: _import('pointManage/pointIndateList'), name: 'pointIndateList', meta: { title: '积分有效期列表', noCache: true }},
+      { path: 'pointList', component: _import('pointManage/pointList'), name: 'pointList', meta: { title: '积分列表', noCache: true }},
+      { path: 'pointsDetailList', component: _import('pointManage/pointsDetailList'), name: 'pointsDetailList', meta: { title: '积分明细列表', noCache: true }},
+      { path: 'pointsPlusOrMinus', component: _import('pointManage/pointsPlusOrMinus'), name: 'pointsPlusOrMinus', meta: { title: '积分加减列表', noCache: true }},
+    ]
+  },
+  {
+    path: '/goodsManage',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'goodsManage',
+    meta: {
+      title: '商品管理',
+      icon: 'shangpin'
+    },
+    children: [
+      { path: 'goodsExchangeRules', component: _import('goodsManage/goodsExchangeRules'), name: 'goodsExchangeRules', meta: { title: '兑换须知', noCache: true }},
+      { path: 'goodsList', component: _import('goodsManage/goodsList'), name: 'goodsList', meta: { title: '商品列表', noCache: true }},
+    ]
+  },
+  {
+    path: '/giftManage',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'giftManage',
+    meta: {
+      title: '礼品管理',
+      icon: 'lipin'
+    },
+    children: [
+      { path: 'giftExchangeRules', component: _import('giftManage/giftExchangeRules'), name: 'giftExchangeRules', meta: { title: '兑换须知', noCache: true }},
+      { path: 'giftList', component: _import('giftManage/giftList'), name: 'giftList', meta: { title: '礼品列表', noCache: true }},
+    ]
+  },
+  {
+    path: '/welfareManage',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'welfareManage',
+    meta: {
+      title: '福利管理',
+      icon: 'fuli'
+    },
+    children: [
+      { path: 'welfareList', component: _import('welfareManage/welfareList'), name: 'welfareList', meta: { title: '福利列表', icon: 'lipin', noCache: true }},
+      // { path: 'welfareList', component: _import('welfareManage/welfareList'), name: 'welfareList', meta: { title: '福利列表', noCache: false, hideTag: true, hidden: true}},
+    ]
+  },
+  {
+    path: '/exchangeManage',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'exchangeManage',
+    meta: {
+      title: '兑换管理',
+      icon: 'duihuan'
+    },
+    children: [
+      { path: 'exchangeList', component: _import('exchangeManage/exchangeList'), name: 'exchangeList', meta: { title: '兑换列表', noCache: true }},
+      { path: 'cancelledList', component: _import('exchangeManage/cancelledList'), name: 'cancelledList', meta: { title: '已作废列表', noCache: true }},
+      { path: 'approvalList', component: _import('exchangeManage/approvalList'), name: 'approvalList', meta: { title: '待审批列表', noCache: true }},
+      { path: 'pasList', component: _import('exchangeManage/pasList'), name: 'pasList', meta: { title: '待发货列表', noCache: true }},
+      { path: 'voidList', component: _import('exchangeManage/voidList'), name: 'voidList', meta: { title: '订单已完成列表', noCache: true }},
+    ]
+  },
+  {
+    path: '/activityManage',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'activityManage',
+    meta: {
+      title: '活动管理',
+      icon: 'huodong'
+    },
+    children: [
+      { path: 'activityList', component: _import('activityManage/activityList'), name: 'activityList', meta: { title: '活动列表', icon: 'huodong', noCache: true }},
+      // { path: 'activityList', component: _import('activityManage/activityList'), name: 'activityList', meta: { title: '活动列表', noCache: false, hideTag: true, hidden: true}},
+    ]
+  },
+  {
+    path: '/answerGame',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'answerGame',
+    meta: {
+      title: '答题管理',
+      icon: 'huodong'
+    },
+    children: [
+      { path: 'answerList', component: _import('answerGame/answerList'), name: 'answerList', meta: { title: '答题列表', icon: 'huodong', noCache: true }},
+    ]
+  },
+  {
+    path: '/noticeManage',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'noticeManage',
+    meta: {
+      title: '通知管理',
+      icon: 'tongzhi'
+    },
+    children: [
+      { path: 'noticeList', component: _import('noticeManage/noticeList'), name: 'noticeList', meta: { title: '通知列表', icon: 'tongzhi', noCache: true }},
+      // { path: 'noticeList', component: _import('noticeManage/noticeList'), name: 'noticeList', meta: { title: '通知列表', noCache: false, hideTag: true, hidden: true}},
+    ]
+  },
+  {
+    path: '/ranking',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'ranking',
+    meta: {
+      title: '积分排行',
+      icon: 'paihang'
+    },
+    children: [
+      { path: 'rankingList', component: _import('ranking/rankingList'), name: 'rankingList', meta: { title: '积分排行', icon: 'paihang', noCache: true }},
+    ]
+  },
+  {
+    path: '/medalManage',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'medalManage',
+    meta: {
+      title: '勋章管理',
+      icon: 'xunzhang'
+    },
+    children: [
+      { path: 'medalList', component: _import('medalManage/medalList'), name: 'medalList', meta: { title: '勋章列表', noCache: true }},
+      { path: 'medalDataList/:id', component: _import('medalManage/medalDataList'), name: 'medalDataList', meta: { title: '勋章等级列表', noCache: false, hideTag: true, hidden: true }},
+    ]
+  },
+  {
+    path: '/raffleManage',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'raffleManage',
+    meta: {
+      title: '抽奖管理',
+      icon: 'huodong'
+    },
+    children: [
+      { path: 'raffleList', component: _import('raffleManage/raffleList'), name: 'raffleList', meta: { title: '奖池列表', noCache: true }},
+      { path: 'raffleLogsList', component: _import('raffleManage/raffleLogsList'), name: 'raffleLogsList', meta: { title: '抽奖记录', noCache: true }},
+      { path: 'raffleDataList/:id', component: _import('raffleManage/raffleDataList'), name: 'raffleDataList', meta: { title: '奖池奖品', noCache: false, hideTag: true, hidden: true }},
+    ]
+  },
+  {
+    path: '/lotteryManage',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'lotteryManage',
+    meta: {
+      title: '开奖管理',
+      icon: 'huodong'
+    },
+    children: [
+      { path: 'lotteryList', component: _import('lotteryManage/lotteryList'), name: 'lotteryList', meta: { title: '奖池列表', noCache: true }},
+      { path: 'lotteryLogsList', component: _import('lotteryManage/lotteryLogsList'), name: 'lotteryLogsList', meta: { title: '抽奖记录', noCache: true }},
+      { path: 'lotteryDataList/:id', component: _import('lotteryManage/lotteryDataList'), name: 'lotteryDataList', meta: { title: '奖池奖品', noCache: false, hideTag: true, hidden: true }},
+    ]
+  },
+  {
+    path: '/couponsManage',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'couponsManage',
+    meta: {
+      title: '兑换卷管理',
+      icon: 'huodong'
+    },
+    children: [
+      { path: 'couponsList', component: _import('couponsManage/couponsList'), name: 'couponsList', meta: { title: '兑换卷列表', icon: 'huodong', noCache: true }},
+    ]
+  },
+  {
+    path: '/commendManage',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'commendManage',
+    meta: {
+      title: '表彰管理',
+      icon: 'xunzhang'
+    },
+    children: [
+      { path: 'commendList', component: _import('commendManage/commendList'), name: 'commendList', meta: { title: '表彰列表', noCache: true }},
+      { path: 'commendDataList/:id', component: _import('commendManage/commendDataList'), name: 'commendDataList', meta: { title: '表彰人员', noCache: false, hideTag: true, hidden: true }},
+      { path: 'citeList', component: _import('commendManage/citeList'), name: 'citeList', meta: { title: '客户表彰列表', noCache: true }},
+      { path: 'operateCiteList', component: _import('commendManage/operateCiteList'), name: 'operateCiteList', meta: { title: '客户表彰审批列表', noCache: true }},
+      { path: 'ceoCiteList', component: _import('commendManage/ceoCiteList'), name: 'ceoCiteList', meta: { title: '客户表彰确认列表', noCache: true }},
+    ]
+  },
+  {
+    path: '/trainManage',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'trainManage',
+    meta: {
+      title: '培训管理',
+      icon: 'xunzhang'
+    },
+    children: [
+      { path: 'upLoadFileRules', component: _import('trainManage/upLoadFileRules'), name: 'upLoadFileRules', meta: { title: '培训材料备注', noCache: true }},
+      { path: 'trainList', component: _import('trainManage/trainList'), name: 'trainList', meta: { title: '培训列表', noCache: true }},
+      { path: 'operateTrainList', component: _import('trainManage/operateTrainList'), name: 'operateTrainList', meta: { title: '培训审批列表', noCache: true }},
+      { path: 'ceoTrainList', component: _import('trainManage/ceoTrainList'), name: 'ceoTrainList', meta: { title: '培训确认列表', noCache: true }},
+    ]
+  },
+  {
+    path: '/festivalManage',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'festivalManage',
+    meta: {
+      title: '节日管理',
+      icon: 'lipin'
+    },
+    children: [
+      { path: 'festivalList', component: _import('festivalManage/festivalList'), name: 'festivalList', meta: { title: '节日列表', icon: 'lipin', noCache: true }},
+    ]
+  },
+  {
+    path: '/certManage',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'certManage',
+    meta: {
+      title: '证书管理',
+      icon: 'zhengshu'
+    },
+    children: [
+      { path: 'certSetList', component: _import('certManage/certSetList'), name: 'certSetList', meta: { title: '证书配置列表', noCache: true }},
+      { path: 'certRules', component: _import('certManage/certRules'), name: 'certRules', meta: { title: '积分获取规则', noCache: true }},
+      { path: 'certList', component: _import('certManage/certList'), name: 'certList', meta: { title: '证书列表', noCache: true }},
+      
+    ]
+  },
+  {
+    path: '/dictManage',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'dictManage',
+    meta: {
+      title: '字典管理',
+      icon: 'zidian'
+    },
+    children: [
+      { path: 'dictList', component: _import('dictManage/dictList'), name: 'dictList', meta: { title: '字典列表', noCache: true }},
+      { path: 'dictDataList/:id', component: _import('dictManage/dictDataList'), name: 'dictDataList', meta: { title: '字典数据', noCache: false, hideTag: true, hidden: true }},
+    ]
+  },
+
+  {
+    path: '/postManage',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'postManage',
+    meta: {
+      title: '帖子管理',
+      icon: 'fuli'
+    },
+    children: [
+      { path: 'postList', component: _import('postManage/postList'), name: 'postList', meta: { title: '帖子列表', noCache: true }},
+      { path: 'postApprovalList', component: _import('postManage/postApprovalList'), name: 'postApprovalList', meta: { title: '回复列表', noCache: true}},
+    ]
+  },
+
+  {
+    path: '/rankingManage',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'rankingManage',
+    meta: {
+      title: '排行管理',
+      icon: 'zhengshu'
+    },
+    children: [
+      { path: 'answerRanking', component: _import('rankingManage/answerRanking'), name: 'answerRanking', meta: { title: '答题排行', noCache: true }},
+      { path: 'gameRanking', component: _import('rankingManage/gameRanking'), name: 'gameRanking', meta: { title: '游戏排行', noCache: true}},
+    ]
+  },
+
+
+
+  {
+    path: '/user',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'userManage',
+    meta: {
+      title: '用户管理',
+      icon: 'people'
+    },
+    children: [
+      { path: 'user', component: _import('user/user'), name: 'user', meta: { title: '联系人', noCache: true }},
+      { path: 'checkUser', component: _import('user/checkUser'), name: 'checkUser', meta: { title: '待审核', noCache: true }},
+      { path: 'approveHistory', component: _import('user/approveHistory'), name: 'approveHistory', meta: { title: '驳回记录', noCache: true }},
+      { path: 'userDetail', component: _import('user/userDetail'), name: 'userDetail', meta: { title: '用户详情', noCache: false, hideTag: true, hidden: true }},
+      { path: 'welfare', component: _import('user/welfare'), name: 'welfare', meta: { title: '用户福利', noCache: true }},
+    ]
+  },
+  {
+    path: '/community',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'communityManage',
+    meta: {
+      title: '圈子管理',
+      icon: 'example'
+    },
+    children: [
+      { path: 'local', component: _import('organize/organizePlace'), name: 'local', meta: { title: '部门专委会', noCache: true }},
+      { path: 'industry', component: _import('organize/organizeTrade'), name: 'industry', meta: { title: '技术专委会', noCache: true }},
+      { path: 'interest', component: _import('organize/organizeInterest'), name: 'interest', meta: { title: '兴趣小组', noCache: true }}
+    ]
+  },
+  {
+    path: '/content',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'contentManage',
+    meta: {
+      title: '内容&互动',
+      icon: 'language'
+    },
+    children: [
+      { path: 'yearLottoNotice', component: _import('content/yearLottoNotice'), name: 'yearLottoNotice', meta: { title: '年会抽奖规则', noCache: true }},
+      { path: 'bannerManage', component: _import('content/banner'), name: 'bannerManage', meta: { title: 'Banner管理', noCache: true }},
+      { path: 'schoolInfo', component: _import('content/index'), name: 'schoolInfo', meta: { title: '公司动态', noCache: true }},
+      { path: 'newsCenter', component: _import('content/newsCenter'), name: 'newsCenter', meta: { title: '新闻中心', noCache: true }},
+      { path: 'customerStories', component: _import('content/customerStories'), name: 'customerStories', meta: { title: '客户案例', noCache: true }},
+      { path: 'alumniInfo', component: _import('content/index'), name: 'alumniInfo', meta: { title: '员工风采', noCache: true }},
+      { path: 'recruitInfo', component: _import('content/index'), name: 'recruitInfo', meta: { title: '招聘季度之星', noCache: true }},
+      { path: 'video', component: _import('content/index'), name: 'video', meta: { title: '年会视频', noCache: true }},
+      { path: 'activityNews', component: _import('content/index'), name: 'activityNews', meta: { title: '公司活动', noCache: true }},
+      { path: 'activity', component: _import('content/index'), name: 'activity', meta: { title: '互动', noCache: true }},
+      { path: 'lecture', component: _import('content/index'), name: 'lecture', meta: { title: '信息中心', noCache: true }},
+      { path: 'reading', component: _import('content/index'), name: 'reading', meta: { title: '季刊', noCache: true }},
+      { path: 'manual', component: _import('content/index'), name: 'manual', meta: { title: '操作手册', noCache: true }},
+      { path: 'rules', component: _import('content/index'), name: 'rules', meta: { title: '规章制度', noCache: true }},
+      { path: 'notice', component: _import('content/index'), name: 'notice', meta: { title: '公告管理', noCache: true }},
+      { path: 'comment', component: _import('content/comment'), name: 'comment', meta: { title: '评论管理', noCache: true }},
+      { path: 'questions', component: _import('content/questions'), name: 'questions', meta: { title: '提问管理', noCache: true }},
+      { path: 'contribute', component: _import('content/contribute'), name: 'contribute', meta: { title: '投稿管理', noCache: true }},
+      { path: 'questionSort', component: _import('content/questionSort'), name: 'questionSort', meta: { title: 'PK类别管理', noCache: true }},
+      { path: 'questionDetail', component: _import('content/questionDetail'), name: 'questionDetail', meta: { title: 'PK题目管理', noCache: true }},
+    ]
+  },
+  {
+    path: '/visitor',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'visitorManage',
+    meta: {
+      title: '访客管理',
+      icon: 'people'
+    },
+    children: [
+      { path: 'visitorList', component: _import('visitor/visitorList'), name: 'visitorList', meta: { title: '访客', noCache: true }},
+      { path: 'visitorDetail', component: _import('visitor/visitorDetail'), name: 'visitorDetail', meta: { title: '访客详情', noCache: false, hideTag: true, hidden: true }}
+      ]
+  },
+  {
+    path: '/sys',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'sysManage',
+    meta: {
+      title: '系统管理',
+      icon: 'chart'
+    },
+    children: [
+      { path: 'admin', component: _import('sys/admin'), name: 'admin', meta: { title: '管理员', noCache: true }},
+      { path: 'role', component: _import('sys/role'), name: 'role', meta: { title: '角色管理', noCache: true }},
+      // { path: 'message', component: _import('sys/admin'), name: 'message', meta: { title: '系统消息', noCache: true, hideTag: true }}
+      // { path: 'sms', component: _import('sys/admin'), name: 'sms', meta: { title: '短信通知', noCache: true, hideTag: true }},
+      // { path: 'os', component: _import('sys/os'), name: 'os', meta: { title: '对象存储', noCache: true, hideTag: true }}
+    ]
+  },
+
+  { path: '*', redirect: '/404', hidden: true }
+]

+ 5 - 377
src/router/index.js

@@ -52,50 +52,7 @@ export default new Router({
 })
 
 export const asyncRouterMap = [
-  {
-    path: '/activeUsers',
-    component: Layout,
-    redirect: 'noredirect',
-    name: 'activeUsers',
-    meta: {
-      title: '活跃用户',
-      icon: 'paihang'
-    },
-    children: [
-      { path: 'activeUsers', component: _import('activeUsers/index'), name: 'activeUsers', meta: { title: '活跃用户', icon: 'paihang', noCache: true }},
-    ]
-  },
-  {
-    path: '/pointsLottery',
-    component: Layout,
-    redirect: 'noredirect',
-    name: 'pointsLottery',
-    meta: {
-      title: '积分抽奖',
-      icon: 'paihang'
-    },
-    children: [
-      { path: 'pointsLottery', component: _import('pointsLottery/index'), name: 'pointsLottery', meta: { title: '积分抽奖', icon: 'paihang', noCache: true }},
-    ]
-  },
-  {
-    path: '/pointManage',
-    component: Layout,
-    redirect: 'noredirect',
-    name: 'pointManage',
-    meta: {
-      title: '积分管理',
-      icon: 'jifen'
-    },
-    children: [
-      { path: 'pointInstructions', component: _import('pointManage/pointInstructions'), name: 'pointInstructions', meta: { title: '积分规则说明书', noCache: true }},
-      { path: 'pointRulesList', component: _import('pointManage/pointRulesList'), name: 'pointRulesList', meta: { title: '积分规则列表', noCache: true }},
-      { path: 'pointIndateList', component: _import('pointManage/pointIndateList'), name: 'pointIndateList', meta: { title: '积分有效期列表', noCache: true }},
-      { path: 'pointList', component: _import('pointManage/pointList'), name: 'pointList', meta: { title: '积分列表', noCache: true }},
-      { path: 'pointsDetailList', component: _import('pointManage/pointsDetailList'), name: 'pointsDetailList', meta: { title: '积分明细列表', noCache: true }},
-      { path: 'pointsPlusOrMinus', component: _import('pointManage/pointsPlusOrMinus'), name: 'pointsPlusOrMinus', meta: { title: '积分加减列表', noCache: true }},
-    ]
-  },
+
   {
     path: '/goodsManage',
     component: Layout,
@@ -106,228 +63,11 @@ export const asyncRouterMap = [
       icon: 'shangpin'
     },
     children: [
-      { path: 'goodsExchangeRules', component: _import('goodsManage/goodsExchangeRules'), name: 'goodsExchangeRules', meta: { title: '兑换须知', noCache: true }},
+      { path: 'certSetList', component: _import('certManage/certSetList'), name: 'certSetList', meta: { title: '商品类别', noCache: true }},
       { path: 'goodsList', component: _import('goodsManage/goodsList'), name: 'goodsList', meta: { title: '商品列表', noCache: true }},
     ]
   },
-  {
-    path: '/giftManage',
-    component: Layout,
-    redirect: 'noredirect',
-    name: 'giftManage',
-    meta: {
-      title: '礼品管理',
-      icon: 'lipin'
-    },
-    children: [
-      { path: 'giftExchangeRules', component: _import('giftManage/giftExchangeRules'), name: 'giftExchangeRules', meta: { title: '兑换须知', noCache: true }},
-      { path: 'giftList', component: _import('giftManage/giftList'), name: 'giftList', meta: { title: '礼品列表', noCache: true }},
-    ]
-  },
-  {
-    path: '/welfareManage',
-    component: Layout,
-    redirect: 'noredirect',
-    name: 'welfareManage',
-    meta: {
-      title: '福利管理',
-      icon: 'fuli'
-    },
-    children: [
-      { path: 'welfareList', component: _import('welfareManage/welfareList'), name: 'welfareList', meta: { title: '福利列表', icon: 'lipin', noCache: true }},
-      // { path: 'welfareList', component: _import('welfareManage/welfareList'), name: 'welfareList', meta: { title: '福利列表', noCache: false, hideTag: true, hidden: true}},
-    ]
-  },
-  {
-    path: '/exchangeManage',
-    component: Layout,
-    redirect: 'noredirect',
-    name: 'exchangeManage',
-    meta: {
-      title: '兑换管理',
-      icon: 'duihuan'
-    },
-    children: [
-      { path: 'exchangeList', component: _import('exchangeManage/exchangeList'), name: 'exchangeList', meta: { title: '兑换列表', noCache: true }},
-      { path: 'cancelledList', component: _import('exchangeManage/cancelledList'), name: 'cancelledList', meta: { title: '已作废列表', noCache: true }},
-      { path: 'approvalList', component: _import('exchangeManage/approvalList'), name: 'approvalList', meta: { title: '待审批列表', noCache: true }},
-      { path: 'pasList', component: _import('exchangeManage/pasList'), name: 'pasList', meta: { title: '待发货列表', noCache: true }},
-      { path: 'voidList', component: _import('exchangeManage/voidList'), name: 'voidList', meta: { title: '订单已完成列表', noCache: true }},
-    ]
-  },
-  {
-    path: '/activityManage',
-    component: Layout,
-    redirect: 'noredirect',
-    name: 'activityManage',
-    meta: {
-      title: '活动管理',
-      icon: 'huodong'
-    },
-    children: [
-      { path: 'activityList', component: _import('activityManage/activityList'), name: 'activityList', meta: { title: '活动列表', icon: 'huodong', noCache: true }},
-      // { path: 'activityList', component: _import('activityManage/activityList'), name: 'activityList', meta: { title: '活动列表', noCache: false, hideTag: true, hidden: true}},
-    ]
-  },
-  {
-    path: '/answerGame',
-    component: Layout,
-    redirect: 'noredirect',
-    name: 'answerGame',
-    meta: {
-      title: '答题管理',
-      icon: 'huodong'
-    },
-    children: [
-      { path: 'answerList', component: _import('answerGame/answerList'), name: 'answerList', meta: { title: '答题列表', icon: 'huodong', noCache: true }},
-    ]
-  },
-  {
-    path: '/noticeManage',
-    component: Layout,
-    redirect: 'noredirect',
-    name: 'noticeManage',
-    meta: {
-      title: '通知管理',
-      icon: 'tongzhi'
-    },
-    children: [
-      { path: 'noticeList', component: _import('noticeManage/noticeList'), name: 'noticeList', meta: { title: '通知列表', icon: 'tongzhi', noCache: true }},
-      // { path: 'noticeList', component: _import('noticeManage/noticeList'), name: 'noticeList', meta: { title: '通知列表', noCache: false, hideTag: true, hidden: true}},
-    ]
-  },
-  {
-    path: '/ranking',
-    component: Layout,
-    redirect: 'noredirect',
-    name: 'ranking',
-    meta: {
-      title: '积分排行',
-      icon: 'paihang'
-    },
-    children: [
-      { path: 'rankingList', component: _import('ranking/rankingList'), name: 'rankingList', meta: { title: '积分排行', icon: 'paihang', noCache: true }},
-    ]
-  },
-  {
-    path: '/medalManage',
-    component: Layout,
-    redirect: 'noredirect',
-    name: 'medalManage',
-    meta: {
-      title: '勋章管理',
-      icon: 'xunzhang'
-    },
-    children: [
-      { path: 'medalList', component: _import('medalManage/medalList'), name: 'medalList', meta: { title: '勋章列表', noCache: true }},
-      { path: 'medalDataList/:id', component: _import('medalManage/medalDataList'), name: 'medalDataList', meta: { title: '勋章等级列表', noCache: false, hideTag: true, hidden: true }},
-    ]
-  },
-  {
-    path: '/raffleManage',
-    component: Layout,
-    redirect: 'noredirect',
-    name: 'raffleManage',
-    meta: {
-      title: '抽奖管理',
-      icon: 'huodong'
-    },
-    children: [
-      { path: 'raffleList', component: _import('raffleManage/raffleList'), name: 'raffleList', meta: { title: '奖池列表', noCache: true }},
-      { path: 'raffleLogsList', component: _import('raffleManage/raffleLogsList'), name: 'raffleLogsList', meta: { title: '抽奖记录', noCache: true }},
-      { path: 'raffleDataList/:id', component: _import('raffleManage/raffleDataList'), name: 'raffleDataList', meta: { title: '奖池奖品', noCache: false, hideTag: true, hidden: true }},
-    ]
-  },
-  {
-    path: '/lotteryManage',
-    component: Layout,
-    redirect: 'noredirect',
-    name: 'lotteryManage',
-    meta: {
-      title: '开奖管理',
-      icon: 'huodong'
-    },
-    children: [
-      { path: 'lotteryList', component: _import('lotteryManage/lotteryList'), name: 'lotteryList', meta: { title: '奖池列表', noCache: true }},
-      { path: 'lotteryLogsList', component: _import('lotteryManage/lotteryLogsList'), name: 'lotteryLogsList', meta: { title: '抽奖记录', noCache: true }},
-      { path: 'lotteryDataList/:id', component: _import('lotteryManage/lotteryDataList'), name: 'lotteryDataList', meta: { title: '奖池奖品', noCache: false, hideTag: true, hidden: true }},
-    ]
-  },
-  {
-    path: '/couponsManage',
-    component: Layout,
-    redirect: 'noredirect',
-    name: 'couponsManage',
-    meta: {
-      title: '兑换卷管理',
-      icon: 'huodong'
-    },
-    children: [
-      { path: 'couponsList', component: _import('couponsManage/couponsList'), name: 'couponsList', meta: { title: '兑换卷列表', icon: 'huodong', noCache: true }},
-    ]
-  },
-  {
-    path: '/commendManage',
-    component: Layout,
-    redirect: 'noredirect',
-    name: 'commendManage',
-    meta: {
-      title: '表彰管理',
-      icon: 'xunzhang'
-    },
-    children: [
-      { path: 'commendList', component: _import('commendManage/commendList'), name: 'commendList', meta: { title: '表彰列表', noCache: true }},
-      { path: 'commendDataList/:id', component: _import('commendManage/commendDataList'), name: 'commendDataList', meta: { title: '表彰人员', noCache: false, hideTag: true, hidden: true }},
-      { path: 'citeList', component: _import('commendManage/citeList'), name: 'citeList', meta: { title: '客户表彰列表', noCache: true }},
-      { path: 'operateCiteList', component: _import('commendManage/operateCiteList'), name: 'operateCiteList', meta: { title: '客户表彰审批列表', noCache: true }},
-      { path: 'ceoCiteList', component: _import('commendManage/ceoCiteList'), name: 'ceoCiteList', meta: { title: '客户表彰确认列表', noCache: true }},
-    ]
-  },
-  {
-    path: '/trainManage',
-    component: Layout,
-    redirect: 'noredirect',
-    name: 'trainManage',
-    meta: {
-      title: '培训管理',
-      icon: 'xunzhang'
-    },
-    children: [
-      { path: 'upLoadFileRules', component: _import('trainManage/upLoadFileRules'), name: 'upLoadFileRules', meta: { title: '培训材料备注', noCache: true }},
-      { path: 'trainList', component: _import('trainManage/trainList'), name: 'trainList', meta: { title: '培训列表', noCache: true }},
-      { path: 'operateTrainList', component: _import('trainManage/operateTrainList'), name: 'operateTrainList', meta: { title: '培训审批列表', noCache: true }},
-      { path: 'ceoTrainList', component: _import('trainManage/ceoTrainList'), name: 'ceoTrainList', meta: { title: '培训确认列表', noCache: true }},
-    ]
-  },
-  {
-    path: '/festivalManage',
-    component: Layout,
-    redirect: 'noredirect',
-    name: 'festivalManage',
-    meta: {
-      title: '节日管理',
-      icon: 'lipin'
-    },
-    children: [
-      { path: 'festivalList', component: _import('festivalManage/festivalList'), name: 'festivalList', meta: { title: '节日列表', icon: 'lipin', noCache: true }},
-    ]
-  },
-  {
-    path: '/certManage',
-    component: Layout,
-    redirect: 'noredirect',
-    name: 'certManage',
-    meta: {
-      title: '证书管理',
-      icon: 'zhengshu'
-    },
-    children: [
-      { path: 'certSetList', component: _import('certManage/certSetList'), name: 'certSetList', meta: { title: '证书配置列表', noCache: true }},
-      { path: 'certRules', component: _import('certManage/certRules'), name: 'certRules', meta: { title: '积分获取规则', noCache: true }},
-      { path: 'certList', component: _import('certManage/certList'), name: 'certList', meta: { title: '证书列表', noCache: true }},
-      
-    ]
-  },
+  
   {
     path: '/dictManage',
     component: Layout,
@@ -343,116 +83,6 @@ export const asyncRouterMap = [
     ]
   },
 
-  {
-    path: '/postManage',
-    component: Layout,
-    redirect: 'noredirect',
-    name: 'postManage',
-    meta: {
-      title: '帖子管理',
-      icon: 'fuli'
-    },
-    children: [
-      { path: 'postList', component: _import('postManage/postList'), name: 'postList', meta: { title: '帖子列表', noCache: true }},
-      { path: 'postApprovalList', component: _import('postManage/postApprovalList'), name: 'postApprovalList', meta: { title: '回复列表', noCache: true}},
-    ]
-  },
-
-  {
-    path: '/rankingManage',
-    component: Layout,
-    redirect: 'noredirect',
-    name: 'rankingManage',
-    meta: {
-      title: '排行管理',
-      icon: 'zhengshu'
-    },
-    children: [
-      { path: 'answerRanking', component: _import('rankingManage/answerRanking'), name: 'answerRanking', meta: { title: '答题排行', noCache: true }},
-      { path: 'gameRanking', component: _import('rankingManage/gameRanking'), name: 'gameRanking', meta: { title: '游戏排行', noCache: true}},
-    ]
-  },
-
-
-
-  {
-    path: '/user',
-    component: Layout,
-    redirect: 'noredirect',
-    name: 'userManage',
-    meta: {
-      title: '用户管理',
-      icon: 'people'
-    },
-    children: [
-      { path: 'user', component: _import('user/user'), name: 'user', meta: { title: '联系人', noCache: true }},
-      { path: 'checkUser', component: _import('user/checkUser'), name: 'checkUser', meta: { title: '待审核', noCache: true }},
-      { path: 'approveHistory', component: _import('user/approveHistory'), name: 'approveHistory', meta: { title: '驳回记录', noCache: true }},
-      { path: 'userDetail', component: _import('user/userDetail'), name: 'userDetail', meta: { title: '用户详情', noCache: false, hideTag: true, hidden: true }},
-      { path: 'welfare', component: _import('user/welfare'), name: 'welfare', meta: { title: '用户福利', noCache: true }},
-    ]
-  },
-  {
-    path: '/community',
-    component: Layout,
-    redirect: 'noredirect',
-    name: 'communityManage',
-    meta: {
-      title: '圈子管理',
-      icon: 'example'
-    },
-    children: [
-      { path: 'local', component: _import('organize/organizePlace'), name: 'local', meta: { title: '部门专委会', noCache: true }},
-      { path: 'industry', component: _import('organize/organizeTrade'), name: 'industry', meta: { title: '技术专委会', noCache: true }},
-      { path: 'interest', component: _import('organize/organizeInterest'), name: 'interest', meta: { title: '兴趣小组', noCache: true }}
-    ]
-  },
-  {
-    path: '/content',
-    component: Layout,
-    redirect: 'noredirect',
-    name: 'contentManage',
-    meta: {
-      title: '内容&互动',
-      icon: 'language'
-    },
-    children: [
-      { path: 'yearLottoNotice', component: _import('content/yearLottoNotice'), name: 'yearLottoNotice', meta: { title: '年会抽奖规则', noCache: true }},
-      { path: 'bannerManage', component: _import('content/banner'), name: 'bannerManage', meta: { title: 'Banner管理', noCache: true }},
-      { path: 'schoolInfo', component: _import('content/index'), name: 'schoolInfo', meta: { title: '公司动态', noCache: true }},
-      { path: 'newsCenter', component: _import('content/newsCenter'), name: 'newsCenter', meta: { title: '新闻中心', noCache: true }},
-      { path: 'customerStories', component: _import('content/customerStories'), name: 'customerStories', meta: { title: '客户案例', noCache: true }},
-      { path: 'alumniInfo', component: _import('content/index'), name: 'alumniInfo', meta: { title: '员工风采', noCache: true }},
-      { path: 'recruitInfo', component: _import('content/index'), name: 'recruitInfo', meta: { title: '招聘季度之星', noCache: true }},
-      { path: 'video', component: _import('content/index'), name: 'video', meta: { title: '年会视频', noCache: true }},
-      { path: 'activityNews', component: _import('content/index'), name: 'activityNews', meta: { title: '公司活动', noCache: true }},
-      { path: 'activity', component: _import('content/index'), name: 'activity', meta: { title: '互动', noCache: true }},
-      { path: 'lecture', component: _import('content/index'), name: 'lecture', meta: { title: '信息中心', noCache: true }},
-      { path: 'reading', component: _import('content/index'), name: 'reading', meta: { title: '季刊', noCache: true }},
-      { path: 'manual', component: _import('content/index'), name: 'manual', meta: { title: '操作手册', noCache: true }},
-      { path: 'rules', component: _import('content/index'), name: 'rules', meta: { title: '规章制度', noCache: true }},
-      { path: 'notice', component: _import('content/index'), name: 'notice', meta: { title: '公告管理', noCache: true }},
-      { path: 'comment', component: _import('content/comment'), name: 'comment', meta: { title: '评论管理', noCache: true }},
-      { path: 'questions', component: _import('content/questions'), name: 'questions', meta: { title: '提问管理', noCache: true }},
-      { path: 'contribute', component: _import('content/contribute'), name: 'contribute', meta: { title: '投稿管理', noCache: true }},
-      { path: 'questionSort', component: _import('content/questionSort'), name: 'questionSort', meta: { title: 'PK类别管理', noCache: true }},
-      { path: 'questionDetail', component: _import('content/questionDetail'), name: 'questionDetail', meta: { title: 'PK题目管理', noCache: true }},
-    ]
-  },
-  {
-    path: '/visitor',
-    component: Layout,
-    redirect: 'noredirect',
-    name: 'visitorManage',
-    meta: {
-      title: '访客管理',
-      icon: 'people'
-    },
-    children: [
-      { path: 'visitorList', component: _import('visitor/visitorList'), name: 'visitorList', meta: { title: '访客', noCache: true }},
-      { path: 'visitorDetail', component: _import('visitor/visitorDetail'), name: 'visitorDetail', meta: { title: '访客详情', noCache: false, hideTag: true, hidden: true }}
-      ]
-  },
   {
     path: '/sys',
     component: Layout,
@@ -463,11 +93,9 @@ export const asyncRouterMap = [
       icon: 'chart'
     },
     children: [
-      { path: 'admin', component: _import('sys/admin'), name: 'admin', meta: { title: '管理员', noCache: true }},
+      { path: 'admin', component: _import('sys/admin'), name: 'admin', meta: { title: '用户管理', noCache: true }},
+      { path: 'dept', component: _import('sys/dept'), name: 'dept', meta: { title: '部门管理', noCache: true }},
       { path: 'role', component: _import('sys/role'), name: 'role', meta: { title: '角色管理', noCache: true }},
-      // { path: 'message', component: _import('sys/admin'), name: 'message', meta: { title: '系统消息', noCache: true, hideTag: true }}
-      // { path: 'sms', component: _import('sys/admin'), name: 'sms', meta: { title: '短信通知', noCache: true, hideTag: true }},
-      // { path: 'os', component: _import('sys/os'), name: 'os', meta: { title: '对象存储', noCache: true, hideTag: true }}
     ]
   },
 

+ 1 - 1
src/views/layout/components/Navbar.vue

@@ -12,7 +12,7 @@
 
       <el-dropdown class="avatar-container right-menu-item" trigger="click">
         <div class="avatar-wrapper">
-          <img class="user-avatar" :src="avatar">
+          <img class="user-avatar" :src="avatar?avatar:require('@/assets/avatar.gif')">
           <i class="el-icon-caret-bottom"></i>
         </div>
         <el-dropdown-menu slot="dropdown">

+ 23 - 15
src/views/sys/admin.vue

@@ -3,7 +3,7 @@
 
     <!-- 查询和其他操作 -->
     <div class="filter-container">
-      <el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入管理员名称" v-model="listQuery.username">
+      <el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入用户名称" v-model="listQuery.username">
       </el-input>
       <el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查找</el-button>
       <el-button class="filter-item" type="primary" @click="handleCreate" icon="el-icon-edit">添加</el-button>
@@ -12,18 +12,21 @@
 
     <!-- 查询结果 -->
     <el-table size="small" :data="list" v-loading="listLoading" element-loading-text="正在查询中。。。" border fit highlight-current-row>
-      <!--<el-table-column align="center" width="100px" label="管理员ID" prop="id" sortable>
+      <!--<el-table-column align="center" width="100px" label="用户ID" prop="id" sortable>
       </el-table-column>-->
       <el-table-column type="index" label="序号" header-align="center" align="center">
       </el-table-column>
 
-      <el-table-column align="center" min-width="100px" label="管理员名称" prop="username">
+      <el-table-column align="center" min-width="100px" label="用户名称" prop="username">
       </el-table-column>
 
-      <el-table-column align="center" min-width="100px" label="管理员昵称" prop="nickname">
+      <el-table-column align="center" min-width="100px" label="用户昵称" prop="nickname">
       </el-table-column>
 
-      <el-table-column align="center" min-width="100px" label="管理员头像" prop="avatar">
+      <el-table-column align="center" min-width="100px" label="用户头像" prop="avatar">
+        <template slot-scope="scope">
+          <img class="user-avatar" :src="scope.row.avatar?scope.row.avatar:require('@/assets/avatar.gif')">
+        </template>
       </el-table-column>
 
       <el-table-column align="center" label="操作" width="250" class-name="small-padding fixed-width">
@@ -46,23 +49,23 @@
     <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
       <template v-if="!dialogFlag">
         <el-form :rules="rules" ref="dataForm" :model="dataForm" status-icon label-position="left" label-width="120px" style='width: 400px; margin-left:50px;'>
-          <!-- <el-form-item label="管理员名称" prop="username">
+          <!-- <el-form-item label="用户名称" prop="username">
             <el-input v-if="dialogStatus=='create'" v-model="dataForm.username" auto-complete="off"></el-input>
             <el-input v-else v-model="dataForm.username" disabled auto-complete="off"></el-input>
           </el-form-item> -->
-          <el-form-item label="管理员" prop="username">
+          <el-form-item label="用户" prop="username">
                     <el-select :disabled="dialogStatus=='create'?false:true" v-model="dataForm.username" filterable clearable placeholder="请选择" style="width: 280px">
                         <el-option :key="item.loginId" v-for="item in recipientsList" :label="item.deptName+'_'+item.userName+'_'+item.employeNo" :value="item.loginId">
                         </el-option>
                     </el-select>
           </el-form-item>
-          <el-form-item label="管理员密码" prop="password">
+          <el-form-item label="用户密码" prop="password">
             <el-input type="password" v-model="dataForm.password"  auto-complete="off"></el-input>
           </el-form-item>
           <el-form-item label="确认密码" prop="checkPassword">
             <el-input type="password" v-model="dataForm.checkPassword" auto-complete="off"></el-input>
           </el-form-item>
-          <el-form-item label="管理员昵称" prop="nickname">
+          <el-form-item label="用户昵称" prop="nickname">
             <el-input v-model="dataForm.nickname"></el-input>
           </el-form-item>
 
@@ -89,7 +92,7 @@
             </el-select>
           </el-form-item>
 
-          <el-form-item label="管理员头像" prop="avatar">
+          <el-form-item label="用户头像" prop="avatar">
             <el-input v-model="dataForm.avatar"></el-input>
             <el-upload action="#" list-type="picture" :show-file-list="false" :limit="1" :http-request="uploadAvatar">
               <el-button size="small" type="primary">点击上传</el-button>
@@ -99,7 +102,7 @@
       </template>
       <template v-else>
         <el-form status-icon label-position="left" label-width="100px" style='width: 400px; margin-left:50px;'>
-          <el-form-item label="管理员角色">
+          <el-form-item label="用户角色">
             <el-select v-model="role" multiple placeholder="请选择">
               <el-option
                 v-for="item in roleList"
@@ -150,6 +153,11 @@
     height: 178px;
     display: block;
   }
+  .user-avatar{
+    width: 50px;
+    height: 50px;
+    border-radius: 50%;
+  }
 </style>
 
 
@@ -246,8 +254,8 @@ export default {
         create: '创建'
       },
       rules: {
-        username: [{ required: true, message: '管理员不能为空', trigger: 'blur' }],
-        nickname: [{ required: true, message: '管理员昵称不能为空', trigger: 'blur' }],
+        username: [{ required: true, message: '用户不能为空', trigger: 'blur' }],
+        nickname: [{ required: true, message: '用户昵称不能为空', trigger: 'blur' }],
         password: [
           { required: true, message: '密码不能为空', trigger: 'blur' },
           { min:8, max:18, message: '长度在 8 到 18 个字符' },
@@ -406,9 +414,9 @@ export default {
     handleDownload() {
       this.downloadLoading = true
       import('@/vendor/Export2Excel').then(excel => {
-        const tHeader = ['管理员ID', '管理员名称','管理员昵称', '管理员头像']
+        const tHeader = ['用户ID', '用户名称','用户昵称', '用户头像']
         const filterVal = ['id', 'username', 'nickname', 'avatar']
-        excel.export_json_to_excel2(tHeader, this.list, filterVal, '管理员信息')
+        excel.export_json_to_excel2(tHeader, this.list, filterVal, '用户信息')
         this.downloadLoading = false
       })
     },

+ 314 - 0
src/views/sys/dept.vue

@@ -0,0 +1,314 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
+      <el-form-item label="部门名称" prop="deptName">
+        <el-input
+          v-model="queryParams.deptName"
+          placeholder="请输入部门名称"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <!-- <el-form-item label="状态" prop="status">
+        <el-select v-model="queryParams.status" placeholder="部门状态" clearable>
+          <el-option
+            v-for="dict in dict.type.sys_normal_disable"
+            :key="dict.value"
+            :label="dict.label"
+            :value="dict.value"
+          />
+        </el-select>
+      </el-form-item> -->
+      <el-form-item>
+          <el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleQuery">查找</el-button>
+          <el-button class="filter-item" type="primary" icon="el-icon-refresh" @click="resetQuery">重置</el-button>
+          <el-button class="filter-item" type="primary" icon="el-icon-edit" @click="handleAdd">添加</el-button>
+          <el-button class="filter-item" type="info" icon="el-icon-sort" @click="toggleExpandAll">展开/折叠</el-button>
+        </el-form-item>
+    </el-form>
+    <!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> -->
+    <el-table
+      v-if="refreshTable"
+      v-loading="loading"
+      :data="deptList"
+      row-key="deptId"
+      border
+      :default-expand-all="isExpandAll"
+      :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
+    >
+      <el-table-column prop="deptName" label="部门名称" width="260"></el-table-column>
+      <el-table-column prop="orderNum" label="排序" width="200"></el-table-column>
+      <!-- <el-table-column prop="status" label="状态" width="100">
+        <template slot-scope="scope">
+          <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
+        </template>
+      </el-table-column> -->
+      <el-table-column label="创建时间" align="center" prop="createTime" width="200">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.createTime) }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+            <el-button
+              size="mini"
+              type="primary"
+              @click="handleUpdate(scope.row)"
+            >修改</el-button>
+            <el-button
+              size="mini"
+              type="success"
+              @click="handleAdd(scope.row)"
+            >添加</el-button>
+            <el-button
+              v-if="scope.row.parentId != 0"
+              size="mini"
+              type="danger"
+              @click="handleDelete(scope.row)"
+            >删除</el-button>
+          </template>
+      </el-table-column>
+    </el-table>
+
+    <!-- 添加或修改部门对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-row>
+          <el-col :span="24" v-if="form.parentId !== 0">
+            <el-form-item label="上级部门" prop="parentId">
+              <treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级部门" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="部门名称" prop="deptName">
+              <el-input v-model="form.deptName" placeholder="请输入部门名称" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="显示排序" prop="orderNum">
+              <el-input-number v-model="form.orderNum" controls-position="right" :min="0" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="负责人" prop="leader">
+              <el-input v-model="form.leader" placeholder="请输入负责人" maxlength="20" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="联系电话" prop="phone">
+              <el-input v-model="form.phone" placeholder="请输入联系电话" maxlength="11" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="邮箱" prop="email">
+              <el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" />
+            </el-form-item>
+          </el-col>
+          <!-- <el-col :span="12">
+            <el-form-item label="部门状态">
+              <el-radio-group v-model="form.status">
+                <el-radio
+                  v-for="dict in dict.type.sys_normal_disable"
+                  :key="dict.value"
+                  :label="dict.value"
+                >{{dict.label}}</el-radio>
+              </el-radio-group>
+            </el-form-item>
+          </el-col> -->
+        </el-row>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/dept";
+import Treeselect from "@riophae/vue-treeselect";
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+
+export default {
+  name: "Dept",
+  // dicts: ['sys_normal_disable'],
+  components: { Treeselect },
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 表格树数据
+      deptList: [],
+      // 部门树选项
+      deptOptions: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 是否展开,默认全部展开
+      isExpandAll: true,
+      // 重新渲染表格状态
+      refreshTable: true,
+      // 查询参数
+      queryParams: {
+        deptName: undefined,
+        status: undefined
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        parentId: [
+          { required: true, message: "上级部门不能为空", trigger: "blur" }
+        ],
+        deptName: [
+          { required: true, message: "部门名称不能为空", trigger: "blur" }
+        ],
+        orderNum: [
+          { required: true, message: "显示排序不能为空", trigger: "blur" }
+        ],
+        email: [
+          {
+            type: "email",
+            message: "请输入正确的邮箱地址",
+            trigger: ["blur", "change"]
+          }
+        ],
+        phone: [
+          {
+            pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
+            message: "请输入正确的手机号码",
+            trigger: "blur"
+          }
+        ]
+      }
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询部门列表 */
+    getList() {
+      this.loading = true;
+      listDept(this.queryParams).then(response => {
+        this.deptList = this.handleTree(response.data, "deptId");
+        this.loading = false;
+      });
+    },
+    /** 转换部门数据结构 */
+    normalizer(node) {
+      if (node.children && !node.children.length) {
+        delete node.children;
+      }
+      return {
+        id: node.deptId,
+        label: node.deptName,
+        children: node.children
+      };
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        deptId: undefined,
+        parentId: undefined,
+        deptName: undefined,
+        orderNum: undefined,
+        leader: undefined,
+        phone: undefined,
+        email: undefined,
+        status: "0"
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    /** 新增按钮操作 */
+    handleAdd(row) {
+      this.reset();
+      if (row != undefined) {
+        this.form.parentId = row.deptId;
+      }
+      this.open = true;
+      this.title = "添加部门";
+      listDept().then(response => {
+        this.deptOptions = this.handleTree(response.data, "deptId");
+      });
+    },
+    /** 展开/折叠操作 */
+    toggleExpandAll() {
+      this.refreshTable = false;
+      this.isExpandAll = !this.isExpandAll;
+      this.$nextTick(() => {
+        this.refreshTable = true;
+      });
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      getDept(row.deptId).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改部门";
+        listDeptExcludeChild(row.deptId).then(response => {
+          this.deptOptions = this.handleTree(response.data, "deptId");
+          if (this.deptOptions.length == 0) {
+            const noResultsOptions = { deptId: this.form.parentId, deptName: this.form.parentName, children: [] };
+            this.deptOptions.push(noResultsOptions);
+          }
+        });
+      });
+    },
+    /** 提交按钮 */
+    submitForm: function() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.deptId != undefined) {
+            updateDept(this.form).then(response => {
+              this.$modal.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addDept(this.form).then(response => {
+              this.$modal.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      this.$modal.confirm('是否确认删除名称为"' + row.deptName + '"的数据项?').then(function() {
+        return delDept(row.deptId);
+      }).then(() => {
+        this.getList();
+        this.$modal.msgSuccess("删除成功");
+      }).catch(() => {});
+    }
+  }
+};
+</script>

+ 0 - 218
src/views/sys/os.vue

@@ -1,218 +0,0 @@
-<template>
-  <div class="app-container calendar-list-container">
-
-    <!-- 查询和其他操作 -->
-    <div class="filter-container">
-      <el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入对象KEY" v-model="listQuery.key">
-      </el-input>
-      <el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入对象名称" v-model="listQuery.oldName">
-      </el-input>
-      <el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查找</el-button>
-      <el-button class="filter-item" type="primary" @click="handleCreate" icon="el-icon-edit">添加</el-button>
-      <el-button class="filter-item" type="primary" :loading="downloadLoading" v-waves icon="el-icon-download" @click="handleDownload">导出</el-button>
-    </div>
-
-    <!-- 查询结果 -->
-    <el-table size="small" :data="list" v-loading="listLoading" element-loading-text="正在查询中。。。" border fit highlight-current-row>
-      <!--<el-table-column align="center" width="100px" label="存储ID" prop="id" sortable>
-      </el-table-column>-->
-      <el-table-column type="index" label="序号" header-align="center" align="center">
-      </el-table-column>
-
-      <el-table-column align="center" min-width="100px" label="对象KEY" prop="key">
-      </el-table-column>
-
-      <el-table-column align="center" min-width="100px" label="对象名称" prop="oldName">
-      </el-table-column>
-
-      <el-table-column align="center" min-width="100px" label="对象类型" prop="type">
-      </el-table-column>
-
-      <el-table-column align="center" min-width="100px" label="对象大小" prop="size">
-      </el-table-column>
-
-      <el-table-column align="center" min-width="100px" label="访问链接" prop="url">
-      </el-table-column>
-
-      <el-table-column align="center" label="操作" width="250" class-name="small-padding fixed-width">
-        <template slot-scope="scope">
-          <!-- <el-button type="primary" size="mini" @click="handleUpdate(scope.row)">编辑</el-button> -->
-          <el-button type="danger" size="mini"  @click="handleDelete(scope.row)">删除</el-button>
-        </template>
-      </el-table-column>
-    </el-table>
-
-    <!-- 分页 -->
-    <div class="pagination-container">
-      <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listQuery.page"
-        :page-sizes="[10,20,30,50]" :page-size="listQuery.limit" layout="total, sizes, prev, pager, next, jumper" :total="total">
-      </el-pagination>
-    </div>
-
-    <!-- 添加对话框 -->
-    <el-dialog title="上传对象" :visible.sync="createDialogVisible">
-      <el-upload action="#" list-type="picture" :show-file-list="false" :limit="1" :http-request="handleUpload">
-        <el-button size="small" type="primary">点击上传</el-button>
-      </el-upload>
-    </el-dialog>
-
-    <!-- 修改对话框 -->
-    <el-dialog title="修改对象名称" :visible.sync="updateDialogVisible">
-      <el-form :rules="rules" ref="dataForm" :model="dataForm" status-icon label-position="left" label-width="100px" style='width: 400px; margin-left:50px;'>
-        <el-form-item label="对象名称" prop="oldName">
-          <el-input v-model="dataForm.oldName"></el-input>
-        </el-form-item>
-      </el-form>
-      <div slot="footer" class="dialog-footer">
-        <el-button @click="updateDialogVisible = false">取消</el-button>
-        <el-button type="primary" @click="updateData">确定</el-button>
-      </div>
-    </el-dialog>
-
-  </div>
-</template>
-
-<script>
-import { listStorage, createStorage, updateStorage, deleteStorage } from '@/api/storage'
-import waves from '@/directive/waves' // 水波纹指令
-
-export default {
-  name: 'Storage',
-  directives: {
-    waves
-  },
-  data() {
-    return {
-      list: null,
-      total: null,
-      listLoading: true,
-      listQuery: {
-        page: 1,
-        limit: 20,
-        key: undefined,
-        name: undefined,
-        sort: '+id'
-      },
-      createDialogVisible: false,
-      dataForm: {
-        id: undefined,
-        name: ''
-      },
-      updateDialogVisible: false,
-      rules: {
-        name: [{ required: true, message: '对象名称不能为空', trigger: 'blur' }]
-      },
-      downloadLoading: false
-    }
-  },
-  created() {
-    this.getList()
-  },
-  methods: {
-    getList() {
-      this.listLoading = true
-      listStorage(this.listQuery).then(response => {
-        this.list = response.data.data.items
-        this.total = response.data.data.total
-        this.listLoading = false
-      }).catch(() => {
-        this.list = []
-        this.total = 0
-        this.listLoading = false
-      })
-    },
-    handleFilter() {
-      this.listQuery.page = 1
-      this.getList()
-    },
-    handleSizeChange(val) {
-      this.listQuery.limit = val
-      this.getList()
-    },
-    handleCurrentChange(val) {
-      this.listQuery.page = val
-      this.getList()
-    },
-    resetForm() {
-      this.dataForm = {
-        id: undefined,
-        name: ''
-      }
-    },
-    handleCreate() {
-      this.createDialogVisible = true
-    },
-    handleUpload(item) {
-      const formData = new FormData()
-      formData.append('file', item.file)
-      createStorage(formData).then(response => {
-        this.list.unshift(response.data.data)
-        this.createDialogVisible = false
-        this.$notify({
-          title: '成功',
-          message: '创建成功',
-          type: 'success',
-          duration: 2000
-        })
-      }).catch(() => {
-        this.$message.error('上传失败,请重新上传')
-      })
-    },
-    handleUpdate(row) {
-      this.dataForm = Object.assign({}, row)
-      this.updateDialogVisible = true
-      this.$nextTick(() => {
-        this.$refs['dataForm'].clearValidate()
-      })
-    },
-    updateData() {
-      this.$refs['dataForm'].validate((valid) => {
-        if (valid) {
-          updateStorage({
-            id:this.dataForm.id,
-            oldName:this.dataForm.oldName
-          }).then(() => {
-            for (const v of this.list) {
-              if (v.id === this.dataForm.id) {
-                const index = this.list.indexOf(v)
-                this.list.splice(index, 1, this.dataForm)
-                break
-              }
-            }
-            this.updateDialogVisible = false
-            this.$notify({
-              title: '成功',
-              message: '更新成功',
-              type: 'success',
-              duration: 2000
-            })
-          })
-        }
-      })
-    },
-    handleDelete(row) {
-      deleteStorage({
-        id:row.id
-      }).then(response => {
-        this.$notify({
-          title: '成功',
-          message: '删除成功',
-          type: 'success',
-          duration: 2000
-        })
-        const index = this.list.indexOf(row)
-        this.list.splice(index, 1)
-      })
-    },
-    handleDownload() {
-      this.downloadLoading = true
-      import('@/vendor/Export2Excel').then(excel => {
-        const tHeader = ['ID', '对象KEY', '对象名称', '对象类型', '对象大小', '访问链接']
-        const filterVal = ['id', 'key', 'oldName', 'type', 'size', 'url']
-        excel.export_json_to_excel2(tHeader, this.list, filterVal, '对象存储信息')
-        this.downloadLoading = false
-      })
-    }
-  }
-}
-</script>