fix: 用例评审测试计划版本选择框
This commit is contained in:
parent
23b4884e19
commit
f3fa4412a5
|
@ -31,26 +31,6 @@
|
|||
<if test="request.refId != null">
|
||||
and load_test.ref_id = #{request.refId}
|
||||
</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">
|
||||
<foreach collection="request.filters.entrySet()" index="key" item="values">
|
||||
<if test="values != null and values.size() > 0">
|
||||
|
|
|
@ -9,6 +9,7 @@ import io.metersphere.base.mapper.LoadTestMapper;
|
|||
import io.metersphere.base.mapper.LoadTestReportMapper;
|
||||
import io.metersphere.base.mapper.TestPlanLoadCaseMapper;
|
||||
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.ExtTestPlanLoadCaseMapper;
|
||||
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.dto.LoadTestDTO;
|
||||
import io.metersphere.log.vo.OperatingLogDetails;
|
||||
import io.metersphere.performance.request.QueryTestPlanRequest;
|
||||
import io.metersphere.performance.request.RunTestPlanRequest;
|
||||
import io.metersphere.performance.service.PerformanceTestService;
|
||||
import io.metersphere.track.dto.*;
|
||||
|
@ -69,6 +71,8 @@ public class TestPlanLoadCaseService {
|
|||
@Resource
|
||||
@Lazy
|
||||
private TestPlanService testPlanService;
|
||||
@Resource
|
||||
private ExtLoadTestMapper extLoadTestMapper;
|
||||
|
||||
public Pager<List<LoadTestDTO>> relevanceList(LoadCaseRequest request, int goPage, int pageSize) {
|
||||
List<OrderRequest> orders = ServiceUtils.getDefaultSortOrder(request.getOrders());
|
||||
|
@ -82,7 +86,12 @@ public class TestPlanLoadCaseService {
|
|||
return PageUtils.setPageInfo(PageHelper.startPage(goPage, pageSize, true), new ArrayList <>());
|
||||
}
|
||||
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) {
|
||||
|
|
|
@ -27,7 +27,11 @@
|
|||
:plan-id="planId"
|
||||
:versionFilters="versionFilters"
|
||||
@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
|
||||
v-if="!isApiListEnable"
|
||||
|
@ -36,9 +40,15 @@
|
|||
:is-api-list-enable="isApiListEnable"
|
||||
:project-id="projectId"
|
||||
:is-test-plan="true"
|
||||
:versionFilters="versionFilters"
|
||||
:plan-id="planId"
|
||||
@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>
|
||||
|
||||
|
@ -51,6 +61,8 @@
|
|||
import RelevanceApiList from "../../../../../api/automation/scenario/api/RelevanceApiList";
|
||||
import RelevanceCaseList from "../../../../../api/automation/scenario/api/RelevanceCaseList";
|
||||
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 {
|
||||
name: "TestCaseApiRelevance",
|
||||
|
@ -59,6 +71,7 @@
|
|||
RelevanceApiList,
|
||||
MsApiModule,
|
||||
TestCaseRelevanceBase,
|
||||
'VersionSelect': VersionSelect.default,
|
||||
},
|
||||
data() {
|
||||
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>
|
||||
|
|
|
@ -17,8 +17,11 @@
|
|||
ref="nodeTree"/>
|
||||
</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
|
||||
v-loading="page.result.loading"
|
||||
: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 MsTag from "@/business/components/common/components/MsTag";
|
||||
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 {
|
||||
name: "FunctionalRelevance",
|
||||
|
@ -127,6 +132,7 @@ export default {
|
|||
MsTableSearchBar,
|
||||
MsTableAdvSearchBar,
|
||||
MsTableHeader,
|
||||
'VersionSelect': VersionSelect.default,
|
||||
},
|
||||
mounted(){
|
||||
this.getVersionOptions();
|
||||
|
@ -255,6 +261,10 @@ export default {
|
|||
});
|
||||
}
|
||||
},
|
||||
changeVersion(currentVersion) {
|
||||
this.page.condition.versionId = currentVersion || null;
|
||||
this.getTestCases();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
<ms-table-adv-search-bar :condition.sync="condition" class="adv-search-bar"
|
||||
v-if="condition.components !== undefined && condition.components.length > 0"
|
||||
@search="getTestCases"/>
|
||||
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion" margin-right="20" class="search-input"/>
|
||||
|
||||
<el-table
|
||||
v-loading="result.loading"
|
||||
|
@ -101,6 +102,8 @@ import MsTablePagination from "@/business/components/common/pagination/TablePagi
|
|||
import {_filter} from "@/common/js/tableUtils";
|
||||
import {TEST_PLAN_RELEVANCE_LOAD_CASE} from "@/business/components/common/components/search/search-components";
|
||||
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 {
|
||||
name: "TestCaseLoadRelevance",
|
||||
|
@ -113,7 +116,8 @@ export default {
|
|||
MsTableAdvSearchBar,
|
||||
MsTableHeader,
|
||||
MsPerformanceTestStatus,
|
||||
MsTablePagination
|
||||
MsTablePagination,
|
||||
'VersionSelect': VersionSelect.default,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -140,7 +144,7 @@ export default {
|
|||
{text: 'Completed', value: 'Completed'},
|
||||
{text: 'Error', value: 'Error'}
|
||||
],
|
||||
versionFilters: []
|
||||
versionFilters: [],
|
||||
};
|
||||
},
|
||||
props: {
|
||||
|
@ -303,6 +307,10 @@ export default {
|
|||
});
|
||||
}
|
||||
},
|
||||
changeVersion(currentVersion){
|
||||
this.condition.versionId = currentVersion || null;
|
||||
this.search();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -24,7 +24,11 @@
|
|||
|
||||
<el-container>
|
||||
<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"
|
||||
@filter-change="filter" row-key="id"
|
||||
@select-all="handleSelectAll"
|
||||
|
@ -122,6 +126,8 @@ import elTableInfiniteScroll from 'el-table-infinite-scroll';
|
|||
import SelectMenu from "../../../common/SelectMenu";
|
||||
import {_filter} from "@/common/js/tableUtils";
|
||||
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 {
|
||||
|
@ -135,269 +141,273 @@ export default {
|
|||
MsTableSearchBar,
|
||||
MsTableAdvSearchBar,
|
||||
MsTableHeader,
|
||||
SwitchProject,
|
||||
ReviewStatus
|
||||
|
||||
SwitchProject,
|
||||
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: {
|
||||
'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;
|
||||
},
|
||||
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);
|
||||
selectNodeIds() {
|
||||
if (this.dialogFormVisible) {
|
||||
this.search();
|
||||
},
|
||||
toggleSelection(rows) {
|
||||
rows.forEach(row => {
|
||||
this.selectIds.forEach(id => {
|
||||
if (row.id === id) {
|
||||
// true 是为选中
|
||||
this.$refs.table.toggleRowSelection(row, true)
|
||||
}
|
||||
},
|
||||
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();
|
||||
},
|
||||
toggleSelection(rows) {
|
||||
rows.forEach(row => {
|
||||
this.selectIds.forEach(id => {
|
||||
if (row.id === id) {
|
||||
// true 是为选中
|
||||
this.$refs.table.toggleRowSelection(row, true)
|
||||
}
|
||||
})
|
||||
},
|
||||
getProject() {
|
||||
if (this.reviewId) {
|
||||
this.$post("/project/list/related", {userId: getCurrentUserId(), workspaceId: getCurrentWorkspaceId()}, res => {
|
||||
let data = res.data;
|
||||
if (data) {
|
||||
this.projects = data;
|
||||
const index = data.findIndex(d => d.id === getCurrentProjectID());
|
||||
if (index !== -1) {
|
||||
this.projectId = data[index].id;
|
||||
this.projectName = data[index].name;
|
||||
this.currentProject = data[index];
|
||||
} else {
|
||||
this.projectId = data[0].id;
|
||||
this.projectName = data[0].name;
|
||||
this.currentProject = data[0];
|
||||
}
|
||||
})
|
||||
},
|
||||
getProject() {
|
||||
if (this.reviewId) {
|
||||
this.$post("/project/list/related", {userId: getCurrentUserId(), workspaceId: getCurrentWorkspaceId()}, res => {
|
||||
let data = res.data;
|
||||
if (data) {
|
||||
this.projects = data;
|
||||
const index = data.findIndex(d => d.id === getCurrentProjectID());
|
||||
if (index !== -1) {
|
||||
this.projectId = data[index].id;
|
||||
this.projectName = data[index].name;
|
||||
this.currentProject = data[index];
|
||||
} else {
|
||||
this.projectId = data[0].id;
|
||||
this.projectName = data[0].name;
|
||||
this.currentProject = data[0];
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
switchProject() {
|
||||
this.$refs.switchProject.open({id: this.reviewId, url: '/test/case/review/project/', type: 'review'});
|
||||
},
|
||||
scrollLoading() {
|
||||
if (this.dialogFormVisible && this.lineStatus) {
|
||||
this.currentPage += 1;
|
||||
this.getReviews();
|
||||
}
|
||||
},
|
||||
search() {
|
||||
this.currentPage = 1;
|
||||
this.testReviews = [];
|
||||
this.getReviews(true);
|
||||
},
|
||||
changeProject(project) {
|
||||
this.projectId = project.id;
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
switchProject() {
|
||||
this.$refs.switchProject.open({id: this.reviewId, url: '/test/case/review/project/', type: 'review'});
|
||||
},
|
||||
scrollLoading() {
|
||||
if (this.dialogFormVisible && this.lineStatus) {
|
||||
this.currentPage += 1;
|
||||
this.getReviews();
|
||||
}
|
||||
},
|
||||
search() {
|
||||
this.currentPage = 1;
|
||||
this.testReviews = [];
|
||||
this.getReviews(true);
|
||||
},
|
||||
changeProject(project) {
|
||||
this.projectId = project.id;
|
||||
},
|
||||
|
||||
getProjectNode(projectId) {
|
||||
const index = this.projects.findIndex(project => project.id === projectId);
|
||||
if (index !== -1) {
|
||||
this.projectName = this.projects[index].name;
|
||||
this.currentProject = this.projects[index];
|
||||
}
|
||||
if (projectId) {
|
||||
this.projectId = projectId;
|
||||
}
|
||||
this.result = this.$post("/case/node/list/all/review",
|
||||
{reviewId: this.reviewId, projectId: this.projectId}, response => {
|
||||
this.treeNodes = response.data;
|
||||
});
|
||||
getProjectNode(projectId) {
|
||||
const index = this.projects.findIndex(project => project.id === projectId);
|
||||
if (index !== -1) {
|
||||
this.projectName = this.projects[index].name;
|
||||
this.currentProject = this.projects[index];
|
||||
}
|
||||
if (projectId) {
|
||||
this.projectId = projectId;
|
||||
}
|
||||
this.result = this.$post("/case/node/list/all/review",
|
||||
{reviewId: this.reviewId, projectId: this.projectId}, response => {
|
||||
this.treeNodes = response.data;
|
||||
});
|
||||
|
||||
this.selectNodeIds = [];
|
||||
},
|
||||
getVersionOptions() {
|
||||
if (hasLicense()) {
|
||||
this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => {
|
||||
this.versionFilters = response.data.map(u => {
|
||||
return {text: u.name, value: u.id};
|
||||
});
|
||||
this.selectNodeIds = [];
|
||||
},
|
||||
getVersionOptions() {
|
||||
if (hasLicense()) {
|
||||
this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => {
|
||||
this.versionFilters = response.data.map(u => {
|
||||
return {text: u.name, value: u.id};
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
changeVersion(version) {
|
||||
this.condition.versionId = version || null;
|
||||
this.search();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
Loading…
Reference in New Issue