Commit 8929c586 authored by feifei's avatar feifei

权限

parent 43f6cf52
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
<el-table-column prop="userStatus" label="状态" :formatter="userStatusFormat"></el-table-column> <el-table-column prop="userStatus" label="状态" :formatter="userStatusFormat"></el-table-column>
<el-table-column label="操作"> <el-table-column label="操作">
<template scope="scope"> <template scope="scope">
<el-button type="primary" size="small" v-if="scope.row.userStatus == 'REAL_NAME'" @click="cancellation(scope.row)">注销</el-button> <el-button type="primary" size="small" v-if="$permissionUtils.rolePermission('customBoss') && scope.row.userStatus == 'REAL_NAME' " @click="cancellation(scope.row)">注销</el-button>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="查看详情"> <el-table-column label="查看详情">
...@@ -148,6 +148,7 @@ ...@@ -148,6 +148,7 @@
loanList(){ loanList(){
console.log("角色" + this.$permissionUtils.rolePermission('admin'));
/** 加载数据 */ /** 加载数据 */
this.$$post('/customer/selectClientInfo', this.buildParam()).then(res => { this.$$post('/customer/selectClientInfo', this.buildParam()).then(res => {
if (res.data.code != 200) { if (res.data.code != 200) {
......
...@@ -97,9 +97,13 @@ ...@@ -97,9 +97,13 @@
.then(res => { .then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
localStorage.setItem('userName', res.data.result.userName) localStorage.setItem('userName', res.data.result.userName);
localStorage.setItem('agentNo', res.data.result.extensionNumber); localStorage.setItem('agentNo', res.data.result.extensionNumber);
localStorage.setItem('loginName', res.data.result.loginName) localStorage.setItem('loginName', res.data.result.loginName);
var userRolePermission = this.userRolelistToStringUtils(res.data.result.userRole);
localStorage.setItem('userRole', userRolePermission);
var btnPermission = this.listToStringUtils(res.data.result.buttonList); var btnPermission = this.listToStringUtils(res.data.result.buttonList);
localStorage.setItem('btnPermission', btnPermission) localStorage.setItem('btnPermission', btnPermission)
...@@ -210,6 +214,18 @@ ...@@ -210,6 +214,18 @@
return returnStr; return returnStr;
}, },
userRolelistToStringUtils(list) {
var returnStr = ''
for (var num in list) {
if (num == list.length - 1) {
returnStr = returnStr + list[num].roleCode
} else {
returnStr = returnStr + list[num].roleCode + ","
}
}
return returnStr;
},
showErrorAlert(err) { showErrorAlert(err) {
this.$message.error(err.msg === undefined ? '404' : err.msg) this.$message.error(err.msg === undefined ? '404' : err.msg)
this.ui.loginLoading = false this.ui.loginLoading = false
......
...@@ -11,6 +11,7 @@ const cacheManage = { ...@@ -11,6 +11,7 @@ const cacheManage = {
localStorage.setItem('userName', "") localStorage.setItem('userName', "")
localStorage.setItem('loginName', "") localStorage.setItem('loginName', "")
localStorage.setItem('userRole', "")
localStorage.setItem('btnPermission', "") localStorage.setItem('btnPermission', "")
localStorage.setItem('menuPermission', "") localStorage.setItem('menuPermission', "")
localStorage.setItem('myRaisCardName', "") localStorage.setItem('myRaisCardName', "")
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
const permissionUtils = { const permissionUtils = {
install: function (Vue) { install: function (Vue) {
Vue.prototype.$permissionUtils = { Vue.prototype.$permissionUtils = {
btnPermission(code) { btnPermission(code) {
if (localStorage.getItem('btnPermission') == null || localStorage.getItem('btnPermission') == '') { if (localStorage.getItem('btnPermission') == null || localStorage.getItem('btnPermission') == '') {
return false return false
...@@ -30,6 +31,20 @@ const permissionUtils = { ...@@ -30,6 +31,20 @@ const permissionUtils = {
} }
} }
return false return false
},
rolePermission(code) {
if (localStorage.getItem('userRole') == null || localStorage.getItem('userRole') == '') {
return false
}
var rolePerList = localStorage.getItem('userRole').split(",");
for (var num in rolePerList) {
if (code == rolePerList[num]) {
return true
}
}
return false
} }
......
{ {
"name": "versiony", "name": "versiony",
"version": "5.6.2" "version": "5.6.4"
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment