diff --git a/src/components/FormFields/ProtocolSelector/ProtocolSettingDialog.vue b/src/components/FormFields/ProtocolSelector/ProtocolSettingDialog.vue index 76acf6508..7e6232f3a 100644 --- a/src/components/FormFields/ProtocolSelector/ProtocolSettingDialog.vue +++ b/src/components/FormFields/ProtocolSelector/ProtocolSettingDialog.vue @@ -11,7 +11,7 @@ @open="onOpen" v-on="$listeners" > - + 继承自平台配置,如需更改,请更改平台中的配置 查看 @@ -19,7 +19,7 @@ @@ -41,7 +41,7 @@ export default { }, disabled: { type: Boolean, - default: true + default: false } }, data() { @@ -52,8 +52,7 @@ export default { }, loading: true, form: {}, - iDisabled: this.disabled, - platformDetail: '#/console/assets/platforms/' + this.$route.query['platform'], + platformDetail: '#/console/assets/platforms/' + this.$route.query.platform, config: { hasSaveContinue: false, hasButtons: !this.disabled, diff --git a/src/views/assets/Asset/AssetCreateUpdate/HostCreateUpdate.vue b/src/views/assets/Asset/AssetCreateUpdate/HostCreateUpdate.vue index e3d67e4e3..7c2702c13 100644 --- a/src/views/assets/Asset/AssetCreateUpdate/HostCreateUpdate.vue +++ b/src/views/assets/Asset/AssetCreateUpdate/HostCreateUpdate.vue @@ -56,10 +56,13 @@ export default { nodes: nodesInitial } Object.assign(this.initial, initial) - this.fieldsMeta.protocols.el.choices = this.platform['protocols'] - if (this.platform.domain_enabled === false) { - this.fieldsMeta.domain.hidden = () => true + const hiddenCheckFields = ['protocols', 'domain'] + for (const field of hiddenCheckFields) { + if (this.platform[field + '_enabled'] === false) { + this.fieldsMeta[field].hidden = () => true + } } + this.fieldsMeta.protocols.el.choices = this.platform['protocols'] } } } diff --git a/src/views/assets/Asset/AssetDetail/index.vue b/src/views/assets/Asset/AssetDetail/index.vue index fc437be7e..ba3ca655f 100644 --- a/src/views/assets/Asset/AssetDetail/index.vue +++ b/src/views/assets/Asset/AssetDetail/index.vue @@ -1,7 +1,12 @@ @@ -25,7 +30,7 @@ export default { }, data() { return { - TaskDetail: {}, + asset: {}, config: { activeMenu: 'Detail', submenu: [ @@ -55,11 +60,12 @@ export default { }, actions: { updateCallback: () => { - const category = this.TaskDetail.category.value || 'host' + const category = this.asset.category.value || 'host' const routerName = _.capitalize(category) + 'Update' this.$router.push({ name: routerName, - params: { id: this.$route.params.id } + params: { id: this.$route.params.id }, + query: { platform: this.asset.platform.id } }) } } diff --git a/src/views/assets/Asset/AssetList/components/BaseList.vue b/src/views/assets/Asset/AssetList/components/BaseList.vue index 0058669c8..4a753f1b8 100644 --- a/src/views/assets/Asset/AssetList/components/BaseList.vue +++ b/src/views/assets/Asset/AssetList/components/BaseList.vue @@ -60,12 +60,22 @@ export default { data() { const vm = this const onAction = (row, action) => { - const routeName = _.capitalize(row.category.value) + action - vm.$router.push({ + let routeAction = action + if (action === 'Clone') { + routeAction = 'Create' + } + const routeName = _.capitalize(row.category.value) + routeAction + const route = { name: routeName, params: { id: row.id }, - ...(action === 'Create' && { query: { clone_from: row.id }}) - }) + query: {} + } + if (action === 'Clone') { + route.query.clone_from = row.id + } else if (action === 'Update') { + route.query.platform = row.platform.id + } + vm.$router.push(route) } return { showPlatform: false, @@ -109,15 +119,6 @@ export default { sortable: 'custom', width: '140px' }, - hardware_info: { - showOverflowTooltip: true - }, - cpu_model: { - showOverflowTooltip: true - }, - sn: { - showOverflowTooltip: true - }, comment: { showOverflowTooltip: true }, @@ -129,7 +130,7 @@ export default { formatter: ActionsFormatter, formatterArgs: { onUpdate: ({ row }) => onAction(row, 'Update'), - onClone: ({ row }) => onAction(row, 'Create'), + onClone: ({ row }) => onAction(row, 'Clone'), performDelete: ({ row }) => { const id = row.id const url = `/api/v1/assets/assets/${id}/`