From d186b4d37394e4816e0f271fcced4d06b3069454 Mon Sep 17 00:00:00 2001 From: 田源 <lastanimals@163.com> Date: 星期一, 16 十二月 2024 15:31:28 +0800 Subject: [PATCH] 路由query添加当前页面id&&人员组织管理模块下所有页面按钮权限控制 --- Source/plt-web/plt-web-ui/src/views/system/role/index.vue | 74 +++++++++++++++++++++++++------------ 1 files changed, 50 insertions(+), 24 deletions(-) diff --git a/Source/plt-web/plt-web-ui/src/views/system/role/index.vue b/Source/plt-web/plt-web-ui/src/views/system/role/index.vue index 80a085f..55308b2 100644 --- a/Source/plt-web/plt-web-ui/src/views/system/role/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/system/role/index.vue @@ -17,12 +17,20 @@ @row-del="rowDeleteHandler" > <template slot="menuLeft" slot-scope="scope"> - <el-button icon="el-icon-delete" plain size="small" type="danger" @click="allDelHandler">鍒犻櫎</el-button> - <el-button icon="el-icon-school" plain size="small" type="primary" @click="assignMembersHandler">鍒嗛厤鎴愬憳 + <el-button v-if="permissionList.delBtn" icon="el-icon-delete" plain size="small" type="danger" + @click="allDelHandler">鍒犻櫎 </el-button> - <el-button icon="el-icon-user" plain size="small" type="primary" @click="statisticsHandler">缁熻</el-button> - <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="upLoadRole">瀵煎叆瑙掕壊</el-button> - <el-button icon="el-icon-download" plain size="small" type="primary">瀵煎嚭</el-button> + <el-button v-if="permissionList.assignMembersBtn" icon="el-icon-school" plain size="small" type="primary" + @click="assignMembersHandler">鍒嗛厤鎴愬憳 + </el-button> + <el-button v-if="permissionList.statisticsBtn" icon="el-icon-user" plain size="small" type="primary" + @click="statisticsHandler">缁熻 + </el-button> + <el-button v-if="permissionList.importRoleBtn" icon="el-icon-upload2" plain size="small" type="primary" + @click="upLoadRole">瀵煎叆瑙掕壊 + </el-button> + <el-button v-if="permissionList.exportBtn" icon="el-icon-download" plain size="small" type="primary">瀵煎嚭 + </el-button> </template> <template slot="roleClassifyText" slot-scope="{row}"> @@ -30,7 +38,7 @@ </template> </avue-crud> - <!-- 鍒嗛厤瑙掕壊绌挎妗� --> + <!-- 鍒嗛厤鎴愬憳绌挎妗� --> <transfer ref="transfer" :left-role-data="leftRoleData" :right-role-data="rightRoleData" :transferTitle="transferTitle" title="瑙掕壊娣诲姞鎴愬憳" @transferSend="roleSendHandler"> @@ -79,19 +87,13 @@ import basicOption from "@/util/basic-option"; import {column} from "@/views/system/role/option"; import func from "@/util/func"; +import {mapGetters} from "vuex"; export default { name: "index", data() { return { tableData: [], - option: { - ...basicOption, - dialogTop: 0, - dialogWidth: '30%', - column: column, - calcHeight: -60, - }, page: { currentPage: 1, pageSize: 10, @@ -113,6 +115,7 @@ refreshBtn: false, addBtn: false, menu: false, + header: false, column: [ { label: '閮ㄩ棬', @@ -140,6 +143,32 @@ upFileType: ['xls', 'xlsx'], fileUrl: 'api/roleQueryController/importRole', tipList: ["瑙掕壊瀵煎叆鍙湁 鍚嶇О 鍜� 鎻忚堪 涓ゅ垪锛屼笖鍚嶇О涓哄繀杈撻」涓嶈兘涓虹┖"] + } + }, + computed: { + ...mapGetters(["permission"]), + permissionList() { + return { + addBtn: this.vaildData(this.permission[this.$route.query.id].ADD, false), + delBtn: this.vaildData(this.permission[this.$route.query.id].DELETE, false), + editBtn: this.vaildData(this.permission[this.$route.query.id].EDIT, false), + exportBtn: this.vaildData(this.permission[this.$route.query.id].EXPORT, false), + assignMembersBtn: this.vaildData(this.permission[this.$route.query.id].assignMembers, false), + importRoleBtn: this.vaildData(this.permission[this.$route.query.id].importRole, false), + statisticsBtn: this.vaildData(this.permission[this.$route.query.id].statistics, false), + }; + }, + option() { + return { + ...basicOption, + addBtn: this.permissionList.addBtn, + delBtn: this.permissionList.delBtn, + editBtn: this.permissionList.editBtn, + dialogTop: 0, + dialogWidth: '30%', + column: column, + calcHeight: -60, + } } }, methods: { @@ -180,8 +209,12 @@ row, this.$refs.roleCrud, this.lastIndex, - (newIndex) => { this.lastIndex = newIndex; }, - () => { this.selectList = []; } + (newIndex) => { + this.lastIndex = newIndex; + }, + () => { + this.selectList = [row]; + } ); }, @@ -189,7 +222,6 @@ rowSaveHandler(row, done, loading) { delete row.roleClassifyText; addRole(row).then(res => { - console.log(res) if (res.data.code === 200) { this.$message.success(res.data.obj); this.getTableList(); @@ -212,7 +244,6 @@ } }).catch(err => { loading(); - console.log(err); }); }, @@ -284,6 +315,8 @@ listUserUnInRoleOid({pkRole: this.selectList[0].oid}), listUserByRoleOid({pkRole: this.selectList[0].oid}) ]).then(([unInRoleRes, byRoleRes]) => { + this.leftRoleData = []; + this.rightRoleData = []; if (unInRoleRes.data.code === 200 && byRoleRes.data.code === 200) { const leftData = [...unInRoleRes.data.data, ...byRoleRes.data.data]; // 缁勮濂界┛姊鍙敤鏁版嵁 @@ -296,8 +329,6 @@ this.rightRoleData = byRoleRes.data.data.map(item => item.oid); this.$refs.transfer.visible = true; } - }).catch(err => { - console.error(err); }); }, @@ -311,8 +342,6 @@ saveRight(params).then(res => { this.$message.success(res.data.obj); this.getTableList(); - }).catch(err => { - this.$message.error(err) }) }, @@ -328,7 +357,6 @@ return; } listUserByRoleOid({pkRole: this.selectList[0].oid}).then(res => { - console.log(res) if (res.data.code === 200) { const data = res.data.data; this.countData = data.map(item => { @@ -341,8 +369,6 @@ }); this.statisticsVisible = true; } - }).catch(err => { - console.log(err) }) }, -- Gitblit v1.9.3