refactor(接口测试): 修复查看接口引用项目显示不全以及版本查询不全问题
--bug=1022722 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001022722 --bug=1022720 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001022720
This commit is contained in:
parent
a122001c75
commit
80fae150a3
|
@ -24,6 +24,10 @@ export function getProjectVersions(projectId) {
|
||||||
return get('/project/version/get-project-versions/' + projectId);
|
return get('/project/version/get-project-versions/' + projectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getVersionsByProjectIds(param) {
|
||||||
|
return post('/project/version/get-versions', param);
|
||||||
|
}
|
||||||
|
|
||||||
export function versionEnableByProjectId(projectId) {
|
export function versionEnableByProjectId(projectId) {
|
||||||
return get('/project/version/enable/' + projectId);
|
return get('/project/version/enable/' + projectId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,15 +167,21 @@
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import MsTablePagination from 'metersphere-frontend/src/components/pagination/TablePagination';
|
import MsTablePagination from 'metersphere-frontend/src/components/pagination/TablePagination';
|
||||||
import { apiProjectRelated, getOwnerProjectIds, getProject, getUserWorkspace, projectRelated } from '@/api/project';
|
import {
|
||||||
import { getCurrentProjectID, getCurrentUserId, getCurrentWorkspaceId } from 'metersphere-frontend/src/utils/token';
|
getOwnerProjectIds,
|
||||||
|
getOwnerProjects,
|
||||||
|
getProject,
|
||||||
|
getUserWorkspace,
|
||||||
|
projectRelated
|
||||||
|
} from '@/api/project';
|
||||||
|
import {getCurrentProjectID, getCurrentUserId, getCurrentWorkspaceId} from 'metersphere-frontend/src/utils/token';
|
||||||
import {getUUID} from 'metersphere-frontend/src/utils';
|
import {getUUID} from 'metersphere-frontend/src/utils';
|
||||||
import {hasLicense} from 'metersphere-frontend/src/utils/permission';
|
import {hasLicense} from 'metersphere-frontend/src/utils/permission';
|
||||||
import {getDefinitionReference, getPlanReference} from '@/api/definition';
|
import {getDefinitionReference, getPlanReference} from '@/api/definition';
|
||||||
import MsTable from 'metersphere-frontend/src/components/table/MsTable';
|
import MsTable from 'metersphere-frontend/src/components/table/MsTable';
|
||||||
import MsTableColumn from 'metersphere-frontend/src/components/table/MsTableColumn';
|
import MsTableColumn from 'metersphere-frontend/src/components/table/MsTableColumn';
|
||||||
import MsTabButton from '@/business/commons/MsTabs';
|
import MsTabButton from '@/business/commons/MsTabs';
|
||||||
import {getProjectVersions} from "@/api/xpack";
|
import {getVersionsByProjectIds} from "@/api/xpack";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ShowReference',
|
name: 'ShowReference',
|
||||||
|
@ -247,23 +253,34 @@ export default {
|
||||||
this.projectList = res.data ? res.data : [];
|
this.projectList = res.data ? res.data : [];
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getVersionOptions(currentVersion) {
|
getVersionOptions(projectIds, data) {
|
||||||
|
if (!projectIds || projectIds.length === 0) {
|
||||||
|
projectIds = [];
|
||||||
|
}
|
||||||
if (hasLicense()) {
|
if (hasLicense()) {
|
||||||
getProjectVersions(getCurrentProjectID()).then((response) => {
|
getVersionsByProjectIds(projectIds).then((response) => {
|
||||||
if (currentVersion) {
|
if (this.projectFilters.length === 0 || !this.projectFilters.length) {
|
||||||
this.versionFilters = response.data
|
this.versionFilters = [];
|
||||||
.filter((u) => u.id === currentVersion)
|
|
||||||
.map((u) => {
|
|
||||||
return {text: u.name, value: u.id};
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
this.versionFilters = response.data.map((u) => {
|
this.versionFilters = response.data.filter((version) => {
|
||||||
return {text: u.name, value: u.id};
|
return data.listObject.find((i) => i.versionId === version.id);
|
||||||
|
}).map((u) => {
|
||||||
|
return {text: u.name + "-" + this.getProjectName(u.projectId), value: u.id};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
getProjectName(id) {
|
||||||
|
let name
|
||||||
|
for (let item of this.projectFilters) {
|
||||||
|
if (item.value === id) {
|
||||||
|
name = item.text;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return name;
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 操作方法
|
* 操作方法
|
||||||
*/
|
*/
|
||||||
|
@ -281,7 +298,6 @@ export default {
|
||||||
this.init();
|
this.init();
|
||||||
this.getUserProjectList();
|
this.getUserProjectList();
|
||||||
this.getWorkSpaceList();
|
this.getWorkSpaceList();
|
||||||
this.getVersionOptions();
|
|
||||||
this.isVisible = true;
|
this.isVisible = true;
|
||||||
this.scenarioId = row.id;
|
this.scenarioId = row.id;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
@ -318,17 +334,16 @@ export default {
|
||||||
workspaceIds.push(item.value);
|
workspaceIds.push(item.value);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
apiProjectRelated({
|
getOwnerProjects().then((res) => {
|
||||||
userId: getCurrentUserId(),
|
|
||||||
workspaceIds: workspaceIds,
|
|
||||||
}).then((res) => {
|
|
||||||
this.projectFilters = res.data
|
this.projectFilters = res.data
|
||||||
.filter((project) => {
|
.filter((project) => {
|
||||||
return data.listObject.find((i) => i.projectId === project.id);
|
return data.listObject.find((i) => i.projectId === project.id);
|
||||||
})
|
})
|
||||||
.map((e) => {
|
.map((e) => {
|
||||||
return {text: e.name, value: e.id};
|
return {text: e.name, value: e.id};
|
||||||
});
|
});
|
||||||
|
let map = res.data.map(item => item.id);
|
||||||
|
this.getVersionOptions(map, data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.scenarioData = data.listObject || [];
|
this.scenarioData = data.listObject || [];
|
||||||
|
|
Loading…
Reference in New Issue