commit
e73f313786
@ -23,7 +23,8 @@
|
|||||||
"path-to-regexp": "2.4.0",
|
"path-to-regexp": "2.4.0",
|
||||||
"vue": "2.6.10",
|
"vue": "2.6.10",
|
||||||
"vue-router": "3.0.6",
|
"vue-router": "3.0.6",
|
||||||
"vuex": "3.1.0"
|
"vuex": "3.1.0",
|
||||||
|
"webpack-dev-server": "^2.9.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vue/cli-plugin-babel": "4.4.4",
|
"@vue/cli-plugin-babel": "4.4.4",
|
||||||
|
@ -1,21 +1,15 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* 菜单管理相关的API请求函数
|
菜单管理相关的API请求函数
|
||||||
*
|
*/
|
||||||
* @type {string}
|
|
||||||
*/
|
|
||||||
|
|
||||||
const api_name = '/admin/system/sysMenu'
|
const api_name = '/admin/system/sysMenu'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* 获取权限(菜单/功能)列表
|
获取权限(菜单/功能)列表
|
||||||
*
|
|
||||||
* @returns {AxiosPromise}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
findNodes() {
|
findNodes() {
|
||||||
return request({
|
return request({
|
||||||
url: `${api_name}/findNodes`,
|
url: `${api_name}/findNodes`,
|
||||||
@ -23,56 +17,41 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* 删除一个权限项
|
删除一个权限项
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
* @returns {AxiosPromise}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
removeById(id) {
|
removeById(id) {
|
||||||
return request({
|
return request({
|
||||||
url: `${api_name}/remove/${id}`,
|
url: `${api_name}/remove/${id}`,
|
||||||
method: 'delete'
|
method: "delete"
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* 保存一个权限项
|
保存一个权限项
|
||||||
*
|
|
||||||
* @param sysMenu
|
|
||||||
* @returns {AxiosPromise}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
save(sysMenu) {
|
save(sysMenu) {
|
||||||
return request({
|
return request({
|
||||||
url: `${api_name}/save`,
|
url: `${api_name}/save`,
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: sysMenu
|
data: sysMenu
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* 更新一个权限项
|
更新一个权限项
|
||||||
*
|
|
||||||
* @param sysMenu
|
|
||||||
* @returns {AxiosPromise}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
updateById(sysMenu) {
|
updateById(sysMenu) {
|
||||||
return request({
|
return request({
|
||||||
url: `${api_name}/update`,
|
url: `${api_name}/update`,
|
||||||
method: 'put',
|
method: "put",
|
||||||
data: sysMenu
|
data: sysMenu
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/**
|
|
||||||
* 查看某个角色的权限列表
|
|
||||||
*
|
|
||||||
* @param roleId
|
|
||||||
* @returns {AxiosPromise}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
查看某个角色的权限列表
|
||||||
|
*/
|
||||||
toAssign(roleId) {
|
toAssign(roleId) {
|
||||||
return request({
|
return request({
|
||||||
url: `${api_name}/toAssign/${roleId}`,
|
url: `${api_name}/toAssign/${roleId}`,
|
||||||
@ -80,18 +59,14 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* 给某个角色授权
|
给某个角色授权
|
||||||
*
|
|
||||||
* @param assignMenuVo
|
|
||||||
* @returns {AxiosPromise}
|
|
||||||
*/
|
*/
|
||||||
|
doAssign(assginMenuVo) {
|
||||||
doAssign(assignMenuVo) {
|
|
||||||
return request({
|
return request({
|
||||||
url: `${api_name}/doAssign`,
|
url: `${api_name}/doAssign`,
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: assignMenuVo
|
data: assginMenuVo
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,48 +1,28 @@
|
|||||||
|
/*
|
||||||
|
角色管理相关的API请求函数
|
||||||
|
*/
|
||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
/**
|
|
||||||
* 角色管理相关的API请求函数
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
*/
|
|
||||||
const api_name = '/admin/system/sysRole'
|
const api_name = '/admin/system/sysRole'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* 获取角色分页列表(带搜索)
|
获取角色分页列表(带搜索)
|
||||||
* @param {*} page
|
|
||||||
* @param {*} limit
|
|
||||||
* @param {*} searchObj
|
|
||||||
* @returns
|
|
||||||
*/
|
*/
|
||||||
getPageList(page, limit, searchObj) {
|
getPageList(page, limit, searchObj) {
|
||||||
return request({
|
return request({
|
||||||
url: `${api_name}/${page}/${limit}`,
|
url: `${api_name}/${page}/${limit}`,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
// 如果是普通对象参数写法,params:对象参数名
|
|
||||||
// 如果是使用json格式传递,data:对象参数名
|
|
||||||
params: searchObj
|
params: searchObj
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* 角色删除
|
|
||||||
* @param {*} id
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
removeById(id) {
|
removeById(id) {
|
||||||
return request({
|
return request({
|
||||||
url: `${api_name}/remove/${id}`,
|
url: `${api_name}/remove/${id}`,
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* 角色添加
|
|
||||||
* @param {*} role
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
save(role) {
|
save(role) {
|
||||||
return request({
|
return request({
|
||||||
url: `${api_name}/save`,
|
url: `${api_name}/save`,
|
||||||
@ -50,13 +30,6 @@ export default {
|
|||||||
data: role
|
data: role
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* 回显要修改的id信息
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
* @returns {*}
|
|
||||||
*/
|
|
||||||
getById(id) {
|
getById(id) {
|
||||||
return request({
|
return request({
|
||||||
url: `${api_name}/get/${id}`,
|
url: `${api_name}/get/${id}`,
|
||||||
@ -64,11 +37,6 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 修改
|
|
||||||
*
|
|
||||||
* @param role
|
|
||||||
* @returns {*}
|
|
||||||
*/
|
|
||||||
updateById(role) {
|
updateById(role) {
|
||||||
return request({
|
return request({
|
||||||
url: `${api_name}/update`,
|
url: `${api_name}/update`,
|
||||||
@ -76,13 +44,6 @@ export default {
|
|||||||
data: role
|
data: role
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除
|
|
||||||
*
|
|
||||||
* @param idList
|
|
||||||
* @returns {*}
|
|
||||||
*/
|
|
||||||
batchRemove(idList) {
|
batchRemove(idList) {
|
||||||
return request({
|
return request({
|
||||||
url: `${api_name}/batchRemove`,
|
url: `${api_name}/batchRemove`,
|
||||||
@ -90,24 +51,12 @@ export default {
|
|||||||
data: idList
|
data: idList
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/**
|
|
||||||
* 根据用户获取角色数据
|
|
||||||
*
|
|
||||||
* @param adminId
|
|
||||||
* @returns {*}
|
|
||||||
*/
|
|
||||||
getRoles(adminId) {
|
getRoles(adminId) {
|
||||||
return request({
|
return request({
|
||||||
url: `${api_name}/toAssign/${adminId}`,
|
url: `${api_name}/toAssign/${adminId}`,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/**
|
|
||||||
* 为用户分配角色
|
|
||||||
*
|
|
||||||
* @param assginRoleVo
|
|
||||||
* @returns {*}
|
|
||||||
*/
|
|
||||||
assignRoles(assginRoleVo) {
|
assignRoles(assginRoleVo) {
|
||||||
return request({
|
return request({
|
||||||
url: `${api_name}/doAssign`,
|
url: `${api_name}/doAssign`,
|
||||||
|
@ -1,21 +1,9 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户管理相关的API请求函数
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
*/
|
|
||||||
const api_name = '/admin/system/sysUser'
|
const api_name = '/admin/system/sysUser'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
/**
|
|
||||||
* 用户条件分页查询
|
|
||||||
*
|
|
||||||
* @param page
|
|
||||||
* @param limit
|
|
||||||
* @param searchObj
|
|
||||||
* @returns {AxiosPromise}
|
|
||||||
*/
|
|
||||||
getPageList(page, limit, searchObj) {
|
getPageList(page, limit, searchObj) {
|
||||||
return request({
|
return request({
|
||||||
url: `${api_name}/${page}/${limit}`,
|
url: `${api_name}/${page}/${limit}`,
|
||||||
@ -23,24 +11,13 @@ export default {
|
|||||||
params: searchObj // url查询字符串或表单键值对
|
params: searchObj // url查询字符串或表单键值对
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/**
|
|
||||||
* 获取用户
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
* @returns {AxiosPromise}
|
|
||||||
*/
|
|
||||||
getById(id) {
|
getById(id) {
|
||||||
return request({
|
return request({
|
||||||
url: `${api_name}/get/${id}`,
|
url: `${api_name}/get/${id}`,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/**
|
|
||||||
* 保存用户
|
|
||||||
*
|
|
||||||
* @param role
|
|
||||||
* @returns {AxiosPromise}
|
|
||||||
*/
|
|
||||||
save(role) {
|
save(role) {
|
||||||
return request({
|
return request({
|
||||||
url: `${api_name}/save`,
|
url: `${api_name}/save`,
|
||||||
@ -48,12 +25,7 @@ export default {
|
|||||||
data: role
|
data: role
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/**
|
|
||||||
* 更新用户
|
|
||||||
*
|
|
||||||
* @param role
|
|
||||||
* @returns {AxiosPromise}
|
|
||||||
*/
|
|
||||||
updateById(role) {
|
updateById(role) {
|
||||||
return request({
|
return request({
|
||||||
url: `${api_name}/update`,
|
url: `${api_name}/update`,
|
||||||
@ -61,29 +33,17 @@ export default {
|
|||||||
data: role
|
data: role
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/**
|
|
||||||
* 删除用户
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
* @returns {AxiosPromise}
|
|
||||||
*/
|
|
||||||
removeById(id) {
|
removeById(id) {
|
||||||
return request({
|
return request({
|
||||||
url: `${api_name}/remove/${id}`,
|
url: `${api_name}/remove/${id}`,
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/**
|
|
||||||
* 更新用户状态
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
* @param status
|
|
||||||
* @returns {AxiosPromise}
|
|
||||||
*/
|
|
||||||
updateStatus(id, status) {
|
updateStatus(id, status) {
|
||||||
return request({
|
return request({
|
||||||
url: `${api_name}/updateStatus/${id}/${status}`,
|
url: `${api_name}/updateStatus/${id}/${status}`,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
<template>
|
<template >
|
||||||
<router-view />
|
<router-view />
|
||||||
</template>
|
</template>
|
||||||
|
@ -3,16 +3,16 @@
|
|||||||
<logo v-if="showLogo" :collapse="isCollapse" />
|
<logo v-if="showLogo" :collapse="isCollapse" />
|
||||||
<el-scrollbar wrap-class="scrollbar-wrapper">
|
<el-scrollbar wrap-class="scrollbar-wrapper">
|
||||||
<el-menu
|
<el-menu
|
||||||
:active-text-color="variables.menuActiveText"
|
|
||||||
:background-color="variables.menuBg"
|
|
||||||
:collapse="isCollapse"
|
|
||||||
:collapse-transition="false"
|
|
||||||
:default-active="activeMenu"
|
:default-active="activeMenu"
|
||||||
|
:collapse="isCollapse"
|
||||||
|
:background-color="variables.menuBg"
|
||||||
:text-color="variables.menuText"
|
:text-color="variables.menuText"
|
||||||
:unique-opened="false"
|
:unique-opened="false"
|
||||||
|
:active-text-color="variables.menuActiveText"
|
||||||
|
:collapse-transition="false"
|
||||||
mode="vertical"
|
mode="vertical"
|
||||||
>
|
>
|
||||||
<sidebar-item v-for="route in routes" :key="route.path" :base-path="route.path" :item="route" />
|
<sidebar-item v-for="route in routes" :key="route.path" :item="route" :base-path="route.path" />
|
||||||
</el-menu>
|
</el-menu>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
</div>
|
</div>
|
||||||
@ -31,7 +31,7 @@ export default {
|
|||||||
'sidebar'
|
'sidebar'
|
||||||
]),
|
]),
|
||||||
routes() {
|
routes() {
|
||||||
// return this.$router.options.routes
|
//return this.$router.options.routes
|
||||||
return this.$router.options.routes.concat(global.antRouter)
|
return this.$router.options.routes.concat(global.antRouter)
|
||||||
},
|
},
|
||||||
activeMenu() {
|
activeMenu() {
|
||||||
|
12
src/main.js
12
src/main.js
@ -1,21 +1,23 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
|
||||||
import 'normalize.css/normalize.css' // A modern alternative to CSS resets
|
import 'normalize.css/normalize.css' // A modern alternative to CSS resets
|
||||||
|
|
||||||
import ElementUI from 'element-ui'
|
import ElementUI from 'element-ui'
|
||||||
import 'element-ui/lib/theme-chalk/index.css'
|
import 'element-ui/lib/theme-chalk/index.css'
|
||||||
import locale from 'element-ui/lib/locale/lang/en' // lang i18n
|
import locale from 'element-ui/lib/locale/lang/en' // lang i18n
|
||||||
|
|
||||||
import '@/styles/index.scss' // global css
|
import '@/styles/index.scss' // global css
|
||||||
|
|
||||||
import App from './App'
|
import App from './App'
|
||||||
import store from './store'
|
import store from './store'
|
||||||
import router from './router'
|
import router from './router'
|
||||||
|
|
||||||
import '@/icons' // icon
|
import '@/icons' // icon
|
||||||
import '@/permission' // permission control
|
import '@/permission' // permission control
|
||||||
// 新增
|
|
||||||
|
//新增
|
||||||
import hasBtnPermission from '@/utils/btn-permission'
|
import hasBtnPermission from '@/utils/btn-permission'
|
||||||
|
|
||||||
Vue.prototype.$hasBP = hasBtnPermission
|
Vue.prototype.$hasBP = hasBtnPermission
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If you don't want to use mock-server
|
* If you don't want to use mock-server
|
||||||
* you want to use MockJs for mock api
|
* you want to use MockJs for mock api
|
||||||
@ -30,9 +32,9 @@ if (process.env.NODE_ENV === 'production') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set ElementUI lang to EN
|
// set ElementUI lang to EN
|
||||||
// Vue.use(ElementUI, { locale })
|
Vue.use(ElementUI, { locale })
|
||||||
// 如果想要中文版 element-ui,按如下方式声明
|
// 如果想要中文版 element-ui,按如下方式声明
|
||||||
Vue.use(ElementUI)
|
// Vue.use(ElementUI)
|
||||||
|
|
||||||
Vue.config.productionTip = false
|
Vue.config.productionTip = false
|
||||||
|
|
||||||
|
@ -7,16 +7,15 @@ import 'nprogress/nprogress.css' // 水平进度条样式
|
|||||||
import getPageTitle from '@/utils/get-page-title' // 获取应用头部标题的函数
|
import getPageTitle from '@/utils/get-page-title' // 获取应用头部标题的函数
|
||||||
import Layout from '@/layout'
|
import Layout from '@/layout'
|
||||||
import ParentView from '@/components/ParentView'
|
import ParentView from '@/components/ParentView'
|
||||||
|
const _import = require('./router/_import_'+process.env.NODE_ENV) // 获取组件的方法
|
||||||
const _import = require('./router/_import_' + process.env.NODE_ENV) // 获取组件的方法
|
|
||||||
|
|
||||||
NProgress.configure({ showSpinner: false }) // NProgress Configuration
|
NProgress.configure({ showSpinner: false }) // NProgress Configuration
|
||||||
const whiteList = ['/login'] // no redirect whitelist
|
const whiteList = ['/login'] // no redirect whitelist
|
||||||
router.beforeEach(async(to, from, next) => {
|
router.beforeEach(async(to, from, next) => {
|
||||||
NProgress.start()
|
NProgress.start()
|
||||||
// set page title
|
// set page title
|
||||||
document.title = getPageTitle(to.meta.title)
|
document.title = getPageTitle(to.meta.title)
|
||||||
// determine whether the user has logged in
|
// determine whether the user has logged in
|
||||||
const hasToken = getToken()
|
const hasToken = getToken()
|
||||||
if (hasToken) {
|
if (hasToken) {
|
||||||
if (to.path === '/login') {
|
if (to.path === '/login') {
|
||||||
@ -38,14 +37,14 @@ router.beforeEach(async(to, from, next) => {
|
|||||||
const menus = filterAsyncRouter(store.getters.menus)// 1.过滤路由
|
const menus = filterAsyncRouter(store.getters.menus)// 1.过滤路由
|
||||||
console.log(menus)
|
console.log(menus)
|
||||||
router.addRoutes(menus) // 2.动态添加路由
|
router.addRoutes(menus) // 2.动态添加路由
|
||||||
const lastRou = [{ path: '*', redirect: '/404', hidden: true }]
|
let lastRou = [{ path: '*', redirect: '/404', hidden: true }]
|
||||||
router.addRoutes(lastRou)
|
router.addRoutes(lastRou)
|
||||||
global.antRouter = menus // 3.将路由数据传递给全局变量,做侧边栏菜单渲染工作
|
global.antRouter = menus // 3.将路由数据传递给全局变量,做侧边栏菜单渲染工作
|
||||||
next({
|
next({
|
||||||
...to,
|
...to,
|
||||||
replace: true
|
replace: true
|
||||||
})
|
})
|
||||||
// next()
|
//next()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// remove token and go to login page to re-login
|
// remove token and go to login page to re-login
|
||||||
console.log(error)
|
console.log(error)
|
||||||
@ -82,7 +81,7 @@ function filterAsyncRouter(asyncRouterMap) {
|
|||||||
try {
|
try {
|
||||||
route.component = _import(route.component)// 导入组件
|
route.component = _import(route.component)// 导入组件
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// debugger
|
debugger
|
||||||
console.log(error)
|
console.log(error)
|
||||||
route.component = _import('dashboard/index')// 导入组件
|
route.component = _import('dashboard/index')// 导入组件
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import Router from 'vue-router'
|
import Router from 'vue-router'
|
||||||
/* Layout */
|
|
||||||
import Layout from '@/layout'
|
|
||||||
|
|
||||||
Vue.use(Router)
|
Vue.use(Router)
|
||||||
|
|
||||||
|
/* Layout */
|
||||||
|
import Layout from '@/layout'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note: sub-menu only appear when route children.length >= 1
|
* Note: sub-menu only appear when route children.length >= 1
|
||||||
* Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
|
* Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
|
||||||
@ -35,6 +36,13 @@ export const constantRoutes = [
|
|||||||
component: () => import('@/views/login/index'),
|
component: () => import('@/views/login/index'),
|
||||||
hidden: true
|
hidden: true
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// {
|
||||||
|
// path: '/404',
|
||||||
|
// component: () => import('@/views/404'),
|
||||||
|
// hidden: true
|
||||||
|
// },
|
||||||
|
|
||||||
{
|
{
|
||||||
path: '/',
|
path: '/',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
@ -46,6 +54,60 @@ export const constantRoutes = [
|
|||||||
meta: { title: 'Dashboard', icon: 'dashboard' }
|
meta: { title: 'Dashboard', icon: 'dashboard' }
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//添加我们的路由
|
||||||
|
// {
|
||||||
|
// path: '/system',
|
||||||
|
// component: Layout,
|
||||||
|
// meta: {
|
||||||
|
// title: '系统管理',
|
||||||
|
// icon: 'el-icon-s-tools'
|
||||||
|
// },
|
||||||
|
// alwaysShow: true,
|
||||||
|
// children: [
|
||||||
|
// {
|
||||||
|
// path: 'sysRole',
|
||||||
|
// component: () => import('@/views/system/sysRole/list'),
|
||||||
|
// meta: {
|
||||||
|
// title: '角色管理',
|
||||||
|
// icon: 'el-icon-s-help'
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// path: 'sysUser',
|
||||||
|
// component: () => import('@/views/system/sysUser/list'),
|
||||||
|
// meta: {
|
||||||
|
// title: '用户管理',
|
||||||
|
// icon: 'el-icon-s-help'
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
|
||||||
|
// {
|
||||||
|
// name: 'sysMenu',
|
||||||
|
// path: 'sysMenu',
|
||||||
|
// component: () => import('@/views/system/sysMenu/list'),
|
||||||
|
// meta: {
|
||||||
|
// title: '菜单管理',
|
||||||
|
// icon: 'el-icon-s-unfold'
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
|
||||||
|
// {
|
||||||
|
// path: 'assignAuth',
|
||||||
|
// component: () => import('@/views/system/sysRole/assignAuth'),
|
||||||
|
// meta: {
|
||||||
|
// activeMenu: '/system/sysRole',
|
||||||
|
// title: '角色授权'
|
||||||
|
// },
|
||||||
|
// hidden: true,
|
||||||
|
// }
|
||||||
|
// ]
|
||||||
|
// },
|
||||||
|
|
||||||
|
|
||||||
|
// 404 page must be placed at the end !!!
|
||||||
|
// { path: '*', redirect: '/404', hidden: true }
|
||||||
]
|
]
|
||||||
|
|
||||||
const createRouter = () => new Router({
|
const createRouter = () => new Router({
|
||||||
|
@ -4,7 +4,8 @@ const getters = {
|
|||||||
token: state => state.user.token,
|
token: state => state.user.token,
|
||||||
avatar: state => state.user.avatar,
|
avatar: state => state.user.avatar,
|
||||||
name: state => state.user.name,
|
name: state => state.user.name,
|
||||||
// 新增
|
|
||||||
|
//新增
|
||||||
buttons: state => state.user.buttons,
|
buttons: state => state.user.buttons,
|
||||||
menus: state => state.user.menus
|
menus: state => state.user.menus
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { getInfo, login, logout } from '@/api/user'
|
import { login, logout, getInfo } from '@/api/user'
|
||||||
import { getToken, removeToken, setToken } from '@/utils/auth'
|
import { getToken, setToken, removeToken } from '@/utils/auth'
|
||||||
import { resetRouter } from '@/router'
|
import { resetRouter } from '@/router'
|
||||||
|
|
||||||
const getDefaultState = () => {
|
const getDefaultState = () => {
|
||||||
@ -9,7 +9,7 @@ const getDefaultState = () => {
|
|||||||
avatar: '',
|
avatar: '',
|
||||||
|
|
||||||
buttons: [], // 新增
|
buttons: [], // 新增
|
||||||
menus: '' // 新增
|
menus: '' //新增
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ const actions = {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// get user info
|
// get user info
|
||||||
getInfo({ commit, state }) {
|
getInfo({ commit, state }) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
getInfo().then(response => {
|
getInfo().then(response => {
|
||||||
@ -69,8 +69,8 @@ const actions = {
|
|||||||
commit('SET_NAME', name)
|
commit('SET_NAME', name)
|
||||||
commit('SET_AVATAR', avatar)
|
commit('SET_AVATAR', avatar)
|
||||||
|
|
||||||
commit('SET_BUTTONS', data.buttons)
|
commit("SET_BUTTONS", data.buttons)
|
||||||
commit('SET_MENUS', data.routers)
|
commit("SET_MENUS", data.routers)
|
||||||
resolve(data)
|
resolve(data)
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
reject(error)
|
reject(error)
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="login-container">
|
<div class="login-container">
|
||||||
<el-form
|
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" auto-complete="on" label-position="left">
|
||||||
ref="loginForm"
|
|
||||||
:model="loginForm"
|
|
||||||
:rules="loginRules"
|
|
||||||
auto-complete="on"
|
|
||||||
class="login-form"
|
|
||||||
label-position="left"
|
|
||||||
>
|
|
||||||
|
|
||||||
<div class="title-container">
|
<div class="title-container">
|
||||||
<h3 class="title">Login Form</h3>
|
<h3 class="title">Login Form</h3>
|
||||||
@ -20,11 +13,11 @@
|
|||||||
<el-input
|
<el-input
|
||||||
ref="username"
|
ref="username"
|
||||||
v-model="loginForm.username"
|
v-model="loginForm.username"
|
||||||
auto-complete="on"
|
|
||||||
name="username"
|
|
||||||
placeholder="Username"
|
placeholder="Username"
|
||||||
tabindex="1"
|
name="username"
|
||||||
type="text"
|
type="text"
|
||||||
|
tabindex="1"
|
||||||
|
auto-complete="on"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
@ -37,10 +30,10 @@
|
|||||||
ref="password"
|
ref="password"
|
||||||
v-model="loginForm.password"
|
v-model="loginForm.password"
|
||||||
:type="passwordType"
|
:type="passwordType"
|
||||||
auto-complete="on"
|
|
||||||
name="password"
|
|
||||||
placeholder="Password"
|
placeholder="Password"
|
||||||
|
name="password"
|
||||||
tabindex="2"
|
tabindex="2"
|
||||||
|
auto-complete="on"
|
||||||
@keyup.enter.native="handleLogin"
|
@keyup.enter.native="handleLogin"
|
||||||
/>
|
/>
|
||||||
<span class="show-pwd" @click="showPwd">
|
<span class="show-pwd" @click="showPwd">
|
||||||
@ -48,13 +41,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-button
|
<el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;" @click.native.prevent="handleLogin">Login</el-button>
|
||||||
:loading="loading"
|
|
||||||
style="width:100%;margin-bottom:30px;"
|
|
||||||
type="primary"
|
|
||||||
@click.native.prevent="handleLogin"
|
|
||||||
>Login
|
|
||||||
</el-button>
|
|
||||||
|
|
||||||
<div class="tips">
|
<div class="tips">
|
||||||
<span style="margin-right:20px;">username: admin</span>
|
<span style="margin-right:20px;">username: admin</span>
|
||||||
@ -66,12 +53,13 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { validUsername } from '@/utils/validate'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Login',
|
name: 'Login',
|
||||||
data() {
|
data() {
|
||||||
const validateUsername = (rule, value, callback) => {
|
const validateUsername = (rule, value, callback) => {
|
||||||
if (value.length < 4) {
|
if (value.length<4) {
|
||||||
callback(new Error('Please enter the correct user name'))
|
callback(new Error('Please enter the correct user name'))
|
||||||
} else {
|
} else {
|
||||||
callback()
|
callback()
|
||||||
@ -141,8 +129,8 @@ export default {
|
|||||||
/* 修复input 背景不协调 和光标变色 */
|
/* 修复input 背景不协调 和光标变色 */
|
||||||
/* Detail see https://github.com/PanJiaChen/vue-element-admin/pull/927 */
|
/* Detail see https://github.com/PanJiaChen/vue-element-admin/pull/927 */
|
||||||
|
|
||||||
$bg: #283443;
|
$bg:#283443;
|
||||||
$light_gray: #fff;
|
$light_gray:#fff;
|
||||||
$cursor: #fff;
|
$cursor: #fff;
|
||||||
|
|
||||||
@supports (-webkit-mask: none) and (not (cater-color: $cursor)) {
|
@supports (-webkit-mask: none) and (not (cater-color: $cursor)) {
|
||||||
@ -185,9 +173,9 @@ $cursor: #fff;
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
$bg: #2d3a4b;
|
$bg:#2d3a4b;
|
||||||
$dark_gray: #889aa4;
|
$dark_gray:#889aa4;
|
||||||
$light_gray: #eee;
|
$light_gray:#eee;
|
||||||
|
|
||||||
.login-container {
|
.login-container {
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
|
@ -3,7 +3,14 @@
|
|||||||
|
|
||||||
<!-- 工具条 -->
|
<!-- 工具条 -->
|
||||||
<div class="tools-div">
|
<div class="tools-div">
|
||||||
<el-button icon="el-icon-plus" size="mini" type="success" @click="add()">添 加</el-button>
|
<el-button
|
||||||
|
:disabled="$hasBP('bnt.sysMenu.add') === false"
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
type="success"
|
||||||
|
@click="add()"
|
||||||
|
>添 加
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<el-table
|
<el-table
|
||||||
:data="sysMenuList"
|
:data="sysMenuList"
|
||||||
@ -14,16 +21,16 @@
|
|||||||
style="width: 100%;margin-bottom: 20px;margin-top: 10px;"
|
style="width: 100%;margin-bottom: 20px;margin-top: 10px;"
|
||||||
>
|
>
|
||||||
|
|
||||||
<el-table-column label="菜单名称" prop="name" width="160" />
|
<el-table-column label="菜单名称" prop="name" width="160"/>
|
||||||
<el-table-column label="图标">
|
<el-table-column label="图标">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<i :class="scope.row.icon" />
|
<i :class="scope.row.icon"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="权限标识" prop="perms" width="160" />
|
<el-table-column label="权限标识" prop="perms" width="160"/>
|
||||||
<el-table-column label="路由地址" prop="path" width="120" />
|
<el-table-column label="路由地址" prop="path" width="120"/>
|
||||||
<el-table-column label="组件路径" prop="component" width="160" />
|
<el-table-column label="组件路径" prop="component" width="160"/>
|
||||||
<el-table-column label="排序" prop="sortValue" width="60" />
|
<el-table-column label="排序" prop="sortValue" width="60"/>
|
||||||
<el-table-column label="状态" width="80">
|
<el-table-column label="状态" width="80">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-switch
|
<el-switch
|
||||||
@ -32,7 +39,7 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="创建时间" prop="createTime" width="160" />
|
<el-table-column label="创建时间" prop="createTime" width="160"/>
|
||||||
<el-table-column align="center" fixed="right" label="操作" width="180">
|
<el-table-column align="center" fixed="right" label="操作" width="180">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
@ -43,9 +50,16 @@
|
|||||||
type="success"
|
type="success"
|
||||||
@click="add(scope.row)"
|
@click="add(scope.row)"
|
||||||
/>
|
/>
|
||||||
<el-button icon="el-icon-edit" size="mini" title="修改" type="primary" @click="edit(scope.row)" />
|
|
||||||
<el-button
|
<el-button
|
||||||
:disabled="scope.row.children.length > 0"
|
:disabled="$hasBP('bnt.sysMenu.update') === false"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
size="mini"
|
||||||
|
title="修改"
|
||||||
|
type="primary"
|
||||||
|
@click="edit(scope.row)"
|
||||||
|
/>
|
||||||
|
<el-button
|
||||||
|
:disabled="(scope.row.children.length > 0) || !$hasBP('bnt.sysMenu.remove')"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
size="mini"
|
size="mini"
|
||||||
title="删除"
|
title="删除"
|
||||||
@ -59,7 +73,7 @@
|
|||||||
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="40%">
|
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="40%">
|
||||||
<el-form ref="dataForm" :model="sysMenu" label-width="150px" size="small" style="padding-right: 40px;">
|
<el-form ref="dataForm" :model="sysMenu" label-width="150px" size="small" style="padding-right: 40px;">
|
||||||
<el-form-item v-if="sysMenu.id === ''" label="上级部门">
|
<el-form-item v-if="sysMenu.id === ''" label="上级部门">
|
||||||
<el-input v-model="sysMenu.parentName" disabled="true" />
|
<el-input v-model="sysMenu.parentName" disabled="true"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="菜单类型" prop="type">
|
<el-form-item label="菜单类型" prop="type">
|
||||||
<el-radio-group v-model="sysMenu.type" :disabled="typeDisabled">
|
<el-radio-group v-model="sysMenu.type" :disabled="typeDisabled">
|
||||||
@ -69,47 +83,47 @@
|
|||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="菜单名称" prop="name">
|
<el-form-item label="菜单名称" prop="name">
|
||||||
<el-input v-model="sysMenu.name" />
|
<el-input v-model="sysMenu.name"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="sysMenu.type !== 2" label="图标" prop="icon">
|
<el-form-item v-if="sysMenu.type !== 2" label="图标" prop="icon">
|
||||||
<el-select v-model="sysMenu.icon" clearable>
|
<el-select v-model="sysMenu.icon" clearable>
|
||||||
<el-option v-for="item in iconList" :key="item.class" :label="item.class" :value="item.class">
|
<el-option v-for="item in iconList" :key="item.class" :label="item.class" :value="item.class">
|
||||||
<span style="float: left;">
|
<span style="float: left;">
|
||||||
<i :class="item.class" /> <!-- 如果动态显示图标,这里添加判断 -->
|
<i :class="item.class"/> <!-- 如果动态显示图标,这里添加判断 -->
|
||||||
</span>
|
</span>
|
||||||
<span style="padding-left: 6px;">{{ item.class }}</span>
|
<span style="padding-left: 6px;">{{ item.class }}</span>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="排序">
|
<el-form-item label="排序">
|
||||||
<el-input-number v-model="sysMenu.sortValue" :min="0" controls-position="right" />
|
<el-input-number v-model="sysMenu.sortValue" :min="0" controls-position="right"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="path">
|
<el-form-item prop="path">
|
||||||
<span slot="label">
|
<span slot="label">
|
||||||
<el-tooltip content="访问的路由地址,如:`sysUser`" placement="top">
|
<el-tooltip content="访问的路由地址,如:`sysUser`" placement="top">
|
||||||
<i class="el-icon-question" />
|
<i class="el-icon-question"/>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
路由地址
|
路由地址
|
||||||
</span>
|
</span>
|
||||||
<el-input v-model="sysMenu.path" placeholder="请输入路由地址" />
|
<el-input v-model="sysMenu.path" placeholder="请输入路由地址"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="sysMenu.type !== 0" prop="component">
|
<el-form-item v-if="sysMenu.type !== 0" prop="component">
|
||||||
<span slot="label">
|
<span slot="label">
|
||||||
<el-tooltip content="访问的组件路径,如:`system/user/index`,默认在`views`目录下" placement="top">
|
<el-tooltip content="访问的组件路径,如:`system/user/index`,默认在`views`目录下" placement="top">
|
||||||
<i class="el-icon-question" />
|
<i class="el-icon-question"/>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
组件路径
|
组件路径
|
||||||
</span>
|
</span>
|
||||||
<el-input v-model="sysMenu.component" placeholder="请输入组件路径" />
|
<el-input v-model="sysMenu.component" placeholder="请输入组件路径"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="sysMenu.type === 2">
|
<el-form-item v-if="sysMenu.type === 2">
|
||||||
<el-input v-model="sysMenu.perms" maxlength="100" placeholder="请输入权限标识" />
|
<el-input v-model="sysMenu.perms" maxlength="100" placeholder="请输入权限标识"/>
|
||||||
<span slot="label">
|
<span slot="label">
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
content="控制器中定义的权限字符,如:@PreAuthorize(hasAuthority('bnt.sysRole.list'))"
|
content="控制器中定义的权限字符,如:@PreAuthorize(hasAuthority('bnt.sysRole.list'))"
|
||||||
placement="top"
|
placement="top"
|
||||||
>
|
>
|
||||||
<i class="el-icon-question" />
|
<i class="el-icon-question"/>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
权限字符
|
权限字符
|
||||||
</span>
|
</span>
|
||||||
@ -255,7 +269,7 @@ export default {
|
|||||||
|
|
||||||
// -------------
|
// -------------
|
||||||
add(row) {
|
add(row) {
|
||||||
// debugger
|
debugger
|
||||||
this.typeDisabled = false
|
this.typeDisabled = false
|
||||||
this.dialogTitle = '添加下级节点'
|
this.dialogTitle = '添加下级节点'
|
||||||
this.dialogVisible = true
|
this.dialogVisible = true
|
||||||
@ -286,7 +300,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
edit(row) {
|
edit(row) {
|
||||||
// debugger
|
debugger
|
||||||
this.dialogTitle = '修改节点'
|
this.dialogTitle = '修改节点'
|
||||||
this.dialogVisible = true
|
this.dialogVisible = true
|
||||||
|
|
||||||
|
@ -4,25 +4,24 @@
|
|||||||
授权角色:{{ $route.query.roleName }}
|
授权角色:{{ $route.query.roleName }}
|
||||||
</div>
|
</div>
|
||||||
<el-tree
|
<el-tree
|
||||||
|
style="margin: 20px 0"
|
||||||
ref="tree"
|
ref="tree"
|
||||||
:data="sysMenuList"
|
:data="sysMenuList"
|
||||||
:props="defaultProps"
|
|
||||||
default-expand-all
|
|
||||||
node-key="id"
|
node-key="id"
|
||||||
show-checkbox
|
show-checkbox
|
||||||
style="margin: 20px 0"
|
default-expand-all
|
||||||
|
:props="defaultProps"
|
||||||
/>
|
/>
|
||||||
<div style="padding: 20px 20px;">
|
<div style="padding: 20px 20px;">
|
||||||
<el-button :loading="loading" icon="el-icon-check" size="mini" type="primary" @click="save">保存</el-button>
|
<el-button :loading="loading" type="primary" icon="el-icon-check" size="mini" @click="save">保存</el-button>
|
||||||
<el-button icon="el-icon-refresh-right" size="mini" @click="$router.push('/system/sysRole')">返回</el-button>
|
<el-button @click="$router.push('/system/sysRole')" size="mini" icon="el-icon-refresh-right">返回</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import api from '@/api/system/sysMenu'
|
import api from '@/api/system/sysMenu'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'RoleAuth',
|
name: 'roleAuth',
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -31,8 +30,8 @@ export default {
|
|||||||
defaultProps: {
|
defaultProps: {
|
||||||
children: 'children',
|
children: 'children',
|
||||||
label: 'name'
|
label: 'name'
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
@ -57,7 +56,7 @@ export default {
|
|||||||
/*
|
/*
|
||||||
得到所有选中的id列表
|
得到所有选中的id列表
|
||||||
*/
|
*/
|
||||||
getCheckedIds(auths, initArr = []) {
|
getCheckedIds (auths, initArr = []) {
|
||||||
return auths.reduce((pre, item) => {
|
return auths.reduce((pre, item) => {
|
||||||
if (item.select && item.children.length === 0) {
|
if (item.select && item.children.length === 0) {
|
||||||
pre.push(item.id)
|
pre.push(item.id)
|
||||||
@ -72,13 +71,14 @@ export default {
|
|||||||
保存权限列表
|
保存权限列表
|
||||||
*/
|
*/
|
||||||
save() {
|
save() {
|
||||||
// 获取到当前子节点
|
debugger
|
||||||
// const checkedNodes = this.$refs.tree.getCheckedNodes()
|
//获取到当前子节点
|
||||||
// 获取到当前子节点及父节点
|
//const checkedNodes = this.$refs.tree.getCheckedNodes()
|
||||||
const allCheckedNodes = this.$refs.tree.getCheckedNodes(false, true)
|
//获取到当前子节点及父节点
|
||||||
const idList = allCheckedNodes.map(node => node.id)
|
const allCheckedNodes = this.$refs.tree.getCheckedNodes(false, true);
|
||||||
|
let idList = allCheckedNodes.map(node => node.id);
|
||||||
console.log(idList)
|
console.log(idList)
|
||||||
const assginMenuVo = {
|
let assginMenuVo = {
|
||||||
roleId: this.$route.query.id,
|
roleId: this.$route.query.id,
|
||||||
menuIdList: idList
|
menuIdList: idList
|
||||||
}
|
}
|
||||||
@ -86,9 +86,9 @@ export default {
|
|||||||
api.doAssign(assginMenuVo).then(result => {
|
api.doAssign(assginMenuVo).then(result => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
this.$message.success(result.$message || '分配权限成功')
|
this.$message.success(result.$message || '分配权限成功')
|
||||||
this.$router.push('/system/sysRole')
|
this.$router.push('/system/sysRole');
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -6,87 +6,113 @@
|
|||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="角色名称">
|
<el-form-item label="角色名称">
|
||||||
<el-input v-model="searchObj.roleName" placeholder="角色名称" style="width: 100%" />
|
<el-input
|
||||||
|
v-model="searchObj.roleName"
|
||||||
|
style="width: 100%"
|
||||||
|
placeholder="角色名称"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row style="display:flex">
|
<el-row style="display: flex">
|
||||||
<el-button :loading="loading" icon="el-icon-search" size="mini" type="primary" @click="fetchData()">搜索
|
|
||||||
</el-button>
|
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetData">重置</el-button>
|
|
||||||
<!-- 工具条 -->
|
|
||||||
<!-- <div class="tools-div">-->
|
|
||||||
<el-button
|
<el-button
|
||||||
:disabled="$hasBP('bnt.sysRole.add') === false"
|
type="primary"
|
||||||
|
icon="el-icon-search"
|
||||||
|
size="mini"
|
||||||
|
:loading="loading"
|
||||||
|
@click="fetchData()"
|
||||||
|
>搜索</el-button>
|
||||||
|
<el-button
|
||||||
|
icon="el-icon-refresh"
|
||||||
|
size="mini"
|
||||||
|
@click="resetData"
|
||||||
|
>重置</el-button>
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
size="mini"
|
size="mini"
|
||||||
type="success"
|
:disabled="$hasBP('bnt.sysRole.add') === false"
|
||||||
@click="add"
|
@click="add"
|
||||||
>添 加
|
>添 加</el-button>
|
||||||
</el-button>
|
<el-button
|
||||||
<el-button class="btn-add" size="mini" @click="batchRemove()">批量删除</el-button>
|
class="btn-add"
|
||||||
<!-- </div>-->
|
size="mini"
|
||||||
|
@click="batchRemove()"
|
||||||
|
>批量删除</el-button>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- 工具条 -->
|
||||||
|
<!-- <div class="tools-div">
|
||||||
|
<el-button type="success" icon="el-icon-plus" size="mini" @click="add">添 加</el-button>
|
||||||
|
</div> -->
|
||||||
<!-- 表格 -->
|
<!-- 表格 -->
|
||||||
<el-table
|
<el-table
|
||||||
v-loading="listLoading"
|
v-loading="listLoading"
|
||||||
:data="list"
|
:data="list"
|
||||||
border
|
|
||||||
stripe
|
stripe
|
||||||
style="width: 100%;margin-top: 10px;"
|
border
|
||||||
|
style="width: 100%; margin-top: 10px"
|
||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
>
|
>
|
||||||
|
|
||||||
<el-table-column type="selection" />
|
<el-table-column type="selection" />
|
||||||
|
|
||||||
<el-table-column
|
<el-table-column label="序号" width="70" align="center">
|
||||||
align="center"
|
|
||||||
label="序号"
|
|
||||||
width="70"
|
|
||||||
>
|
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ (page - 1) * limit + scope.$index + 1 }}
|
{{ (page - 1) * limit + scope.$index + 1 }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column label="角色名称" prop="roleName" />
|
<el-table-column prop="roleName" label="角色名称" />
|
||||||
<el-table-column label="角色编码" prop="roleCode" />
|
<el-table-column prop="roleCode" label="角色编码" />
|
||||||
<el-table-column label="创建时间" prop="createTime" width="160" />
|
<el-table-column prop="createTime" label="创建时间" width="160" />
|
||||||
<el-table-column align="center" label="操作" width="200">
|
<el-table-column label="操作" width="200" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button icon="el-icon-edit" size="mini" title="修改" type="primary" @click="edit(scope.row.id)" />
|
|
||||||
<el-button
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
size="mini"
|
||||||
|
:disabled="$hasBP('bnt.sysRole.update') === false"
|
||||||
|
title="修改"
|
||||||
|
@click="edit(scope.row.id)"
|
||||||
|
/>
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
|
:disabled="$hasBP('bnt.sysRole.remove') === false"
|
||||||
size="mini"
|
size="mini"
|
||||||
title="删除"
|
title="删除"
|
||||||
type="danger"
|
|
||||||
@click="removeDataById(scope.row.id)"
|
@click="removeDataById(scope.row.id)"
|
||||||
/>
|
/>
|
||||||
<el-button
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
:disabled="$hasBP('bnt.sysRole.assignAuth') === false"
|
||||||
icon="el-icon-baseball"
|
icon="el-icon-baseball"
|
||||||
size="mini"
|
size="mini"
|
||||||
title="分配权限"
|
title="分配权限"
|
||||||
type="warning"
|
|
||||||
@click="showAssignAuth(scope.row)"
|
@click="showAssignAuth(scope.row)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<!-- 分页组件 -->
|
<!-- 分页组件 -->
|
||||||
<el-pagination
|
<el-pagination
|
||||||
:current-page="page"
|
:current-page="page"
|
||||||
:page-size="limit"
|
|
||||||
:total="total"
|
:total="total"
|
||||||
|
:page-size="limit"
|
||||||
|
style="padding: 30px 0; text-align: center"
|
||||||
layout="total, prev, pager, next, jumper"
|
layout="total, prev, pager, next, jumper"
|
||||||
style="padding: 30px 0; text-align: center;"
|
|
||||||
@current-change="fetchData"
|
@current-change="fetchData"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<el-dialog :visible.sync="dialogVisible" title="添加/修改" width="40%">
|
<el-dialog title="添加/修改" :visible.sync="dialogVisible" width="40%">
|
||||||
<el-form ref="dataForm" :model="sysRole" label-width="150px" size="small" style="padding-right: 40px;">
|
<el-form
|
||||||
|
ref="dataForm"
|
||||||
|
:model="sysRole"
|
||||||
|
label-width="150px"
|
||||||
|
size="small"
|
||||||
|
style="padding-right: 40px"
|
||||||
|
>
|
||||||
<el-form-item label="角色名称">
|
<el-form-item label="角色名称">
|
||||||
<el-input v-model="sysRole.roleName" />
|
<el-input v-model="sysRole.roleName" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -95,51 +121,129 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<span slot="footer" class="dialog-footer">
|
<span slot="footer" class="dialog-footer">
|
||||||
<el-button icon="el-icon-refresh-right" size="small" @click="dialogVisible = false">取 消</el-button>
|
<el-button
|
||||||
<el-button icon="el-icon-check" size="small" type="primary" @click="saveOrUpdate()">确 定</el-button>
|
size="small"
|
||||||
|
icon="el-icon-refresh-right"
|
||||||
|
@click="dialogVisible = false"
|
||||||
|
>取 消</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-check"
|
||||||
|
size="small"
|
||||||
|
@click="saveOrUpdate()"
|
||||||
|
>确 定</el-button>
|
||||||
</span>
|
</span>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// 引入定义接口js文件
|
|
||||||
import api from '@/api/system/sysRole'
|
import api from '@/api/system/sysRole'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
// vue代码结构
|
// 定义数据模型
|
||||||
// 初始值
|
// 定义数据模型
|
||||||
|
// 定义数据模型
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
list: [], // 角色列表
|
list: [], // 列表
|
||||||
page: 1, // 当前页
|
|
||||||
limit: 10, // 每页显示记录数
|
|
||||||
total: 0, // 总记录数
|
total: 0, // 总记录数
|
||||||
searchObj: {}, // 条件对象
|
page: 1, // 页码
|
||||||
|
limit: 10, // 每页记录数
|
||||||
selections: [], // 多个复选框值
|
searchObj: {}, // 查询条件
|
||||||
sysRole: {}, // 封装表单角色数据
|
sysRole: {}, // 封装表单角色数据
|
||||||
dialogVisible: false// 是否弹框
|
multipleSelection: [], // 批量删除选中的记录列表
|
||||||
|
dialogVisible: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() { // 渲染之前执行
|
// 页面渲染成功后获取数据
|
||||||
|
created() {
|
||||||
this.fetchData()
|
this.fetchData()
|
||||||
},
|
},
|
||||||
methods: { // 操作方法
|
// 定义方法
|
||||||
// 跳转分配菜单页面
|
methods: {
|
||||||
showAssignAuth(row) {
|
showAssignAuth(row) {
|
||||||
this.$router.push('/system/assignAuth?id=' + row.id + '&roleName=' + row.roleName)
|
this.$router.push('/system/assignAuth?id=' + row.id + '&roleName=' + row.roleName)
|
||||||
},
|
},
|
||||||
// 选择复选框,把复选框所在行内容传递
|
edit(id) {
|
||||||
|
this.dialogVisible = true
|
||||||
|
this.fetchDataById(id)
|
||||||
|
},
|
||||||
|
|
||||||
|
fetchDataById(id) {
|
||||||
|
api.getById(id).then((response) => {
|
||||||
|
this.sysRole = response.data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
add() {
|
||||||
|
this.dialogVisible = true
|
||||||
|
},
|
||||||
|
|
||||||
|
saveOrUpdate() {
|
||||||
|
this.saveBtnDisabled = true // 防止表单重复提交
|
||||||
|
if (!this.sysRole.id) {
|
||||||
|
this.saveData()
|
||||||
|
} else {
|
||||||
|
this.updateData()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
saveData() {
|
||||||
|
api.save(this.sysRole).then((response) => {
|
||||||
|
this.$message.success(response.message || '操作成功')
|
||||||
|
this.dialogVisible = false
|
||||||
|
this.fetchData(this.page)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
updateData() {
|
||||||
|
api.updateById(this.sysRole).then((response) => {
|
||||||
|
this.$message.success(response.message || '操作成功')
|
||||||
|
this.dialogVisible = false
|
||||||
|
this.fetchData(this.page)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fetchData(current = 1) {
|
||||||
|
this.page = current
|
||||||
|
// 调用api
|
||||||
|
api
|
||||||
|
.getPageList(this.page, this.limit, this.searchObj)
|
||||||
|
.then((response) => {
|
||||||
|
this.list = response.data.records
|
||||||
|
this.total = response.data.total
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 重置表单
|
||||||
|
resetData() {
|
||||||
|
console.log('重置查询表单')
|
||||||
|
this.searchObj = {}
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
// 根据id删除数据
|
||||||
|
removeDataById(id) {
|
||||||
|
// debugger
|
||||||
|
this.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
// promise
|
||||||
|
// 点击确定,远程调用ajax
|
||||||
|
return api.removeById(id)
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
this.fetchData(this.page)
|
||||||
|
this.$message.success(response.message || '删除成功')
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 当多选选项发生变化的时候调用
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.selections = selection
|
console.log(selection)
|
||||||
console.log(this.selections)
|
this.multipleSelection = selection
|
||||||
},
|
},
|
||||||
// 批量删除
|
// 批量删除
|
||||||
batchRemove() {
|
batchRemove() {
|
||||||
// 判断
|
if (this.multipleSelection.length === 0) {
|
||||||
if (this.selections.length === 0) {
|
|
||||||
this.$message.warning('请选择要删除的记录!')
|
this.$message.warning('请选择要删除的记录!')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -147,92 +251,20 @@ export default {
|
|||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
})
|
||||||
// [1,2,3]
|
.then(() => {
|
||||||
|
// 点击确定,远程调用ajax
|
||||||
|
// 遍历selection,将id取出放入id列表
|
||||||
var idList = []
|
var idList = []
|
||||||
// 选择复选框数据在数组里面 this.selections
|
this.multipleSelection.forEach((item) => {
|
||||||
this.selections.forEach(item => {
|
idList.push(item.id)
|
||||||
var id = item.id
|
|
||||||
idList.push(id)
|
|
||||||
})
|
})
|
||||||
|
// 调用api
|
||||||
return api.batchRemove(idList)
|
return api.batchRemove(idList)
|
||||||
}).then(response => {
|
})
|
||||||
|
.then((response) => {
|
||||||
|
this.fetchData()
|
||||||
this.$message.success(response.message)
|
this.$message.success(response.message)
|
||||||
this.fetchData()
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// 点击修改,弹出框,根据id查询数据显示
|
|
||||||
edit(id) {
|
|
||||||
// 弹出框
|
|
||||||
this.dialogVisible = true
|
|
||||||
// 根据id查询
|
|
||||||
this.fetchDataById(id)
|
|
||||||
},
|
|
||||||
// 根据id查询
|
|
||||||
fetchDataById(id) {
|
|
||||||
api.getById(id)
|
|
||||||
.then(response => {
|
|
||||||
this.sysRole = response.data
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// 点击添加弹出框
|
|
||||||
add() {
|
|
||||||
this.dialogVisible = true
|
|
||||||
},
|
|
||||||
// 添加或者修改
|
|
||||||
saveOrUpdate() {
|
|
||||||
// 根据id判断
|
|
||||||
if (!this.sysRole.id) { // 添加
|
|
||||||
this.save()
|
|
||||||
} else { // 修改
|
|
||||||
this.update()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
save() { // 添加
|
|
||||||
api.saveRole(this.sysRole)
|
|
||||||
.then(response => {
|
|
||||||
// 提示
|
|
||||||
this.$message.success(response.message || '操作成功')
|
|
||||||
// 关闭弹框
|
|
||||||
this.dialogVisible = false
|
|
||||||
// 刷新页面
|
|
||||||
this.fetchData()
|
|
||||||
})
|
|
||||||
},
|
|
||||||
update() { // 修改
|
|
||||||
api.updateById(this.sysRole)
|
|
||||||
.then(response => {
|
|
||||||
// 提示
|
|
||||||
this.$message.success(response.message || '操作成功')
|
|
||||||
// 关闭弹框
|
|
||||||
this.dialogVisible = false
|
|
||||||
// 刷新页面
|
|
||||||
this.fetchData()
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// 条件分页查询
|
|
||||||
fetchData(current = 1) {
|
|
||||||
this.page = current
|
|
||||||
api.getPageList(this.page, this.limit, this.searchObj)
|
|
||||||
.then(response => {
|
|
||||||
this.list = response.data.records
|
|
||||||
this.total = response.data.total
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// 删除
|
|
||||||
removeDataById(id) {
|
|
||||||
this.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
|
|
||||||
confirmButtonText: '确定',
|
|
||||||
cancelButtonText: '取消',
|
|
||||||
type: 'warning'
|
|
||||||
}).then(() => {
|
|
||||||
// 调用
|
|
||||||
return api.removeById(id)
|
|
||||||
}).then(response => {
|
|
||||||
// 刷新页面
|
|
||||||
this.fetchData()
|
|
||||||
// 提示信息
|
|
||||||
this.$message.success(response.message || '删除成功')
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="关 键 字">
|
<el-form-item label="关 键 字">
|
||||||
<el-input v-model="searchObj.keyword" placeholder="用户名/姓名/手机号码" style="width: 95%" />
|
<el-input v-model="searchObj.keyword" placeholder="用户名/姓名/手机号码" style="width: 95%"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
@ -27,14 +27,23 @@
|
|||||||
<el-button :loading="loading" icon="el-icon-search" size="mini" type="primary" @click="fetchData()">搜索
|
<el-button :loading="loading" icon="el-icon-search" size="mini" type="primary" @click="fetchData()">搜索
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetData">重置</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetData">重置</el-button>
|
||||||
<!-- 工具条 -->
|
<el-button
|
||||||
<!-- <div class="tools-div">-->
|
:disabled="$hasBP('bnt.sysUser.add') === false"
|
||||||
<el-button icon="el-icon-plus" size="mini" type="success" @click="add">添 加</el-button>
|
icon="el-icon-plus"
|
||||||
<!-- </div>-->
|
size="mini"
|
||||||
|
type="success"
|
||||||
|
@click="add"
|
||||||
|
>添 加
|
||||||
|
</el-button>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 工具条 -->
|
||||||
|
<!-- <div class="tools-div">-->
|
||||||
|
<!-- <el-button type="success" icon="el-icon-plus" size="mini" @click="add">添 加</el-button>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<el-table
|
<el-table
|
||||||
v-loading="listLoading"
|
v-loading="listLoading"
|
||||||
@ -54,11 +63,11 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column label="用户名" prop="username" width="100" />
|
<el-table-column label="用户名" prop="username" width="100"/>
|
||||||
<el-table-column label="姓名" prop="name" width="70" />
|
<el-table-column label="姓名" prop="name" width="70"/>
|
||||||
<el-table-column label="手机" prop="phone" width="120" />
|
<el-table-column label="手机" prop="phone" width="120"/>
|
||||||
<el-table-column label="岗位" prop="postName" width="100" />
|
<el-table-column label="岗位" prop="postName" width="100"/>
|
||||||
<el-table-column label="部门" prop="deptName" width="100" />
|
<el-table-column label="部门" prop="deptName" width="100"/>
|
||||||
<el-table-column label="所属角色" width="130">
|
<el-table-column label="所属角色" width="130">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span v-for="item in scope.row.roleList" :key="item.id" style="margin-right: 10px;">{{ item.roleName }}</span>
|
<span v-for="item in scope.row.roleList" :key="item.id" style="margin-right: 10px;">{{ item.roleName }}</span>
|
||||||
@ -72,12 +81,20 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="创建时间" prop="createTime" width="160" />
|
<el-table-column label="创建时间" prop="createTime" width="160"/>
|
||||||
|
|
||||||
<el-table-column align="center" fixed="right" label="操作" width="180">
|
<el-table-column align="center" fixed="right" label="操作" width="180">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button icon="el-icon-edit" size="mini" title="修改" type="primary" @click="edit(scope.row.id)" />
|
|
||||||
<el-button
|
<el-button
|
||||||
|
:disabled="$hasBP('bnt.sysUser.update') === false"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
size="mini"
|
||||||
|
title="修改"
|
||||||
|
type="primary"
|
||||||
|
@click="edit(scope.row.id)"
|
||||||
|
/>
|
||||||
|
<el-button
|
||||||
|
:disabled="$hasBP('bnt.sysUser.remove') === false"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
size="mini"
|
size="mini"
|
||||||
title="删除"
|
title="删除"
|
||||||
@ -85,6 +102,7 @@
|
|||||||
@click="removeDataById(scope.row.id)"
|
@click="removeDataById(scope.row.id)"
|
||||||
/>
|
/>
|
||||||
<el-button
|
<el-button
|
||||||
|
:disabled="$hasBP('bnt.sysUser.assignRole') === false"
|
||||||
icon="el-icon-baseball"
|
icon="el-icon-baseball"
|
||||||
size="mini"
|
size="mini"
|
||||||
title="分配角色"
|
title="分配角色"
|
||||||
@ -110,16 +128,16 @@
|
|||||||
<el-dialog :visible.sync="dialogVisible" title="添加/修改" width="40%">
|
<el-dialog :visible.sync="dialogVisible" title="添加/修改" width="40%">
|
||||||
<el-form ref="dataForm" :model="sysUser" label-width="100px" size="small" style="padding-right: 40px;">
|
<el-form ref="dataForm" :model="sysUser" label-width="100px" size="small" style="padding-right: 40px;">
|
||||||
<el-form-item label="用户名" prop="username">
|
<el-form-item label="用户名" prop="username">
|
||||||
<el-input v-model="sysUser.username" />
|
<el-input v-model="sysUser.username"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="!sysUser.id" label="密码" prop="password">
|
<el-form-item v-if="!sysUser.id" label="密码" prop="password">
|
||||||
<el-input v-model="sysUser.password" type="password" />
|
<el-input v-model="sysUser.password" type="password"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="姓名" prop="name">
|
<el-form-item label="姓名" prop="name">
|
||||||
<el-input v-model="sysUser.name" />
|
<el-input v-model="sysUser.name"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="手机" prop="phone">
|
<el-form-item label="手机" prop="phone">
|
||||||
<el-input v-model="sysUser.phone" />
|
<el-input v-model="sysUser.phone"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<span slot="footer" class="dialog-footer">
|
<span slot="footer" class="dialog-footer">
|
||||||
@ -131,13 +149,13 @@
|
|||||||
<el-dialog :visible.sync="dialogRoleVisible" title="分配角色">
|
<el-dialog :visible.sync="dialogRoleVisible" title="分配角色">
|
||||||
<el-form label-width="80px">
|
<el-form label-width="80px">
|
||||||
<el-form-item label="用户名">
|
<el-form-item label="用户名">
|
||||||
<el-input :value="sysUser.username" disabled />
|
<el-input :value="sysUser.username" disabled/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="角色列表">
|
<el-form-item label="角色列表">
|
||||||
<el-checkbox v-model="checkAll" :indeterminate="isIndeterminate" @change="handleCheckAllChange">全选
|
<el-checkbox v-model="checkAll" :indeterminate="isIndeterminate" @change="handleCheckAllChange">全选
|
||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
<div style="margin: 15px 0;" />
|
<div style="margin: 15px 0;"/>
|
||||||
<el-checkbox-group v-model="userRoleIds" @change="handleCheckedChange">
|
<el-checkbox-group v-model="userRoleIds" @change="handleCheckedChange">
|
||||||
<el-checkbox v-for="role in allRoles" :key="role.id" :label="role.id">{{ role.roleName }}</el-checkbox>
|
<el-checkbox v-for="role in allRoles" :key="role.id" :label="role.id">{{ role.roleName }}</el-checkbox>
|
||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
@ -212,11 +230,11 @@ export default {
|
|||||||
|
|
||||||
// 加载banner列表数据
|
// 加载banner列表数据
|
||||||
fetchData(page = 1) {
|
fetchData(page = 1) {
|
||||||
// debugger
|
debugger
|
||||||
this.page = page
|
this.page = page
|
||||||
console.log('翻页。。。' + this.page)
|
console.log('翻页。。。' + this.page)
|
||||||
|
|
||||||
if (this.createTimes && this.createTimes.length === 2) {
|
if (this.createTimes && this.createTimes.length == 2) {
|
||||||
this.searchObj.createTimeBegin = this.createTimes[0]
|
this.searchObj.createTimeBegin = this.createTimes[0]
|
||||||
this.searchObj.createTimeEnd = this.createTimes[1]
|
this.searchObj.createTimeEnd = this.createTimes[1]
|
||||||
}
|
}
|
||||||
@ -252,7 +270,7 @@ export default {
|
|||||||
// 点击确定,远程调用ajax
|
// 点击确定,远程调用ajax
|
||||||
return api.removeById(id)
|
return api.removeById(id)
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
this.fetchData(this.page)
|
this.fetchData()
|
||||||
this.$message.success(response.message || '删除成功')
|
this.$message.success(response.message || '删除成功')
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.$message.info('取消删除')
|
this.$message.info('取消删除')
|
||||||
@ -315,7 +333,7 @@ export default {
|
|||||||
|
|
||||||
getRoles() {
|
getRoles() {
|
||||||
roleApi.getRoles(this.sysUser.id).then(response => {
|
roleApi.getRoles(this.sysUser.id).then(response => {
|
||||||
const { allRolesList, assginRoleList } = response.data
|
const {allRolesList, assginRoleList} = response.data
|
||||||
this.allRoles = allRolesList
|
this.allRoles = allRolesList
|
||||||
this.userRoleIds = assginRoleList.map(item => item.id)
|
this.userRoleIds = assginRoleList.map(item => item.id)
|
||||||
this.checkAll = allRolesList.length === assginRoleList.length
|
this.checkAll = allRolesList.length === assginRoleList.length
|
||||||
@ -337,7 +355,7 @@ export default {
|
|||||||
角色列表选中项发生改变的监听
|
角色列表选中项发生改变的监听
|
||||||
*/
|
*/
|
||||||
handleCheckedChange(value) {
|
handleCheckedChange(value) {
|
||||||
const { userRoleIds, allRoles } = this
|
const {userRoleIds, allRoles} = this
|
||||||
this.checkAll = userRoleIds.length === allRoles.length && allRoles.length > 0
|
this.checkAll = userRoleIds.length === allRoles.length && allRoles.length > 0
|
||||||
this.isIndeterminate = userRoleIds.length > 0 && userRoleIds.length < allRoles.length
|
this.isIndeterminate = userRoleIds.length > 0 && userRoleIds.length < allRoles.length
|
||||||
},
|
},
|
||||||
|
@ -27,7 +27,7 @@ module.exports = {
|
|||||||
publicPath: '/',
|
publicPath: '/',
|
||||||
outputDir: 'dist',
|
outputDir: 'dist',
|
||||||
assetsDir: 'static',
|
assetsDir: 'static',
|
||||||
lintOnSave: process.env.NODE_ENV === 'development',
|
lintOnSave: false,// process.env.NODE_ENV === 'development',
|
||||||
productionSourceMap: false,
|
productionSourceMap: false,
|
||||||
devServer: {
|
devServer: {
|
||||||
port: port,
|
port: port,
|
||||||
|
Loading…
Reference in New Issue
Block a user