fix test case
This commit is contained in:
parent
04fa63a1e5
commit
51fa6ed5b0
|
@ -28,6 +28,8 @@ public class TestPlanController {
|
|||
|
||||
@PostMapping("/list/{goPage}/{pageSize}")
|
||||
public Pager<List<TestPlanDTO>> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestPlanRequest request) {
|
||||
String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId();
|
||||
request.setWorkspaceId(currentWorkspaceId);
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
return PageUtils.setPageInfo(page, testPlanService.listTestPlan(request));
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
<script>
|
||||
import MsCreateBox from "../settings/CreateBox";
|
||||
import {Message} from "element-ui";
|
||||
import {CURRENT_PROJECT, TokenKey} from "../../../common/constants";
|
||||
import {TokenKey} from "../../../common/constants";
|
||||
|
||||
export default {
|
||||
name: "MsProject",
|
||||
|
@ -168,10 +168,6 @@
|
|||
this.$get('/project/delete/' + row.id, () => {
|
||||
Message.success(this.$t('commons.delete_success'));
|
||||
this.list();
|
||||
let currentProject = JSON.parse(localStorage.getItem(CURRENT_PROJECT));
|
||||
if(currentProject && row.id === currentProject.id){
|
||||
localStorage.removeItem(CURRENT_PROJECT);
|
||||
}
|
||||
});
|
||||
}).catch(() => {
|
||||
});
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<label v-for="(item,index) in projects" :key="index">
|
||||
<el-menu-item @click="changeProject(item)">
|
||||
{{item.name}}
|
||||
<i class="el-icon-check" v-if="item.id === currentProject.id"></i>
|
||||
<i class="el-icon-check" v-if="currentProject && item.id === currentProject.id"></i>
|
||||
</el-menu-item>
|
||||
</label>
|
||||
</el-scrollbar>
|
||||
|
@ -22,6 +22,7 @@
|
|||
</el-submenu>
|
||||
</el-menu>
|
||||
<node-tree class="node_tree"
|
||||
:current-project="currentProject"
|
||||
@nodeSelectEvent="refreshTable"
|
||||
@refresh="refreshTable"
|
||||
ref="nodeTree"></node-tree>
|
||||
|
@ -30,6 +31,7 @@
|
|||
<el-main class="main-content">
|
||||
|
||||
<test-case-list
|
||||
:current-project="currentProject"
|
||||
@openTestCaseEditDialog="openTestCaseEditDialog"
|
||||
@testCaseEdit="openTestCaseEditDialog"
|
||||
ref="testCaseList"></test-case-list>
|
||||
|
@ -67,7 +69,6 @@
|
|||
total: 0,
|
||||
loadingRequire: {project: true, testCase: true},
|
||||
projects: [],
|
||||
initProjects: [],
|
||||
currentProject: null,
|
||||
treeNodes: []
|
||||
}
|
||||
|
@ -95,22 +96,29 @@
|
|||
methods: {
|
||||
getProjects() {
|
||||
this.$get("/project/listAll", (response) => {
|
||||
if (response.success) {
|
||||
this.projects = response.data;
|
||||
this.initProjects = this.projects.slice(0, 4);
|
||||
if(localStorage.getItem(CURRENT_PROJECT)) {
|
||||
this.currentProject = JSON.parse(localStorage.getItem(CURRENT_PROJECT));
|
||||
} else {
|
||||
this.currentProject = this.projects[0];
|
||||
if(this.projects.length > 0){
|
||||
localStorage.setItem(CURRENT_PROJECT, JSON.stringify(this.projects[0]));
|
||||
this.projects = response.data;
|
||||
if (localStorage.getItem(CURRENT_PROJECT)) {
|
||||
let lastProject = JSON.parse(localStorage.getItem(CURRENT_PROJECT));
|
||||
let hasCurrentProject = false;
|
||||
for (let i = 0; i < this.projects.length; i++) {
|
||||
if (this.projects[i].id == lastProject.id) {
|
||||
this.currentProject = lastProject;
|
||||
hasCurrentProject = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasCurrentProject) {
|
||||
this.currentProject = null;
|
||||
}
|
||||
if(this.projects.length > 0){
|
||||
this.currentProject = this.projects[0];
|
||||
localStorage.setItem(CURRENT_PROJECT, JSON.stringify(this.projects[0]));
|
||||
}
|
||||
} else {
|
||||
this.$message()({
|
||||
type: 'warning',
|
||||
message: response.message
|
||||
});
|
||||
if(this.projects.length > 0){
|
||||
this.currentProject = this.projects[0];
|
||||
localStorage.setItem(CURRENT_PROJECT, JSON.stringify(this.projects[0]));
|
||||
}
|
||||
}
|
||||
this.loadingRequire.project = false;
|
||||
// this.checkProject();
|
||||
|
|
|
@ -91,9 +91,17 @@
|
|||
defaultKeys: []
|
||||
};
|
||||
},
|
||||
props: {
|
||||
currentProject: {
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
filterText(val) {
|
||||
this.$refs.tree.filter(val);
|
||||
},
|
||||
currentProject() {
|
||||
this.getNodeTree();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
@ -163,8 +171,8 @@
|
|||
this.dialogFormVisible = true;
|
||||
},
|
||||
getNodeTree() {
|
||||
if (localStorage.getItem(CURRENT_PROJECT)) {
|
||||
let projectId = JSON.parse(localStorage.getItem(CURRENT_PROJECT)).id;
|
||||
if (this.currentProject) {
|
||||
let projectId = this.currentProject.id;
|
||||
this.$get("/case/node/list/" + projectId, response => {
|
||||
this.treeNodes = response.data;
|
||||
});
|
||||
|
|
|
@ -139,9 +139,19 @@
|
|||
testId: null
|
||||
}
|
||||
},
|
||||
props: {
|
||||
currentProject: {
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
created: function () {
|
||||
this.initTableData();
|
||||
},
|
||||
watch: {
|
||||
currentProject() {
|
||||
this.initTableData();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initTableData(nodeIds) {
|
||||
let param = {
|
||||
|
@ -149,16 +159,15 @@
|
|||
};
|
||||
param.nodeIds = nodeIds;
|
||||
|
||||
if(localStorage.getItem(CURRENT_PROJECT)) {
|
||||
param.projectId = JSON.parse(localStorage.getItem(CURRENT_PROJECT)).id;
|
||||
if (this.currentProject) {
|
||||
param.projectId = this.currentProject.id;
|
||||
this.$post(this.buildPagePath('/test/case/list'), param, response => {
|
||||
this.loadingRequire.testCase = false;
|
||||
let data = response.data;
|
||||
this.total = data.itemCount;
|
||||
this.tableData = data.listObject;
|
||||
});
|
||||
}
|
||||
|
||||
this.$post(this.buildPagePath('/test/case/list'), param, response => {
|
||||
this.loadingRequire.testCase = false;
|
||||
let data = response.data;
|
||||
this.total = data.itemCount;
|
||||
this.tableData = data.listObject;
|
||||
});
|
||||
},
|
||||
search() {
|
||||
this.initTableData();
|
||||
|
|
Loading…
Reference in New Issue