[update] 修改bug87487,企标-关联文件做特殊判断

This commit is contained in:
lideqin
2024-07-29 10:52:46 +08:00
parent a26b0fb7a9
commit c283eb6486
2 changed files with 39 additions and 6 deletions
+2
View File
@@ -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)',
+37 -6
View File
@@ -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)">
<div class="title-text">
<!-- 上传文件类型的有特殊判断其他类型全部正常显示 -->
<div class="title-text" v-if="item.fieldShowType === FieldType.FILE_UP.value ? fileVisibility(item.dbFieldName) : true">
<span class="required" v-if="item.fieldMustInput === '1' || rules[item.dbFieldName][0].required">*</span>
<span class="title-text-text" :title="item.dbFieldTxt">{{ item.dbFieldTxt }}</span>
</div>
@@ -66,7 +67,7 @@
:backDepart="true"
:treeOpera="true" />
<!-- 8, 上传文件 -->
<a-button v-else-if="item.fieldShowType === FieldType.FILE_UP.value" type="primary" ghost class="button-text"
<a-button v-else-if="item.fieldShowType === FieldType.FILE_UP.value && fileVisibility(item.dbFieldName)" type="primary" ghost class="button-text"
@click="clickButtonToUpload(item)">
{{
(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()