mirror of
https://github.com/jumpserver/lina.git
synced 2026-01-29 21:28:52 +00:00
Merge branch 'v3' of github.com:jumpserver/lina into v3
This commit is contained in:
@@ -82,14 +82,13 @@ export default {
|
||||
},
|
||||
addAccount(form) {
|
||||
const data = { asset: this.asset.id, ...form }
|
||||
this.$axios.post(`/api/v1/assets/accounts/`, data)
|
||||
.then(() => {
|
||||
this.iVisible = false
|
||||
this.$emit('add', true)
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message.error(this.$tc('common.createErrorMsg'))
|
||||
})
|
||||
this.$axios.post(`/api/v1/assets/accounts/`, data).then(() => {
|
||||
this.iVisible = false
|
||||
this.$emit('add', true)
|
||||
this.$message.success(this.$t('common.createSuccessMsg'))
|
||||
}).catch(() => {
|
||||
this.$message.error(this.$tc('common.createErrorMsg'))
|
||||
})
|
||||
},
|
||||
editAccount(form) {
|
||||
const data = { ...form }
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<AddAccount
|
||||
v-if="showAddDialog"
|
||||
:visible.sync="showAddDialog"
|
||||
:asset="asset"
|
||||
:asset="iAsset"
|
||||
:account="account"
|
||||
@add="addAccountSuccess"
|
||||
/>
|
||||
@@ -26,6 +26,7 @@ import UpdateSecretInfo from './UpdateSecretInfo'
|
||||
import AddAccount from './AddAccount'
|
||||
import { connectivityMeta } from './const'
|
||||
import { openTaskPage } from '@/utils/jms'
|
||||
import { hasUUID } from '@/utils/common'
|
||||
|
||||
export default {
|
||||
name: 'AccountListTable',
|
||||
@@ -73,6 +74,7 @@ export default {
|
||||
showViewSecretDialog: false,
|
||||
showUpdateSecretDialog: false,
|
||||
showAddDialog: false,
|
||||
iAsset: this.asset,
|
||||
account: {},
|
||||
tableConfig: {
|
||||
url: this.url,
|
||||
@@ -213,6 +215,12 @@ export default {
|
||||
url(iNew) {
|
||||
this.$set(this.tableConfig, 'url', iNew)
|
||||
this.$set(this.headerActions.exportOptions, 'url', iNew.replace('/accounts/', '/account-secrets/'))
|
||||
},
|
||||
'$route.query.assets': {
|
||||
immediate: true,
|
||||
handler() {
|
||||
this.hasAccountPermission()
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@@ -232,6 +240,14 @@ export default {
|
||||
},
|
||||
addAccountSuccess() {
|
||||
this.$refs.ListTable.reloadTable()
|
||||
},
|
||||
hasAccountPermission() {
|
||||
const { path, query } = this.$route
|
||||
if (!hasUUID(path)) {
|
||||
const hasPerm = this.$hasPerm('assets.add_account') && !!query.assets
|
||||
this.iAsset = { id: query.assets }
|
||||
this.$set(this.headerActions.extraActions[0], 'can', hasPerm)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user