refactor(测试跟踪): 关联测试用例一次加载全部优化
This commit is contained in:
parent
a02cb2cc46
commit
92122e0546
|
@ -77,9 +77,10 @@ public class TestCaseController {
|
||||||
return testCaseService.getTestCaseNames(request);
|
return testCaseService.getTestCaseNames(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/reviews/case")
|
@PostMapping("/reviews/case/{goPage}/{pageSize}")
|
||||||
public List<TestCase> getReviewCase(@RequestBody QueryTestCaseRequest request) {
|
public Pager<List<TestCase>> getReviewCase(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestCaseRequest request) {
|
||||||
return testCaseService.getReviewCase(request);
|
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||||
|
return PageUtils.setPageInfo(page, testCaseService.getReviewCase(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get/{testCaseId}")
|
@GetMapping("/get/{testCaseId}")
|
||||||
|
|
|
@ -34,7 +34,8 @@
|
||||||
"html2canvas": "^1.0.0-rc.7",
|
"html2canvas": "^1.0.0-rc.7",
|
||||||
"jspdf": "^2.1.1",
|
"jspdf": "^2.1.1",
|
||||||
"yan-progress": "^1.0.3",
|
"yan-progress": "^1.0.3",
|
||||||
"nprogress": "^0.2.0"
|
"nprogress": "^0.2.0",
|
||||||
|
"el-table-infinite-scroll": "^1.0.10"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vue/cli-plugin-babel": "^4.1.0",
|
"@vue/cli-plugin-babel": "^4.1.0",
|
||||||
|
|
|
@ -11,7 +11,9 @@
|
||||||
|
|
||||||
<el-container class="main-content">
|
<el-container class="main-content">
|
||||||
<el-aside class="tree-aside" width="250px">
|
<el-aside class="tree-aside" width="250px">
|
||||||
<el-link type="primary" class="project-link" @click="switchProject">{{projectName ? projectName : $t('test_track.switch_project') }}</el-link>
|
<el-link type="primary" class="project-link" @click="switchProject">{{projectName ? projectName :
|
||||||
|
$t('test_track.switch_project') }}
|
||||||
|
</el-link>
|
||||||
<node-tree class="node-tree"
|
<node-tree class="node-tree"
|
||||||
@nodeSelectEvent="nodeChange"
|
@nodeSelectEvent="nodeChange"
|
||||||
@refresh="refresh"
|
@refresh="refresh"
|
||||||
|
@ -21,9 +23,11 @@
|
||||||
|
|
||||||
<el-container>
|
<el-container>
|
||||||
<el-main class="case-content">
|
<el-main class="case-content">
|
||||||
<ms-table-header :condition.sync="condition" @search="getReviews" title="" :show-create="false"/>
|
<ms-table-header :condition.sync="condition" @search="search" title="" :show-create="false"/>
|
||||||
<el-table
|
<el-table
|
||||||
:data="testReviews"
|
:data="testReviews"
|
||||||
|
v-el-table-infinite-scroll="loadData"
|
||||||
|
class="infinite-list"
|
||||||
@filter-change="filter"
|
@filter-change="filter"
|
||||||
row-key="id"
|
row-key="id"
|
||||||
@select-all="handleSelectAll"
|
@select-all="handleSelectAll"
|
||||||
|
@ -72,7 +76,7 @@
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<div style="text-align: center">共 {{testReviews.length}} 条</div>
|
<div style="text-align: center">共 {{total}} 条</div>
|
||||||
</el-main>
|
</el-main>
|
||||||
</el-container>
|
</el-container>
|
||||||
</el-container>
|
</el-container>
|
||||||
|
@ -90,19 +94,20 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import NodeTree from "../../../common/NodeTree";
|
import NodeTree from "../../../common/NodeTree";
|
||||||
import MsDialogFooter from "../../../../common/components/MsDialogFooter";
|
import MsDialogFooter from "../../../../common/components/MsDialogFooter";
|
||||||
import PriorityTableItem from "../../../common/tableItems/planview/PriorityTableItem";
|
import PriorityTableItem from "../../../common/tableItems/planview/PriorityTableItem";
|
||||||
import TypeTableItem from "../../../common/tableItems/planview/TypeTableItem";
|
import TypeTableItem from "../../../common/tableItems/planview/TypeTableItem";
|
||||||
import MsTableSearchBar from "../../../../common/components/MsTableSearchBar";
|
import MsTableSearchBar from "../../../../common/components/MsTableSearchBar";
|
||||||
import MsTableAdvSearchBar from "../../../../common/components/search/MsTableAdvSearchBar";
|
import MsTableAdvSearchBar from "../../../../common/components/search/MsTableAdvSearchBar";
|
||||||
import MsTableHeader from "../../../../common/components/MsTableHeader";
|
import MsTableHeader from "../../../../common/components/MsTableHeader";
|
||||||
import SwitchProject from "../../../case/components/SwitchProject";
|
import SwitchProject from "../../../case/components/SwitchProject";
|
||||||
import {TEST_CASE_CONFIGS} from "../../../../common/components/search/search-components";
|
import {TEST_CASE_CONFIGS} from "../../../../common/components/search/search-components";
|
||||||
import {_filter} from "../../../../../../common/js/utils";
|
import {_filter} from "../../../../../../common/js/utils";
|
||||||
import StatusTableItem from "@/business/components/track/common/tableItems/planview/StatusTableItem";
|
import StatusTableItem from "@/business/components/track/common/tableItems/planview/StatusTableItem";
|
||||||
|
import elTableInfiniteScroll from 'el-table-infinite-scroll';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TestReviewRelevance",
|
name: "TestReviewRelevance",
|
||||||
components: {
|
components: {
|
||||||
NodeTree,
|
NodeTree,
|
||||||
|
@ -115,12 +120,16 @@ export default {
|
||||||
SwitchProject,
|
SwitchProject,
|
||||||
StatusTableItem
|
StatusTableItem
|
||||||
},
|
},
|
||||||
|
directives: {
|
||||||
|
'el-table-infinite-scroll': elTableInfiniteScroll
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
result: {},
|
result: {},
|
||||||
dialogFormVisible: false,
|
dialogFormVisible: false,
|
||||||
isCheckAll: false,
|
isCheckAll: false,
|
||||||
testReviews: [],
|
testReviews: [],
|
||||||
|
tableData: [],
|
||||||
selectIds: new Set(),
|
selectIds: new Set(),
|
||||||
treeNodes: [],
|
treeNodes: [],
|
||||||
selectNodeIds: [],
|
selectNodeIds: [],
|
||||||
|
@ -128,6 +137,10 @@ export default {
|
||||||
projectId: '',
|
projectId: '',
|
||||||
projectName: '',
|
projectName: '',
|
||||||
projects: [],
|
projects: [],
|
||||||
|
pageSize: 50,
|
||||||
|
currentPage: 1,
|
||||||
|
total: 0,
|
||||||
|
endStatus: true,
|
||||||
condition: {
|
condition: {
|
||||||
components: TEST_CASE_CONFIGS
|
components: TEST_CASE_CONFIGS
|
||||||
},
|
},
|
||||||
|
@ -159,7 +172,7 @@ export default {
|
||||||
this.initData();
|
this.initData();
|
||||||
},
|
},
|
||||||
selectNodeIds() {
|
selectNodeIds() {
|
||||||
this.getReviews();
|
this.search();
|
||||||
},
|
},
|
||||||
projectId() {
|
projectId() {
|
||||||
this.getProjectNode();
|
this.getProjectNode();
|
||||||
|
@ -185,6 +198,9 @@ export default {
|
||||||
this.$emit('refresh');
|
this.$emit('refresh');
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
buildPagePath(path) {
|
||||||
|
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||||
|
},
|
||||||
getReviews() {
|
getReviews() {
|
||||||
if (this.reviewId) {
|
if (this.reviewId) {
|
||||||
this.condition.reviewId = this.reviewId;
|
this.condition.reviewId = this.reviewId;
|
||||||
|
@ -197,11 +213,15 @@ export default {
|
||||||
|
|
||||||
if (this.projectId) {
|
if (this.projectId) {
|
||||||
this.condition.projectId = this.projectId;
|
this.condition.projectId = this.projectId;
|
||||||
this.result = this.$post('/test/case/reviews/case', this.condition, response => {
|
this.result = this.$post(this.buildPagePath('/test/case/reviews/case'), this.condition, response => {
|
||||||
this.testReviews = response.data;
|
let data = response.data;
|
||||||
this.testReviews.forEach(item => {
|
this.total = data.itemCount;
|
||||||
|
this.tableData = data.listObject;
|
||||||
|
this.endStatus = this.tableData.length === 50;
|
||||||
|
this.tableData.forEach(item => {
|
||||||
item.checked = false;
|
item.checked = false;
|
||||||
});
|
});
|
||||||
|
this.testReviews = this.testReviews.concat(this.tableData);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,8 +252,9 @@ export default {
|
||||||
this.selectNodeNames = nodeNames;
|
this.selectNodeNames = nodeNames;
|
||||||
},
|
},
|
||||||
initData() {
|
initData() {
|
||||||
this.getReviews();
|
// this.testReviews=[];
|
||||||
this.getAllNodeTreeByPlanId();
|
// this.getReviews();
|
||||||
|
// this.getAllNodeTreeByPlanId();
|
||||||
},
|
},
|
||||||
refresh() {
|
refresh() {
|
||||||
this.close();
|
this.close();
|
||||||
|
@ -244,19 +265,21 @@ export default {
|
||||||
reviewId: this.reviewId,
|
reviewId: this.reviewId,
|
||||||
projectId: this.projectId
|
projectId: this.projectId
|
||||||
};
|
};
|
||||||
this.result = this.$post("/case/node/list/all/review", param , response => {
|
this.result = this.$post("/case/node/list/all/review", param, response => {
|
||||||
this.treeNodes = response.data;
|
this.treeNodes = response.data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
|
this.endStatus = false;
|
||||||
this.selectIds.clear();
|
this.selectIds.clear();
|
||||||
this.selectNodeIds = [];
|
this.selectNodeIds = [];
|
||||||
this.selectNodeNames = [];
|
this.selectNodeNames = [];
|
||||||
|
this.tableData = [];
|
||||||
},
|
},
|
||||||
filter(filters) {
|
filter(filters) {
|
||||||
_filter(filters, this.condition);
|
_filter(filters, this.condition);
|
||||||
this.initData();
|
this.search();
|
||||||
},
|
},
|
||||||
toggleSelection(rows) {
|
toggleSelection(rows) {
|
||||||
rows.forEach(row => {
|
rows.forEach(row => {
|
||||||
|
@ -270,7 +293,7 @@ export default {
|
||||||
},
|
},
|
||||||
getProject() {
|
getProject() {
|
||||||
if (this.reviewId) {
|
if (this.reviewId) {
|
||||||
this.$post("/test/case/review/projects", {reviewId: this.reviewId},res => {
|
this.$post("/test/case/review/projects", {reviewId: this.reviewId}, res => {
|
||||||
let data = res.data;
|
let data = res.data;
|
||||||
if (data) {
|
if (data) {
|
||||||
this.projects = data;
|
this.projects = data;
|
||||||
|
@ -281,8 +304,24 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
switchProject() {
|
switchProject() {
|
||||||
this.$refs.switchProject.open({id: this.reviewId, url : '/test/case/review/project/', type: 'review'});
|
this.$refs.switchProject.open({id: this.reviewId, url: '/test/case/review/project/', type: 'review'});
|
||||||
},
|
},
|
||||||
|
loadData() {
|
||||||
|
if (this.dialogFormVisible) {
|
||||||
|
if (this.endStatus === true) {
|
||||||
|
this.currentPage += 1;
|
||||||
|
this.getReviews();
|
||||||
|
} else {
|
||||||
|
this.$message.warning(this.$t('test_track.review_view.last_page'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
search() {
|
||||||
|
this.currentPage = 1;
|
||||||
|
this.testReviews = [];
|
||||||
|
this.getReviews();
|
||||||
|
},
|
||||||
|
|
||||||
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) {
|
||||||
|
@ -292,14 +331,14 @@ export default {
|
||||||
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 = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
@ -807,6 +807,7 @@ export default {
|
||||||
all_case: "All case",
|
all_case: "All case",
|
||||||
start_review: "Start Review",
|
start_review: "Start Review",
|
||||||
relevance_case: "Relevance Case",
|
relevance_case: "Relevance Case",
|
||||||
|
last_page: "It's the end!",
|
||||||
execute_result: "Result",
|
execute_result: "Result",
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
|
|
|
@ -809,6 +809,7 @@ export default {
|
||||||
all_case: "全部用例",
|
all_case: "全部用例",
|
||||||
start_review: "开始评审",
|
start_review: "开始评审",
|
||||||
relevance_case: "关联用例",
|
relevance_case: "关联用例",
|
||||||
|
last_page: "已经到底了!",
|
||||||
execute_result: "评审结果",
|
execute_result: "评审结果",
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
|
|
|
@ -809,6 +809,7 @@ export default {
|
||||||
all_case: "全部用例",
|
all_case: "全部用例",
|
||||||
start_review: "開始評審",
|
start_review: "開始評審",
|
||||||
relevance_case: "關聯用例",
|
relevance_case: "關聯用例",
|
||||||
|
last_page: "已經到底了!",
|
||||||
execute_result: "評審結果",
|
execute_result: "評審結果",
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
|
|
Loading…
Reference in New Issue