项目列表根据角色隐藏显示编辑删除按钮

dev_2022-05-11
jialong.yu 3 years ago
parent cca23884ed
commit 1c3b175493
  1. 1
      src/api/index.js
  2. 24
      src/pages/project/list/index.vue

@ -9,6 +9,7 @@ export default {
logins: `${host}users/users/user/login`, //登录 logins: `${host}users/users/user/login`, //登录
verification: `${host}users/users/user/captcha`,// 验证码图片 verification: `${host}users/users/user/captcha`,// 验证码图片
isClient: `${host}users/users/user/isClient`,// 是否为客户 isClient: `${host}users/users/user/isClient`,// 是否为客户
getUserAllRoleByToken : `${host}users/role/getUserAllRoleByToken`,
// 权限管理 // 权限管理
getUserRolesPermissionMenu: `${host}users/user-role/getUserRolesPermissionMenu`, getUserRolesPermissionMenu: `${host}users/user-role/getUserRolesPermissionMenu`,

@ -84,11 +84,11 @@
{{ stateKeys[scope.row.state] }} {{ stateKeys[scope.row.state] }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center"> <el-table-column label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="edit(scope.row,'0',queryData.founder)">查看</el-button> <el-button type="text" @click="edit(scope.row,'0',queryData.founder)">查看</el-button>
<el-button v-if="scope.row.founder != 0" type="text" @click="edit(scope.row,'1',queryData.founder)">编辑</el-button> <el-button v-if="scope.row.founder && (isSuper || roleName === scope.row.roleName)" type="text" @click="edit(scope.row,'1',queryData.founder)">编辑</el-button>
<el-button v-if="scope.row.founder != 0" type="text" @click="handleDelete(scope.row.projectId)">删除</el-button> <el-button v-if="scope.row.founder && (isSuper || roleName === scope.row.roleName)" type="text" @click="handleDelete(scope.row.projectId)">删除</el-button>
<el-button v-if="auth('复制')" type="text" @click="copyData(scope.row.projectId)">复制</el-button> <el-button v-if="auth('复制')" type="text" @click="copyData(scope.row.projectId)">复制</el-button>
<el-switch <el-switch
v-if="auth('禁用')" v-if="auth('禁用')"
@ -123,6 +123,7 @@
</template> </template>
<script> <script>
import Setting from "@/setting";
import { mapState, mapActions, mapMutations } from "vuex"; import { mapState, mapActions, mapMutations } from "vuex";
import util from "@/libs/util"; import util from "@/libs/util";
@ -201,7 +202,10 @@ export default {
copyVisible: false, copyVisible: false,
projectName: "", projectName: "",
currentRow: {}, // currentRow: {}, //
listDataAll: [] listDataAll: [],
isSuper: false, //
isAdmin: false, //
roleName: '' //
}; };
}, },
computed: { computed: {
@ -232,7 +236,7 @@ export default {
// this.queryData = this.queryDataStatus // this.queryData = this.queryDataStatus
// }, // },
mounted() { mounted() {
this.getSystemData(); this.getRole()
if(this.queryDataStatus.platformId) { if(this.queryDataStatus.platformId) {
this.queryData = this.queryDataStatus this.queryData = this.queryDataStatus
} }
@ -263,6 +267,16 @@ export default {
}); });
}, },
//
getRole() {
this.$post(`${this.api.getUserAllRoleByToken}?platformId=${Setting.platformId}`).then(res => {
this.isSuper = res.includes('超级管理员')
this.isAdmin = res === '管理员'
this.roleName = res
this.getSystemData();
}).catch(err => {
});
},
getData() { getData() {
this.setSystemId(this.systemId); this.setSystemId(this.systemId);
let data = { let data = {

Loading…
Cancel
Save