From ba109da3245cda62d3e85d21e37a65fc5d7ca96f Mon Sep 17 00:00:00 2001 From: wangruidong <940853815@qq.com> Date: Thu, 1 Feb 2024 18:00:44 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E7=A6=81=E6=AD=A2=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E8=87=AA=E8=BA=AB=E6=9B=B4=E6=96=B0=E8=87=AA=E5=B7=B1=E7=9A=84?= =?UTF-8?q?=E6=9F=90=E4=BA=9B=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/render-form-item.vue | 9 ++++----- src/i18n/langs/en.json | 3 ++- src/i18n/langs/ja.json | 3 ++- src/i18n/langs/zh.json | 3 ++- src/views/users/User/UserCreateUpdate.vue | 15 ++++++++++++++- 5 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/components/Form/DataForm/components/el-form-renderer/components/render-form-item.vue b/src/components/Form/DataForm/components/el-form-renderer/components/render-form-item.vue index 7f397c5c4..5d1be1318 100755 --- a/src/components/Form/DataForm/components/el-form-renderer/components/render-form-item.vue +++ b/src/components/Form/DataForm/components/el-form-renderer/components/render-form-item.vue @@ -7,13 +7,11 @@ v-bind="data.attrs" >
diff --git a/src/i18n/langs/en.json b/src/i18n/langs/en.json index b6eb66aaf..8f2eaddae 100644 --- a/src/i18n/langs/en.json +++ b/src/i18n/langs/en.json @@ -2116,7 +2116,8 @@ "passwordWillExpiredPrefixMsg": "The password will expire in ", "passwordWillExpiredSuffixMsg": " days.Please change your password as soon as possible.", "dateLastLogin": "Date last login", - "AddAllMembersWarningMsg": "Are you sure you want to add all members?" + "AddAllMembersWarningMsg": "Are you sure you want to add all members?", + "disallowSelfUpdateFields": "Not allowed to modify the current fields oneself" }, "notifications": { "MessageType": "Message Type", diff --git a/src/i18n/langs/ja.json b/src/i18n/langs/ja.json index 2095a291a..bfe341f78 100644 --- a/src/i18n/langs/ja.json +++ b/src/i18n/langs/ja.json @@ -2105,7 +2105,8 @@ "passwordExpired": "パスワードが期限切れです", "passwordWillExpiredPrefixMsg": "パスワードはまもなく", "passwordWillExpiredSuffixMsg": "期限が切れた後、できるだけ早くパスワードを変更してください。", - "AddAllMembersWarningMsg": "すべてのメンバーを追加してもよろしいですか?" + "AddAllMembersWarningMsg": "すべてのメンバーを追加してもよろしいですか?", + "disallowSelfUpdateFields": "現在のフィールドを自分で変更することは許可されていません" }, "notifications": { "MessageType": "メッセージタイプ", diff --git a/src/i18n/langs/zh.json b/src/i18n/langs/zh.json index 96ec6c6bd..a16afb5d0 100644 --- a/src/i18n/langs/zh.json +++ b/src/i18n/langs/zh.json @@ -2099,7 +2099,8 @@ "SetPublicKey": "设置SSH公钥", "passwordExpired": "密码过期了", "passwordWillExpiredPrefixMsg": "密码即将在 ", - "passwordWillExpiredSuffixMsg": "天 后过期,请尽快修改您的密码。" + "passwordWillExpiredSuffixMsg": "天 后过期,请尽快修改您的密码。", + "disallowSelfUpdateFields": "不允许自己修改当前字段" }, "notifications": { "MessageType": "消息类型", diff --git a/src/views/users/User/UserCreateUpdate.vue b/src/views/users/User/UserCreateUpdate.vue index d6f987313..88a830431 100644 --- a/src/views/users/User/UserCreateUpdate.vue +++ b/src/views/users/User/UserCreateUpdate.vue @@ -133,6 +133,7 @@ export default { }, org_roles: { component: Select2, + label: this.$t('users.OrgRoles'), rules: this.$store.getters.currentOrgIsRoot ? [] : [rules.RequiredChange], el: { multiple: true, @@ -164,6 +165,10 @@ export default { }, phone: { component: PhoneInput + }, + is_active: { + label: this.$t('users.IsActive'), + el: {} } }, submitMethod() { @@ -200,7 +205,7 @@ export default { } }, computed: { - ...mapGetters(['currentOrgIsRoot']) + ...mapGetters(['currentOrgIsRoot', 'currentUser']) }, async mounted() { if (this.currentOrgIsRoot) { @@ -212,6 +217,14 @@ export default { methods: { afterGetUser(user) { this.user = user + if (this.user.id === this.currentUser.id) { + const fieldsToUpdate = ['system_roles', 'org_roles', 'is_active'] + fieldsToUpdate.forEach(field => { + const msg = this.$t('users.disallowSelfUpdateFields', { attr: this.fieldsMeta[field]['label'] }) + this.fieldsMeta[field].el.disabled = true + this.fieldsMeta[field].helpTips = msg + }) + } this.fieldsMeta.password.el.userIsOrgAdmin = user['is_org_admin'] if (this.$route.query.clone_from) { this.user.groups = []