From 9d62614ff472bc78ee0e32de5a06a8b28dd328f3 Mon Sep 17 00:00:00 2001 From: jym503558564 <503558564@qq.com> Date: Tue, 20 Oct 2020 12:30:23 +0800 Subject: [PATCH] =?UTF-8?q?perf(formatterPassword):=20=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E7=94=A8=E6=88=B7=E3=80=81=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=AF=86=E7=A0=81=E7=BB=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AdminUser/AdminUserCreateUpdate.vue | 21 +++++++++++++++++-- .../SystemUser/SystemUserCreateUpdate.vue | 20 +++++++++++++----- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/src/views/assets/AdminUser/AdminUserCreateUpdate.vue b/src/views/assets/AdminUser/AdminUserCreateUpdate.vue index 383667d4c..daa2b6f46 100644 --- a/src/views/assets/AdminUser/AdminUserCreateUpdate.vue +++ b/src/views/assets/AdminUser/AdminUserCreateUpdate.vue @@ -17,7 +17,8 @@ export default { }, fields: [ - [this.$t('common.Basic'), ['name', 'username', 'password', 'private_key', 'comment']] + [this.$t('common.Basic'), ['name', 'username', 'update_password', 'password', 'private_key']], + [this.$t('common.Other'), ['comment']] ], fieldsMeta: { name: { @@ -30,8 +31,24 @@ export default { placeholder: this.$t('common.Username') } }, + update_password: { + label: this.$t('users.UpdatePassword'), + type: 'checkbox', + hidden: (formValue) => { + if (formValue.update_password) { + return true + } + return !this.$route.params.id + } + }, password: { - helpText: this.$t('common.passwordOrPassphrase') + helpText: this.$t('common.passwordOrPassphrase'), + hidden: (formValue) => { + if (!this.$route.params.id) { + return false + } + return !formValue.update_password + } }, private_key: { component: Uploadkey diff --git a/src/views/assets/SystemUser/SystemUserCreateUpdate.vue b/src/views/assets/SystemUser/SystemUserCreateUpdate.vue index 3145ddf6c..1bf7ed6bf 100644 --- a/src/views/assets/SystemUser/SystemUserCreateUpdate.vue +++ b/src/views/assets/SystemUser/SystemUserCreateUpdate.vue @@ -30,7 +30,7 @@ export default { fields: [ [this.$t('common.Basic'), ['name', 'login_mode', 'username', 'username_same_with_user', 'priority', 'protocol']], [this.$t('assets.AutoPush'), ['auto_push', 'sudo', 'shell', 'home', 'system_groups']], - [this.$t('common.Auth'), ['auto_generate_key', 'password', 'private_key', 'token']], + [this.$t('common.Auth'), ['auto_generate_key', 'update_password', 'password', 'private_key', 'token']], [this.$t('common.Command filter'), ['cmd_filters']], [this.$t('common.Other'), ['sftp_root', 'comment']] ], @@ -175,16 +175,26 @@ export default { helpText: this.$t('assets.SudoHelpMessage'), hidden: (item) => item.protocol !== 'ssh' || !item.auto_push }, + update_password: { + label: this.$t('users.UpdatePassword'), + type: 'checkbox', + hidden: (formValue) => { + if (formValue.update_password) { + return true + } + return !this.$route.params.id + } + }, password: { helpText: this.$t('assets.PasswordHelpMessage'), hidden: form => { - if (form.login_mode !== 'auto') { + if (form.login_mode !== 'auto' || form.protocol === 'k8s' || form.auto_generate_key) { return true } - if (form.protocol === 'k8s') { - return true + if (!this.$route.params.id) { + return false } - return form.auto_generate_key === true + return !form.update_password } }, shell: {