From a8f350e6d77276e2ff06d74d8c56cc78ad055efc Mon Sep 17 00:00:00 2001 From: lideqin <694785430@qq.com> Date: Wed, 23 Aug 2023 18:28:36 +0800 Subject: [PATCH] =?UTF-8?q?[update]=20=E4=BF=AE=E6=94=B9=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E5=88=97=E5=8F=AA=E6=98=BE=E7=A4=BA=E4=B8=80=E4=B8=AA=E6=8C=89?= =?UTF-8?q?=E9=92=AE=EF=BC=8C=E5=85=B6=E4=BB=96=E6=98=BE=E7=A4=BA=E5=9C=A8?= =?UTF-8?q?=E6=9B=B4=E5=A4=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mixins/ConfigurableTableMixin.js | 9 ++- src/mixins/JeroListMixin.js | 11 ++- src/utils/hasPermission.js | 66 +++++++++++++++++ src/views/businessSupport/DataCenter.vue | 71 +++++++++++++++---- src/views/documentManage/DocumentLibrary.vue | 45 ++++++++---- src/views/documentTool/DocumentComparison.vue | 44 ++++++++---- src/views/documentTool/DocumentSplit.vue | 43 +++++------ 7 files changed, 227 insertions(+), 62 deletions(-) diff --git a/src/mixins/ConfigurableTableMixin.js b/src/mixins/ConfigurableTableMixin.js index 9e69dd7e..fde758e6 100644 --- a/src/mixins/ConfigurableTableMixin.js +++ b/src/mixins/ConfigurableTableMixin.js @@ -2,6 +2,7 @@ * 表头通过标签管理配置的模块的表格数据的混入 */ import { getAction, postAction } from '@api/manage' +import { isHasPermission } from '../utils/hasPermission' // 模拟接口返回的表头数据 const TempApiReturnColumns = [ @@ -49,6 +50,7 @@ export const ConfigurableTableMixin = { orderBy: '1', orderByField: '', getTableHeaderData: null, // 获取表头数据的方法 + operateMaxNum: 1, // 操作列的column operateColumn: { title: this.$t('operation'), @@ -57,12 +59,17 @@ export const ConfigurableTableMixin = { scopedSlots: { customRender: 'operation' } }, type: '', // 这个字段不知道什么含义 - filters: {} // 固定的搜索条件 + filters: {}, // 固定的搜索条件 + needFilterTableBtn: true // 是否需要过滤没有权限的按钮 } }, mounted () { this.getTableHeader() this.loadData() + // 过滤没有权限的按钮 + if (this.needFilterTableBtn) { + this.operationList = this.operationList.filter(item => isHasPermission(item.has)) + } }, methods: { /** diff --git a/src/mixins/JeroListMixin.js b/src/mixins/JeroListMixin.js index c6871959..f510e0b4 100644 --- a/src/mixins/JeroListMixin.js +++ b/src/mixins/JeroListMixin.js @@ -8,6 +8,7 @@ import { downFile, getAction, getFileAccessHttpUrl, postAction } from '@/api/man import Vue from 'vue' import { ACCESS_TOKEN, TENANT_ID } from '@/store/mutation-types' import store from '@/store' +import { isHasPermission } from '../utils/hasPermission' // 导入的加载提示 let importModalLoading @@ -51,7 +52,9 @@ export const JeroListMixin = { /* 高级查询条件 */ superQueryParams: '', /** 高级查询拼接方式 */ - superQueryMatchType: 'and' + superQueryMatchType: 'and', + operateMaxNum: 1, // 表格操作列最多显示的按钮,其他显示在更多中 + needFilterTableBtn: true // 是否需要过滤表格操作列没有权限的按钮 } }, created () { @@ -61,6 +64,12 @@ export const JeroListMixin = { this.initDictConfig() } }, + mounted () { + // 过滤表格操作列没有权限的按钮 + if (this.needFilterTableBtn) { + this.operationList = this.operationList.filter(item => isHasPermission(item.has)) + } + }, computed: { // token header tokenHeader () { diff --git a/src/utils/hasPermission.js b/src/utils/hasPermission.js index 886a317e..a7e5589d 100644 --- a/src/utils/hasPermission.js +++ b/src/utils/hasPermission.js @@ -127,4 +127,70 @@ export function filterGlobalPermission (el, binding) { } } +/** + * 根据授权标识是否拥有该权限,用于tab页签的权限 + */ +export function isHasPermission (permissionIdentifier) { + const permissionList = [] + const allPermissionList = [] + + // let authList = Vue.ls.get(USER_AUTH); + const authList = JSON.parse(sessionStorage.getItem(USER_AUTH) || '[]') + for (const auth of authList) { + if (auth.type + '' !== '2') { + permissionList.push(auth) + } + } + // console.log("页面权限--Global--",sessionStorage.getItem(SYS_BUTTON_AUTH)); + const allAuthList = JSON.parse(sessionStorage.getItem(SYS_BUTTON_AUTH) || '[]') + for (const gauth of allAuthList) { + if (gauth.type + '' !== '2') { + allPermissionList.push(gauth) + } + } + // 设置全局配置是否有命中 + let invalidFlag = false// 无效命中 + if (allPermissionList && allPermissionList.length > 0) { + for (const itemG of allPermissionList) { + if (permissionIdentifier === itemG.action) { + if (itemG.status + '' === '0') { + invalidFlag = true + break + } + } + } + } + if (invalidFlag) { + return + } + if (permissionList === null || permissionList === '' || permissionList === undefined || permissionList.length <= 0) { + return false + } + const permissions = [] + for (const item of permissionList) { + // 权限策略1显示2禁用 + if (item.type + '' !== '2') { + // update--begin--autor:wangshuai-----date:20200729------for:按钮权限,授权标识的提示信息是多个用逗号分隔逻辑处理 gitee#I1OUGU------- + if (item.action) { + if (item.action.includes(',')) { + const split = item.action.split(',') + for (let i = 0; i < split.length; i++) { + if (!split[i] || split[i].length === 0) { + continue + } + permissions.push(split[i]) + } + } else { + permissions.push(item.action) + } + } + // update--end--autor:wangshuai-----date:20200729------for:按钮权限,授权标识的提示信息是多个用逗号分隔逻辑处理 gitee#I1OUGU------ + } + } + if (!permissions.includes(permissionIdentifier)) { + return false + } + return true +} + export default hasPermission diff --git a/src/views/businessSupport/DataCenter.vue b/src/views/businessSupport/DataCenter.vue index 1faa2b91..3dee8a53 100644 --- a/src/views/businessSupport/DataCenter.vue +++ b/src/views/businessSupport/DataCenter.vue @@ -130,16 +130,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -172,12 +200,31 @@ export default { mixins: [JeroListMixin], data () { return { + operationList: [ + { + text: this.$t('download'), + clickEvent: 'download', + has: 'externalReport:download' + }, + { + text: this.$t('edit'), + clickEvent: 'handleEdit', + has: 'externalReport:edit' + }, + { + text: this.$t('delete'), + clickEvent: 'batchDel', + has: 'externalReport:delete' + } + ], labelCol: { span: 6 }, wrapperCol: { span: 16 }, disabled: false, manager: false, // 是否有树右键菜单 addSub: true, - dataSource: [], + dataSource: [ + { id: 1 } + ], expandedKeys: [], searchValue: '', autoExpandParent: true, @@ -225,7 +272,7 @@ export default { }, { title: this.$t('operation'), - align: 'left', + align: 'center', fixed: 'right', ellipsis: true, width: 240, @@ -233,7 +280,7 @@ export default { } ], url: { - list: 'com.jero.modules.extRepo/extRepoData/page', + list: '/extRepo/extRepoData/page', getSysCategoryTree: '/sys/category/getSysCategoryTree' }, // upAccept:'.zip', //导入文件类型 diff --git a/src/views/documentManage/DocumentLibrary.vue b/src/views/documentManage/DocumentLibrary.vue index 00d0b99c..0eabb05c 100644 --- a/src/views/documentManage/DocumentLibrary.vue +++ b/src/views/documentManage/DocumentLibrary.vue @@ -47,24 +47,45 @@ :pagination="ipagination" :scroll="{x: '100%'}" @change="tableOnChange"> - -