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()