mirror of
https://github.com/jumpserver/lina.git
synced 2026-05-17 04:47:38 +00:00
fix(perms): refresh asset permission list after relation changes
This commit is contained in:
@@ -65,7 +65,8 @@ export default {
|
||||
const url = `/api/v1/perms/asset-permissions-assets-relations/?assetpermission=${this.object.id}&asset=${cellValue}`
|
||||
this.$axios.delete(url).then(res => {
|
||||
this.$message.success(this.$tc('DeleteSuccessMsg'))
|
||||
this.$store.commit('common/reload')
|
||||
this.$emit('relation-changed')
|
||||
reload()
|
||||
}).catch(error => {
|
||||
this.$message.error(this.$tc('DeleteErrorMsg') + ' ' + error)
|
||||
})
|
||||
@@ -103,7 +104,8 @@ export default {
|
||||
onAddSuccess: (items, that) => {
|
||||
this.$log.debug('AssetSelect value', that.assets)
|
||||
this.$message.success(this.$tc('UpdateSuccessMsg'))
|
||||
this.$store.commit('common/reload')
|
||||
this.$emit('relation-changed')
|
||||
this.$refs.ListTable.reloadTable()
|
||||
}
|
||||
},
|
||||
nodeRelationConfig: {
|
||||
@@ -131,6 +133,7 @@ export default {
|
||||
this.$log.debug('Select value', that.select2.value)
|
||||
that.iHasObjects = [...that.iHasObjects, ...objects]
|
||||
that.$refs.select2.clearSelected()
|
||||
this.$emit('relation-changed')
|
||||
this.$message.success(this.$tc('UpdateSuccessMsg'))
|
||||
this.$refs.ListTable.reloadTable()
|
||||
},
|
||||
@@ -148,6 +151,7 @@ export default {
|
||||
this.$log.debug('disabled values remove index: ', i)
|
||||
that.select2.disabledValues.splice(i, 1)
|
||||
}
|
||||
this.$emit('relation-changed')
|
||||
this.$message.success(this.$tc('DeleteSuccessMsg'))
|
||||
this.$refs.ListTable.reloadTable()
|
||||
}
|
||||
|
||||
@@ -55,7 +55,8 @@ export default {
|
||||
const url = `/api/v1/perms/asset-permissions-users-relations/?assetpermission=${this.object.id}&user=${cellValue}`
|
||||
this.$axios.delete(url).then(res => {
|
||||
this.$message.success(this.$tc('DeleteSuccessMsg'))
|
||||
this.$store.commit('common/reload')
|
||||
this.$emit('relation-changed')
|
||||
reload()
|
||||
}).catch(error => {
|
||||
this.$message.error(this.$tc('DeleteErrorMsg') + ' ' + error)
|
||||
})
|
||||
@@ -103,6 +104,7 @@ export default {
|
||||
this.$log.debug('Select value', that.select2.value)
|
||||
that.iHasObjects = [...that.iHasObjects, ...objects]
|
||||
that.$refs.select2.clearSelected()
|
||||
this.$emit('relation-changed')
|
||||
this.$refs.ListTable.reloadTable()
|
||||
}
|
||||
},
|
||||
@@ -133,6 +135,7 @@ export default {
|
||||
onAddSuccess: (objects, that) => {
|
||||
that.iHasObjects = [...that.iHasObjects, ...objects]
|
||||
that.$refs.select2.clearSelected()
|
||||
this.$emit('relation-changed')
|
||||
this.$message.success(this.$tc('UpdateSuccessMsg'))
|
||||
this.$refs.ListTable.reloadTable()
|
||||
},
|
||||
@@ -144,6 +147,7 @@ export default {
|
||||
this.$log.debug('disabled values remove index: ', i)
|
||||
that.select2.disabledValues.splice(i, 1)
|
||||
}
|
||||
this.$emit('relation-changed')
|
||||
this.$message.success(this.$tc('DeleteSuccessMsg'))
|
||||
this.$refs.ListTable.reloadTable()
|
||||
}
|
||||
|
||||
@@ -7,7 +7,11 @@
|
||||
@tab-click="handleTabClick"
|
||||
>
|
||||
<keep-alive>
|
||||
<component :is="config.activeMenu" :object="AssetPermission" />
|
||||
<component
|
||||
:is="config.activeMenu"
|
||||
:object="AssetPermission"
|
||||
@relation-changed="handleRelationChanged"
|
||||
/>
|
||||
</keep-alive>
|
||||
</GenericDetailPage>
|
||||
</template>
|
||||
@@ -30,6 +34,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
relationChanged: false,
|
||||
AssetPermission: {
|
||||
name: '',
|
||||
users_amount: 0,
|
||||
@@ -67,7 +72,16 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
// 当弹窗关闭时,如果关联发生变化,通知父级列表局部刷新
|
||||
if (this.relationChanged) {
|
||||
this.$emit('relation-change')
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleRelationChanged() {
|
||||
this.relationChanged = true
|
||||
},
|
||||
handleTabClick(tab) {
|
||||
if (tab.name !== 'AssetPermissionDetail') {
|
||||
this.$set(this.config, 'hasRightSide', false)
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
:tree-setting="treeSetting"
|
||||
:quick-filters="quickFilter"
|
||||
:create-drawer="createDrawer"
|
||||
@relation-change="handleRelationChange"
|
||||
/>
|
||||
<PermBulkUpdateDialog
|
||||
:visible.sync="updateSelectedDialogSetting.visible"
|
||||
@@ -141,6 +142,10 @@ export default {
|
||||
}, 500)
|
||||
},
|
||||
methods: {
|
||||
handleRelationChange() {
|
||||
this.$log.debug('Asset permission relation changed, reloading table')
|
||||
this.$refs.AssetTreeTable.$refs.TreeList.$refs?.ListTable?.reloadTable()
|
||||
},
|
||||
handlePermBulkUpdate() {
|
||||
this.updateSelectedDialogSetting.visible = false
|
||||
this.$refs.AssetTreeTable.$refs.TreeList.$refs?.ListTable?.reloadTable()
|
||||
|
||||
Reference in New Issue
Block a user