From 4d4e8cd36377fa24cdda7a560dfc42fd2c9334b4 Mon Sep 17 00:00:00 2001 From: 董国庆 <364620639@qq.com> Date: 星期五, 23 五月 2025 15:33:49 +0800 Subject: [PATCH] 实验结果汇报 --- laboratory/src/components/SelectMember/index.vue | 25 ++++++++++++++++--------- 1 files changed, 16 insertions(+), 9 deletions(-) diff --git a/laboratory/src/components/SelectMember/index.vue b/laboratory/src/components/SelectMember/index.vue index 621e526..fcde772 100644 --- a/laboratory/src/components/SelectMember/index.vue +++ b/laboratory/src/components/SelectMember/index.vue @@ -82,12 +82,14 @@ setSelection(selected) { this.selectData = selected this.$nextTick(() => { - // 设置新选中 - this.tableData.forEach(row => { - if (selected.some(i => i.userId === row.userId)) { - this.$refs.memberTable.toggleRowSelection(row, true) - } - }) + // 确保 tableData 和 memberTable 都存在 + if (this.tableData && this.$refs.memberTable) { + this.tableData.forEach(row => { + if (selected.some(i => i.userId === row.userId)) { + this.$refs.memberTable.toggleRowSelection(row, true) + } + }) + } }) }, openDialog() { @@ -108,7 +110,7 @@ async searchUserList(roleId) { this.roleId = roleId // 根据是否有项目组ID来决定调用不同的接口 - const params = { + let params = { roleIds: roleId ? [roleId] : [], nickNameOrPhone: this.searchName, pageSize: 9999, @@ -116,10 +118,15 @@ }; if (this.projectId) { - params.projectId = this.projectId; + params={ + ...params, + roleId: roleId?roleId:'', + projectId: this.projectId + } + delete params.roleIds; // TODO: 这里需要替换为新的接口调用 const res = await listByRole(params); - this.tableData = res.records; + this.tableData = res; } else { const res = await getUserList(params); this.tableData = res.records; -- Gitblit v1.7.1