fix: 用例评审测试计划版本选择框

This commit is contained in:
zhangdahai112 2022-01-19 22:22:05 +08:00 committed by zhangdahai112
parent 23b4884e19
commit f3fa4412a5
6 changed files with 320 additions and 281 deletions

View File

@ -31,26 +31,6 @@
<if test="request.refId != null"> <if test="request.refId != null">
and load_test.ref_id = #{request.refId} and load_test.ref_id = #{request.refId}
</if> </if>
<if test="request.versionId == null and request.refId == null and request.id == null">
AND (
load_test.version_id = (SELECT project_version.id
FROM load_test tmp
JOIN project_version
ON tmp.project_id = project_version.project_id AND tmp.version_id = project_version.id AND latest = TRUE
WHERE ref_id = load_test.ref_id
LIMIT 1)
OR
load_test.version_id = (SELECT project_version.id
FROM load_test tmp
JOIN project_version ON tmp.project_id = project_version.project_id AND
tmp.version_id = project_version.id
WHERE ref_id = load_test.ref_id
GROUP BY ref_id
HAVING MAX(latest) = 0
ORDER BY MAX(project_version.create_time) DESC
LIMIT 1)
)
</if>
<if test="request.filters != null and request.filters.size() > 0"> <if test="request.filters != null and request.filters.size() > 0">
<foreach collection="request.filters.entrySet()" index="key" item="values"> <foreach collection="request.filters.entrySet()" index="key" item="values">
<if test="values != null and values.size() > 0"> <if test="values != null and values.size() > 0">

View File

