fix(接口定义): 修复点击工作空间筛选后,下拉框只剩当前工作空间的选项的缺陷

--bug=1019884 --user=王孝刚 【接口测试】接口用例查看引用关系 - 场景引用,所属工作空间和所属项目筛选后就只剩所选的选项了
https://www.tapd.cn/55049933/s/1299800
This commit is contained in:
wxg0103 2022-11-21 17:18:30 +08:00 committed by wxg0103
parent 100bec5f3d
commit 8732795ce6
1 changed files with 22 additions and 10 deletions

View File

@ -164,6 +164,7 @@ export default {
let data = res.data || []; let data = res.data || [];
this.total = data.itemCount || 0; this.total = data.itemCount || 0;
if (this.workspaceList) { if (this.workspaceList) {
if (this.workspaceFilters.length === 0) {
this.workspaceFilters = this.workspaceList this.workspaceFilters = this.workspaceList
.filter((workspace) => { .filter((workspace) => {
return data.listObject.find((i) => i.workspaceId === workspace.id); return data.listObject.find((i) => i.workspaceId === workspace.id);
@ -171,10 +172,21 @@ export default {
.map((e) => { .map((e) => {
return { text: e.name, value: e.id }; return { text: e.name, value: e.id };
}); });
}
let workspaceIds = []; let workspaceIds = [];
if (
this.condition.filters &&
this.condition.filters.workspace_id &&
this.condition.filters.workspace_id.length > 0
) {
this.condition.filters.workspace_id.map((item) => {
workspaceIds.push(item);
});
} else {
this.workspaceFilters.map((item) => { this.workspaceFilters.map((item) => {
workspaceIds.push(item.value); workspaceIds.push(item.value);
}); });
}
apiProjectRelated({ apiProjectRelated({
userId: getCurrentUserId(), userId: getCurrentUserId(),
workspaceIds: workspaceIds, workspaceIds: workspaceIds,