diff --git a/src/components/Apps/AccountCreateUpdateForm/const.js b/src/components/Apps/AccountCreateUpdateForm/const.js index cb3fac519..f9a481ffa 100644 --- a/src/components/Apps/AccountCreateUpdateForm/const.js +++ b/src/components/Apps/AccountCreateUpdateForm/const.js @@ -165,15 +165,16 @@ export const accountFieldsMeta = (vm) => { params: { label: vm.$t('assets.PushParams'), component: AutomationParamsForm, - el: { - method: vm.asset?.auto_config?.push_account_method - }, + el: {}, hidden: (formValue) => { const automation = vm.iPlatform.automation || {} + vm.fieldsMeta.params.el.method = vm.iPlatform.automation.push_account_method + vm.fieldsMeta.params.el.pushAccountParams = vm.iPlatform.automation.push_account_params return !formValue.push_now || !automation.push_account_enabled || !automation.ansible_enabled || - (formValue.secret_type === 'ssh_key' && vm.iPlatform.type.value === 'windows') || + (formValue.secret_type === 'ssh_key' && + vm.iPlatform.type.value === 'windows') || !vm.$hasPerm('accounts.push_account') || vm.addTemplate } diff --git a/src/views/assets/Platform/AutomationParamsSetting.vue b/src/views/assets/Platform/AutomationParamsSetting.vue index d3294fb8b..ff37eb74d 100644 --- a/src/views/assets/Platform/AutomationParamsSetting.vue +++ b/src/views/assets/Platform/AutomationParamsSetting.vue @@ -70,6 +70,10 @@ export default { type: String, default: '' }, + pushAccountParams: { + type: Object, + default: () => ({}) + }, visible: { type: Boolean, default: false @@ -135,6 +139,7 @@ export default { fieldsMeta: {} } + const param = this.pushAccountParams[method] if (Object.keys(filterField?.children || {}).length > 0) { for (const [k, v] of Object.entries(filterField.children)) { let component = 'el-input' @@ -143,6 +148,8 @@ export default { component = DynamicInput break } + + v.default = param[k] || v.default const item = { ...v, component: component } fieldsMeta[method].fields.push(k) fieldsMeta[method].fieldsMeta[k] = item