@ -9,6 +9,7 @@ import io.metersphere.base.mapper.LoadTestMapper;
import io.metersphere.base.mapper.LoadTestReportMapper; import io.metersphere.base.mapper.LoadTestReportMapper;
import io.metersphere.base.mapper.TestPlanLoadCaseMapper; import io.metersphere.base.mapper.TestPlanLoadCaseMapper;
import io.metersphere.base.mapper.TestPlanMapper; import io.metersphere.base.mapper.TestPlanMapper;
import io.metersphere.base.mapper.ext.ExtLoadTestMapper;
import io.metersphere.base.mapper.ext.ExtLoadTestReportMapper; import io.metersphere.base.mapper.ext.ExtLoadTestReportMapper;
import io.metersphere.base.mapper.ext.ExtTestPlanLoadCaseMapper; import io.metersphere.base.mapper.ext.ExtTestPlanLoadCaseMapper;
import io.metersphere.commons.constants.PerformanceTestStatus; import io.metersphere.commons.constants.PerformanceTestStatus;
@ -21,6 +22,7 @@ import io.metersphere.controller.request.OrderRequest;
import io.metersphere.controller.request.ResetOrderRequest; import io.metersphere.controller.request.ResetOrderRequest;
import io.metersphere.dto.LoadTestDTO; import io.metersphere.dto.LoadTestDTO;
import io.metersphere.log.vo.OperatingLogDetails; import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.performance.request.QueryTestPlanRequest;
import io.metersphere.performance.request.RunTestPlanRequest; import io.metersphere.performance.request.RunTestPlanRequest;
import io.metersphere.performance.service.PerformanceTestService; import io.metersphere.performance.service.PerformanceTestService;
import io.metersphere.track.dto.*; import io.metersphere.track.dto.*;
@ -69,6 +71,8 @@ public class TestPlanLoadCaseService {
@Resource @Resource
@Lazy @Lazy
private TestPlanService testPlanService; private TestPlanService testPlanService;
@Resource
private ExtLoadTestMapper extLoadTestMapper;
public Pager<List<LoadTestDTO>> relevanceList(LoadCaseRequest request, int goPage, int pageSize) { public Pager<List<LoadTestDTO>> relevanceList(LoadCaseRequest request, int goPage, int pageSize) {
List<OrderRequest> orders = ServiceUtils.getDefaultSortOrder(request.getOrders()); List<OrderRequest> orders = ServiceUtils.getDefaultSortOrder(request.getOrders());
@ -82,7 +86,12 @@ public class TestPlanLoadCaseService {
return PageUtils.setPageInfo(PageHelper.startPage(goPage, pageSize, true), new ArrayList <>()); return PageUtils.setPageInfo(PageHelper.startPage(goPage, pageSize, true), new ArrayList <>());
} }
Page<Object> page = PageHelper.startPage(goPage, pageSize, true); Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, performanceTestService.getLoadTestListByIds(ids)); QueryTestPlanRequest newRequest = new QueryTestPlanRequest();
Map filters = new HashMap();
filters.put("id", ids);
newRequest.setFilters(filters);
List<LoadTestDTO> loadTestDTOS = extLoadTestMapper.list(newRequest);
return PageUtils.setPageInfo(page, loadTestDTOS);
} }
public List<TestPlanLoadCaseDTO> list(LoadCaseRequest request) { public List<TestPlanLoadCaseDTO> list(LoadCaseRequest request) {

View File

@ -27,7 +27,11 @@
:plan-id="planId" :plan-id="planId"
:versionFilters="versionFilters" :versionFilters="versionFilters"
@isApiListEnableChange="isApiListEnableChange" @isApiListEnableChange="isApiListEnableChange"
ref="apiList"/> ref="apiList">
<template v-slot:version>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion($event,'api')" margin-left="10"/>
</template>
</relevance-api-list>
<relevance-case-list <relevance-case-list
v-if="!isApiListEnable" v-if="!isApiListEnable"
@ -36,9 +40,15 @@
:is-api-list-enable="isApiListEnable" :is-api-list-enable="isApiListEnable"
:project-id="projectId" :project-id="projectId"
:is-test-plan="true" :is-test-plan="true"
:versionFilters="versionFilters"
:plan-id="planId" :plan-id="planId"
@isApiListEnableChange="isApiListEnableChange" @isApiListEnableChange="isApiListEnableChange"
ref="apiCaseList"/> ref="apiCaseList">
<template v-slot:version>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion($event, 'case')"
margin-left="10"/>
</template>
</relevance-case-list>
</test-case-relevance-base> </test-case-relevance-base>
@ -51,6 +61,8 @@
import RelevanceApiList from "../../../../../api/automation/scenario/api/RelevanceApiList"; import RelevanceApiList from "../../../../../api/automation/scenario/api/RelevanceApiList";
import RelevanceCaseList from "../../../../../api/automation/scenario/api/RelevanceCaseList"; import RelevanceCaseList from "../../../../../api/automation/scenario/api/RelevanceCaseList";
import {getCurrentProjectID, hasLicense} from "@/common/js/utils"; import {getCurrentProjectID, hasLicense} from "@/common/js/utils";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
export default { export default {
name: "TestCaseApiRelevance", name: "TestCaseApiRelevance",
@ -59,6 +71,7 @@
RelevanceApiList, RelevanceApiList,
MsApiModule, MsApiModule,
TestCaseRelevanceBase, TestCaseRelevanceBase,
'VersionSelect': VersionSelect.default,
}, },
data() { data() {
return { return {
@ -198,6 +211,15 @@
}); });
} }
}, },
changeVersion(currentVersion, type) {
if (type == 'api') {
this.$refs.apiList.condition.versionId = currentVersion || null;
this.$refs.apiList.initTable();
} else {
this.$refs.apiCaseList.condition.versionId = currentVersion || null;
this.$refs.apiCaseList.initTable();
}
}
} }
} }
</script> </script>

View File

@ -17,8 +17,11 @@
ref="nodeTree"/> ref="nodeTree"/>
</template> </template>
<ms-table-header :condition.sync="page.condition" @search="getTestCases" title="" :show-create="false"/> <ms-table-header :condition.sync="page.condition" @search="getTestCases" title="" :show-create="false">
<template v-slot:searchBarBefore>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion" margin-right="20"/>
</template>
</ms-table-header>
<ms-table <ms-table
v-loading="page.result.loading" v-loading="page.result.loading"
:data="page.data" :data="page.data"
@ -112,6 +115,8 @@ import MsTable from "@/business/components/common/components/table/MsTable";
import MsTablePagination from "@/business/components/common/pagination/TablePagination"; import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import MsTag from "@/business/components/common/components/MsTag"; import MsTag from "@/business/components/common/components/MsTag";
import {hasLicense, getCurrentProjectID} from "@/common/js/utils"; import {hasLicense, getCurrentProjectID} from "@/common/js/utils";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
export default { export default {
name: "FunctionalRelevance", name: "FunctionalRelevance",
@ -127,6 +132,7 @@ export default {
MsTableSearchBar, MsTableSearchBar,
MsTableAdvSearchBar, MsTableAdvSearchBar,
MsTableHeader, MsTableHeader,
'VersionSelect': VersionSelect.default,
}, },
mounted(){ mounted(){
this.getVersionOptions(); this.getVersionOptions();
@ -255,6 +261,10 @@ export default {
}); });
} }
}, },
changeVersion(currentVersion) {
this.page.condition.versionId = currentVersion || null;
this.getTestCases();
}
} }
} }
</script> </script>

