权限添加按钮级别控制

dev_2022-03-03
yujialong 3 years ago
parent 77c9fb958e
commit 86a6c31b60
  1. 19
      src/components/Sidebar.vue
  2. 27
      src/directive/auth/index.js
  3. 12
      src/directive/index.js
  4. 7
      src/libs/auth/generateBtnPermission.js
  5. 5
      src/libs/route/addRoutes.js
  6. 2
      src/libs/route/generateRoutes.js
  7. 3
      src/main.js
  8. 5
      src/utils/api.js
  9. 13
      src/views/course/Curriculum.vue
  10. 20
      src/views/course/contentSettings.vue
  11. 14
      src/views/customer/customer.vue
  12. 16
      src/views/data/Data.vue
  13. 18
      src/views/data/Framework.vue
  14. 2
      src/views/data/Introduce.vue
  15. 12
      src/views/data/Product.vue
  16. 12
      src/views/order/Order.vue
  17. 6
      src/views/serve/Configure.vue
  18. 16
      src/views/serve/backstage/modelType.vue
  19. 24
      src/views/system/index.vue
  20. 2
      src/views/system/log.vue
  21. 8
      src/views/system/manageLog.vue
  22. 10
      src/views/system/role.vue
  23. 12
      src/views/user/User.vue

@ -59,37 +59,37 @@ export default {
menuList: [
{
icon: 'el-icon-school',
index: 'customer',
index: '/customer',
title: '客户管理'
},
{
icon: 'el-icon-user',
index: 'user',
index: '/user',
title: '用户管理'
},
{
icon: 'el-icon-shopping-bag-2',
index: 'order',
index: '/order',
title: '订单管理'
},
{
icon: 'el-icon-document-checked',
index: 'curriculum',
index: '/curriculum',
title: '课程管理'
},
{
icon: 'el-icon-notebook-2',
index: 'data',
index: '/data',
title: '数据管理'
},
{
icon: 'el-icon-office-building',
index: 'configure',
index: '/configure',
title: '服务配置'
},
{
icon: 'el-icon-office-building',
index: 'system',
index: '/system',
title: '系统配置'
},
],
@ -118,10 +118,11 @@ export default {
},
initMenu() {
if (Setting.dynamicRoute) {
const routes = this.routes
const routes = this.$store.state.routes
console.log("🚀 ~ file: Sidebar.vue ~ line 122 ~ initMenu ~ routes", routes)
const menus = []
this.menuList.map(e => {
routes.find(n => n.name === e.index) && menus.push(e)
routes.find(n => n.path === e.index) && menus.push(e)
})
this.menus = menus
} else {

@ -0,0 +1,27 @@
/**
* @description 鉴权指令
* 当传入的权限当前用户没有时会移除该组件
* 用例<Tag v-auth>text</Tag> <Tag v-auth="'user:'">text</Tag>
* */
import store from '@/store'
export default {
inserted (el, binding, vnode) {
let btnText = ''
// 如果有传值,就取传的值,否则,就取页面路由和按钮名字拼接起来
if(binding.value){
btnText = binding.value
}else{
btnText = `${vnode.context.$route.path}:${el.innerText}`
}
const btnPermissions = store.state.btns
console.log("🚀 ~ file: index.js ~ line 18 ~ inserted ~ btnPermissions", btnPermissions, btnText)
if (btnText && btnPermissions && btnPermissions.length) {
const isPermission = btnPermissions.includes(btnText)
// 如果按钮集合里没有该权限,就把该按钮给去除
if (!isPermission) {
el.parentNode && el.parentNode.removeChild(el)
}
}
}
}

@ -0,0 +1,12 @@
/**
* 插件
* */
import directiveAuth from './auth'
export default {
async install (Vue) {
// 指令
Vue.directive('auth', directiveAuth)
}
}

@ -8,14 +8,17 @@ export default function(data){
data.map(e => {
e.children.map(n => {
if(n.children.length){
result.push(`${e.name}:${n.name}`)
result.push(`${e.path}:${n.name}`)
n.children.map(j => {
e.path ? result.push(`${e.path}:${n.name}:${j.name}`) : result.push(`${n.path}:${j.name}`)
j.children.map(k => {
e.path ? result.push(`${e.path}:${n.name}:${j.name}:${k.name}`) : result.push(`${n.path}:${j.name}:${k.name}`)
})
})
}else{
result.push(`${e.path}:${n.name}`)
}
})
})
store.dispatch('auth/addBtnAuth',result)
store.commit('addBtnAuth', result)
}

@ -1,5 +1,4 @@
import store from '@/store';
import router from '@/router';
import generateBtnPermission from '../auth/generateBtnPermission';
const newRoutes = []
@ -14,7 +13,6 @@ function createRoute(data){
if(e.path){
let meta = createMeta(e)
newRoutes.push({
name: e.path,
path: e.path,
meta
})
@ -27,6 +25,5 @@ function createRoute(data){
export default function(data,path){
generateBtnPermission(data)
createRoute(data)
console.log('route', newRoutes)
// store.dispatch('addRoutes',newRoutes)
store.commit('addRoutes',newRoutes)
}

@ -3,7 +3,7 @@ import router from '@/router';
export default function(){
setTimeout(() => {
let routes = store.state.auth.routes
let routes = store.state.routes
routes.forEach(e => {
if(e.path == '/'){
e.component = () => import('@/layouts/home/index.vue')

@ -14,6 +14,7 @@ import store from './store'
import { systemStatus, systemTypeStatus, systemAttributionStatus, courseTypeStatus,
hoursStatus, roleStatus, orderTypeFn, orderStatusFn, orderNatureFn, Percentage, removeByValue, isIE, encodeString, formatDate, downloadFile } from './utils/core';
import preventReClick from './utils/preventReClick' //防多次点击,重复提交
import plugins from '@/directive';
Vue.prototype.api = api;
@ -41,7 +42,7 @@ Vue.prototype.downloadFile = downloadFile;
Vue.config.productionTip = false;
Vue.use(ElementUI, { size: 'small' });
Vue.use(plugins);
new Vue({
router,

@ -5,8 +5,8 @@ const host1 = 'http://192.168.31.137:9000'
export default {
logins: `users/users/user/login`, //登录
verification: `users/users/user/captcha`,// 验证码图片
logins: `${host1}/users/users/user/login`, //登录
verification: `${host1}/users/users/user/captcha`,// 验证码图片
bindPhoneOrEmail: `users/users/userAccount/bindPhoneOrEmail`,// 绑定手机
sendPhoneOrEmailCode: `users/users/userAccount/sendPhoneOrEmailCode`,// 手机验证码
@ -110,6 +110,7 @@ export default {
saveReferenceDemo: `nakadai/model/reference/demo/saveReferenceDemo`,
referenceDemoList: `nakadai/model/reference/demo/referenceDemoList`,
getAllModelList: `nakadai/model/reference/demo/getAllModelList`,
synchronizationMdel: `nakadai/model/reference/demo/synchronizationMdel`,
deleteSourceModelCategory: `nakadai/model/category/deleteSourceModelCategory`,
categorySave: `nakadai/model/category/save`,

@ -72,8 +72,8 @@
<span>课程列表</span>
</div>
<div>
<el-button type="primary" round @click="addcourse">新建课程</el-button>
<el-button type="primary" round @click="delAllSelection">批量删除</el-button>
<el-button type="primary" round @click="addcourse" v-auth>新增课程</el-button>
<el-button type="primary" round @click="delAllSelection" v-auth>批量删除</el-button>
</div>
</div>
<el-table v-loading="loading" :data="courseData" class="table" ref="table" stripe header-align="center"
@ -100,15 +100,16 @@
v-model="scope.row.isEnable"
:active-value="0"
:inactive-value="1"
@change="changeSwitch($event, scope.row)">
@change="changeSwitch($event, scope.row)"
v-auth="'/curriculum:上下架'">
</el-switch>
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button type="text" @click="edit(scope.row)">编辑</el-button>
<el-button type="text" @click="config(scope.row)">内容设置</el-button>
<el-button type="text" @click="handleDelete(scope.row)">删除</el-button>
<el-button type="text" @click="edit(scope.row)" v-auth>编辑</el-button>
<el-button type="text" @click="config(scope.row)" v-auth>内容设置</el-button>
<el-button type="text" @click="handleDelete(scope.row)" v-auth>删除</el-button>
</template>
</el-table-column>
</el-table>

@ -12,8 +12,8 @@
<div class="p-title">内容设置</div>
<div class="btns">
<template v-if="!sorting">
<el-button type="primary" round @click="addChapter">添加章节</el-button>
<el-button type="primary" round @click="sort">编辑顺序</el-button>
<el-button type="primary" round @click="addChapter" v-auth="'/curriculum:内容设置:添加章节'">添加章节</el-button>
<el-button type="primary" round @click="sort" v-auth="'/curriculum:内容设置:编辑顺序'">编辑顺序</el-button>
</template>
<template v-else>
<el-button type="primary" round @click="cancelSort">取消</el-button>
@ -28,9 +28,9 @@
<div>{{ chapter.name }}</div>
<div>
<template v-if="!sorting">
<el-button class="action-btn" plain @click="editChapter(chapter)">修改章节名称</el-button>
<el-button class="action-btn" plain @click="addSection(chapter.id)">添加小节</el-button>
<el-button class="action-btn" plain @click="delChapter(chapter.id)">删除</el-button>
<el-button class="action-btn" plain @click="editChapter(chapter)" v-auth="'/curriculum:内容设置:修改章节名称'">修改章节名称</el-button>
<el-button class="action-btn" plain @click="addSection(chapter.id)" v-auth="'/curriculum:内容设置:添加小节'">添加小节</el-button>
<el-button class="action-btn" plain @click="delChapter(chapter.id)" v-auth="'/curriculum:内容设置:删除章节'">删除</el-button>
</template>
<template v-else>
<i class="el-icon-top sort-icon" :class="{disabled: index == 0}" style="margin-right: 5px" @click="sortChapter(chapter,'up',index == 0,index)"></i>
@ -51,11 +51,11 @@
<el-table-column label="操作" align="center" width="300">
<template slot-scope="scope">
<template v-if="!sorting">
<el-button type="text" @click="download(scope.row)">下载</el-button>
<el-button type="text" @click="preview(scope.row)">查看</el-button>
<el-button type="text" @click="delSection(scope.row)">删除</el-button>
<el-button type="text" @click="editSectionName(scope.row,chapter.id)">修改小节名称</el-button>
<el-button type="text" @click="switchFile(scope.row,chapter.id)">更换文件</el-button>
<el-button type="text" @click="download(scope.row)" v-auth="'/curriculum:内容设置:下载'">下载</el-button>
<el-button type="text" @click="preview(scope.row)" v-auth="'/curriculum:内容设置:查看'">查看</el-button>
<el-button type="text" @click="delSection(scope.row)" v-auth="'/curriculum:内容设置:删除小节'">删除</el-button>
<el-button type="text" @click="editSectionName(scope.row,chapter.id)" v-auth="'/curriculum:内容设置:修改小节名称'">修改小节名称</el-button>
<el-button type="text" @click="switchFile(scope.row,chapter.id)" v-auth="'/curriculum:内容设置:更换文件'">更换文件</el-button>
</template>
<template v-else>
<i class="el-icon-top sort-icon" :class="{disabled: scope.$index == 0}" style="margin-right: 5px" @click="sortSection(index,'up',scope.$index == 0,scope.$index)"></i>

@ -50,8 +50,8 @@
<span>客户列表</span>
</div>
<div>
<el-button type="primary" round class="mag" @click="addcustomer">新建</el-button>
<el-button type="primary" round @click="delAllSelection">批量删除</el-button>
<el-button type="primary" round class="mag" @click="addcustomer" v-auth>新增</el-button>
<el-button type="primary" round @click="delAllSelection" v-auth>批量删除</el-button>
</div>
</div>
<el-table v-loading="loading" :data="listData" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange" row-key="customerId">
@ -80,11 +80,11 @@
</el-table-column>
<el-table-column label="操作" width="270" align="center">
<template slot-scope="scope">
<el-button type="text" @click="resetPassword(scope.row)">重置密码</el-button>
<el-button type="text" @click="show(scope.row)">查看</el-button>
<el-button type="text" @click="edit(scope.row)">编辑</el-button>
<el-button type="text" @click="handleDelete(scope.row)">删除</el-button>
<el-button type="text" @click="permission(scope.row)">应用权限</el-button>
<el-button type="text" @click="resetPassword(scope.row)" v-auth>重置密码</el-button>
<el-button type="text" @click="show(scope.row)" v-auth>查看</el-button>
<el-button type="text" @click="edit(scope.row)" v-auth>编辑</el-button>
<el-button type="text" @click="handleDelete(scope.row)" v-auth>删除</el-button>
<el-button type="text" @click="permission(scope.row)" v-auth>应用权限</el-button>
</template>
</el-table-column>
</el-table>

@ -20,6 +20,7 @@
import Product from './Product.vue';
import Framework from './Framework.vue';
import Introduce from './Introduce.vue';
import Setting from '@/setting'
export default {
data() {
return {
@ -39,13 +40,26 @@ export default {
Introduce
},
created() {
Setting.dynamicRoute && this.initTabs()
},
methods: {
tabChange(index){
this.active = index
this.$router.push(`/data?tab=${index}`)
},
initTabs() {
const btns = this.$store.state.btns
const tab1 = btns.includes('/data:产品管理')
const tab2 = btns.includes('/data:数据架构')
const tab3 = btns.includes('/data:数据简介')
tab1 || delete this.tabs.first
tab2 || delete this.tabs.second
tab3 || delete this.tabs.third
const tab = this.$route.query.tab
const keys = Object.keys(this.tabs)
this.active = keys.includes(tab) ? tab : keys[0]
}
}
};
</script>

@ -10,9 +10,9 @@
<span class="custom-tree-node" slot-scope="{ node, data }">
<span :title="node.label">{{ node.label }}</span>
<span class="actions">
<i class="el-icon-circle-plus-outline" @click.stop="addType(node)" v-if="data.level != 6"></i>
<i class="el-icon-edit" @click.stop="editType(node)"></i>
<i class="el-icon-delete" @click.stop="delType(node)"></i>
<i class="el-icon-circle-plus-outline" @click.stop="addType(node)" v-if="data.level != 6" v-auth="'/data:数据架构:新增分类'"></i>
<i class="el-icon-edit" @click.stop="editType(node)" v-auth="'/data:数据架构:编辑分类'"></i>
<i class="el-icon-delete" @click.stop="delType(node)" v-auth="'/data:数据架构:删除分类'"></i>
</span>
</span>
</el-tree>
@ -28,8 +28,8 @@
<el-input placeholder="请输入数据表名称" v-model="keyword" prefix-icon="el-icon-search" clearable></el-input>
</div>
<div>
<el-button type="primary" round @click="batchImport">导入数据</el-button>
<el-button type="primary" round @click="delAllSelection">批量删除</el-button>
<el-button type="primary" round @click="batchImport" v-auth="'/data:数据架构:导入数据'">导入数据</el-button>
<el-button type="primary" round @click="delAllSelection" v-auth="'/data:数据架构:批量删除'">批量删除</el-button>
</div>
</el-form>
<el-table :data="listData" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange">
@ -51,10 +51,10 @@
<el-table-column prop="updateTime" label="更新时间" width="180" align="center"></el-table-column>
<el-table-column label="操作" width="260" align="center">
<template slot-scope="scope">
<el-button type="text" @click="preview(scope.row)">预览</el-button>
<el-button type="text" @click="delTable(scope.row)">删除</el-button>
<el-button type="text" @click="editName(scope.row)">编辑产品表名</el-button>
<el-button type="text" @click="editHead(scope.row)">编辑产品表头</el-button>
<el-button type="text" @click="preview(scope.row)" v-auth="'/data:数据架构:预览'">预览</el-button>
<el-button type="text" @click="delTable(scope.row)" v-auth="'/data:数据架构:删除'">删除</el-button>
<el-button type="text" @click="editName(scope.row)" v-auth="'/data:数据架构:编辑产品表名'">编辑产品表名</el-button>
<el-button type="text" @click="editHead(scope.row)" v-auth="'/data:数据架构:编辑产品表头'">编辑产品表头</el-button>
</template>
</el-table-column>
</el-table>

@ -10,7 +10,7 @@
<el-card shadow="hover" class="mgb20 teacher_tab">
<div class="flex-between" style="margin-bottom: 10px;">
<p>数据简介</p>
<el-button v-if="introduceText && !editing" type="primary" @click="editing = !editing">编辑</el-button>
<el-button v-if="introduceText && !editing" type="primary" @click="editing = !editing" v-auth="'/data:数据简介:编辑'">编辑</el-button>
</div>
<div class="intro" v-if="!introduceText && !editing">
<p class="text">请添加简介</p>

@ -37,8 +37,8 @@
<span>产品列表</span>
</div>
<div>
<el-button type="primary" round @click="add">新增</el-button>
<el-button type="primary" round @click="delAllSelection">批量删除</el-button>
<el-button type="primary" round @click="add" v-auth="'/data:产品管理:新增'">新增</el-button>
<el-button type="primary" round @click="delAllSelection" v-auth="'/data:产品管理:批量删除'">批量删除</el-button>
</div>
</div>
<el-table :data="listData" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange" row-key="id">
@ -52,14 +52,14 @@
<el-table-column prop="createTime" label="创建时间" align="center"></el-table-column>
<el-table-column prop="orderNature" label="状态" align="center">
<template slot-scope="scope">
<el-switch v-model="scope.row.status" :active-text="scope.row.status ? '上架' : '下架'" :active-value="1" :inactive-value="0" @change="switchOff($event,scope.row,scope.$index)"></el-switch>
<el-switch v-model="scope.row.status" :active-text="scope.row.status ? '上架' : '下架'" :active-value="1" :inactive-value="0" @change="switchOff($event,scope.row,scope.$index)" v-auth="'/data:产品管理:上架'"></el-switch>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button type="text" @click="preview(scope.row)">预览</el-button>
<el-button type="text" @click="edit(scope.row)">编辑</el-button>
<el-button type="text" @click="handleDelete(scope.row)">删除</el-button>
<el-button type="text" @click="preview(scope.row)" v-auth="'/data:产品管理:预览'">预览</el-button>
<el-button type="text" @click="edit(scope.row)" v-auth="'/data:产品管理:编辑'">编辑</el-button>
<el-button type="text" @click="handleDelete(scope.row)" v-auth="'/data:产品管理:删除'">删除</el-button>
</template>
</el-table-column>
</el-table>

@ -65,8 +65,8 @@
<span>订单列表</span>
</div>
<div>
<el-button type="primary" round @click="addOrder()">新建订单</el-button>
<el-button type="primary" round @click="delAllSelection">批量删除</el-button>
<el-button type="primary" round @click="addOrder()" v-auth>新建订单</el-button>
<el-button type="primary" round @click="delAllSelection" v-auth>批量删除</el-button>
</div>
</div>
<el-table :data="orderData" class="table" ref="table" stripe header-align="center"
@ -104,13 +104,13 @@
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button type="text" v-if="scope.row.isDel!==1" @click="handle('edit',scope.row)">
<el-button type="text" v-if="scope.row.isDel!==1" @click="handle('edit',scope.row)" v-auth="'/order:修改'">
{{ scope.row.orderStatus === "已完成" ? "修改" : "处理" }}
</el-button>
<el-button type="text" @click="handle('watch',scope.row)">查看</el-button>
<el-button type="text" @click="handleDelete(scope.row)">删除</el-button>
<el-button type="text" @click="handle('watch',scope.row)" v-auth>查看</el-button>
<el-button type="text" @click="handleDelete(scope.row)" v-auth>删除</el-button>
<el-button type="text" v-if="scope.row.orderStatus==='已完成'&&scope.row.isDel!==1"
@click="handle('renew',scope.row)">续费
@click="handle('renew',scope.row)" v-auth>续费
</el-button>
</template>
</el-table-column>

@ -70,17 +70,17 @@
</el-table-column>
<el-table-column prop="payamount" label="系统后台" align="center">
<template slot-scope="scope">
<el-button type="text" @click="toBackstage(scope.row)">进入</el-button>
<el-button type="text" @click="toBackstage(scope.row)" v-auth="'/configure:系统后台进入'">进入</el-button>
</template>
</el-table-column>
<el-table-column prop="payamount" label="项目系统" align="center">
<template slot-scope="scope">
<el-button type="text" @click="getIntoProject(scope.row)">进入</el-button>
<el-button type="text" @click="getIntoProject(scope.row)" v-auth="'/configure:项目系统进入'">进入</el-button>
</template>
</el-table-column>
<el-table-column prop="payamount" label="判分系统" align="center">
<template slot-scope="scope">
<el-button type="text" @click="getIntoJudgement(scope.row)">进入</el-button>
<el-button type="text" @click="getIntoJudgement(scope.row)" v-auth="'/configure:判分系统进入'">进入</el-button>
</template>
</el-table-column>
<!--

@ -109,8 +109,20 @@ export default {
getSingle() {
this.$emit('initData')
},
//
syncModel() {
this.$confirm('同步后当前的组织架构将会被删除,是否继续?', '提示', {
type: 'warning'
}).then(() => {
//
this.$post(`${this.api.delModelInfoBySystemId}?systemId=${this.systemId}`).then(res => {
this.$post(`${this.api.synchronizationMdel}?systemId=${this.systemId}`).then(res => {
this.getType()
})
}).catch(() => {})
}).catch(() => {})
},
//
syncModel1() {
this.$confirm('同步后当前的组织架构将会被删除,是否继续?', '提示', {
type: 'warning'
}).then(() => {
@ -125,7 +137,7 @@ export default {
}).then(res => {
this.addData(res.referenceCategoryId)
}).catch(res => {})
})
}).catch(() => {})
}).catch(() => {})
},
//

@ -53,19 +53,19 @@ export default {
})
},
initTabs() {
let tab1 = this.auth("员工管理");
let tab2 = this.auth("角色权限");
let tab3 = this.auth("系统logo设置");
const btns = this.$store.state.btns
const tab1 = btns.includes('/system:后台账号')
const tab2 = btns.includes('/system:角色权限')
const tab3 = btns.includes('/system:数据字典')
const tab4 = btns.includes('/system:日志更新')
if (!tab1) {
delete this.tabs.staff;
}
if (!tab2) {
delete this.tabs.role;
}
if (!tab3) {
delete this.tabs.logo;
}
tab1 || delete this.tabs.staff
tab2 || delete this.tabs.role
tab3 || delete this.tabs.dic
tab4 || delete this.tabs.log
const type = this.$route.query.type
const keys = Object.keys(this.tabs)
this.active = keys.includes(type) ? type : keys[0]
}
}
};

@ -26,7 +26,7 @@
<el-table-column prop="versionNum" label="版本数" align="center"></el-table-column>
<el-table-column label="操作" align="center" width="200">
<template slot-scope="scope">
<el-button type="text" @click="toManage(scope.row)">管理</el-button>
<el-button type="text" @click="toManage(scope.row)" v-auth="'/system:日志更新:管理'">管理</el-button>
</template>
</el-table-column>
</el-table>

@ -25,7 +25,7 @@
</div>
</div>
<div>
<el-button type="primary" @click="add">新增日志</el-button>
<el-button type="primary" @click="add" v-auth="'/system:日志更新:管理:新增日志'">新增日志</el-button>
</div>
</div>
<el-timeline class="timeline">
@ -35,11 +35,11 @@
<div>
{{ platformName + item.versionName }}
<span class="action">
<i class="el-icon-edit-outline" @click="edit(item)"></i>
<i class="el-icon-delete" @click="del(item)"></i>
<i class="el-icon-edit-outline" @click="edit(item)" v-auth="'/system:日志更新:管理:编辑日志'"></i>
<i class="el-icon-delete" @click="del(item)" v-auth="'/system:日志更新:管理:删除日志'"></i>
</span>
</div>
<el-switch v-model="item.open" :active-value="0" :inactive-value="1" @change="switchOff($event, item)"></el-switch>
<el-switch v-model="item.open" :active-value="0" :inactive-value="1" @change="switchOff($event, item)" v-auth="'/system:日志更新:管理:开启日志'"></el-switch>
</div>
<ul class="detail">
<li v-for="(item, i) in item.logContents" :key="i">

@ -8,8 +8,8 @@
</li>
</ul>
<div>
<el-button type="primary" round @click="addRole">新增角色</el-button>
<el-button type="primary" round @click="delAllSelection">批量删除</el-button>
<el-button type="primary" round @click="addRole" v-auth="'/system:角色权限:新增角色'">新增角色</el-button>
<el-button type="primary" round @click="delAllSelection" v-auth="'/system:角色权限:批量删除'">批量删除</el-button>
</div>
</div>
@ -24,9 +24,9 @@
</el-table-column>
<el-table-column label="操作" align="center" width="200">
<template slot-scope="scope">
<el-button type="text" @click="showRole(scope.row)">查看</el-button>
<el-button v-if="scope.row.roleName !== '超级管理员'" type="text" @click="editRole(scope.row)">编辑</el-button>
<el-button v-if="scope.row.roleName !== '超级管理员' && scope.row.roleName !== '管理员'" type="text" @click="handleDelete(scope.row)">删除</el-button>
<el-button type="text" @click="showRole(scope.row)" v-auth="'/system:角色权限:查看'">查看</el-button>
<el-button v-if="scope.row.roleName !== '超级管理员'" type="text" @click="editRole(scope.row)" v-auth="'/system:角色权限:编辑'">编辑</el-button>
<el-button v-if="scope.row.roleName !== '超级管理员' && scope.row.roleName !== '管理员'" type="text" @click="handleDelete(scope.row)" v-auth="'/system:角色权限:删除'">删除</el-button>
</template>
</el-table-column>
</el-table>

@ -105,7 +105,7 @@
<span>用户列表</span>
</div>
<div>
<el-button type="primary" round @click="delAllSelection">批量删除</el-button>
<el-button type="primary" round @click="delAllSelection" v-auth>批量删除</el-button>
</div>
</div>
<el-table :data="userData" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange" row-key="userId">
@ -122,11 +122,11 @@
<el-table-column prop="logInNumber" label="登录次数" align="center"></el-table-column>
<el-table-column label="操作" width="300" align="center">
<template slot-scope="scope">
<el-button type="text" @click="show(scope.row)">查看</el-button>
<el-button type="text" @click="edit(scope.row)">编辑</el-button>
<el-button v-if="scope.row.userId!==1" type="text" @click="handleDelete(scope.row)">删除</el-button>
<el-button type="text" @click="resetPassword(scope.row)">重置密码</el-button>
<el-switch v-if="scope.row.userId!==1" v-model="scope.row.isEnable" :active-value="1" :inactive-value="0" style="margin: 0 10px 0 5px" :active-text="scope.row.isEnable ? '启用' : '禁用'" @change="switchOff($event,scope.row,scope.$index)"></el-switch>
<el-button type="text" @click="show(scope.row)" v-auth>查看</el-button>
<el-button type="text" @click="edit(scope.row)" v-auth>编辑</el-button>
<el-button v-if="scope.row.userId!==1" type="text" @click="handleDelete(scope.row)" v-auth>删除</el-button>
<el-button type="text" @click="resetPassword(scope.row)" v-auth>重置密码</el-button>
<el-switch v-if="scope.row.userId!==1" v-model="scope.row.isEnable" :active-value="1" :inactive-value="0" style="margin: 0 10px 0 5px" :active-text="scope.row.isEnable ? '启用' : '禁用'" @change="switchOff($event,scope.row,scope.$index)" v-auth="'/user:启用'"></el-switch>
</template>
</el-table-column>
</el-table>

Loading…
Cancel
Save