13404089107
2025-05-28 a60dc30be50598fe2d1acb42f8171ec69e37b436
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;