View File

@ -19,6 +19,7 @@
<ms-table-adv-search-bar :condition.sync="condition" class="adv-search-bar" <ms-table-adv-search-bar :condition.sync="condition" class="adv-search-bar"
v-if="condition.components !== undefined && condition.components.length > 0" v-if="condition.components !== undefined && condition.components.length > 0"
@search="getTestCases"/> @search="getTestCases"/>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion" margin-right="20" class="search-input"/>
<el-table <el-table
v-loading="result.loading" v-loading="result.loading"
@ -101,6 +102,8 @@ import MsTablePagination from "@/business/components/common/pagination/TablePagi
import {_filter} from "@/common/js/tableUtils"; import {_filter} from "@/common/js/tableUtils";
import {TEST_PLAN_RELEVANCE_LOAD_CASE} from "@/business/components/common/components/search/search-components"; import {TEST_PLAN_RELEVANCE_LOAD_CASE} from "@/business/components/common/components/search/search-components";
import {hasLicense, getCurrentProjectID} from "@/common/js/utils"; import {hasLicense, getCurrentProjectID} from "@/common/js/utils";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
export default { export default {
name: "TestCaseLoadRelevance", name: "TestCaseLoadRelevance",
@ -113,7 +116,8 @@ export default {
MsTableAdvSearchBar, MsTableAdvSearchBar,
MsTableHeader, MsTableHeader,
MsPerformanceTestStatus, MsPerformanceTestStatus,
MsTablePagination MsTablePagination,
'VersionSelect': VersionSelect.default,
}, },
data() { data() {
return { return {
@ -140,7 +144,7 @@ export default {
{text: 'Completed', value: 'Completed'}, {text: 'Completed', value: 'Completed'},
{text: 'Error', value: 'Error'} {text: 'Error', value: 'Error'}
], ],
versionFilters: [] versionFilters: [],
}; };
}, },
props: { props: {
@ -303,6 +307,10 @@ export default {
}); });
} }
}, },
changeVersion(currentVersion){
this.condition.versionId = currentVersion || null;
this.search();
}
} }
} }
</script> </script>

View File

