From e8b8da9108c6632b31d3480d610efc0d37dd605b Mon Sep 17 00:00:00 2001 From: lhzzforever Date: Mon, 11 Nov 2024 18:01:28 +0800 Subject: [PATCH] =?UTF-8?q?feature:=20=E4=BA=8C=E7=BA=A7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E7=A9=BA=E9=97=B4=E4=BA=BA=E5=91=98=E9=80=89=E6=8B=A9=E5=99=A8?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E7=BB=84=E4=BB=B6=E6=94=AF=E6=8C=81=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E4=B8=BA=E7=A9=BA=EF=BC=8C=E7=BC=96=E8=BE=91=E4=B8=8D?= =?UTF-8?q?=E5=8F=AF=E4=B8=BA=E7=A9=BA=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/grading-admin/index.vue | 6 +- .../secondary-manage-space/index.vue | 61 ++++++++++++++++--- .../components/iam-edit/member-selector.vue | 12 ++++ frontend/src/views/my-manage-space/index.vue | 7 +-- 4 files changed, 70 insertions(+), 16 deletions(-) diff --git a/frontend/src/views/grading-admin/index.vue b/frontend/src/views/grading-admin/index.vue index 8c4636a8c..69a6a94a2 100644 --- a/frontend/src/views/grading-admin/index.vue +++ b/frontend/src/views/grading-admin/index.vue @@ -68,6 +68,7 @@ :ref="`subManagerRef${child.$index}`" :placeholder="$t(`m.verify['请输入']`)" :allow-empty="true" + :is-edit-allow-empty="false" :value="child.row.members" :index="child.$index" @on-change="handleUpdateSubMembers" @@ -183,6 +184,7 @@ :ref="`managerRef${$index}`" :placeholder="$t(`m.verify['请输入']`)" :allow-empty="true" + :is-edit-allow-empty="false" :value="row.members" :index="$index" @on-change="handleUpdateMembers" @@ -642,10 +644,6 @@ members: members || this.formData.members, id: this.formData.id }; - if (!params.members.length) { - this.messageWarn(this.$t(`m.verify['管理员不能为空']`), 3000); - return; - } try { await this.$store.dispatch(url, params); this.messageSuccess(this.$t(`m.info['编辑成功']`), 3000); diff --git a/frontend/src/views/manage-spaces/secondary-manage-space/index.vue b/frontend/src/views/manage-spaces/secondary-manage-space/index.vue index dc7b7a95c..d5ae423c9 100644 --- a/frontend/src/views/manage-spaces/secondary-manage-space/index.vue +++ b/frontend/src/views/manage-spaces/secondary-manage-space/index.vue @@ -29,13 +29,30 @@ @@ -89,11 +106,13 @@ import { buildURLParams } from '@/common/url'; import { formatCodeData, getWindowHeight } from '@/common/util'; import IamEditMemberSelector from '@/views/my-manage-space/components/iam-edit/member-selector'; + import IamManagerEditInput from '@/components/iam-edit/input'; export default { name: 'secondaryManageSpace', components: { - IamEditMemberSelector + IamEditMemberSelector, + IamManagerEditInput }, data () { return { @@ -215,6 +234,32 @@ await this.fetchGradingAdmin(true); }, + getMemberFilter (value) { + if (value.length) { + return Array.isArray(value) ? value.map(item => item.username).join(';') : value; + } + return '--'; + }, + + handleOpenManagerEdit (payload, index) { + this.$set(this.tableList[index], 'isEdit', true); + this.$nextTick(() => { + const managerRef = this.$refs[`managerRef${index}`]; + if (managerRef) { + managerRef.isEditable = true; + if (!payload.members.length) { + setTimeout(() => { + this.$refs[`managerRef${index}`].$refs.selector.focus(); + }, 10); + } + } + }); + }, + + handleEmptyMemberChange (index, row) { + row.isEdit = false; + }, + handleNavAuthBoundary (payload) { window.localStorage.setItem('iam-header-name-cache', payload.name); this.$store.commit('updateIndex', 1); diff --git a/frontend/src/views/my-manage-space/components/iam-edit/member-selector.vue b/frontend/src/views/my-manage-space/components/iam-edit/member-selector.vue index 538cbdd6e..01016ace9 100644 --- a/frontend/src/views/my-manage-space/components/iam-edit/member-selector.vue +++ b/frontend/src/views/my-manage-space/components/iam-edit/member-selector.vue @@ -86,9 +86,15 @@ return ['detail', 'edit'].includes(value); } }, + // 默认允许空 allowEmpty: { type: Boolean, default: false + }, + // 编辑不允许空 + isEditAllowEmpty: { + type: Boolean, + default: true } }, data () { @@ -201,6 +207,12 @@ triggerChange () { console.log(this.isAllowTrigger, this.displayValue, '显示内容'); + // 单独处理初始化为空但编辑不能为空数据 + if (!this.displayValue.length && !this.isEditAllowEmpty) { + this.displayValue = [...this.value]; + this.messageWarn(this.$t(`m.verify['管理员不能为空']`), 3000); + return; + } if (this.isAllowTrigger) { this.isLoading = true; this.remoteHandler({ diff --git a/frontend/src/views/my-manage-space/index.vue b/frontend/src/views/my-manage-space/index.vue index a6dffb628..6625b7af1 100644 --- a/frontend/src/views/my-manage-space/index.vue +++ b/frontend/src/views/my-manage-space/index.vue @@ -92,6 +92,8 @@ width="200" :ref="`subManagerRef${child.$index}`" :placeholder="$t(`m.verify['请输入']`)" + :allow-empty="true" + :is-edit-allow-empty="false" :value="child.row.members" :index="child.$index" @on-change="handleUpdateSubMembers" @@ -229,6 +231,7 @@ :ref="`managerRef${$index}`" :placeholder="$t(`m.verify['请输入']`)" :allow-empty="true" + :is-edit-allow-empty="false" :value="row.members" :index="$index" @on-change="handleUpdateMembers" @@ -611,10 +614,6 @@ members: members || this.formData.members, id: this.formData.id }; - if (!params.members.length) { - this.messageWarn(this.$t(`m.verify['管理员不能为空']`), 3000); - return; - } try { await this.$store.dispatch(url, params); this.messageSuccess(this.$t(`m.info['编辑成功']`), 3000);