From 278629de9caa1f78988f05509b51f60f40a6aee3 Mon Sep 17 00:00:00 2001 From: polo Date: Tue, 9 Nov 2021 10:47:06 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix:=20=E8=BF=87=E6=BB=A4=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/grading-admin/index.vue | 2 -- 1 file changed, 2 deletions(-) diff --git a/frontend/src/views/grading-admin/index.vue b/frontend/src/views/grading-admin/index.vue index 49ffcb95d..eecf02341 100644 --- a/frontend/src/views/grading-admin/index.vue +++ b/frontend/src/views/grading-admin/index.vue @@ -176,8 +176,6 @@ this.isFilter = true } } - this.pagination.current = 1 - this.searchValue = '' }, methods: { showImgDialog () { From 32c743ef0020a34f55277fdff6d304d8088a5c79 Mon Sep 17 00:00:00 2001 From: polo Date: Tue, 9 Nov 2021 22:09:43 +0800 Subject: [PATCH 2/4] feat: add render-action deleteCount --- .../components/render-action.vue | 54 ++++++++++++++++--- .../components/render-content.vue | 2 + .../src/views/perm-template/detail/detail.vue | 24 +++++++-- 3 files changed, 68 insertions(+), 12 deletions(-) diff --git a/frontend/src/views/perm-template/components/render-action.vue b/frontend/src/views/perm-template/components/render-action.vue index c6ea66530..cf4f33b86 100644 --- a/frontend/src/views/perm-template/components/render-action.vue +++ b/frontend/src/views/perm-template/components/render-action.vue @@ -11,7 +11,7 @@
{{ item.name }} - {{$t(`m.common['已选']`)}} {{ item.count }} / {{ item.allCount }} {{ $t(`m.common['个']`) }} + {{$t(`m.common['已选']`)}} {{ item.count }} / {{ item.allCount }} {{ $t(`m.common['个']`) }} 包含{{item.deleteCount}}个需要被删除的操作
@@ -89,10 +91,12 @@ @change="handleSubActionChecked(...arguments, act, subAct, item)">
@@ -239,15 +243,38 @@ } }) const isSubAllChecked = sub.actions.every(v => v.checked) + const subActions = sub.actions.filter(e => !e.disabled) + let isSubAllCheckedData = true + if (subActions.length) { + isSubAllCheckedData = subActions.every(v => v.checked) + } + sub.allChecked = isSubAllChecked + sub.allCheckedData = isSubAllCheckedData }) + const isAllChecked = item.actions.every(v => v.checked) + const actions = item.actions.filter(e => !e.disabled) + let isAllCheckedData = true + if (actions.length) { + isAllCheckedData = actions.every(v => v.checked) + } + + console.log('isAllChecked', isAllChecked) item.allChecked = isAllChecked + item.allCheckedData = isAllCheckedData if (item.sub_groups && item.sub_groups.length > 0) { - item.actionsAllChecked = isAllChecked && item.sub_groups.every(v => v.allChecked) + console.log('isAllChecked && item.sub_groups.every(v => v.allCheckedData)', item.sub_groups.every(v => v.allCheckedData)) + this.$nextTick(() => { + item.actionsAllChecked = isAllCheckedData && item.sub_groups.every(v => v.allCheckedData) + console.log('item.actionsAllChecked', item.actionsAllChecked) + }) } else { - item.actionsAllChecked = isAllChecked + this.$nextTick(() => { + item.actionsAllChecked = isAllCheckedData + }) } + console.log('this.originalCustomTmplList', this.originalCustomTmplList) }) }, @@ -373,7 +400,7 @@ tempActions.forEach(item => { this.handleRelatedActions(item, payload.actionsAllChecked) }) - payload.count = payload.actionsAllChecked ? payload.allCount : 0 + payload.count = payload.actionsAllChecked ? tempActions.length : 0 }, handleActionChecked (newVal, oldVal, val, actData, payload) { @@ -562,6 +589,9 @@ font-weight: normal; color: #979ba5; } + .delete-count{ + color: #ec4545; + } } .check-all { position: relative; @@ -615,6 +645,14 @@ .iam-action-cls { width: 175px; line-height: 36px; + .error-icon { + font-size: 14px; + color: #ffb400; + } + .text-through{ + text-decoration: line-through; + text-decoration-color: #ffb400; + } } .iam-action-all-cls { position: absolute; diff --git a/frontend/src/views/perm-template/components/render-content.vue b/frontend/src/views/perm-template/components/render-content.vue index 89de9067b..4ebd935a5 100644 --- a/frontend/src/views/perm-template/components/render-content.vue +++ b/frontend/src/views/perm-template/components/render-content.vue @@ -460,6 +460,7 @@ item.actions.forEach(act => { this.$set(act, 'checked', ['checked', 'readonly'].includes(act.tag)) this.$set(act, 'disabled', act.tag === 'readonly') + this.$set(act, 'disabled', act.tag === 'delete') linearActions.push(act) if (act.checked) { this.curSelectActions.push(act.id) @@ -477,6 +478,7 @@ sub.actions.forEach(act => { this.$set(act, 'checked', ['checked', 'readonly'].includes(act.tag)) this.$set(act, 'disabled', act.tag === 'readonly') + this.$set(act, 'disabled', act.tag === 'delete') linearActions.push(act) if (act.checked) { this.curSelectActions.push(act.id) diff --git a/frontend/src/views/perm-template/detail/detail.vue b/frontend/src/views/perm-template/detail/detail.vue index fed353ad1..f6b7ac350 100644 --- a/frontend/src/views/perm-template/detail/detail.vue +++ b/frontend/src/views/perm-template/detail/detail.vue @@ -169,16 +169,20 @@ this.$set(item, 'expanded', false) let count = 0 let allCount = 0 + let deleteCount = 0 if (!item.actions) { this.$set(item, 'actions', []) } item.actions.forEach(act => { - this.$set(act, 'checked', ['checked', 'readonly'].includes(act.tag)) + this.$set(act, 'checked', ['checked', 'readonly', 'delete'].includes(act.tag)) this.$set(act, 'disabled', act.tag === 'readonly') if (act.checked) { ++count this.defaultCheckedActions.push(act.id) } + if (act.tag === 'delete') { + ++deleteCount + } ++allCount }) ;(item.sub_groups || []).forEach(sub => { @@ -188,12 +192,15 @@ this.$set(sub, 'actions', []) } sub.actions.forEach(act => { - this.$set(act, 'checked', ['checked', 'readonly'].includes(act.tag)) + this.$set(act, 'checked', ['checked', 'readonly', 'delete'].includes(act.tag)) this.$set(act, 'disabled', act.tag === 'readonly') if (act.checked) { ++count this.defaultCheckedActions.push(act.id) } + if (act.tag === 'delete') { + ++deleteCount + } ++allCount }) @@ -201,6 +208,7 @@ this.$set(sub, 'allChecked', isSubAllChecked) }) + this.$set(item, 'deleteCount', deleteCount) this.$set(item, 'count', count) this.$set(item, 'allCount', allCount) @@ -233,11 +241,12 @@ temps.forEach((item, index) => { this.$set(item, 'expanded', index === 0) let count = 0 + let deleteCount = 0 if (!item.actions) { this.$set(item, 'actions', []) } item.actions.forEach(act => { - this.$set(act, 'checked', ['checked', 'readonly'].includes(act.tag)) + this.$set(act, 'checked', ['checked', 'readonly', 'delete'].includes(act.tag)) this.$set(act, 'disabled', act.tag === 'readonly') if (hasAddActions.includes(act.id)) { this.$set(act, 'checked', true) @@ -250,6 +259,9 @@ if (act.checked) { ++count } + if (act.tag === 'delete') { + ++deleteCount + } }) ;(item.sub_groups || []).forEach(sub => { this.$set(sub, 'expanded', false) @@ -258,7 +270,7 @@ this.$set(sub, 'actions', []) } sub.actions.forEach(act => { - this.$set(act, 'checked', ['checked', 'readonly'].includes(act.tag)) + this.$set(act, 'checked', ['checked', 'readonly', 'delete'].includes(act.tag)) this.$set(act, 'disabled', act.tag === 'readonly') if (hasAddActions.includes(act.id)) { this.$set(act, 'checked', true) @@ -271,12 +283,16 @@ if (act.checked) { ++count } + if (act.tag === 'delete') { + ++deleteCount + } }) const isSubAllChecked = sub.actions.every(v => v.checked) this.$set(sub, 'allChecked', isSubAllChecked) }) + this.$set(item, 'deleteCount', deleteCount) this.$set(item, 'count', count) const isAllChecked = item.actions.every(v => v.checked) From d5e61207714134601637c1a8e54462bb555bdcf3 Mon Sep 17 00:00:00 2001 From: polo Date: Thu, 11 Nov 2021 12:02:11 +0800 Subject: [PATCH 3/4] =?UTF-8?q?feat:=20=E5=AE=8C=E6=88=90=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=88=86=E7=BA=A7=E7=AE=A1=E7=90=86=E5=91=98=E6=8E=88?= =?UTF-8?q?=E6=9D=83=E8=8C=83=E5=9B=B4=E5=90=8C=E6=AD=A5=E6=9D=83=E9=99=90?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=B7=B2=E6=8E=88=E6=9D=83=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/add-group-perm-sideslider.vue | 9 ++++- .../components/render-action.vue | 19 ++++++--- .../components/render-content.vue | 40 +++++++++++++++++-- 3 files changed, 57 insertions(+), 11 deletions(-) diff --git a/frontend/src/views/group/components/add-group-perm-sideslider.vue b/frontend/src/views/group/components/add-group-perm-sideslider.vue index 81112a6f0..2f9554970 100644 --- a/frontend/src/views/group/components/add-group-perm-sideslider.vue +++ b/frontend/src/views/group/components/add-group-perm-sideslider.vue @@ -55,6 +55,7 @@ @@ -291,7 +292,7 @@ }, getIsSelect (row, index) { - return row.tag === 'unchecked' + return row.tag === 'unchecked' && !row.need_to_update }, handleRefresh () { @@ -580,5 +581,11 @@ color: #3a84ff; } } + .error-icon { + font-size: 14px; + color: #ffb400; + position: absolute; + left: -5px; + } } diff --git a/frontend/src/views/perm-template/components/render-action.vue b/frontend/src/views/perm-template/components/render-action.vue index cf4f33b86..bf9b55814 100644 --- a/frontend/src/views/perm-template/components/render-action.vue +++ b/frontend/src/views/perm-template/components/render-action.vue @@ -11,7 +11,7 @@
{{ item.name }} - {{$t(`m.common['已选']`)}} {{ item.count }} / {{ item.allCount }} {{ $t(`m.common['个']`) }} 包含{{item.deleteCount}}个需要被删除的操作 + {{$t(`m.common['已选']`)}} {{ item.count }} / {{ item.allCount }} {{ $t(`m.common['个']`) }} 包含{{item.deleteCount}}个需要被删除的操作
@@ -91,11 +91,11 @@ @change="handleSubActionChecked(...arguments, act, subAct, item)">
@@ -177,17 +177,24 @@ curSelectActions () { const allActionIds = [] this.originalCustomTmplList.forEach(payload => { + payload.deleteCount = 0 if (!payload.actionsAllDisabled) { payload.actions.forEach(item => { if (!item.disabled && item.checked) { allActionIds.push(item.id) } + if (!item.disabled && item.checked && item.tag === 'delete') { + payload.deleteCount++ + } }) ;(payload.sub_groups || []).forEach(subItem => { (subItem.actions || []).forEach(act => { if (!act.disabled && act.checked) { allActionIds.push(act.id) } + if (!act.disabled && act.checked && act.tag === 'delete') { + payload.deleteCount++ + } }) }) } @@ -400,7 +407,7 @@ tempActions.forEach(item => { this.handleRelatedActions(item, payload.actionsAllChecked) }) - payload.count = payload.actionsAllChecked ? tempActions.length : 0 + payload.count = payload.actionsAllChecked ? payload.allCount : 0 }, handleActionChecked (newVal, oldVal, val, actData, payload) { diff --git a/frontend/src/views/perm-template/components/render-content.vue b/frontend/src/views/perm-template/components/render-content.vue index 4ebd935a5..75dc9a28f 100644 --- a/frontend/src/views/perm-template/components/render-content.vue +++ b/frontend/src/views/perm-template/components/render-content.vue @@ -370,6 +370,7 @@ let allCheckedLen = 0 let count = 0 let delCount = 0 + let deleteCount = 0 item.actions.forEach(item => { if (!item.disabled) { if (payload.includes(item.id)) { @@ -383,6 +384,9 @@ this.$refs.actionsRef.handleRelatedActions(item, flag) } } + if (item.tag === 'delete') { + ++deleteCount + } if (item.disabled || item.checked) { allCheckedLen++ } @@ -404,6 +408,10 @@ this.$refs.actionsRef.handleRelatedActions(act, flag) } } + + if (item.tag === 'delete') { + ++deleteCount + } if (act.disabled || act.checked) { allSubCheckedLen++ } @@ -422,6 +430,7 @@ } else { item.count = item.count - delCount } + this.$set(item, 'deleteCount', deleteCount) }) }, @@ -453,19 +462,22 @@ this.$set(item, 'expanded', index === 0) let allCount = 0 let count = 0 + let deleteCount = 0 this.$set(item, 'count', 0) if (!item.actions) { this.$set(item, 'actions', []) } item.actions.forEach(act => { - this.$set(act, 'checked', ['checked', 'readonly'].includes(act.tag)) + this.$set(act, 'checked', ['checked', 'readonly', 'delete'].includes(act.tag)) this.$set(act, 'disabled', act.tag === 'readonly') - this.$set(act, 'disabled', act.tag === 'delete') linearActions.push(act) if (act.checked) { this.curSelectActions.push(act.id) this.$set(act, 'flag', 'selected') ++count + if (act.tag === 'delete') { + ++deleteCount + } } }) allCount = allCount + item.actions.length @@ -476,14 +488,16 @@ this.$set(sub, 'actions', []) } sub.actions.forEach(act => { - this.$set(act, 'checked', ['checked', 'readonly'].includes(act.tag)) + this.$set(act, 'checked', ['checked', 'readonly', 'delete'].includes(act.tag)) this.$set(act, 'disabled', act.tag === 'readonly') - this.$set(act, 'disabled', act.tag === 'delete') linearActions.push(act) if (act.checked) { this.curSelectActions.push(act.id) this.$set(act, 'flag', 'selected') ++count + if (act.tag === 'delete') { + ++deleteCount + } } }) @@ -495,6 +509,7 @@ this.$set(item, 'allCount', allCount) this.$set(item, 'count', count) + this.$set(item, 'deleteCount', deleteCount) const isAllChecked = item.actions.every(v => v.checked) const isAllDisabled = item.actions.every(v => v.disabled) this.$set(item, 'allChecked', isAllChecked) @@ -604,19 +619,27 @@ const temps = _.cloneDeep(payload) temps.forEach(item => { let count = 0 + let deleteCount = 0 item.actions.forEach(act => { if (act.checked) { ++count + if (act.tag === 'delete') { + ++deleteCount + } } }) ;(item.sub_groups || []).forEach(sub => { sub.actions.forEach(act => { if (act.checked) { ++count + if (act.tag === 'delete') { + ++deleteCount + } } }) }) this.$set(item, 'count', count) + this.$set(item, 'deleteCount', deleteCount) }) return temps @@ -673,6 +696,15 @@ }, async handleNextStep () { + if (!this.hasGroupPreview && this.originalCustomTmplList.some(e => e.deleteCount)) { + this.bkMessageInstance = this.$bkMessage({ + limit: 1, + theme: 'error', + message: '由于分级管理员的授权范围没有包含此操作,如需使用该模板进行新的授权必须先删除该操作。', + ellipsisLine: 2, + ellipsisCopy: true + }) + } this.handleNameBlur(this.tempName) this.isShowActionError = this.curSelectActions.length < 1 if (this.isShowNameError || this.isShowActionError) { From e82ff0cf40dd6794a6002e70b10cf4da7b2a1076 Mon Sep 17 00:00:00 2001 From: polo Date: Thu, 11 Nov 2021 15:31:22 +0800 Subject: [PATCH 4/4] fix: add return --- frontend/src/views/perm-template/components/render-content.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/views/perm-template/components/render-content.vue b/frontend/src/views/perm-template/components/render-content.vue index 75dc9a28f..2bec1fc26 100644 --- a/frontend/src/views/perm-template/components/render-content.vue +++ b/frontend/src/views/perm-template/components/render-content.vue @@ -704,6 +704,7 @@ ellipsisLine: 2, ellipsisCopy: true }) + return } this.handleNameBlur(this.tempName) this.isShowActionError = this.curSelectActions.length < 1