From 8489d94643e084bb1db04084ce5dbe8016b42f96 Mon Sep 17 00:00:00 2001 From: jiangweidong Date: Tue, 16 May 2023 16:17:36 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E9=9D=9E=E6=9C=AC=E5=9C=B0=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E6=97=A0=E6=B3=95=E8=A7=A3=E7=BB=91=E9=A3=9E=E4=B9=A6?= =?UTF-8?q?=E3=80=81=E4=BC=81=E4=B8=9A=E5=BE=AE=E4=BF=A1=E3=80=81=E9=92=89?= =?UTF-8?q?=E9=92=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/QuickActions/action.vue | 27 ++++++++++++++++---------- src/i18n/langs/en.json | 1 + src/i18n/langs/ja.json | 1 + src/i18n/langs/zh.json | 1 + src/views/profile/ProfileInfo.vue | 18 ++++++++++++++--- 5 files changed, 35 insertions(+), 13 deletions(-) diff --git a/src/components/QuickActions/action.vue b/src/components/QuickActions/action.vue index 86b24d9ad..d9a0afed7 100644 --- a/src/components/QuickActions/action.vue +++ b/src/components/QuickActions/action.vue @@ -2,16 +2,23 @@ {{ action.title }}: - - - {{ label }} - - + + + + {{ label }} + + + diff --git a/src/i18n/langs/en.json b/src/i18n/langs/en.json index 5e73fd09f..8423c7eae 100644 --- a/src/i18n/langs/en.json +++ b/src/i18n/langs/en.json @@ -1733,6 +1733,7 @@ "UpdateNodeAssetHardwareInfo": "Update node asset hardware information" }, "users": { + "UnbindHelpText": "The user is not a local user and cannot be unbound. Contact the administrator", "SetStatus": "Set status", "Set": "Set", "NotSet": "Not set", diff --git a/src/i18n/langs/ja.json b/src/i18n/langs/ja.json index 951a4504f..05b8eed52 100644 --- a/src/i18n/langs/ja.json +++ b/src/i18n/langs/ja.json @@ -1725,6 +1725,7 @@ "UpdateNodeAssetHardwareInfo": "ノード資産ハードウェア情報の更新" }, "users": { + "UnbindHelpText": "このユーザーはローカルユーザーではありませんので、解除できません。管理者に連絡してください。", "SetStatus": "ステータスの設定", "Set": "設定", "NotSet": "未設定", diff --git a/src/i18n/langs/zh.json b/src/i18n/langs/zh.json index 8ed068b09..d560e569f 100644 --- a/src/i18n/langs/zh.json +++ b/src/i18n/langs/zh.json @@ -1720,6 +1720,7 @@ "UpdateNodeAssetHardwareInfo": "更新节点资产硬件信息" }, "users": { + "UnbindHelpText": "此用户非本地用户,无法进行解绑,请联系管理员", "SetStatus": "设置状态", "Set": "已设置", "NotSet": "未设置", diff --git a/src/views/profile/ProfileInfo.vue b/src/views/profile/ProfileInfo.vue index 245ad6f2f..d33f04eab 100644 --- a/src/views/profile/ProfileInfo.vue +++ b/src/views/profile/ProfileInfo.vue @@ -63,7 +63,10 @@ export default { title: this.$t('users.setWeCom'), attrs: { type: 'primary', - label: this.$store.state.users.profile.wecom_id ? this.$t('common.unbind') : this.$t('common.bind') + label: this.$store.state.users.profile.wecom_id ? this.$t('common.unbind') : this.$t('common.bind'), + disabled: this.isComponentDisabled('wecom_id'), + showTip: this.isComponentDisabled('wecom_id'), + tip: this.$t('users.UnbindHelpText') }, has: this.$store.getters.publicSettings.AUTH_WECOM, callbacks: { @@ -77,7 +80,10 @@ export default { title: this.$t('users.setDingTalk'), attrs: { type: 'primary', - label: this.$store.state.users.profile.dingtalk_id ? this.$t('common.unbind') : this.$t('common.bind') + label: this.$store.state.users.profile.dingtalk_id ? this.$t('common.unbind') : this.$t('common.bind'), + disabled: this.isComponentDisabled('dingtalk_id'), + showTip: this.isComponentDisabled('dingtalk_id'), + tip: this.$t('users.UnbindHelpText') }, has: this.$store.getters.publicSettings.AUTH_DINGTALK, callbacks: { @@ -91,7 +97,10 @@ export default { title: this.$t('users.setFeiShu'), attrs: { type: 'primary', - label: this.$store.state.users.profile.feishu_id ? this.$t('common.unbind') : this.$t('common.bind') + label: this.$store.state.users.profile.feishu_id ? this.$t('common.unbind') : this.$t('common.bind'), + disabled: this.isComponentDisabled('feishu_id'), + showTip: this.isComponentDisabled('feishu_id'), + tip: this.$t('users.UnbindHelpText') }, has: this.$store.getters.publicSettings.AUTH_FEISHU, callbacks: { @@ -300,6 +309,9 @@ export default { } }, methods: { + isComponentDisabled(source) { + return !!this.$store.state.users.profile[source] && this.$store.state.users.profile.source.value !== 'local' + }, updateUserReceiveBackends(val) { this.$axios.patch( `/api/v1/notifications/user-msg-subscription/${this.object.id}/`,