From a60dc30be50598fe2d1acb42f8171ec69e37b436 Mon Sep 17 00:00:00 2001
From: 13404089107 <puwei@sinata.cn>
Date: 星期三, 28 五月 2025 17:29:05 +0800
Subject: [PATCH] Merge branch 'main' of http://120.76.84.145:10101/gitblit/r/H5/leshan-laboratory

---
 laboratory/src/components/SelectMember/index.vue |   28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/laboratory/src/components/SelectMember/index.vue b/laboratory/src/components/SelectMember/index.vue
index 96ca265..fcde772 100644
--- a/laboratory/src/components/SelectMember/index.vue
+++ b/laboratory/src/components/SelectMember/index.vue
@@ -59,7 +59,7 @@
 </template>
 
 <script>
-import { getRoleList, getUserList } from './service'
+import { getRoleList, getUserList, listByRole } from './service'
 export default {
     props: {
         projectId: {
@@ -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,9 +118,15 @@
             };
             
             if (this.projectId) {
-                params.projectId = this.projectId;
+                params={
+                    ...params,
+                    roleId: roleId?roleId:'',
+                    projectId: this.projectId
+                }
+                delete params.roleIds;
                 // TODO: 这里需要替换为新的接口调用
-                // const res = await getProjectUserList(params);
+                const res = await listByRole(params);
+                this.tableData = res;
             } else {
                 const res = await getUserList(params);
                 this.tableData = res.records;

--
Gitblit v1.7.1