From c283eb6486c703f1eb6ad5eb2e550a67ff6d6783 Mon Sep 17 00:00:00 2001 From: lideqin <694785430@qq.com> Date: Mon, 29 Jul 2024 10:52:46 +0800 Subject: [PATCH] =?UTF-8?q?[update]=20=E4=BF=AE=E6=94=B9bug87487=EF=BC=8C?= =?UTF-8?q?=E4=BC=81=E6=A0=87-=E5=85=B3=E8=81=94=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=81=9A=E7=89=B9=E6=AE=8A=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/api_address_config.js | 2 ++ src/components/customField/AddForm.vue | 43 ++++++++++++++++++++++---- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/public/api_address_config.js b/public/api_address_config.js index b6049a6..eb968b8 100644 --- a/public/api_address_config.js +++ b/public/api_address_config.js @@ -20,6 +20,8 @@ window._CONFIG.adminRoleCode = 'admin,KFGLY' window._CONFIG.superAdminRoleCode = 'superAdmin' // 法规管理员code window._CONFIG.regulationAdminRoleCode = 'regulationAdmin' +// 系统管理员code +window._CONFIG.systemAdminRoleCode = 'admin' // 水印配置 window._CONFIG.watermarkConfig = { color: 'rgba(180, 180, 180, 0.2)', diff --git a/src/components/customField/AddForm.vue b/src/components/customField/AddForm.vue index bebc04e..f42da00 100644 --- a/src/components/customField/AddForm.vue +++ b/src/components/customField/AddForm.vue @@ -9,7 +9,8 @@ class="box-title-text form-flex-item-half" :class="{'form-flex-item-line': item.fieldShowType === FieldType.STANDARD_MORE.value}" v-if="!hiddenFieldList.includes(item.dbFieldName)"> -
+ +
* {{ item.dbFieldTxt }}
@@ -66,7 +67,7 @@ :backDepart="true" :treeOpera="true" /> - {{ (formInline[item.dbFieldName] === 'null' || formInline[item.dbFieldName] === '' @@ -170,6 +171,7 @@ import { ajaxGetDictItems, getFormDictTreeList } from '../../api/api.js' import TreeSelection from '../selection/TreeSelection' import STreeSelect from '../STreeSelect' import { isHasPermission } from '../../utils/hasPermission' +import { mapGetters } from 'vuex' export default { name: 'AddForm', @@ -315,7 +317,7 @@ export default { isEditSetData: false, // 正在编辑回显数据 oldMainDraftingUnit: '', // 上一次的主起草单位 dictNotCodes: ['name_code'], // 用到字典的字段不传dictCode的字段 - filePerm: { // 上传文件根据权限控制只能查看 + filePerm: { // 上传文件根据权限控制只能查看,没有权限的除了系统管理员外不可见不可下载 associated_file: 'enterpriseStandard:associatedFile:look' // 关联文件 } } @@ -349,14 +351,43 @@ export default { } }, computed: { + ...mapGetters(['userInfo']), + // 是否是系统管理员 + isSystemAdmin () { + const roleList = window._CONFIG.systemAdminRoleCode.split(',') + const userRoleList = this.userInfo.roleCode.split(',') + return userRoleList.some(tt => roleList.includes(tt)) + }, fileIsDownload () { // 文件是否可下载 - // const isDisabled - // return Object.keys(filePerm).includes(uploadName) ? isHasPermission(filePerm[uploadName]) : - return true + if (Object.keys(this.filePerm).includes(this.uploadName)) { + // 系统管理员可下载 + if (this.isSystemAdmin) { + return true + } else { + return false + } + } else { + // 不是需要特殊判断的字段正常可下载 + return true + } } }, methods: { isHasPermission, + fileVisibility (fieldName) { // 文件是否可见,有授权的和系统管理员可下载 + if (Object.keys(this.filePerm).includes(fieldName)) { + // 系统管理员和有权限的角色可见 + if (this.isSystemAdmin || isHasPermission(this.filePerm[fieldName])) { + console.log('------系统管理员和有权限的角色可见') + return true + } else { + return false + } + } else { + // 不是需要特殊判断的字段正常可见 + return true + } + }, add () { this.formInline = Object.assign({}, this.defaultValue) this.$forceUpdate()