From 203700c3fca427c37e89f8941a7f1a1898caf9f5 Mon Sep 17 00:00:00 2001 From: lhzzforever Date: Thu, 7 Nov 2024 16:52:08 +0800 Subject: [PATCH 1/6] =?UTF-8?q?fix:=20=E4=BA=BA=E5=91=98=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=99=A8=E7=BB=84=E4=BB=B6=E5=85=BC=E5=AE=B9=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E5=BF=85=E5=A1=AB=E4=BD=86=E6=98=AF=E6=8E=A5=E5=8F=A3=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BC=82=E5=B8=B8=EF=BC=8C=E9=9C=80=E8=A6=81=E6=8F=90?= =?UTF-8?q?=E4=BE=9B=E5=85=A5=E5=8F=A3=E6=94=AF=E6=8C=81=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=9C=BA=E6=99=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/grading-admin/index.vue | 5 ++++- .../components/iam-edit/member-selector.vue | 9 +++++++-- frontend/src/views/my-manage-space/index.vue | 2 ++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/grading-admin/index.vue b/frontend/src/views/grading-admin/index.vue index 923df5b07..106c5eb03 100644 --- a/frontend/src/views/grading-admin/index.vue +++ b/frontend/src/views/grading-admin/index.vue @@ -67,7 +67,9 @@ :placeholder="$t(`m.verify['请输入']`)" :value="child.row.members" :index="child.$index" - @on-change="handleUpdateSubMembers" /> + :is-abnormal="child.row.members.length === 0" + @on-change="handleUpdateSubMembers" + /> @@ -166,6 +168,7 @@ :placeholder="$t(`m.verify['请输入']`)" :value="row.members" :index="$index" + :is-abnormal="row.members.length === 0" @on-change="handleUpdateMembers" /> 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 c523dabdd..16f2d2aa2 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 @@ -89,6 +89,11 @@ allowEmpty: { type: Boolean, default: false + }, + // 兼容必填但接口数据异常情况 + isAbnormal: { + type: Boolean, + default: false } }, data () { @@ -213,7 +218,7 @@ }, handleChange () { - if (this.displayValue.length < 1 && !this.allowEmpty) { + if (this.displayValue.length < 1 && !this.allowEmpty && !this.isAbnormal) { return; } const editValue = this.editValue.reduce((p, v) => { @@ -236,7 +241,7 @@ // 判空校验 handleEmptyChange () { - if (this.displayValue.length < 1 && !this.allowEmpty) { + if (this.displayValue.length < 1 && !this.allowEmpty && !this.isAbnormal) { let editValue = []; if (this.editValue.length) { if (!this.editValue.some((v) => v.username)) { diff --git a/frontend/src/views/my-manage-space/index.vue b/frontend/src/views/my-manage-space/index.vue index af9820dcb..bb7a01eac 100644 --- a/frontend/src/views/my-manage-space/index.vue +++ b/frontend/src/views/my-manage-space/index.vue @@ -92,6 +92,7 @@ :placeholder="$t(`m.verify['请输入']`)" :value="child.row.members" :index="child.$index" + :is-abnormal="child.row.members.length === 0" @on-change="handleUpdateSubMembers" /> @@ -215,6 +216,7 @@ :placeholder="$t(`m.verify['请输入']`)" :value="row.members" :index="$index" + :is-abnormal="row.members.length === 0" @on-change="handleUpdateMembers" /> From ebf5fcf58cb2216f2d1c760753e7129d166f0cdc Mon Sep 17 00:00:00 2001 From: lhzzforever Date: Thu, 7 Nov 2024 17:44:40 +0800 Subject: [PATCH 2/6] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9member-seletor?= =?UTF-8?q?=E4=B8=8Bdisplay=5Fname=E7=9A=84=E5=B1=95=E7=A4=BA=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/iam-edit/member-selector.vue | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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 16f2d2aa2..d8861c4d1 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 @@ -115,6 +115,9 @@ }, isEditMode () { return this.mode === 'edit'; + }, + isAllowTrigger () { + return JSON.stringify(this.displayValue) !== JSON.stringify(this.value) || this.isAbnormal; } }, watch: { @@ -174,10 +177,9 @@ handleEnter (event) { if (!this.isEditable) return; const { key, keyCode } = event; - const isUpdate = JSON.stringify(this.displayValue) !== JSON.stringify(this.value); if (key === 'Enter' && keyCode === 13) { this.handleDefaultEmpty(); - if (isUpdate) { + if (this.isAllowTrigger) { this.handleEmptyChange(); this.isEditable = false; } else { @@ -203,7 +205,7 @@ }, triggerChange () { - if (JSON.stringify(this.displayValue) !== JSON.stringify(this.value)) { + if (this.isAllowTrigger) { this.isLoading = true; this.remoteHandler({ [this.field]: this.displayValue @@ -234,7 +236,7 @@ handleRtxBlur () { this.isEditable = false; this.handleDefaultEmpty(); - if (JSON.stringify(this.displayValue) !== JSON.stringify(this.value)) { + if (this.isAllowTrigger) { this.handleEmptyChange(); } }, From 26c03c5cb6c7e7fac79f06c26034c68b5231b374 Mon Sep 17 00:00:00 2001 From: lhzzforever Date: Thu, 7 Nov 2024 17:46:50 +0800 Subject: [PATCH 3/6] =?UTF-8?q?fix:=20=E5=A2=9E=E5=8A=A0=E7=BA=BF=E4=B8=8A?= =?UTF-8?q?=E8=B0=83=E8=AF=95log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../my-manage-space/components/iam-edit/member-selector.vue | 1 + 1 file changed, 1 insertion(+) 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 d8861c4d1..03c8f8cde 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 @@ -205,6 +205,7 @@ }, triggerChange () { + console.log(this.isAllowTrigger, this.displayValue, '显示内容'); if (this.isAllowTrigger) { this.isLoading = true; this.remoteHandler({ From 680582108ed8ba57c1dd7086f62a6c008a2849cc Mon Sep 17 00:00:00 2001 From: lhzzforever Date: Mon, 11 Nov 2024 13:26:43 +0800 Subject: [PATCH 4/6] =?UTF-8?q?feature:=20=E6=95=B4=E6=94=B9=E4=BA=BA?= =?UTF-8?q?=E5=91=98=E9=80=89=E6=8B=A9=E5=99=A8=E7=BC=96=E8=BE=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E4=BA=A4=E4=BA=92=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/grading-admin/index.vue | 119 ++++++++++++++--- .../components/iam-edit/member-selector.vue | 11 +- frontend/src/views/my-manage-space/index.vue | 122 ++++++++++++++---- 3 files changed, 201 insertions(+), 51 deletions(-) diff --git a/frontend/src/views/grading-admin/index.vue b/frontend/src/views/grading-admin/index.vue index 106c5eb03..8c4636a8c 100644 --- a/frontend/src/views/grading-admin/index.vue +++ b/frontend/src/views/grading-admin/index.vue @@ -61,15 +61,29 @@ @@ -162,14 +176,29 @@ @@ -282,6 +311,7 @@ import IamEditInput from '@/views/my-manage-space/components/iam-edit/input'; import IamEditMemberSelector from '@/views/my-manage-space/components/iam-edit/member-selector'; import IamEditTextarea from '@/views/my-manage-space/components/iam-edit/textarea'; + import IamManagerEditInput from '@/components/iam-edit/input'; import IamSearchSelect from '@/components/iam-search-select'; import ManageInterviewDialog from '@/components/manage-interview-dialog'; @@ -291,6 +321,7 @@ ConfirmDialog, ApplyDialog, IamEditInput, + IamManagerEditInput, IamEditMemberSelector, IamEditTextarea, IamSearchSelect, @@ -421,6 +452,13 @@ return !['child-operate'].includes(column.property) ? 'iam-table-cell-1-cls' : ''; }, + getMemberFilter (value) { + if (value.length) { + return _.isArray(value) ? value.map(item => item.username).join(';') : value; + } + return '--'; + }, + handleExpandChange (row, expandedRows) { // if (row.id !== this.gradingAdminId) return; this.gradingAdminId = row.id; @@ -472,6 +510,40 @@ return JSON.parse(window.localStorage.getItem('gradeManagerList')); }, + 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); + } + } + }); + }, + + handleOpenSubManagerEdit (payload, index) { + this.$set(payload, 'isEdit', true); + this.$nextTick(() => { + const subManagerRef = this.$refs[`subManagerRef${index}`]; + if (subManagerRef) { + subManagerRef.isEditable = true; + if (!payload.members.length) { + setTimeout(() => { + subManagerRef.$refs.selector.focus(); + }, 10); + } + } + }); + }, + + handleEmptyMemberChange (index, row) { + row.isEdit = false; + }, + async fetchGradingAdmin (isTableLoading = false) { this.tableLoading = isTableLoading; this.setCurrentQueryCache(this.refreshCurrentQuery()); @@ -482,9 +554,12 @@ name: this.searchValue }); this.pagination.count = data.count || 0; - data.results = data.results.map(e => { - e.children = []; - return e; + data.results = data.results.map((item) => { + item = Object.assign(item, { + isEdit: false, + children: [] + }); + return item; }); this.tableList.splice(0, this.tableList.length, ...(data.results || [])); if (this.isStaff) { @@ -567,6 +642,10 @@ 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/my-manage-space/components/iam-edit/member-selector.vue b/frontend/src/views/my-manage-space/components/iam-edit/member-selector.vue index 03c8f8cde..538cbdd6e 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 @@ -89,11 +89,6 @@ allowEmpty: { type: Boolean, default: false - }, - // 兼容必填但接口数据异常情况 - isAbnormal: { - type: Boolean, - default: false } }, data () { @@ -117,7 +112,7 @@ return this.mode === 'edit'; }, isAllowTrigger () { - return JSON.stringify(this.displayValue) !== JSON.stringify(this.value) || this.isAbnormal; + return JSON.stringify(this.displayValue) !== JSON.stringify(this.value); } }, watch: { @@ -221,7 +216,7 @@ }, handleChange () { - if (this.displayValue.length < 1 && !this.allowEmpty && !this.isAbnormal) { + if (this.displayValue.length < 1 && !this.allowEmpty) { return; } const editValue = this.editValue.reduce((p, v) => { @@ -244,7 +239,7 @@ // 判空校验 handleEmptyChange () { - if (this.displayValue.length < 1 && !this.allowEmpty && !this.isAbnormal) { + if (this.displayValue.length < 1 && !this.allowEmpty) { let editValue = []; if (this.editValue.length) { if (!this.editValue.some((v) => v.username)) { diff --git a/frontend/src/views/my-manage-space/index.vue b/frontend/src/views/my-manage-space/index.vue index bb7a01eac..a6dffb628 100644 --- a/frontend/src/views/my-manage-space/index.vue +++ b/frontend/src/views/my-manage-space/index.vue @@ -86,15 +86,28 @@ @@ -208,17 +221,30 @@ -