@ -24,7 +24,11 @@
<el-container> <el-container>
<el-main class="case-content"> <el-main class="case-content">
<ms-table-header :condition.sync="condition" @search="search" title="" :show-create="false"/> <ms-table-header :condition.sync="condition" @search="search" title="" :show-create="false">
<template v-slot:searchBarBefore>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion" margin-right="20"/>
</template>
</ms-table-header>
<el-table :data="testReviews" @mouseleave.passive="leave" v-el-table-infinite-scroll="scrollLoading" <el-table :data="testReviews" @mouseleave.passive="leave" v-el-table-infinite-scroll="scrollLoading"
@filter-change="filter" row-key="id" @filter-change="filter" row-key="id"
@select-all="handleSelectAll" @select-all="handleSelectAll"
@ -122,6 +126,8 @@ import elTableInfiniteScroll from 'el-table-infinite-scroll';
import SelectMenu from "../../../common/SelectMenu"; import SelectMenu from "../../../common/SelectMenu";
import {_filter} from "@/common/js/tableUtils"; import {_filter} from "@/common/js/tableUtils";
import {getCurrentProjectID, getCurrentUserId, getCurrentWorkspaceId, hasLicense} from "@/common/js/utils"; import {getCurrentProjectID, getCurrentUserId, getCurrentWorkspaceId, hasLicense} from "@/common/js/utils";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
export default { export default {
@ -135,269 +141,273 @@ export default {
MsTableSearchBar, MsTableSearchBar,
MsTableAdvSearchBar, MsTableAdvSearchBar,
MsTableHeader, MsTableHeader,
SwitchProject, SwitchProject,
ReviewStatus ReviewStatus,
'VersionSelect': VersionSelect.default,
},
directives: {
'el-table-infinite-scroll': elTableInfiniteScroll
},
data() {
return {
openType: 'relevance',
checked: true,
result: {},
currentProject: {},
dialogFormVisible: false,
isCheckAll: false,
testReviews: [],
versionFilters: [],
selectIds: new Set(),
treeNodes: [],
selectNodeIds: [],
selectNodeNames: [],
projectId: '',
projectName: '',
projects: [],
pageSize: 50,
currentPage: 1,
total: 0,
lineStatus: true,
condition: {
components: TEST_CASE_CONFIGS
},
priorityFilters: [
{text: 'P0', value: 'P0'},
{text: 'P1', value: 'P1'},
{text: 'P2', value: 'P2'},
{text: 'P3', value: 'P3'}
],
typeFilters: [
{text: this.$t('commons.functional'), value: 'functional'},
{text: this.$t('commons.performance'), value: 'performance'},
{text: this.$t('commons.api'), value: 'api'}
],
statusFilters: [
{text: this.$t('test_track.review.prepare'), value: 'Prepare'},
{text: this.$t('test_track.review.pass'), value: 'Pass'},
{text: this.$t('test_track.review.un_pass'), value: 'UnPass'},
],
};
},
props: {
reviewId: {
type: String
}
},
watch: {
reviewId() {
this.condition.reviewId = this.reviewId;
}, },
directives: { selectNodeIds() {
'el-table-infinite-scroll': elTableInfiniteScroll if (this.dialogFormVisible) {
},
data() {
return {
openType: 'relevance',
checked: true,
result: {},
currentProject: {},
dialogFormVisible: false,
isCheckAll: false,
testReviews: [],
versionFilters: [],
selectIds: new Set(),
treeNodes: [],
selectNodeIds: [],
selectNodeNames: [],
projectId: '',
projectName: '',
projects: [],
pageSize: 50,
currentPage: 1,
total: 0,
lineStatus: true,
condition: {
components: TEST_CASE_CONFIGS
},
priorityFilters: [
{text: 'P0', value: 'P0'},
{text: 'P1', value: 'P1'},
{text: 'P2', value: 'P2'},
{text: 'P3', value: 'P3'}
],
typeFilters: [
{text: this.$t('commons.functional'), value: 'functional'},
{text: this.$t('commons.performance'), value: 'performance'},
{text: this.$t('commons.api'), value: 'api'}
],
statusFilters: [
{text: this.$t('test_track.review.prepare'), value: 'Prepare'},
{text: this.$t('test_track.review.pass'), value: 'Pass'},
{text: this.$t('test_track.review.un_pass'), value: 'UnPass'},
],
};
},
props: {
reviewId: {
type: String
}
},
watch: {
reviewId() {
this.condition.reviewId = this.reviewId;
},
selectNodeIds() {
if (this.dialogFormVisible) {
this.search();
}
},
projectId() {
this.condition.projectId = this.projectId;
this.getProjectNode();
}
},
mounted() {
if (hasLicense()) {
this.getVersionOptions();
}
},
updated() {
this.toggleSelection(this.testReviews);
},
methods: {
hasLicense(){
return hasLicense();
},
openTestReviewRelevanceDialog() {
this.getProject();
this.dialogFormVisible = true;
},
saveReviewRelevance() {
let param = {};
param.reviewId = this.reviewId;
param.testCaseIds = [...this.selectIds];
param.request = this.condition;
/*
param.checked = this.checked;
*/
//
if (this.testReviews.length === param.testCaseIds.length) {
param.testCaseIds = ['all'];
}
this.result = this.$post('/test/case/review/relevance', param, () => {
this.selectIds.clear();
this.$success(this.$t('commons.save_success'));
this.dialogFormVisible = false;
this.$emit('refresh');
});
},
buildPagePath(path) {
return path + "/" + this.currentPage + "/" + this.pageSize;
},
getReviews(flag) {
if (this.reviewId) {
this.condition.reviewId = this.reviewId;
}
if (this.selectNodeIds && this.selectNodeIds.length > 0) {
this.condition.nodeIds = this.selectNodeIds;
} else {
this.condition.nodeIds = [];
}
if (this.projectId) {
this.condition.projectId = this.projectId;
this.result = this.$post(this.buildPagePath('/test/case/reviews/case'), this.condition, response => {
let data = response.data;
this.total = data.itemCount;
let tableData = data.listObject;
tableData.forEach(item => {
item.checked = false;
});
flag ? this.testReviews = tableData : this.testReviews = this.testReviews.concat(tableData);
//
let hash = {}
this.testReviews = this.testReviews.reduce((item, next) => {
if (!hash[next.id]) {
hash[next.id] = true
item.push(next)
}
return item
}, [])
this.lineStatus = tableData.length === 50 && this.testReviews.length < this.total;
});
}
},
handleSelectAll(selection) {
if (selection.length > 0) {
this.testReviews.forEach(item => {
this.selectIds.add(item.id);
});
} else {
this.testReviews.forEach(item => {
if (this.selectIds.has(item.id)) {
this.selectIds.delete(item.id);
}
});
}
},
handleSelectionChange(selection, row) {
if (this.selectIds.has(row.id)) {
this.selectIds.delete(row.id);
} else {
this.selectIds.add(row.id);
}
},
nodeChange(node, nodeIds, nodeNames) {
this.selectNodeIds = nodeIds;
this.selectNodeNames = nodeNames;
},
refresh() {
this.close();
},
getAllNodeTreeByPlanId() {
if (this.reviewId) {
let param = {
reviewId: this.reviewId,
projectId: this.projectId
};
this.result = this.$post("/case/node/list/all/review", param, response => {
this.treeNodes = response.data;
});
}
},
close() {
this.lineStatus = false;
this.selectIds.clear();
this.selectNodeIds = [];
this.selectNodeNames = [];
},
filter(filters) {
_filter(filters, this.condition);
this.search(); this.search();
}, }
toggleSelection(rows) { },
rows.forEach(row => { projectId() {
this.selectIds.forEach(id => { this.condition.projectId = this.projectId;
if (row.id === id) { this.getProjectNode();
// true }
this.$refs.table.toggleRowSelection(row, true) },
mounted() {
if (hasLicense()) {
this.getVersionOptions();
}
},
updated() {
this.toggleSelection(this.testReviews);
},
methods: {
hasLicense() {
return hasLicense();
},
openTestReviewRelevanceDialog() {
this.getProject();
this.dialogFormVisible = true;
},
saveReviewRelevance() {
let param = {};
param.reviewId = this.reviewId;
param.testCaseIds = [...this.selectIds];
param.request = this.condition;
/*
param.checked = this.checked;
*/
//
if (this.testReviews.length === param.testCaseIds.length) {
param.testCaseIds = ['all'];
}
this.result = this.$post('/test/case/review/relevance', param, () => {
this.selectIds.clear();
this.$success(this.$t('commons.save_success'));
this.dialogFormVisible = false;
this.$emit('refresh');
});
},
buildPagePath(path) {
return path + "/" + this.currentPage + "/" + this.pageSize;
},
getReviews(flag) {
if (this.reviewId) {
this.condition.reviewId = this.reviewId;
}
if (this.selectNodeIds && this.selectNodeIds.length > 0) {
this.condition.nodeIds = this.selectNodeIds;
} else {
this.condition.nodeIds = [];
}
if (this.projectId) {
this.condition.projectId = this.projectId;
this.result = this.$post(this.buildPagePath('/test/case/reviews/case'), this.condition, response => {
let data = response.data;
this.total = data.itemCount;
let tableData = data.listObject;
tableData.forEach(item => {
item.checked = false;
});
flag ? this.testReviews = tableData : this.testReviews = this.testReviews.concat(tableData);
//
let hash = {}
this.testReviews = this.testReviews.reduce((item, next) => {
if (!hash[next.id]) {
hash[next.id] = true
item.push(next)
} }
}) return item
}, [])
this.lineStatus = tableData.length === 50 && this.testReviews.length < this.total;
});
}
},
handleSelectAll(selection) {
if (selection.length > 0) {
this.testReviews.forEach(item => {
this.selectIds.add(item.id);
});
} else {
this.testReviews.forEach(item => {
if (this.selectIds.has(item.id)) {
this.selectIds.delete(item.id);
}
});
}
},
handleSelectionChange(selection, row) {
if (this.selectIds.has(row.id)) {
this.selectIds.delete(row.id);
} else {
this.selectIds.add(row.id);
}
},
nodeChange(node, nodeIds, nodeNames) {
this.selectNodeIds = nodeIds;
this.selectNodeNames = nodeNames;
},
refresh() {
this.close();
},
getAllNodeTreeByPlanId() {
if (this.reviewId) {
let param = {
reviewId: this.reviewId,
projectId: this.projectId
};
this.result = this.$post("/case/node/list/all/review", param, response => {
this.treeNodes = response.data;
});
}
},
close() {
this.lineStatus = false;
this.selectIds.clear();
this.selectNodeIds = [];
this.selectNodeNames = [];
},
filter(filters) {
_filter(filters, this.condition);
this.search();
},
toggleSelection(rows) {
rows.forEach(row => {
this.selectIds.forEach(id => {
if (row.id === id) {
// true
this.$refs.table.toggleRowSelection(row, true)
}
}) })
}, })
getProject() { },
if (this.reviewId) { getProject() {
this.$post("/project/list/related", {userId: getCurrentUserId(), workspaceId: getCurrentWorkspaceId()}, res => { if (this.reviewId) {
let data = res.data; this.$post("/project/list/related", {userId: getCurrentUserId(), workspaceId: getCurrentWorkspaceId()}, res => {
if (data) { let data = res.data;
this.projects = data; if (data) {
const index = data.findIndex(d => d.id === getCurrentProjectID()); this.projects = data;
if (index !== -1) { const index = data.findIndex(d => d.id === getCurrentProjectID());
this.projectId = data[index].id; if (index !== -1) {
this.projectName = data[index].name; this.projectId = data[index].id;
this.currentProject = data[index]; this.projectName = data[index].name;
} else { this.currentProject = data[index];
this.projectId = data[0].id; } else {
this.projectName = data[0].name; this.projectId = data[0].id;
this.currentProject = data[0]; this.projectName = data[0].name;
} this.currentProject = data[0];
} }
}) }
} })
}, }
switchProject() { },
this.$refs.switchProject.open({id: this.reviewId, url: '/test/case/review/project/', type: 'review'}); switchProject() {
}, this.$refs.switchProject.open({id: this.reviewId, url: '/test/case/review/project/', type: 'review'});
scrollLoading() { },
if (this.dialogFormVisible && this.lineStatus) { scrollLoading() {
this.currentPage += 1; if (this.dialogFormVisible && this.lineStatus) {
this.getReviews(); this.currentPage += 1;
} this.getReviews();
}, }
search() { },
this.currentPage = 1; search() {
this.testReviews = []; this.currentPage = 1;
this.getReviews(true); this.testReviews = [];
}, this.getReviews(true);
changeProject(project) { },
this.projectId = project.id; changeProject(project) {
}, this.projectId = project.id;
},
getProjectNode(projectId) { getProjectNode(projectId) {
const index = this.projects.findIndex(project => project.id === projectId); const index = this.projects.findIndex(project => project.id === projectId);
if (index !== -1) { if (index !== -1) {
this.projectName = this.projects[index].name; this.projectName = this.projects[index].name;
this.currentProject = this.projects[index]; this.currentProject = this.projects[index];
} }
if (projectId) { if (projectId) {
this.projectId = projectId; this.projectId = projectId;
} }
this.result = this.$post("/case/node/list/all/review", this.result = this.$post("/case/node/list/all/review",
{reviewId: this.reviewId, projectId: this.projectId}, response => { {reviewId: this.reviewId, projectId: this.projectId}, response => {
this.treeNodes = response.data; this.treeNodes = response.data;
}); });
this.selectNodeIds = []; this.selectNodeIds = [];
}, },
getVersionOptions() { getVersionOptions() {
if (hasLicense()) { if (hasLicense()) {
this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => { this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => {
this.versionFilters = response.data.map(u => { this.versionFilters = response.data.map(u => {
return {text: u.name, value: u.id}; return {text: u.name, value: u.id};
});
}); });
} });
}, }
},
changeVersion(version) {
this.condition.versionId = version || null;
this.search();
} }
} }
}
</script> </script>
<style scoped> <style scoped>