Compare commits

...

3 Commits

2 changed files with 9 additions and 11 deletions

View File

@@ -15,12 +15,11 @@ export default {
initial: { initial: {
login_mode: 'auto', login_mode: 'auto',
protocol: this.$route.query.protocol, protocol: this.$route.query.protocol,
username_same_with_user: false,
auto_generate_key: false, auto_generate_key: false,
auto_push: false auto_push: false
}, },
fields: [ fields: [
[this.$t('common.Basic'), ['name', 'login_mode', 'username', 'username_same_with_user', 'priority', 'protocol']], [this.$t('common.Basic'), ['name', 'login_mode', 'username', 'priority', 'protocol']],
[this.$t('common.Auth'), ['update_password', 'password']], [this.$t('common.Auth'), ['update_password', 'password']],
[this.$t('common.Other'), ['comment']] [this.$t('common.Other'), ['comment']]
], ],
@@ -28,7 +27,6 @@ export default {
login_mode: fields.login_mode, login_mode: fields.login_mode,
username: fields.username, username: fields.username,
private_key: fields.private_key, private_key: fields.private_key,
username_same_with_user: fields.username_same_with_user,
protocol: fields.protocol, protocol: fields.protocol,
update_password: fields.update_password, update_password: fields.update_password,
password: fields.password password: fields.password

View File

@@ -27,17 +27,17 @@ function getFields() {
}, },
rules: [Object.assign({}, Required)], rules: [Object.assign({}, Required)],
hidden: (form) => { hidden: (form) => {
if (form.login_mode === 'manual' || form.username_same_with_user) { if (['mysql', 'postgresql', 'mariadb', 'oracle'].includes(form.protocol)) {
this.fieldsMeta.username.rules[0].required = false
} else {
this.fieldsMeta.username.rules[0].required = true this.fieldsMeta.username.rules[0].required = true
return
} }
if (['vnc'].includes(form.protocol)) {
this.fieldsMeta.username.rules[0].required = false
return
}
this.fieldsMeta.username.rules[0].required = !(form.login_mode === 'manual' || form.username_same_with_user)
if (form.username_same_with_user) { this.fieldsMeta.username.el.disabled = !!form.username_same_with_user
this.fieldsMeta.username.el.disabled = true
} else {
this.fieldsMeta.username.el.disabled = false
}
} }
} }