From be657fcfa1092f7cc6d67c472796d18f3727e3e0 Mon Sep 17 00:00:00 2001 From: lhzzforever Date: Mon, 3 Jun 2024 12:35:07 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E5=B7=B2=E5=85=B3=E8=81=94=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=BB=84=E7=9A=84=E4=BA=BA=E5=91=98=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=9C=A8=E6=89=B9=E9=87=8F=E5=88=A0=E9=99=A4=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99=E5=8F=AF=E4=BB=A5=E6=88=90=E5=8A=9F=E8=A2=AB=E5=88=A0?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/language/lang/en.js | 7 +- frontend/src/language/lang/zh.js | 7 +- frontend/src/views/group/index.vue | 79 ++++++++---- frontend/src/views/member-template/index.vue | 127 +++++++++++++++---- 4 files changed, 170 insertions(+), 50 deletions(-) diff --git a/frontend/src/language/lang/en.js b/frontend/src/language/lang/en.js index 41939b413..3b11ecc05 100644 --- a/frontend/src/language/lang/en.js +++ b/frontend/src/language/lang/en.js @@ -1486,7 +1486,12 @@ export const m = { '请输入用户/组织,按enter键搜索': 'Please enter user/organization, press enter to search', '只读人员模板不能移除': 'The read-only member template cannot be removed', '只读人员模板不能添加、删除、复制成员': 'Read-only member template cannot add, delete, or copy members', - '最多只能选择10个人员模板' : 'You can only select up to 10 member templates' + '最多只能选择10个人员模板' : 'You can only select up to 10 member templates', + '请勾选人员模板': 'Please check personnel template', + '当前勾选项皆为只读人员模板': 'The current options are all read-only member templates', + '当前勾选项皆为有关联用户组人员模板': 'The current options are all associated user group member templates', + '当前勾选项皆为只读和有关联用户组人员模板': 'The current options are all read-only and have associated user group member templates', + '以下为只读或有关联用户组的人员模板,不可删除。': 'The following personnel templates are read-only or have associated user groups and cannot be deleted.' }, userOrOrg: { '用户组名': 'User group name', diff --git a/frontend/src/language/lang/zh.js b/frontend/src/language/lang/zh.js index e10764a87..05a80997d 100644 --- a/frontend/src/language/lang/zh.js +++ b/frontend/src/language/lang/zh.js @@ -1489,7 +1489,12 @@ export const m = { '请输入用户/组织,按enter键搜索': '请输入用户/组织,按enter键搜索', '只读人员模板不能移除': '只读人员模板不能移除', '只读人员模板不能添加、删除、复制成员': '只读人员模板不能添加、删除、复制成员', - '最多只能选择10个人员模板': '最多只能选择10个人员模板' + '最多只能选择10个人员模板': '最多只能选择10个人员模板', + '请勾选人员模板': '请勾选人员模板', + '当前勾选项皆为只读人员模板': '当前勾选项皆为只读人员模板', + '当前勾选项皆为有关联用户组人员模板': '当前勾选项皆为有关联用户组人员模板', + '当前勾选项皆为只读和有关联用户组人员模板': '当前勾选项皆为只读和有关联用户组人员模板', + '以下为只读或有关联用户组的人员模板,不可删除。': '以下为只读或有关联用户组的人员模板,不可删除。' }, userOrOrg: { '用户组名': '用户组名', diff --git a/frontend/src/views/group/index.vue b/frontend/src/views/group/index.vue index a87619f34..8a3344a01 100644 --- a/frontend/src/views/group/index.vue +++ b/frontend/src/views/group/index.vue @@ -182,14 +182,19 @@ > {{ $t(`m.common['添加成员']`) }} - - {{ $t(`m.common['添加权限']`) }} - + + + {{ $t(`m.common['添加权限']`) }} + + 0; - }, - isRatingManager () { - return ['rating_manager', 'subset_manager'].includes(this.curRole); - }, - isSuperManager () { - return this.curRole === 'super_manager'; - }, - curSelectIds () { - return this.currentSelectList.map((item) => item.id); + ...mapGetters(['user', 'showNoviceGuide', 'externalSystemId']), + isCanEditProcess () { + return this.currentSelectList.length > 0; + }, + isRatingManager () { + return ['rating_manager', 'subset_manager'].includes(this.curRole); + }, + isSuperManager () { + return this.curRole === 'super_manager'; + }, + curSelectIds () { + return this.currentSelectList.map((item) => item.id); + }, + isBatchDisabled () { + if (this.currentSelectList.length) { + const isDisabled = this.currentSelectList.every(item => item.readonly); + return isDisabled; + } else { + return true; + } + }, + formatDisabledAddPerm () { + return (payload, type) => { + const typeMap = { + title: () => { + if (payload.attributes && payload.attributes.source_from_role) { + return this.$t(`m.userGroup['管理员组无法添加权限']`); + } + if (payload.readonly) { + return this.$t(`m.userGroup['只读用户组无法添加权限']`); + } + return ''; }, - isBatchDisabled () { - if (this.currentSelectList.length) { - const isDisabled = this.currentSelectList.every(item => item.readonly); - return isDisabled; - } else { + disabled: () => { + if (payload.readonly || (payload.attributes && payload.attributes.source_from_role)) { return true; } + return false; } + }; + if (typeMap[type]) { + return typeMap[type](); + } + }; + } }, watch: { 'pagination.current' (value) { diff --git a/frontend/src/views/member-template/index.vue b/frontend/src/views/member-template/index.vue index ea619a96b..5054d8b52 100644 --- a/frontend/src/views/member-template/index.vue +++ b/frontend/src/views/member-template/index.vue @@ -5,12 +5,22 @@ {{ $t(`m.common['新建']`) }} - - {{ $t(`m.common['批量添加成员']`) }} - - - {{ $t(`m.common['批量删除']`) }} - + + + {{ $t(`m.common['批量添加成员']`) }} + + + + + {{ $t(`m.common['批量删除']`) }} + +
- + @@ -185,6 +195,7 @@ searchList: [], searchValue: [], readOnlyGroups: [], + hasRelatedGroups: [], searchData: [ { id: 'name', @@ -244,8 +255,70 @@ }, computed: { ...mapGetters(['user', 'externalSystemId']), - isBatchDisabled () { - return this.currentSelectList.length === 0; + isAllReadOnly () { + return this.currentSelectList.filter((item) => item.readonly).length === this.currentSelectList.length; + }, + isAllRelated () { + return this.currentSelectList.filter((item) => item.group_count > 0).length === this.currentSelectList.length; + }, + isAllDisabled () { + const readOnlyList = this.currentSelectList.filter((item) => item.readonly).map((v) => v.id); + const relatedList = this.currentSelectList.filter( + (item) => item.group_count > 0 && !readOnlyList.includes(item.id)); + if (!this.currentSelectList.length) { + return true; + } + return readOnlyList.length + relatedList.length === this.currentSelectList.length; + }, + isBatchAddMemberDisabled () { + return (payload) => { + const typeMap = { + title: () => { + if (!this.currentSelectList.length) { + return this.$t(`m.memberTemplate['请勾选人员模板']`); + } + if ((this.isAllReadOnly && this.currentSelectList.length > 0)) { + return this.$t(`m.memberTemplate['当前勾选项皆为只读人员模板']`); + } + return ''; + }, + disabled: () => { + if ((this.isAllReadOnly && this.currentSelectList.length > 0) || !this.currentSelectList.length) { + return true; + } + return false; + } + }; + return typeMap[payload](); + }; + }, + isBatchDeleteDisabled () { + return (payload) => { + const typeMap = { + title: () => { + if (!this.currentSelectList.length) { + return this.$t(`m.memberTemplate['请勾选人员模板']`); + } + if (this.isAllReadOnly) { + return this.$t(`m.memberTemplate['当前勾选项皆为只读人员模板']`); + } + if (this.isAllRelated) { + return this.$t(`m.memberTemplate['当前勾选项皆为有关联用户组人员模板']`); + } + if (this.isAllDisabled) { + return this.$t(`m.memberTemplate['当前勾选项皆为只读和有关联用户组人员模板']`); + } + return ''; + }, + disabled: () => { + if (this.isAllReadOnly || this.isAllRelated || this.isAllDisabled || !this.currentSelectList.length) { + return true; + } + return false; + } + }; + return typeMap[payload](); + }; }, isRatingManager () { return ['rating_manager', 'subset_manager'].includes(this.curRole); @@ -284,6 +357,9 @@ }; return typeMap[type](); }; + }, + formatDisableGroup () { + return this.currentSelectList.filter((item) => item.readonly || item.group_count > 0); } }, watch: { @@ -361,7 +437,7 @@ this.fetchSelectedGroupCount(); this.handleOpenDetail(); } catch (e) { - console.error(e); + this.messageAdvancedError(e); } finally { this.tableLoading = false; } @@ -399,7 +475,6 @@ }, async handleSearch (payload, result) { - console.log(payload, result); this.searchParams = payload; this.searchList = result; this.emptyData.tipType = 'search'; @@ -499,7 +574,6 @@ this.resetPagination(); this.fetchMemberTemplateList(true); } catch (e) { - console.error(e); this.messageAdvancedError(e); } finally { this.memberDialogLoading = false; @@ -507,10 +581,7 @@ }, async handleSubmitDelete () { - const selectGroups = this.currentSelectList.filter((item) => !item.readonly); - if (this.readOnlyGroups.length === this.currentSelectList.length) { - return this.messageWarn(this.$t(`m.memberTemplate['当前选择人员模板皆为只读属性,暂无可删除人员模板']`), 3000); - } + const selectGroups = this.currentSelectList.filter((item) => !item.readonly && item.group_count === 0); this.batchQuitLoading = true; try { for (let i = 0; i < selectGroups.length; i++) { @@ -526,7 +597,6 @@ this.resetPagination(); this.fetchMemberTemplateList(true); } catch (e) { - console.error(e); this.messageAdvancedError(e); } finally { this.batchQuitLoading = false; @@ -586,10 +656,11 @@ handleDeleteActions (type) { const typeMap = { delete: () => { - this.isShowDeleteDialog = true; this.delActionDialogTitle = this.$t(`m.dialog['确认批量删除所选的人员模板吗?']`); - this.delActionDialogTip = this.$t(`m.memberTemplate['以下为只读人员模板,不可删除。']`); + this.delActionDialogTip = this.$t(`m.memberTemplate['以下为只读或有关联用户组的人员模板,不可删除。']`); this.readOnlyGroups = this.currentSelectList.filter((item) => item.readonly); + this.hasRelatedGroups = this.currentSelectList.filter((item) => item.group_count > 0); + this.isShowDeleteDialog = true; } }; return typeMap[type](); @@ -665,6 +736,7 @@ handleAfterDeleteLeave () { this.currentActionName = ''; this.readOnlyGroups = []; + this.hasRelatedGroups = []; }, handleCancelDelete () { @@ -759,9 +831,18 @@ background-color: #f2fff4; } - /deep/ .bk-form-checkbox.is-checked .bk-checkbox { - border-color: #3a84ff; - background-color: #3a84ff; + /deep/ .bk-form-checkbox.is-checked { + .bk-checkbox { + border-color: #3a84ff; + background-color: #3a84ff; + &:hover { + background-color: #3a84ff; + } + } + } + + .bk-table-fixed, .bk-table-fixed-right { + border-bottom: 0; } } } From 4e5f41ef55291e3e02d976fa4ecb2bb3e0d46370 Mon Sep 17 00:00:00 2001 From: lhzzforever Date: Mon, 3 Jun 2024 12:39:18 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E6=BC=8F=E7=BC=BA?= =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/language/lang/en.js | 4 +++- frontend/src/language/lang/zh.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/src/language/lang/en.js b/frontend/src/language/lang/en.js index 3b11ecc05..96039f05f 100644 --- a/frontend/src/language/lang/en.js +++ b/frontend/src/language/lang/en.js @@ -896,7 +896,9 @@ export const m = { '设置不可被申请,则无法申请加入此用户组': 'If the setting cannot be applied for, you cannot apply to join this user group', '管理员已设置空间下所有用户组不可被申请': 'The administrator has set that all user groups in the space cannot be applied for', '已选择的用户组成员不需要续期': 'The selected user group members do not need to be renewed', - '自动生成同名人员模板': 'Automatically generate member template with the same name' + '自动生成同名人员模板': 'Automatically generate member template with the same name', + '管理员组无法添加权限': 'Administrators group unable to add permissions', + '只读用户组无法添加权限': 'Read only user group cannot add permissions' }, userGroupDetail: { '用户组名': 'Group name: ', diff --git a/frontend/src/language/lang/zh.js b/frontend/src/language/lang/zh.js index 05a80997d..fa872c744 100644 --- a/frontend/src/language/lang/zh.js +++ b/frontend/src/language/lang/zh.js @@ -896,7 +896,9 @@ export const m = { '设置后该组只能管理员主动授权,用户无法主动申请': '设置后该组只能管理员主动授权,用户无法主动申请', '管理员已设置空间下所有用户组不可被申请': '管理员已设置空间下所有用户组不可被申请', '已选择的用户组成员不需要续期': '已选择的用户组成员不需要续期', - '自动生成同名人员模板': '自动生成同名人员模板' + '自动生成同名人员模板': '自动生成同名人员模板', + '管理员组无法添加权限': '管理员组无法添加权限', + '只读用户组无法添加权限': '只读用户组无法添加权限' }, userGroupDetail: { '用户组名': '用户组名:',