From a749b62894ec0dcda3bb055371bc75db75f17ce1 Mon Sep 17 00:00:00 2001 From: 13404089107 <puwei@sinata.cn> Date: 星期一, 12 五月 2025 17:46:57 +0800 Subject: [PATCH] Merge branch 'main' of http://120.76.84.145:10101/gitblit/r/H5/leshan-laboratory --- laboratory/src/components/SelectMember/index.vue | 35 +++++++++++++++++++++++++++++++---- 1 files changed, 31 insertions(+), 4 deletions(-) diff --git a/laboratory/src/components/SelectMember/index.vue b/laboratory/src/components/SelectMember/index.vue index 39f24b7..96ca265 100644 --- a/laboratory/src/components/SelectMember/index.vue +++ b/laboratory/src/components/SelectMember/index.vue @@ -61,6 +61,12 @@ <script> import { getRoleList, getUserList } from './service' export default { + props: { + projectId: { + type: [String, Number], + default: null + } + }, data() { return { visible: false, @@ -85,9 +91,15 @@ }) }, openDialog() { + // 获取角色列表并根据项目组ID进行过滤 getRoleList().then(res => { - this.roleList = res; - }) + if (this.projectId) { + // 过滤出实验员和化验师角色 + this.roleList = res.filter(item => item.roleId == 4 || item.roleId == 5); + } else { + this.roleList = res; + } + }); this.searchUserList(null); }, handleSelectionChange(val) { @@ -95,8 +107,23 @@ }, async searchUserList(roleId) { this.roleId = roleId - const res = await getUserList({ roleIds: roleId ? [roleId] : [], nickNameOrPhone: this.searchName, pageSize: 9999, pageNum: 1 }) - this.tableData = res.records + // 根据是否有项目组ID来决定调用不同的接口 + const params = { + roleIds: roleId ? [roleId] : [], + nickNameOrPhone: this.searchName, + pageSize: 9999, + pageNum: 1 + }; + + if (this.projectId) { + params.projectId = this.projectId; + // TODO: 这里需要替换为新的接口调用 + // const res = await getProjectUserList(params); + } else { + const res = await getUserList(params); + this.tableData = res.records; + } + // 数据加载完成后重新应用选中状态 this.setSelection(this.selectData) }, -- Gitblit v1.7.1