fix: 全局组织系统用户详情页中禁用添加资产 (#694)

* fix: 去掉组织创建保存并继续按钮

* fix: 全局组织系统用户详情页中禁用添加资产

* fix: 全局组织系统用户详情页中禁用添加资产

* fix: 修复bugs

* fix: 修复bugs

Co-authored-by: Orange <orangemtony@gmail.com>
This commit is contained in:
fit2bot 2021-03-18 20:41:42 +08:00 committed by GitHub
parent 4eb5155aed
commit b88c90bb75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 13 additions and 6 deletions

View File

@ -8,7 +8,7 @@
</tr> </tr>
<tr> <tr>
<td colspan="2"> <td colspan="2">
<el-button :type="type" size="small" @click="addObjects">{{ $t('common.Add') }}</el-button> <el-button :type="type" size="small" :disabled="disabled" @click="addObjects">{{ $t('common.Add') }}</el-button>
</td> </td>
</tr> </tr>
</table> </table>

View File

@ -1,5 +1,5 @@
<template> <template>
<el-button ref="deleteButton" size="mini" type="danger" :disabled="canDelete" @click="onDelete(col, row, cellValue, reload)"> <el-button ref="deleteButton" size="mini" type="danger" :disabled="iDisabled" @click="onDelete(col, row, cellValue, reload)">
<i class="fa fa-minus" /> <i class="fa fa-minus" />
</el-button> </el-button>
</template> </template>
@ -11,8 +11,9 @@ export default {
name: 'DeleteActionFormatter', name: 'DeleteActionFormatter',
extends: BaseFormatter, extends: BaseFormatter,
computed: { computed: {
canDelete() { iDisabled() {
return this.iCanDelete() //
return (this.disabled() || this.$store.getters.currentOrgIsRoot)
} }
}, },
methods: { methods: {
@ -32,7 +33,7 @@ export default {
this.defaultOnDelete(col, row, cellValue, reload) this.defaultOnDelete(col, row, cellValue, reload)
} }
}, },
iCanDelete() { disabled() {
if (this.col.objects === 'all') { if (this.col.objects === 'all') {
return false return false
} }

View File

@ -77,6 +77,7 @@ export default {
name: 'Delete', name: 'Delete',
title: this.$t('common.Delete'), title: this.$t('common.Delete'),
type: 'danger', type: 'danger',
can: !this.$store.getters.currentOrgIsRoot,
callback: (val) => { callback: (val) => {
this.$axios.delete(`/api/v1/assets/system-users-assets-relations/${val.row.id}/`).then(() => { this.$axios.delete(`/api/v1/assets/system-users-assets-relations/${val.row.id}/`).then(() => {
this.$message.success(this.$t('common.deleteSuccessMsg')) this.$message.success(this.$t('common.deleteSuccessMsg'))
@ -190,6 +191,7 @@ export default {
assetRelationConfig: { assetRelationConfig: {
icon: 'fa-edit', icon: 'fa-edit',
title: this.$t('xpack.ChangeAuthPlan.AddAsset'), title: this.$t('xpack.ChangeAuthPlan.AddAsset'),
disabled: this.$store.getters.currentOrgIsRoot,
performAdd: (items, that) => { performAdd: (items, that) => {
const relationUrl = `/api/v1/assets/system-users-assets-relations/` const relationUrl = `/api/v1/assets/system-users-assets-relations/`
const data = [ const data = [

View File

@ -63,6 +63,7 @@ export default {
remoteAppRelationConfig: { remoteAppRelationConfig: {
icon: 'fa-edit', icon: 'fa-edit',
title: this.$t('perms.addApplicationToThisPermission'), title: this.$t('perms.addApplicationToThisPermission'),
disabled: this.$store.getters.currentOrgIsRoot,
objectsAjax: { objectsAjax: {
url: `/api/v1/applications/applications/?category=${this.object.category}&type=${this.object.type}`, url: `/api/v1/applications/applications/?category=${this.object.category}&type=${this.object.type}`,
transformOption: (item) => { transformOption: (item) => {

View File

@ -70,6 +70,7 @@ export default {
icon: 'fa-edit', icon: 'fa-edit',
title: this.$t('perms.addAssetToThisPermission'), title: this.$t('perms.addAssetToThisPermission'),
hasObjectsId: this.object.assets, hasObjectsId: this.object.assets,
disabled: this.$store.getters.currentOrgIsRoot,
canSelect: (row, index) => { canSelect: (row, index) => {
return this.object.assets.indexOf(row.id) === -1 return this.object.assets.indexOf(row.id) === -1
}, },

View File

@ -7,7 +7,7 @@ export const CUSTOM = 'custom'
export const REMOTEAPP_CATEGORY = 'remote_app' export const REMOTEAPP_CATEGORY = 'remote_app'
function hasLicence() { function hasLicence() {
return store.getters.hasLicence return store.getters.hasValidLicense
} }
export const REMOTE_APP = [ export const REMOTE_APP = [

View File

@ -73,6 +73,7 @@ export default {
assetRelationConfig: { assetRelationConfig: {
icon: 'fa-edit', icon: 'fa-edit',
title: this.$t('xpack.ChangeAuthPlan.AddAsset'), title: this.$t('xpack.ChangeAuthPlan.AddAsset'),
disabled: this.$store.getters.currentOrgIsRoot,
canSelect: (row, index) => { canSelect: (row, index) => {
return this.object.assets.indexOf(row.id) === -1 return this.object.assets.indexOf(row.id) === -1
}, },
@ -99,6 +100,7 @@ export default {
return { label: item.full_value, value: item.id } return { label: item.full_value, value: item.id }
} }
}, },
disabled: this.$store.getters.currentOrgIsRoot,
hasObjectsId: this.object.nodes, hasObjectsId: this.object.nodes,
performAdd: (items, that) => { performAdd: (items, that) => {
const relationUrl = `/api/v1/xpack/change-auth-plan/plan/${this.object.id}/` const relationUrl = `/api/v1/xpack/change-auth-plan/plan/${this.object.id}/`