update 管理员判断调整

This commit is contained in:
赵霄
2023-11-23 09:48:02 +08:00
parent 95f94b071e
commit 025a1e8a63
5 changed files with 23 additions and 18 deletions
+2
View File
@@ -14,3 +14,5 @@ window._CONFIG.onlinePreviewDomainURL = 'http://127.0.0.1:8012/onlinePreview'
window._CONFIG.onlyOfficeUrl = 'http://127.0.0.1:8080'
// onlyOffice下载文件地址(暂时没用)
window._CONFIG.onlyOfficeDownloadFileUrl = 'http://localhost:8184/sys/common/download'
// 管理员角色code,英文逗号拼接
window._CONFIG.adminRoleCode = 'admin'
@@ -233,8 +233,9 @@ export default {
computed: {
...mapGetters(['userInfo']),
administrators () {
const adminRoleList = window._CONFIG.adminRoleCode.split(',')
const userRoleList = this.userInfo.roleCode.split(',')
return userRoleList.some(tt => tt === 'admin')
return userRoleList.some(tt => adminRoleList.includes(tt))
}
},
created () {
@@ -102,14 +102,22 @@ import { releaseSplitStandard, changePermission, withdraw } from '@api/documentT
import ImportSplitResultModal from './modules/ImportSplitResultModal.vue'
import UserSelectModal from '../../../components/selection/UserSelectModal.vue'
import { SplitStatus, StandardSource } from '@/enums/commonEnums'
import { mapGetters } from 'vuex'
export default {
name: 'DocumentSplit',
components: { JTable, SplitText, ImportSplitResultModal, UserSelectModal },
mixins: [JeroListMixin],
computed: {
...mapGetters(['userInfo']),
administrators () {
const adminRoleList = window._CONFIG.adminRoleCode.split(',')
const userRoleList = this.userInfo.roleCode.split(',')
return userRoleList.some(tt => adminRoleList.includes(tt))
}
},
data () {
return {
userInfo: this.$store.getters.userInfo,
operationList: [
// 发布
{
@@ -154,7 +162,7 @@ export default {
has: 'split:sarFileSplitInfo:delete',
show: (record) => {
// 创建人(更改权限更改的是这个字段)是当前登录人或用户为管理员,且状态为编辑中可以删除
return (record.createBy === this.userInfo.id || this.userInfo.roleCode.split(',').some(tt => tt === 'admin'))
return (record.createBy === this.userInfo.id || this.administrators)
}
}
],
@@ -238,7 +238,6 @@ export default {
moveUpFlag: false,
fullWidth: '',
parameter: {},
administrators: false,
showAction: false,
flag: '4', // 查询要用到
operateSlotName: 'action',
@@ -297,7 +296,12 @@ export default {
*/
return `calc(100vh - ${this.defaultHeight['user-info-height']} - ${this.defaultHeight['breadcrumb-height']} - ${this.defaultHeight.oneLineOperationHeight} - 48px - 48px - 54px - ${this.isBackTitle ? '56px' : '0px'})`
},
...mapGetters(['userInfo'])
...mapGetters(['userInfo']),
administrators () {
const adminRoleList = window._CONFIG.adminRoleCode.split(',')
const userRoleList = this.userInfo.roleCode.split(',')
return userRoleList.some(tt => adminRoleList.includes(tt))
}
},
mounted () {
this.operateColumn.scopedSlots.customRender = 'action'
@@ -313,14 +317,6 @@ export default {
if (this.needFilterTableBtn) {
this.operationList = this.operationList.filter(item => !item.has || isHasPermission(item.has))
}
this.administrators = false
if (this.userInfo.userRoleList && this.userInfo.userRoleList.length > 0) {
this.userInfo.userRoleList.forEach(res => {
if (res.roleCode === 'admin') {
this.administrators = true
}
})
}
this.infoId = this.$route.query.infoId
this.loadMenuData()
},
@@ -77,11 +77,9 @@ export default {
...mapGetters(['userInfo']),
// 是否管理员
isAdmin () {
const roleList = this.userInfo.roleCode.split(',')
if (roleList && roleList.length > 0 && roleList.some(tt => tt === 'admin')) {
return true
}
return false
const adminRoleList = window._CONFIG.adminRoleCode.split(',')
const userRoleList = this.userInfo.roleCode.split(',')
return userRoleList.some(tt => adminRoleList.includes(tt))
}
},
data () {