Merge pull request #747 from jumpserver/pr@dev@fix_create_asset_node_lost

fix(assets): 修复选中资产创建时,没有默认选中节点的问题
This commit is contained in:
Orange 2021-04-15 16:19:51 +08:00 committed by GitHub
commit 2bc4b53159
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -100,15 +100,19 @@ export default {
if (this.setting.url.indexOf('?') !== -1) { if (this.setting.url.indexOf('?') !== -1) {
combinator = '&' combinator = '&'
} }
let url = ''
const query = Object.assign({}, this.$route.query)
if (treeNode.meta.type === 'node') { if (treeNode.meta.type === 'node') {
this.currentNode = treeNode this.currentNode = treeNode
this.currentNodeId = treeNode.meta.node.id this.currentNodeId = treeNode.meta.node.id
this.$route.query['node'] = this.currentNodeId query['node'] = this.currentNodeId
this.$emit('urlChange', `${this.setting.url}${combinator}node_id=${treeNode.meta.node.id}&show_current_asset=${show_current_asset}`) url = `${this.setting.url}${combinator}node_id=${treeNode.meta.node.id}&show_current_asset=${show_current_asset}`
} else if (treeNode.meta.type === 'asset') { } else if (treeNode.meta.type === 'asset') {
this.$route.query['asset'] = treeNode.meta.asset.id query['asset'] = treeNode.meta.asset.id
this.$emit('urlChange', `${this.setting.url}${combinator}asset_id=${treeNode.meta.asset.id}&show_current_asset=${show_current_asset}`) url = `${this.setting.url}${combinator}asset_id=${treeNode.meta.asset.id}&show_current_asset=${show_current_asset}`
} }
this.$router.push({ query })
this.$emit('urlChange', url)
}, },
removeTreeNode: function() { removeTreeNode: function() {
this.hideRMenu() this.hideRMenu()
@ -242,7 +246,6 @@ export default {
}) })
}, },
refresh: function() { refresh: function() {
}, },
getSelectedNodes: function() { getSelectedNodes: function() {
return this.zTree.getSelectedNodes() return this.zTree.getSelectedNodes()

View File

@ -72,7 +72,6 @@ export default {
watch: { watch: {
treeConfig: { treeConfig: {
handler(val) { handler(val) {
}, },
deep: true deep: true
} }