快速定位我的用例

This commit is contained in:
chenjianxing 2020-04-17 17:30:55 +08:00
parent c640f4566e
commit b6b0aca9e0
8 changed files with 128 additions and 20 deletions

View File

@ -3,6 +3,7 @@ package io.metersphere.base.mapper.ext;
import io.metersphere.base.domain.TestCase;
import io.metersphere.controller.request.ReportRequest;
import io.metersphere.controller.request.testcase.QueryTestCaseRequest;
import io.metersphere.controller.request.testplancase.QueryTestPlanCaseRequest;
import io.metersphere.dto.ReportDTO;
import io.metersphere.dto.TestPlanCaseDTO;
import org.apache.ibatis.annotations.Param;
@ -13,5 +14,5 @@ public interface ExtTestCaseMapper {
List<TestCase> getTestCaseNames(@Param("request") QueryTestCaseRequest request);
List<TestPlanCaseDTO> getTestPlanTestCases(@Param("request") QueryTestCaseRequest request);
List<TestPlanCaseDTO> getTestPlanTestCases(@Param("request") QueryTestPlanCaseRequest request);
}

View File

@ -37,5 +37,8 @@
<if test="request.name != null">
and t2.name like CONCAT('%', #{request.name},'%')
</if>
<if test="request.executor != null">
and t1.executor = #{request.executor}
</if>
</select>
</mapper>

View File

@ -8,6 +8,7 @@ import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.controller.request.testcase.QueryTestCaseRequest;
import io.metersphere.controller.request.testcase.TestCaseBatchRequest;
import io.metersphere.controller.request.testplancase.QueryTestPlanCaseRequest;
import io.metersphere.dto.TestPlanCaseDTO;
import io.metersphere.service.TestPlanTestCaseService;
import org.springframework.web.bind.annotation.*;
@ -23,7 +24,7 @@ public class TestPlanTestCaseController {
TestPlanTestCaseService testPlanTestCaseService;
@PostMapping("/list/{goPage}/{pageSize}")
public Pager<List<TestPlanCaseDTO>> getTestPlanCases(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestCaseRequest request){
public Pager<List<TestPlanCaseDTO>> getTestPlanCases(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestPlanCaseRequest request){
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, testPlanTestCaseService.getTestPlanCases(request));
}
@ -43,6 +44,4 @@ public class TestPlanTestCaseController {
return testPlanTestCaseService.deleteTestCase(id);
}
}

View File

@ -0,0 +1,39 @@
package io.metersphere.controller.request.testplancase;
import io.metersphere.base.domain.TestCase;
import io.metersphere.base.domain.TestPlanTestCase;
import java.util.List;
public class QueryTestPlanCaseRequest extends TestPlanTestCase {
private List<Integer> nodeIds;
private String workspaceId;
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<Integer> getNodeIds() {
return nodeIds;
}
public void setNodeIds(List<Integer> nodeIds) {
this.nodeIds = nodeIds;
}
public String getWorkspaceId() {
return workspaceId;
}
public void setWorkspaceId(String workspaceId) {
this.workspaceId = workspaceId;
}
}

View File

@ -7,6 +7,7 @@ import io.metersphere.base.mapper.ext.ExtTestCaseMapper;
import io.metersphere.commons.utils.BeanUtils;
import io.metersphere.controller.request.testcase.QueryTestCaseRequest;
import io.metersphere.controller.request.testcase.TestCaseBatchRequest;
import io.metersphere.controller.request.testplancase.QueryTestPlanCaseRequest;
import io.metersphere.dto.TestPlanCaseDTO;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;
@ -25,11 +26,10 @@ public class TestPlanTestCaseService {
@Resource
ExtTestCaseMapper extTestCaseMapper;
public List<TestPlanCaseDTO> getTestPlanCases(QueryTestCaseRequest request) {
public List<TestPlanCaseDTO> getTestPlanCases(QueryTestPlanCaseRequest request) {
return extTestCaseMapper.getTestPlanTestCases(request);
}
public void editTestCase(TestPlanTestCase testPlanTestCase) {
testPlanTestCase.setUpdateTime(System.currentTimeMillis());
testPlanTestCaseMapper.updateByPrimaryKeySelective(testPlanTestCase);

View File

@ -0,0 +1,54 @@
<template>
<el-tooltip :disabled="disabled"
:content="tip"
placement="bottom"
:effect="effect">
<el-button @click="exec()"
circle
:type="type"
:icon="icon"
:size="size"/>
</el-tooltip>
</template>
<script>
export default {
name: "MsTipButton",
props: {
tip: String,
icon: {
type: String,
default: 'el-icon-question'
},
type: {
type: String,
default: null
},
effect: {
type: String,
default: 'dark'
},
size: {
type: String,
default: 'mini'
},
disabled: {
type: Boolean,
default: false
}
},
methods: {
exec() {
this.$emit('click');
}
}
}
</script>
<style scoped>
</style>

View File

@ -1,5 +1,5 @@
<template>
<el-row type="flex" justify="start">
<el-row type="flex" justify="start" :gutter="20">
<el-col>
<el-button type="success" round
:icon="status == 'Pass' ? 'el-icon-check' : ''"

View File

@ -7,6 +7,12 @@
<el-row type="flex" justify="end">
<el-col>
<span class="title">{{$t('test_track.test_case')}} </span>
<ms-tip-button v-if="!showMyTestCase"
:tip="'我的用例'"
icon="el-icon-s-custom" @click="searchMyTestCase"/>
<ms-tip-button v-if="showMyTestCase"
:tip="'全部用例'"
icon="el-icon-files" @click="searchMyTestCase"/>
</el-col>
<el-col :offset="8">
@ -38,7 +44,7 @@
<el-input type="text" size="small" :placeholder="$t('load_test.search_by_name')"
prefix-icon="el-icon-search"
maxlength="60"
v-model="condition" @change="search" clearable/>
v-model="condition.name" @change="search" clearable/>
</span>
</el-col>
</el-row>
@ -157,15 +163,18 @@
import PlanNodeTree from './PlanNodeTree';
import ExecutorEdit from './ExecutorEdit';
import StatusEdit from './StatusEdit';
import MsTipButton from '../../../../components/common/components/MsTipButton';
import {TokenKey} from '../../../../../common/js/constants';
export default {
name: "TestPlanTestCaseList",
components: {PlanNodeTree, StatusEdit, ExecutorEdit},
components: {PlanNodeTree, StatusEdit, ExecutorEdit, MsTipButton},
data() {
return {
result: {},
deletePath: "/test/case/delete",
condition: "",
condition: {},
showMyTestCase: false,
tableData: [],
multipleSelection: [],
currentPage: 1,
@ -192,9 +201,8 @@
methods: {
initTableData(nodeIds) {
if (this.planId) {
let param = {
name: this.condition,
};
let param = {};
Object.assign(param, this.condition);
param.nodeIds = nodeIds;
param.planId = this.planId;
this.result = this.$post(this.buildPagePath('/test/plan/case/list'), param, response => {
@ -272,6 +280,16 @@
} else if (type === 'status'){
this.$refs.statusEdit.openStatusEdit();
}
},
searchMyTestCase() {
this.showMyTestCase = !this.showMyTestCase;
if (this.showMyTestCase) {
let user = JSON.parse(localStorage.getItem(TokenKey));
this.condition.executor = user.id;
} else {
this.condition.executor = null;
}
this.initTableData();
}
}
}
@ -286,10 +304,4 @@
}
/*.main-content {*/
/*margin: 0 auto;*/
/*width: 100%;*/
/*max-width: 1200px;*/
/*}*/
</style>