feat: 页面优化-测试跟踪所有表格设置操作列固定、表格高度固定、增加全选操作

页面优化-测试跟踪所有表格设置操作列固定、表格高度固定、增加全选操作
This commit is contained in:
song-tianyang 2021-04-07 15:25:12 +08:00 committed by fit2-zhao
parent 92596cfd36
commit 2a5e13bfce
52 changed files with 1818 additions and 502 deletions

View File

@ -1,5 +1,6 @@
package io.metersphere.api.controller;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.metersphere.api.dto.*;
@ -10,6 +11,8 @@ import io.metersphere.api.dto.datacount.response.ApiDataCountDTO;
import io.metersphere.api.dto.datacount.response.ExecutedCaseInfoDTO;
import io.metersphere.api.dto.datacount.response.TaskInfoResult;
import io.metersphere.api.dto.definition.RunDefinitionRequest;
import io.metersphere.api.dto.definition.request.ParameterConfig;
import io.metersphere.api.dto.scenario.environment.EnvironmentConfig;
import io.metersphere.api.dto.scenario.request.dubbo.RegistryCenter;
import io.metersphere.api.service.*;
import io.metersphere.base.domain.*;
@ -34,10 +37,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.*;
import static io.metersphere.commons.utils.JsonPathUtils.getListJson;
@ -70,6 +70,8 @@ public class APITestController {
private CheckPermissionService checkPermissionService;
@Resource
private HistoricalDataUpgradeService historicalDataUpgradeService;
@Resource
private ApiTestEnvironmentService environmentService;
@GetMapping("recent/{count}")
public List<APITestResult> recentTest(@PathVariable int count) {
@ -396,7 +398,18 @@ public class APITestController {
@PostMapping(value = "/genPerformanceTestXml", consumes = {"multipart/form-data"})
public JmxInfoDTO genPerformanceTest(@RequestPart("request") RunDefinitionRequest runRequest, @RequestPart(value = "files") List<MultipartFile> bodyFiles) throws Exception {
HashTree hashTree = runRequest.getTestElement().generateHashTree();
ParameterConfig config = new ParameterConfig();
config.setProjectId(runRequest.getProjectId());
Map<String, EnvironmentConfig> envConfig = new HashMap<>();
Map<String, String> map = runRequest.getEnvironmentMap();
if (map != null && map.size() > 0) {
ApiTestEnvironmentWithBLOBs environment = environmentService.get(map.get(runRequest.getProjectId()));
EnvironmentConfig env = JSONObject.parseObject(environment.getConfig(), EnvironmentConfig.class);
envConfig.put(runRequest.getProjectId(), env);
config.setConfig(envConfig);
}
HashTree hashTree = runRequest.getTestElement().generateHashTree(config);
String jmxString = runRequest.getTestElement().getJmx(hashTree);
String testName = runRequest.getName();

View File

@ -19,4 +19,6 @@ public interface ExtTestPlanApiCaseMapper {
List<String> getNotRelevanceCaseIds(@Param("planId")String planId, @Param("relevanceProjectIds")List<String> relevanceProjectIds);
List<String> getStatusByTestPlanId(String id);
List<String> selectIds(@Param("request") ApiTestCaseRequest request);
}

View File

@ -108,6 +108,97 @@
</foreach>
</if>
</select>
<select id="selectIds" resultType="java.lang.String">
select
t.id
from
test_plan_api_case t
inner join
api_test_case c
on t.api_case_id = c.id
<if test="request.planId != null and request.planId!=''">
and t.test_plan_id = #{request.planId}
</if>
inner join
api_definition a
on
c.api_definition_id = a.id
<if test="request.protocol != null and request.protocol!=''">
and a.protocol = #{request.protocol}
</if>
<choose>
<when test="request.status == 'Trash'">
and a.status = 'Trash'
</when>
<when test="request.status == null">
and a.status != 'Trash'
</when>
<when test="request.status == ''">
and a.status != 'Trash'
</when>
<when test="request.status == 'running'">
and t.status IS NULL
</when>
<otherwise>
and t.status = #{request.status}
</otherwise>
</choose>
where 1
<if test="request.ids != null and request.ids.size() > 0">
<if test="request.projectId != null and request.projectId!=''">
and
</if>
t.id in
<foreach collection="request.ids" item="caseId" separator="," open="(" close=")">
#{caseId}
</foreach>
</if>
<if test="request.name != null and request.name!=''">
and (c.name like CONCAT('%', #{request.name},'%') or c.tags like CONCAT('%', #{request.name},'%'))
</if>
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
and a.module_id in
<foreach collection="request.moduleIds" item="nodeId" separator="," open="(" close=")">
#{nodeId}
</foreach>
</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">
<choose>
<when test="key == 'priority'">
and c.priority in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key == 'user_id'">
and c.create_user_id in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
</choose>
</if>
</foreach>
</if>
<if test="request.orders != null and request.orders.size() > 0">
order by
<foreach collection="request.orders" separator="," item="order">
<choose>
<when test="order.name == 'update_time'">
t.${order.name} ${order.type}
</when>
<when test="order.name == 'create_user'">
create_user_id ${order.type}
</when>
<otherwise>
${order.name} ${order.type}
</otherwise>
</choose>
</foreach>
</if>
</select>
<select id="getExecResultByPlanId" resultType="java.lang.String">
select status
from

View File

@ -13,4 +13,5 @@ public interface ExtTestPlanLoadCaseMapper {
void updateCaseStatus(@Param("reportId") String reportId, @Param("status") String status);
List<String> getStatusByTestPlanId(@Param("planId") String planId);
List<String> selectTestPlanLoadCaseId(@Param("request") LoadCaseRequest request);
}

View File

@ -68,6 +68,45 @@
</foreach>
</if>
</select>
<select id="selectTestPlanLoadCaseId" resultType="java.lang.String">
select tplc.id
from test_plan_load_case tplc
inner join load_test lt on tplc.load_case_id = lt.id
inner join user u on lt.user_id = u.id
inner join project p on lt.project_id = p.id
<where>
tplc.test_plan_id = #{request.testPlanId}
<if test="request.projectId != null and request.projectId != ''">
and lt.project_id = #{request.projectId}
</if>
<if test="request.name != null">
and (lt.name like CONCAT('%', #{request.name},'%') or lt.num like CONCAT('%', #{request.name},'%'))
</if>
<if test="request.status != null">
and tplc.status like CONCAT('%', #{request.status},'%')
</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">
<choose>
<when test="key=='status'">
and lt.status in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
</choose>
</if>
</foreach>
</if>
</where>
<if test="request.orders != null and request.orders.size() > 0">
order by
<foreach collection="request.orders" separator="," item="order">
tplc.${order.name} ${order.type}
</foreach>
</if>
</select>
<select id="getStatusByTestPlanId" resultType="java.lang.String">
select status from test_plan_load_case tplc where tplc.test_plan_id = #{planId}
</select>

View File

@ -1,14 +1,8 @@
package io.metersphere.base.mapper.ext;
import io.metersphere.api.dto.automation.ApiScenarioDTO;
import io.metersphere.api.dto.automation.ApiScenarioRequest;
import io.metersphere.api.dto.automation.TestPlanScenarioRequest;
import io.metersphere.api.dto.definition.ApiTestCaseRequest;
import io.metersphere.api.dto.definition.TestPlanApiCaseDTO;
import io.metersphere.base.domain.TestPlanApiCase;
import io.metersphere.base.domain.TestPlanApiScenario;
import io.metersphere.track.dto.TestPlanDTO;
import io.metersphere.track.request.testcase.QueryTestPlanRequest;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -23,4 +17,6 @@ public interface ExtTestPlanScenarioCaseMapper {
List<String> getIdsByPlanId(String planId);
List<String> getNotRelevanceCaseIds(String planId, List<String> relevanceProjectIds);
List<String> selectIds(@Param("request")TestPlanScenarioRequest request);
}

View File

@ -87,6 +87,77 @@
</foreach>
</if>
</select>
<select id="selectIds" resultType="java.lang.String">
select
t.id
from
test_plan_api_scenario t
inner join
api_scenario c
on t.api_scenario_id = c.id and c.status != 'Trash'
<if test="request.planId != null and request.planId!=''">
and t.test_plan_id = #{request.planId}
</if>
left join project p
on c.project_id = p.id
left join user u
on c.user_id = u.id
where 1
<if test="request.ids != null and request.ids.size() > 0">
<if test="request.projectId != null and request.projectId!=''">
and
</if>
t.id in
<foreach collection="request.ids" item="caseId" separator="," open="(" close=")">
#{caseId}
</foreach>
</if>
<if test="request.name != null and request.name!=''">
and (c.name like CONCAT('%', #{request.name},'%')
or c.num like CONCAT('%', #{request.name},'%')
or c.tags like CONCAT('%', #{request.name},'%'))
</if>
<if test="request.status != null and request.status!=''">
and t.last_result like CONCAT('%', #{request.status},'%')
</if>
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
and c.api_scenario_module_id in
<foreach collection="request.moduleIds" item="nodeId" separator="," open="(" close=")">
#{nodeId}
</foreach>
</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">
<choose>
<when test="key == 'priority'">
and c.priority in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
</choose>
</if>
</foreach>
</if>
<if test="request.orders != null and request.orders.size() > 0">
order by
<foreach collection="request.orders" separator="," item="order">
<choose>
<when test="order.name == 'update_time'">
t.${order.name} ${order.type}
</when>
<otherwise>
${order.name} ${order.type}
</otherwise>
</choose>
</foreach>
</if>
</select>
<select id="getExecResultByPlanId" resultType="java.lang.String">
select last_result
from

View File

@ -4,6 +4,7 @@ import io.metersphere.track.dto.TestCaseReportStatusResultDTO;
import io.metersphere.track.dto.TestCaseTestDTO;
import io.metersphere.track.dto.TestPlanCaseDTO;
import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest;
import io.metersphere.track.request.testplancase.TestPlanFuncCaseConditions;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -50,4 +51,6 @@ public interface ExtTestPlanTestCaseMapper {
List<TestPlanCaseDTO> listForMinder(@Param("planId") String planId);
List<TestCaseTestDTO> listTestCaseTest(@Param("caseId") String caseId);
List<String> selectIds(@Param("request") TestPlanFuncCaseConditions conditions);
}

View File

@ -237,6 +237,104 @@
</foreach>
</if>
</select>
<select id="selectIds" resultType="java.lang.String">
select distinct test_plan_test_case.id as id
from test_plan_test_case
inner join test_case on test_plan_test_case.case_id = test_case.id
left join test_case_node on test_case_node.id = test_case.node_id
inner join project on project.id = test_case.project_id
<where>
<if test="request.combine != null">
<include refid="combine">
<property name="condition" value="request.combine"/>
<property name="name" value="request.name"/>
<property name="objectKey" value="request.combine.tags"/>
</include>
</if>
<if test="request.name != null">
and (test_case.name like CONCAT('%', #{request.name},'%') or test_case.num like
CONCAT('%',#{request.name},'%') or test_case.tags like CONCAT('%', #{request.name},'%'))
</if>
<if test="request.id != null">
and test_case.id = #{request.id}
</if>
<if test="request.nodeIds != null and request.nodeIds.size() > 0">
and test_case.node_id in
<foreach collection="request.nodeIds" item="nodeId" separator="," open="(" close=")">
#{nodeId}
</foreach>
</if>
<if test="request.status != null">
and test_plan_test_case.status = #{request.status}
</if>
<if test="request.executor != null">
and test_plan_test_case.executor = #{request.executor}
</if>
<if test="request.planId != null">
and test_plan_test_case.plan_id = #{request.planId}
</if>
<if test="request.method != null">
and test_case.method = #{request.method}
</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">
<choose>
<when test="key=='priority'">
and test_case.priority in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='type'">
and test_case.type in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='method'">
and test_case.method in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='maintainer'">
and test_case.maintainer in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='executor'">
and test_plan_test_case.executor in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<otherwise>
and test_plan_test_case.status in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</otherwise>
</choose>
</if>
</foreach>
</if>
</where>
<if test="request.orders != null and request.orders.size() > 0">
order by
<foreach collection="request.orders" separator="," item="order">
<choose>
<when test="order.name == 'num'">
test_case.num ${order.type}
</when>
<otherwise>
test_plan_test_case.${order.name} ${order.type}
</otherwise>
</choose>
</foreach>
</if>
</select>
<select id="listTestCaseByProjectIds" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
select distinct * from test_plan_test_case, test_case

View File

@ -10,11 +10,14 @@ import java.util.List;
public interface ExtTestReviewCaseMapper {
List<TestReviewCaseDTO> list(@Param("request") QueryCaseReviewRequest request);
List<String> getStatusByReviewId(String reviewId);
List<String> findRelateTestReviewId(@Param("userId") String userId, @Param("workspaceId") String workspaceId, @Param("projectId") String projectId);
/**
* 根据项目 ids 查询 TestReviewCaseDTO 列表
*
* @param ids project id list
* @return List<TestReviewCaseDTO>
*/
@ -22,8 +25,13 @@ public interface ExtTestReviewCaseMapper {
/**
* 获取 TestReviewTestCase 详细信息
*
* @param id TestReviewTestCase id
* @return TestReviewTestCase 详细信息
*/
TestReviewCaseDTO get(@Param("id") String id);
List<String> selectIds(@Param("request") QueryCaseReviewRequest request);
List<String> selectTestCaseIds(@Param("request") QueryCaseReviewRequest request);
}

View File

@ -187,6 +187,176 @@
</if>
</select>
<select id="selectIds" resultType="java.lang.String">
select test_case_review_test_case.id as id
from test_case_review_test_case
inner join test_case on test_case_review_test_case.case_id = test_case.id
left join test_case_node on test_case_node.id=test_case.node_id
inner join project on project.id = test_case.project_id
<where>
<if test="request.combine != null">
<include refid="combine">
<property name="condition" value="request.combine"/>
<property name="name" value="request.name"/>
</include>
</if>
<if test="request.name != null">
and (test_case.name like CONCAT('%', #{request.name},'%') or test_case.num like CONCAT('%', #{request.name},'%'))
</if>
<if test="request.id != null">
and test_case.id = #{request.id}
</if>
<if test="request.nodeIds != null and request.nodeIds.size() > 0">
and test_case.node_id in
<foreach collection="request.nodeIds" item="nodeId" separator="," open="(" close=")">
#{nodeId}
</foreach>
</if>
<if test="request.status != null">
and test_case_review_test_case.status = #{request.status}
</if>
<if test="request.reviewer != null">
and test_case_review_test_case.reviewer = #{request.reviewer}
</if>
<if test="request.reviewId != null">
and test_case_review_test_case.review_id = #{request.reviewId}
</if>
<if test="request.method != null">
and test_case.method = #{request.method}
</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">
<choose>
<when test="key=='priority'">
and test_case.priority in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='type'">
and test_case.type in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='method'">
and test_case.method in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='status'">
and test_case.review_status in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
</choose>
</if>
</foreach>
</if>
</where>
<if test="request.orders != null and request.orders.size() > 0">
order by
<foreach collection="request.orders" separator="," item="order">
<choose>
<when test="order.name == 'num'">
test_case.num ${order.type}
</when>
<otherwise>
test_case_review_test_case.${order.name} ${order.type}
</otherwise>
</choose>
</foreach>
</if>
</select>
<select id="selectTestCaseIds" resultType="java.lang.String">
select distinct test_case.id as id
from test_case_review_test_case
inner join test_case on test_case_review_test_case.case_id = test_case.id
left join test_case_node on test_case_node.id=test_case.node_id
inner join project on project.id = test_case.project_id
<where>
<if test="request.combine != null">
<include refid="combine">
<property name="condition" value="request.combine"/>
<property name="name" value="request.name"/>
</include>
</if>
<if test="request.name != null">
and (test_case.name like CONCAT('%', #{request.name},'%') or test_case.num like CONCAT('%', #{request.name},'%'))
</if>
<if test="request.id != null">
and test_case.id = #{request.id}
</if>
<if test="request.nodeIds != null and request.nodeIds.size() > 0">
and test_case.node_id in
<foreach collection="request.nodeIds" item="nodeId" separator="," open="(" close=")">
#{nodeId}
</foreach>
</if>
<if test="request.status != null">
and test_case_review_test_case.status = #{request.status}
</if>
<if test="request.reviewer != null">
and test_case_review_test_case.reviewer = #{request.reviewer}
</if>
<if test="request.reviewId != null">
and test_case_review_test_case.review_id = #{request.reviewId}
</if>
<if test="request.method != null">
and test_case.method = #{request.method}
</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">
<choose>
<when test="key=='priority'">
and test_case.priority in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='type'">
and test_case.type in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='method'">
and test_case.method in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<when test="key=='status'">
and test_case.review_status in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
</choose>
</if>
</foreach>
</if>
</where>
<if test="request.orders != null and request.orders.size() > 0">
order by
<foreach collection="request.orders" separator="," item="order">
<choose>
<when test="order.name == 'num'">
test_case.num ${order.type}
</when>
<otherwise>
test_case_review_test_case.${order.name} ${order.type}
</otherwise>
</choose>
</foreach>
</if>
</select>
<select id="get" resultType="io.metersphere.track.dto.TestReviewCaseDTO">
select test_case.remark, test_case_review_test_case.*, test_case.*, test_case_node.name as model, project.name as projectName
from test_case_review_test_case

View File

@ -8,6 +8,7 @@ import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.performance.request.RunTestPlanRequest;
import io.metersphere.track.dto.TestPlanLoadCaseDTO;
import io.metersphere.track.request.testplan.LoadCaseReportBatchRequest;
import io.metersphere.track.request.testplan.LoadCaseReportRequest;
import io.metersphere.track.request.testplan.LoadCaseRequest;
import io.metersphere.track.service.TestPlanLoadCaseService;
@ -56,8 +57,8 @@ public class TestPlanLoadCaseController {
}
@PostMapping("/batch/delete")
public void batchDelete(@RequestBody List<String> ids) {
testPlanLoadCaseService.batchDelete(ids);
public void batchDelete(@RequestBody LoadCaseReportBatchRequest request) {
testPlanLoadCaseService.batchDelete(request);
}
@PostMapping("/update")

View File

@ -9,7 +9,7 @@ import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.track.dto.RelevanceScenarioRequest;
import io.metersphere.track.request.testcase.TestPlanApiCaseBatchRequest;
import io.metersphere.track.request.testcase.TestPlanScenarioCaseBatchRequest;
import io.metersphere.track.service.TestPlanScenarioCaseService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
@ -46,7 +46,7 @@ public class TestPlanScenarioCaseController {
@PostMapping("/batch/delete")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public void deleteApiCaseBath(@RequestBody TestPlanApiCaseBatchRequest request) {
public void deleteApiCaseBath(@RequestBody TestPlanScenarioCaseBatchRequest request) {
testPlanScenarioCaseService.deleteApiCaseBath(request);
}

View File

@ -9,6 +9,7 @@ import io.metersphere.commons.utils.Pager;
import io.metersphere.track.dto.TestPlanCaseDTO;
import io.metersphere.track.request.testcase.TestPlanCaseBatchRequest;
import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest;
import io.metersphere.track.request.testplancase.TestPlanFuncCaseBatchRequest;
import io.metersphere.track.service.TestPlanTestCaseService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
@ -90,6 +91,12 @@ public class TestPlanTestCaseController {
return testPlanTestCaseService.list(request);
}
@PostMapping("/idList/all")
public List<String> getTestPlanCases(@RequestBody TestPlanFuncCaseBatchRequest request) {
return testPlanTestCaseService.idList(request);
}
@PostMapping("/list/ids")
public List<TestPlanCaseDTO> getTestPlanCaseIds(@RequestBody QueryTestPlanCaseRequest request) {
return testPlanTestCaseService.list(request);

View File

@ -0,0 +1,19 @@
package io.metersphere.track.request.testcase;
import io.metersphere.api.dto.definition.ApiTestCaseRequest;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
/**
* @author song.tianyang
* @Date 2021/4/6 5:32 下午
* @Description
*/
@Getter
@Setter
public class ApiCaseBatchCondition extends ApiTestCaseRequest {
private boolean selectAll;
private List<String> unSelectIds;
}

View File

@ -0,0 +1,19 @@
package io.metersphere.track.request.testcase;
import io.metersphere.api.dto.automation.TestPlanScenarioRequest;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
/**
* @author song.tianyang
* @Date 2021/4/6 5:32 下午
* @Description
*/
@Getter
@Setter
public class ScenarioCaseBatchCondition extends TestPlanScenarioRequest {
private boolean selectAll;
private List<String> unSelectIds;
}

View File

@ -21,4 +21,6 @@ public class TestPlanApiCaseBatchRequest extends TestPlanTestCase {
* 项目ID环境ID对应关系
*/
private Map<String, String> projectEnvMap;
private ApiCaseBatchCondition condition;
}

View File

@ -1,6 +1,7 @@
package io.metersphere.track.request.testcase;
import io.metersphere.base.domain.TestPlanTestCase;
import io.metersphere.track.request.testplancase.TestPlanFuncCaseConditions;
import lombok.Getter;
import lombok.Setter;
@ -10,4 +11,5 @@ import java.util.List;
@Setter
public class TestPlanCaseBatchRequest extends TestPlanTestCase {
private List<String> ids;
private TestPlanFuncCaseConditions condition;
}

View File

@ -0,0 +1,26 @@
package io.metersphere.track.request.testcase;
import io.metersphere.base.domain.TestPlanTestCase;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
import java.util.Map;
@Getter
@Setter
public class TestPlanScenarioCaseBatchRequest extends TestPlanTestCase {
private List<String> ids;
/**
* 批量修改选中的数据
*/
private Map<String, String> selectRows;
/**
* 项目ID环境ID对应关系
*/
private Map<String, String> projectEnvMap;
private ScenarioCaseBatchCondition condition;
}

View File

@ -0,0 +1,20 @@
package io.metersphere.track.request.testplan;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
/**
* @author song.tianyang
* @Date 2021/4/6 4:18 下午
* @Description
*/
@Getter
@Setter
public class BatchCondition extends LoadCaseRequest{
//是否针对的是全体数据
boolean selectAll;
//if selectAll is true 那么要在结果中排除掉的id集合
List<String> unSelectIds;
}

View File

@ -0,0 +1,26 @@
package io.metersphere.track.request.testplan;
/**
* @author song.tianyang
* @Date 2021/4/6 4:16 下午
* @Description
*/
import lombok.Getter;
import lombok.Setter;
import java.util.List;
/**
* 性能案例--批量处理的request
*/
@Getter
@Setter
public class LoadCaseReportBatchRequest {
List<String> ids;
private String projectId;
private BatchCondition condition;
}

View File

@ -0,0 +1,18 @@
package io.metersphere.track.request.testplancase;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
/**
* @author song.tianyang
* @Date 2021/4/7 10:30 上午
* @Description
*/
@Getter
@Setter
public class TestPlanFuncCaseBatchRequest {
private List<String> ids;
private TestPlanFuncCaseConditions condition;
}

View File

@ -0,0 +1,18 @@
package io.metersphere.track.request.testplancase;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
/**
* @author song.tianyang
* @Date 2021/4/7 10:33 上午
* @Description
*/
@Getter
@Setter
public class TestPlanFuncCaseConditions extends QueryTestPlanCaseRequest{
private boolean selectAll;
private List<String> unSelectIds;
}

View File

@ -1,6 +1,7 @@
package io.metersphere.track.request.testplancase;
import io.metersphere.base.domain.TestCaseReviewTestCase;
import io.metersphere.track.request.testreview.QueryCaseReviewCondition;
import lombok.Getter;
import lombok.Setter;
@ -11,4 +12,5 @@ import java.util.List;
public class TestReviewCaseBatchRequest extends TestCaseReviewTestCase {
private String reviewId;
private List<String> ids;
private QueryCaseReviewCondition condition;
}

View File

@ -0,0 +1,18 @@
package io.metersphere.track.request.testreview;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
/**
* @author song.tianyang
* @Date 2021/4/7 2:38 下午
* @Description
*/
@Getter
@Setter
public class QueryCaseReviewCondition extends QueryCaseReviewRequest {
private boolean selectAll;
private List<String> unSelectIds;
}

View File

@ -55,6 +55,13 @@ public class TestPlanApiCaseService {
return apiTestCases;
}
public List<String> selectIds(ApiTestCaseRequest request) {
request.setProjectId(null);
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
List<String> idList = extTestPlanApiCaseMapper.selectIds(request);
return idList;
}
public List<String> getExecResultByPlanId(String plan) {
return extTestPlanApiCaseMapper.getExecResultByPlanId(plan);
}
@ -89,13 +96,18 @@ public class TestPlanApiCaseService {
}
public void deleteApiCaseBath(TestPlanApiCaseBatchRequest request) {
if (CollectionUtils.isEmpty(request.getIds())) {
List<String> deleteIds = request.getIds();
if(request.getCondition()!=null && request.getCondition().isSelectAll()){
deleteIds = this.selectIds(request.getCondition());
}
if (CollectionUtils.isEmpty(deleteIds)) {
return;
}
apiDefinitionExecResultService.deleteByResourceIds(request.getIds());
apiDefinitionExecResultService.deleteByResourceIds(deleteIds);
TestPlanApiCaseExample example = new TestPlanApiCaseExample();
example.createCriteria()
.andIdIn(request.getIds())
.andIdIn(deleteIds)
.andTestPlanIdEqualTo(request.getPlanId());
testPlanApiCaseMapper.deleteByExample(example);
}

View File

@ -11,6 +11,7 @@ import io.metersphere.controller.request.OrderRequest;
import io.metersphere.performance.request.RunTestPlanRequest;
import io.metersphere.performance.service.PerformanceTestService;
import io.metersphere.track.dto.TestPlanLoadCaseDTO;
import io.metersphere.track.request.testplan.LoadCaseReportBatchRequest;
import io.metersphere.track.request.testplan.LoadCaseReportRequest;
import io.metersphere.track.request.testplan.LoadCaseRequest;
import org.apache.ibatis.session.ExecutorType;
@ -66,6 +67,19 @@ public class TestPlanLoadCaseService {
return extTestPlanLoadCaseMapper.selectTestPlanLoadCaseList(request);
}
public List<String> selectTestPlanLoadCaseIds(LoadCaseRequest request) {
List<OrderRequest> orders = request.getOrders();
if (orders == null || orders.size() < 1) {
OrderRequest orderRequest = new OrderRequest();
orderRequest.setName("create_time");
orderRequest.setType("desc");
orders = new ArrayList<>();
orders.add(orderRequest);
}
request.setOrders(orders);
return extTestPlanLoadCaseMapper.selectTestPlanLoadCaseId(request);
}
public void relevanceCase(LoadCaseRequest request) {
List<String> caseIds = request.getCaseIds();
String planId = request.getTestPlanId();
@ -145,6 +159,23 @@ public class TestPlanLoadCaseService {
testPlanLoadCaseMapper.deleteByExample(example);
}
public void batchDelete(LoadCaseReportBatchRequest request){
List<String> ids = request.getIds();
if(request.getCondition()!=null && request.getCondition().isSelectAll()){
ids = this.selectTestPlanLoadCaseIds(request.getCondition());
if(request.getCondition().getUnSelectIds()!=null){
ids.removeAll(request.getCondition().getUnSelectIds());
}
}
if (CollectionUtils.isEmpty(ids)) {
return;
}
TestPlanLoadCaseExample example = new TestPlanLoadCaseExample();
example.createCriteria().andIdIn(ids);
testPlanLoadCaseMapper.deleteByExample(example);
}
public void update(TestPlanLoadCase testPlanLoadCase) {
if (!StringUtils.isEmpty(testPlanLoadCase.getId())) {
testPlanLoadCaseMapper.updateByPrimaryKeySelective(testPlanLoadCase);

View File

@ -1,12 +1,10 @@
package io.metersphere.track.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONPath;
import io.metersphere.api.dto.automation.ApiScenarioDTO;
import io.metersphere.api.dto.automation.ApiScenarioRequest;
import io.metersphere.api.dto.automation.RunScenarioRequest;
import io.metersphere.api.dto.automation.TestPlanScenarioRequest;
import io.metersphere.api.dto.definition.RunDefinitionRequest;
import io.metersphere.api.service.ApiAutomationService;
import io.metersphere.api.service.ApiScenarioReportService;
import io.metersphere.base.domain.TestPlanApiScenario;
@ -16,11 +14,12 @@ import io.metersphere.base.mapper.ext.ExtTestPlanScenarioCaseMapper;
import io.metersphere.commons.constants.ApiRunMode;
import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.track.dto.RelevanceScenarioRequest;
import io.metersphere.track.request.testcase.TestPlanApiCaseBatchRequest;
import io.metersphere.track.request.testcase.TestPlanScenarioCaseBatchRequest;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
@ -48,6 +47,13 @@ public class TestPlanScenarioCaseService {
return apiTestCases;
}
public List<String> selectIds(TestPlanScenarioRequest request) {
request.setProjectId(null);
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
List<String> idList = extTestPlanScenarioCaseMapper.selectIds(request);
return idList;
}
public List<ApiScenarioDTO> relevanceList(ApiScenarioRequest request) {
request.setNotInTestPlan(true);
List<ApiScenarioDTO> list = apiAutomationService.list(request);
@ -67,13 +73,18 @@ public class TestPlanScenarioCaseService {
return testPlanApiScenarioMapper.deleteByExample(example);
}
public void deleteApiCaseBath(TestPlanApiCaseBatchRequest request) {
if (CollectionUtils.isEmpty(request.getIds())) {
public void deleteApiCaseBath(TestPlanScenarioCaseBatchRequest request) {
List<String> ids = request.getIds();
if(request.getCondition()!=null && request.getCondition().isSelectAll()){
ids = this.selectIds(request.getCondition());
}
if (CollectionUtils.isEmpty(ids)) {
return;
}
TestPlanApiScenarioExample example = new TestPlanApiScenarioExample();
example.createCriteria()
.andIdIn(request.getIds());
.andIdIn(ids);
List<String> reportIds = testPlanApiScenarioMapper.selectByExample(example).stream()
.map(TestPlanApiScenario::getReportId).collect(Collectors.toList());
apiScenarioReportService.deleteByIds(reportIds);
@ -109,14 +120,14 @@ public class TestPlanScenarioCaseService {
}
public void deleteByPlanId(String planId) {
TestPlanApiCaseBatchRequest request = new TestPlanApiCaseBatchRequest();
TestPlanScenarioCaseBatchRequest request = new TestPlanScenarioCaseBatchRequest();
List<String> ids = extTestPlanScenarioCaseMapper.getIdsByPlanId(planId);
request.setIds(ids);
deleteApiCaseBath(request);
}
public void deleteByRelevanceProjectIds(String planId, List<String> relevanceProjectIds) {
TestPlanApiCaseBatchRequest request = new TestPlanApiCaseBatchRequest();
TestPlanScenarioCaseBatchRequest request = new TestPlanScenarioCaseBatchRequest();
request.setIds(extTestPlanScenarioCaseMapper.getNotRelevanceCaseIds(planId, relevanceProjectIds));
request.setPlanId(planId);
deleteApiCaseBath(request);

View File

@ -15,6 +15,8 @@ import io.metersphere.track.dto.TestCaseTestDTO;
import io.metersphere.track.dto.TestPlanCaseDTO;
import io.metersphere.track.request.testcase.TestPlanCaseBatchRequest;
import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest;
import io.metersphere.track.request.testplancase.TestPlanFuncCaseBatchRequest;
import io.metersphere.track.request.testplancase.TestPlanFuncCaseConditions;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -90,8 +92,15 @@ public class TestPlanTestCaseService {
}
public void editTestCaseBath(TestPlanCaseBatchRequest request) {
List<String> ids = request.getIds();
if(request.getCondition()!=null && request.getCondition().isSelectAll()){
ids = extTestPlanTestCaseMapper.selectIds(request.getCondition());
if(request.getCondition().getUnSelectIds()!=null){
ids.removeAll(request.getCondition().getUnSelectIds());
}
}
TestPlanTestCaseExample testPlanTestCaseExample = new TestPlanTestCaseExample();
testPlanTestCaseExample.createCriteria().andIdIn(request.getIds());
testPlanTestCaseExample.createCriteria().andIdIn(ids);
TestPlanTestCaseWithBLOBs testPlanTestCase = new TestPlanTestCaseWithBLOBs();
BeanUtils.copyBean(testPlanTestCase, request);
@ -200,4 +209,17 @@ public class TestPlanTestCaseService {
testPlanTestCaseMapper.updateByPrimaryKeySelective(item);
});
}
public List<String> idList(TestPlanFuncCaseBatchRequest request) {
List<String> returnIdList = new ArrayList<>();
TestPlanFuncCaseConditions conditions = request.getCondition();
if(conditions!= null && conditions.isSelectAll()){
conditions.setOrders(ServiceUtils.getDefaultOrder(conditions.getOrders()));
returnIdList = extTestPlanTestCaseMapper.selectIds(conditions);
if(conditions.getUnSelectIds()!=null){
returnIdList.removeAll(conditions.getUnSelectIds());
}
}
return returnIdList;
}
}

View File

@ -10,7 +10,6 @@ import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.member.QueryMemberRequest;
import io.metersphere.service.UserService;
import io.metersphere.track.dto.TestCaseTestDTO;
import io.metersphere.track.dto.TestPlanCaseDTO;
import io.metersphere.track.dto.TestReviewCaseDTO;
import io.metersphere.track.request.testplancase.TestReviewCaseBatchRequest;
import io.metersphere.track.request.testreview.DeleteRelevanceRequest;
@ -69,6 +68,12 @@ public class TestReviewTestCaseService {
return list;
}
public List<String> selectIds(QueryCaseReviewRequest request) {
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
List<String> list = extTestReviewCaseMapper.selectIds(request);
return list;
}
private List<String> getReviewUserIds(String reviewId) {
TestCaseReviewUsersExample testCaseReviewUsersExample = new TestCaseReviewUsersExample();
testCaseReviewUsersExample.createCriteria().andReviewIdEqualTo(reviewId);
@ -109,8 +114,15 @@ public class TestReviewTestCaseService {
public void deleteTestCaseBatch(TestReviewCaseBatchRequest request) {
checkReviewer(request.getReviewId());
List<String> ids = request.getIds();
if(request.getCondition()!=null && request.getCondition().isSelectAll()){
ids = this.selectIds(request.getCondition());
if(request.getCondition().getUnSelectIds()!=null){
ids.removeAll(request.getCondition().getUnSelectIds());
}
}
TestCaseReviewTestCaseExample example = new TestCaseReviewTestCaseExample();
example.createCriteria().andIdIn(request.getIds());
example.createCriteria().andIdIn(ids);
testCaseReviewTestCaseMapper.deleteByExample(example);
}
@ -175,6 +187,12 @@ public class TestReviewTestCaseService {
public void editTestCaseBatchStatus(TestReviewCaseBatchRequest request) {
List<String> ids = request.getIds();
if(request.getCondition()!=null && request.getCondition().isSelectAll()){
ids = extTestReviewCaseMapper.selectTestCaseIds(request.getCondition());
if(request.getCondition().getUnSelectIds()!=null){
ids.removeAll(request.getCondition().getUnSelectIds());
}
}
if (CollectionUtils.isEmpty(ids)) {
return;
}

View File

@ -447,7 +447,7 @@ export default {
this.$nextTick(function () {
if (this.$refs.scenarioTable) {
setTimeout(this.$refs.scenarioTable.doLayout, 200)
setTimeout(this.$refs.scenarioTable.doLayout, 200);
}
this.checkTableRowIsSelect();
})

View File

@ -124,7 +124,7 @@
createCase() {
this.api = this.currentApi;
this.sysAddition();
}
},
},
created() {
this.api = this.currentApi;
@ -149,6 +149,14 @@
this.getApiTest(true);
this.visible = true;
},
runTestCase(api, testCaseId) {
this.api = api;
// testCaseId
this.testCaseId = testCaseId;
this.condition = {components: API_CASE_CONFIGS};
this.getApiTestToRunTestCase(testCaseId);
this.visible = true;
},
saveApiAndCase(api) {
this.visible = true;
this.api = api;
@ -211,9 +219,49 @@
selectAll(isSelectAll) {
this.apiCaseList.forEach(item => {
this.$set(item, 'selected', isSelectAll);
})
});
},
getApiTest(addCase) {
this.useEnvironment = "";
if (this.api) {
this.condition.projectId = this.projectId;
if (this.isCaseEdit) {
this.condition.id = this.testCaseId;
}
if (this.api) {
this.condition.apiDefinitionId = this.api.id;
}
this.result = this.$post("/api/testcase/list", this.condition, response => {
let data = [];
if (response.data) {
data = response.data;
}
data.forEach(apiCase => {
if (apiCase.tags && apiCase.tags.length > 0) {
apiCase.tags = JSON.parse(apiCase.tags);
this.$set(apiCase, 'selected', false);
}
if (Object.prototype.toString.call(apiCase.request).match(/\[object (\w+)\]/)[1].toLowerCase() != 'object') {
apiCase.request = JSON.parse(apiCase.request);
}
if (!apiCase.request.hashTree) {
apiCase.request.hashTree = [];
}
});
this.apiCaseList = data;
if (!this.useEnvironment && this.apiCaseList[0] && this.apiCaseList[0].request && this.apiCaseList[0].request.useEnvironment) {
this.useEnvironment = this.apiCaseList[0].request.useEnvironment;
this.environment = this.useEnvironment;
}
if (addCase && this.apiCaseList.length == 0 && !this.loaded) {
this.addCase();
}
});
}
},
getApiTestToRunTestCase(testCaseId) {
this.useEnvironment = "";
if (this.api) {
this.condition.projectId = this.projectId;
@ -247,9 +295,17 @@
this.useEnvironment = this.apiCaseList[0].request.useEnvironment;
this.environment = this.useEnvironment;
}
if (addCase && this.apiCaseList.length == 0 && !this.loaded) {
if (this.apiCaseList.length === 0 && !this.loaded) {
this.addCase();
}
this.apiCaseList.forEach(apicase => {
if (apicase.id === testCaseId) {
let data = apicase;
data.message = true;
this.singleRun(data);
}
});
});
}
},

View File

@ -97,12 +97,16 @@
</template>
</el-table-column>
</template>
<el-table-column fixed="right" v-if="!isReadOnly" :label="$t('commons.operating')" min-width="130"
<el-table-column fixed="right" v-if="!isReadOnly" :label="$t('commons.operating')" min-width="160"
align="center">
<template slot="header">
<header-label-operate @exec="customHeader"/>
</template>
<template v-slot:default="scope">
<ms-table-operator-button class="run-button" :is-tester-permission="true"
:tip="$t('api_test.automation.execute')"
icon="el-icon-video-play"
@exec="runTestCase(scope.row)"/>
<ms-table-operator-button :tip="$t('commons.edit')" icon="el-icon-edit" @exec="handleTestCase(scope.row)"
v-tester/>
<ms-table-operator-button :tip="$t('commons.delete')" icon="el-icon-delete" @exec="handleDelete(scope.row)"
@ -354,7 +358,7 @@ export default {
this.$nextTick(function () {
if (this.$refs.caseTable) {
setTimeout(this.$refs.caseTable.doLayout, 200)
setTimeout(this.$refs.caseTable.doLayout, 200);
}
this.checkTableRowIsSelect();
})
@ -412,7 +416,7 @@ export default {
},
handleSelectAll(selection) {
_handleSelectAll(this, selection, this.tableData, this.selectRows);
this.selectRowsCount(this.selectRows)
this.selectRowsCount(this.selectRows);
},
search() {
this.changeSelectDataRangeAll();
@ -421,7 +425,23 @@ export default {
buildPagePath(path) {
return path + "/" + this.currentPage + "/" + this.pageSize;
},
runTestCase(testCase) {
this.$get('/api/definition/get/' + testCase.apiDefinitionId, (response) => {
let api = response.data;
let selectApi = api;
let request = {};
if (Object.prototype.toString.call(api.request).match(/\[object (\w+)\]/)[1].toLowerCase() === 'object') {
request = api.request;
} else {
request = JSON.parse(api.request);
}
if (!request.hashTree) {
request.hashTree = [];
}
selectApi.url = request.path;
this.$refs.caseList.runTestCase(selectApi, testCase.id);
});
},
handleTestCase(testCase) {
this.$get('/api/definition/get/' + testCase.apiDefinitionId, (response) => {
let api = response.data;

View File

@ -464,7 +464,7 @@ export default {
// nexttick:
this.$nextTick(function () {
if (this.$refs.apiDefinitionTable) {
setTimeout(this.$refs.apiDefinitionTable.doLayout, 200)
setTimeout(this.$refs.apiDefinitionTable.doLayout, 200);
}
this.checkTableRowIsSelect();
})

View File

@ -20,13 +20,16 @@
<div style="width: 200px;margin:0 auto">
<el-row align="center" class="hidden-lg-and-down">
<el-col :span="6" style="padding: 5px;border-right-style: solid;border-right-width: 1px;border-right-color: #ECEEF4;">
<el-col :span="6"
style="padding: 5px;border-right-style: solid;border-right-width: 1px;border-right-color: #ECEEF4;">
<div class="count-info-div" v-html="apiCountData.httpCountStr"></div>
</el-col>
<el-col :span="6" style="padding: 5px;border-right-style: solid;border-right-width: 1px;border-right-color: #ECEEF4;">
<el-col :span="6"
style="padding: 5px;border-right-style: solid;border-right-width: 1px;border-right-color: #ECEEF4;">
<div class="count-info-div" v-html="apiCountData.rpcCountStr"></div>
</el-col>
<el-col :span="6" style="padding: 5px;border-right-style: solid;border-right-width: 1px;border-right-color: #ECEEF4;">
<el-col :span="6"
style="padding: 5px;border-right-style: solid;border-right-width: 1px;border-right-color: #ECEEF4;">
<div class="count-info-div" v-html="apiCountData.tcpCountStr"></div>
</el-col>
<el-col :span="6" style="padding: 5px;">
@ -34,13 +37,16 @@
</el-col>
</el-row>
<el-row align="right" style="margin-left: 20px" class="hidden-xl-only">
<el-col :span="6" style="padding: 5px;border-right-style: solid;border-right-width: 1px;border-right-color: #ECEEF4;">
<el-col :span="6"
style="padding: 5px;border-right-style: solid;border-right-width: 1px;border-right-color: #ECEEF4;">
<div class="count-info-div" v-html="apiCountData.httpCountStr"></div>
</el-col>
<el-col :span="6" style="padding: 5px;border-right-style: solid;border-right-width: 1px;border-right-color: #ECEEF4;">
<el-col :span="6"
style="padding: 5px;border-right-style: solid;border-right-width: 1px;border-right-color: #ECEEF4;">
<div class="count-info-div" v-html="apiCountData.rpcCountStr"></div>
</el-col>
<el-col :span="6" style="padding: 5px;border-right-style: solid;border-right-width: 1px;border-right-color: #ECEEF4;">
<el-col :span="6"
style="padding: 5px;border-right-style: solid;border-right-width: 1px;border-right-color: #ECEEF4;">
<div class="count-info-div" v-html="apiCountData.tcpCountStr"></div>
</el-col>
<el-col :span="6" style="padding: 5px;">
@ -55,7 +61,8 @@
<el-row>
<el-col>
{{ $t('api_test.home_page.api_details_card.this_week_add') }}
<el-link type="info" @click="redirectPage('thisWeekCount')" target="_blank" style="color: #000000">{{apiCountData.thisWeekAddedCount}}
<el-link type="info" @click="redirectPage('thisWeekCount')" target="_blank" style="color: #000000">
{{ apiCountData.thisWeekAddedCount }}
</el-link>
{{ $t('api_test.home_page.unit_of_measurement') }}
</el-col>
@ -71,6 +78,10 @@
<el-main style="padding: 0px 0px 0px 0px; line-height: 100px; text-align: center;">
<span class="count-number">
{{ apiCountData.completionRage }}
<el-tooltip placement="top" class="info-tool-tip">
<div slot="content">{{ $t('api_test.home_page.formula.completion')}}</div>
<el-button icon="el-icon-info" style="padding:0px;border: 0px"></el-button>
</el-tooltip>
</span>
</el-main>
</el-container>
@ -144,10 +155,12 @@ export default {
line-height: 100px;
text-align: center;
}
.count-number {
font-family: 'ArialMT', 'Arial', sans-serif;
font-size: 33px;
color: var(--count_number);
position: relative;
}
.main-number-show {
@ -163,16 +176,20 @@ export default {
.count-number-show {
margin: 20px auto;
}
.detail-container {
margin-top: 30px
}
.no-shadow-card {
-webkit-box-shadow: 0 0px 0px 0 rgba(0, 0, 0, .1);
box-shadow: 0 0px 0px 0 rgba(0, 0, 0, .1);
}
.default-property {
font-size: 12px
}
.main-property {
color: #F39021;
font-size: 12px
@ -185,7 +202,12 @@ export default {
.count-info-div {
margin: 3px;
}
.count-info-div >>> p {
font-size: 10px;
}
.info-tool-tip{
position: absolute;
top: 0;
}
</style>

View File

@ -59,6 +59,10 @@
<el-main style="padding: 0px 0px 0px 0px; line-height: 40px; text-align: center;">
<span class="rows-count-number">
{{sceneCountData.passRage}}
<el-tooltip placement="top" class="info-tool-tip">
<div slot="content">{{ $t('api_test.home_page.formula.pass')}}</div>
<el-button icon="el-icon-info" style="padding:0px;border: 0px"></el-button>
</el-tooltip>
</span>
</el-main>
</el-container>
@ -72,6 +76,10 @@
</span>
<span v-else class="rows-count-number">
{{interfaceCoverage}}
<el-tooltip placement="top" class="info-tool-tip">
<div slot="content">{{ $t('api_test.home_page.formula.interface_coverage')}}</div>
<el-button icon="el-icon-info" style="padding:0px;border: 0px"></el-button>
</el-tooltip>
</span>
</el-main>
</el-container>
@ -157,9 +165,10 @@ export default {
.rows-count-number{
font-family:'ArialMT', 'Arial', sans-serif;
font-size:30px;
font-size:23px;
color: var(--count_number);
margin:20px auto;
position: relative;
}
.lading-icon{
font-size: 25px;
@ -203,4 +212,8 @@ export default {
.count-info-div >>>p{
font-size: 10px;
}
.info-tool-tip{
position: absolute;
top: 0;
}
</style>

View File

@ -53,6 +53,10 @@
<el-main style="padding: 0px 0px 0px 0px; line-height: 100px; text-align: center;">
<span class="count-number">
{{scheduleTaskCountData.successRage}}
<el-tooltip placement="top" class="info-tool-tip">
<div slot="content">{{ $t('api_test.home_page.formula.success')}}</div>
<el-button icon="el-icon-info" style="padding:0px;border: 0px"></el-button>
</el-tooltip>
</span>
</el-main>
</el-container>
@ -125,6 +129,7 @@ export default {
font-family:'ArialMT', 'Arial', sans-serif;
font-size:33px;
color: var(--count_number);
position: relative;
}
.main-number-show {
@ -165,4 +170,8 @@ export default {
.count-info-div >>>p{
font-size: 10px;
}
.info-tool-tip{
position: absolute;
top: 0;
}
</style>

View File

@ -91,6 +91,10 @@
<el-main style="padding: 0px 0px 0px 0px; line-height: 100px; text-align: center;">
<span class="count-number">
{{testCaseCountData.coverageRage}}
<el-tooltip placement="top" class="info-tool-tip">
<div slot="content">{{ $t('api_test.home_page.formula.coverage')}}</div>
<el-button icon="el-icon-info" style="padding:0px;border: 0px"></el-button>
</el-tooltip>
</span>
</el-main>
</el-container>
@ -174,6 +178,7 @@ export default {
font-family:'ArialMT', 'Arial', sans-serif;
font-size:33px;
color: var(--count_number);
position: relative;
}
.main-number-show {
@ -214,4 +219,8 @@ export default {
.count-info-div >>>p{
font-size: 10px;
}
.info-tool-tip{
position: absolute;
top: 0;
}
</style>

View File

@ -386,4 +386,9 @@ export default {
padding: 4px 1px !important;
}
/deep/ .el-tabs__header {
margin: 0 0 0px;
/*width: calc(100% - 90px);*/
}
</style>

View File

@ -13,6 +13,7 @@
@select="handleSelect"
@header-dragend="headerDragend"
@cell-mouse-enter="showPopover"
:height="screenHeight"
row-key="id"
class="test-content adjust-table ms-select-all-fixed"
ref="table" @row-click="handleEdit">
@ -26,7 +27,7 @@
@selectPageAll="isSelectDataAll(false)"
@selectAll="isSelectDataAll(true)"/>
<el-table-column width="40" :resizable="false" align="center">
<el-table-column width="30" :resizable="false" align="center">
<template v-slot:default="scope">
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectDataCounts"/>
</template>
@ -39,6 +40,7 @@
sortable="custom"
:label="$t('commons.id')"
:key="index"
width="80"
show-overflow-tooltip>
</el-table-column>
<el-table-column
@ -47,6 +49,7 @@
:label="$t('commons.name')"
show-overflow-tooltip
:key="index"
width="120"
>
</el-table-column>
<el-table-column
@ -57,6 +60,7 @@
min-width="100px"
:label="$t('test_track.case.priority')"
show-overflow-tooltip
width="100"
:key="index">
<template v-slot:default="scope">
<priority-table-item :value="scope.row.priority"/>
@ -74,7 +78,7 @@
</span>
</template>
</el-table-column>
<el-table-column v-if="item.id=='tags'" prop="tags" :label="$t('commons.tag')" :key="index">
<el-table-column v-if="item.id=='tags'" prop="tags" :label="$t('commons.tag')" min-width="80" :key="index">
<template v-slot:default="scope">
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain"
:content="itemName" style="margin-left: 0px; margin-right: 2px"/>
@ -204,6 +208,7 @@ export default {
data() {
return {
type: TEST_CASE_LIST,
screenHeight: document.documentElement.clientHeight-310,
headerItems: Track_Test_Case,
tableLabel: [],
result: {},
@ -394,7 +399,7 @@ export default {
this.$nextTick(() => {
if (this.$refs.table) {
setTimeout(this.$refs.table.doLayout, 200)
setTimeout(this.$refs.table.doLayout, 200);
}
this.checkTableRowIsSelect();
})
@ -461,9 +466,9 @@ export default {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
let param = {};
param.ids = Array.from(this.selectRows).map(row => row.id);
param.condition = this.condition;
let param = buildBatchParam(this);
// param.ids = Array.from(this.selectRows).map(row => row.id);
// param.condition = this.condition;
this.$post('/test/case/batch/delete', param, () => {
this.selectRows.clear();
this.$emit("refresh");
@ -605,9 +610,14 @@ export default {
},
isSelectDataAll(data) {
this.condition.selectAll = data;
setUnSelectIds(this.tableData, this.condition, this.selectRows);
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
//
toggleAllSelection(this.$refs.table, this.tableData, this.selectRows);
//
_handleSelectAll(this, this.tableData, this.tableData, this.selectRows);
//ID()
this.condition.unSelectIds = [];
//
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
},
headerDragend(newWidth, oldWidth, column, event) {
let finalWidth = newWidth;

View File

@ -73,6 +73,10 @@
<el-main style="padding: 0px 0px 0px 0px; line-height: 100px; text-align: center;">
<span class="count-number">
{{trackCountData.reviewRage}}
<el-tooltip placement="top" class="info-tool-tip">
<div slot="content">{{ $t('api_test.home_page.formula.review')}}</div>
<el-button icon="el-icon-info" style="padding:0px;border: 0px"></el-button>
</el-tooltip>
</span>
</el-main>
</el-container>
@ -148,6 +152,7 @@ export default {
font-family:'ArialMT', 'Arial', sans-serif;
font-size:33px;
color: var(--count_number);
position: relative;
}
.main-number-show {
@ -188,4 +193,8 @@ export default {
.count-info-div >>>p{
font-size: 10px;
}
.info-tool-tip{
position: absolute;
top: 0;
}
</style>

View File

@ -56,6 +56,10 @@
<el-main style="padding: 0px 0px 0px 0px; line-height: 100px; text-align: center;">
<span class="count-number">
{{relevanceCountData.coverageRage}}
<el-tooltip placement="top" class="info-tool-tip">
<div slot="content">{{ $t('api_test.home_page.formula.testplan_coverage')}}</div>
<el-button icon="el-icon-info" style="padding:0px;border: 0px"></el-button>
</el-tooltip>
</span>
</el-main>
</el-container>
@ -122,6 +126,7 @@ export default {
font-family:'ArialMT', 'Arial', sans-serif;
font-size:33px;
color: var(--count_number);
position: relative;
}
.main-number-show {
@ -162,4 +167,8 @@ export default {
.count-info-div >>>p{
font-size: 10px;
}
.info-tool-tip{
position: absolute;
top: 0;
}
</style>

View File

@ -12,23 +12,28 @@
v-if="isPlanModel"/>
</template>
<el-table v-loading="result.loading"
<el-table v-loading="result.loading" ref="table"
border
:data="tableData" row-key="id" class="test-content adjust-table"
:data="tableData" row-key="id" class="test-content adjust-table ms-select-all-fixed"
@select-all="handleSelectAll"
@filter-change="filter"
@sort-change="sort"
@select="handleSelect" :height="screenHeight">
<el-table-column type="selection"/>
<ms-table-header-select-popover v-show="total>0"
:page-size="pageSize > total ? total : pageSize"
:total="total"
@selectPageAll="isSelectDataAll(false)"
@selectAll="isSelectDataAll(true)"/>
<el-table-column width="40" :resizable="false" align="center">
<template v-slot:default="scope">
<show-more-btn :is-show="scope.row.showMore && !isReadOnly" :buttons="buttons" :size="selectRows.size"/>
<show-more-btn :is-show="scope.row.showMore && !isReadOnly" :buttons="buttons" :size="selectDataCounts"/>
</template>
</el-table-column>
<template v-for="(item, index) in tableLabel">
<el-table-column v-if="item.id == 'num'" prop="num" sortable="custom" label="ID" show-overflow-tooltip
<el-table-column v-if="item.id == 'num'" prop="num" sortable="custom" label="ID" min-width="80" show-overflow-tooltip
:key="index"/>
<el-table-column v-if="item.id == 'name'" prop="name" sortable="custom"
<el-table-column v-if="item.id == 'name'" prop="name" sortable="custom" min-width="120"
:label="$t('api_test.definition.api_name')" show-overflow-tooltip :key="index"/>
<el-table-column
@ -39,6 +44,7 @@
column-key="priority"
:label="$t('test_track.case.priority')"
show-overflow-tooltip
min-width="120"
:key="index">
<template v-slot:default="scope">
<priority-table-item :value="scope.row.priority"/>
@ -47,6 +53,7 @@
<el-table-column
v-if="item.id == 'path'"
min-width="100"
prop="path"
:label="$t('api_test.definition.api_path')"
show-overflow-tooltip
@ -57,6 +64,7 @@
prop="createUser"
column-key="user_id"
sortable="custom"
min-width="100"
:filters="userFilters"
:label="'创建人'"
show-overflow-tooltip
@ -65,7 +73,7 @@
<el-table-column
v-if="item.id == 'custom'"
sortable="custom"
width="160"
min-width="160"
:label="$t('api_test.definition.api_last_time')"
prop="updateTime"
:key="index">
@ -77,6 +85,7 @@
<el-table-column
v-if="item.id == 'tags'"
prop="tags"
min-width="100"
:label="$t('commons.tag')"
:key="index">
<template v-slot:default="scope">
@ -84,7 +93,7 @@
</template>
</el-table-column>
<el-table-column v-if="item.id == 'execResult'" :label="'执行状态'" min-width="130" align="center" :key="index">
<el-table-column v-if="item.id == 'execResult'" :label="'执行状态'" min-width="150" align="center" :key="index">
<template v-slot:default="scope">
<div v-loading="rowLoading === scope.row.id">
<el-link type="danger"
@ -104,7 +113,7 @@
</template>
</el-table-column>
</template>
<el-table-column v-if="!isReadOnly" :label="$t('commons.operating')" >
<el-table-column fixed="right" min-width="100" v-if="!isReadOnly" :label="$t('commons.operating')" >
<template slot="header">
<header-label-operate @exec="customHeader"/>
</template>
@ -161,10 +170,23 @@ import TestPlanApiCaseResult from "./TestPlanApiCaseResult";
import TestPlan from "../../../../../api/definition/components/jmeter/components/test-plan";
import ThreadGroup from "../../../../../api/definition/components/jmeter/components/thread-group";
import {TEST_PLAN_API_CASE, WORKSPACE_ID} from "@/common/js/constants";
import {_filter, _sort, getLabel} from "@/common/js/tableUtils";
import {
_filter,
_handleSelectAll,
_sort,
getLabel,
_handleSelect,
initCondition,
setUnSelectIds,
getSelectDataCounts,
toggleAllSelection,
buildBatchParam,
checkTableRowIsSelect
} from "@/common/js/tableUtils";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {Test_Plan_Api_Case} from "@/business/components/common/model/JsonData";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover";
export default {
@ -187,6 +209,7 @@ export default {
MsContainer,
MsBottomContainer,
ShowMoreBtn,
MsTableHeaderSelectPopover
},
data() {
return {
@ -224,7 +247,8 @@ export default {
currentPage: 1,
pageSize: 10,
total: 0,
screenHeight: document.documentElement.clientHeight - 330,//
selectDataCounts:0,
screenHeight: document.documentElement.clientHeight - 368,//
// environmentId: undefined,
currentCaseProjectId: "",
runData: [],
@ -342,6 +366,13 @@ export default {
if (item.tags && item.tags.length > 0) {
item.tags = JSON.parse(item.tags);
}
});
this.selectRows.clear();
if (this.$refs.table) {
setTimeout(this.$refs.table.doLayout, 200);
}
this.$nextTick(() => {
checkTableRowIsSelect(this,this.condition,this.tableData,this.$refs.table,this.selectRows);
})
});
}
@ -354,20 +385,22 @@ export default {
if (item.tags && item.tags.length > 0) {
item.tags = JSON.parse(item.tags);
}
});
this.selectRows.clear();
if (this.$refs.table) {
setTimeout(this.$refs.table.doLayout, 200);
}
this.$nextTick(() => {
checkTableRowIsSelect(this,this.condition,this.tableData,this.$refs.table,this.selectRows);
})
});
}
getLabel(this, TEST_PLAN_API_CASE);
},
handleSelect(selection, row) {
row.hashTree = [];
if (this.selectRows.has(row)) {
this.$set(row, "showMore", false);
this.selectRows.delete(row);
} else {
this.$set(row, "showMore", true);
this.selectRows.add(row);
}
_handleSelect(this, selection, row, this.selectRows);
setUnSelectIds(this.tableData, this.condition, this.selectRows);
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
},
showExecResult(row) {
this.$emit('showExecResult', row);
@ -385,17 +418,9 @@ export default {
this.initTable();
},
handleSelectAll(selection) {
if (selection.length > 0) {
this.tableData.forEach(item => {
this.$set(item, "showMore", true);
this.selectRows.add(item);
});
} else {
this.selectRows.clear();
this.tableData.forEach(row => {
this.$set(row, "showMore", false);
})
}
_handleSelectAll(this, selection, this.tableData, this.selectRows);
setUnSelectIds(this.tableData, this.condition, this.selectRows);
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
},
search() {
this.initTable();
@ -415,7 +440,7 @@ export default {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
let param = {};
let param = buildBatchParam(this);
param.ids = Array.from(this.selectRows).map(row => row.id);
if (this.reviewId) {
param.testCaseReviewId = this.reviewId
@ -477,6 +502,11 @@ export default {
let param = {};
//
if (form.type === 'projectEnv') {
if(this.condition != null && this.condition.selectAll){
this.$alert(this.$t('commons.option_cannot_spread_pages'), '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
let map = new Map();
param.projectEnvMap = strMapToObj(form.projectEnvMap);
this.selectRows.forEach(row => {
@ -487,11 +517,31 @@ export default {
this.$success(this.$t('commons.save_success'));
this.initTable();
});
}
}
});
}else {
let map = new Map();
param.projectEnvMap = strMapToObj(form.projectEnvMap);
this.selectRows.forEach(row => {
map[row.id] = row.projectId;
})
param.selectRows = map;
this.$post('/test/plan/api/case/batch/update/env', param, () => {
this.$success(this.$t('commons.save_success'));
this.initTable();
});
}
} else {
//
}
},
handleBatchExecute() {
if(this.condition != null && this.condition.selectAll){
this.$alert(this.$t('commons.option_cannot_spread_pages'), '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
this.selectRows.forEach(row => {
this.$get('/api/testcase/get/' + row.caseId, (response) => {
let apiCase = response.data;
@ -506,6 +556,25 @@ export default {
});
this.$message('任务执行中,请稍后刷新查看结果');
this.search();
}
}
});
}else {
this.selectRows.forEach(row => {
this.$get('/api/testcase/get/' + row.caseId, (response) => {
let apiCase = response.data;
let request = JSON.parse(apiCase.request);
request.name = row.id;
request.id = row.id;
request.useEnvironment = row.environmentId;
let runData = [];
runData.push(request);
this.batchRun(runData, getUUID().substring(0, 8));
});
});
this.$message('任务执行中,请稍后刷新查看结果');
this.search();
}
},
batchRun(runData, reportId) {
let testPlan = new TestPlan();
@ -564,6 +633,17 @@ export default {
}
});
},
isSelectDataAll(data) {
this.condition.selectAll = data;
//
toggleAllSelection(this.$refs.table, this.tableData, this.selectRows);
//
_handleSelectAll(this, this.tableData, this.tableData, this.selectRows);
//ID()
this.condition.unSelectIds = [];
//
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
},
},
}
</script>
@ -590,4 +670,7 @@ export default {
margin-right: 20px;
}
/deep/ .el-table__fixed-body-wrapper {
top: 59px !important;
}
</style>

View File

@ -8,23 +8,30 @@
@relevanceCase="$emit('relevanceCase', 'scenario')"/>
</template>
<el-table ref="scenarioTable" border :data="tableData" class="adjust-table" @select-all="handleSelectAll"
<el-table ref="scenarioTable" border :data="tableData" class="test-content adjust-table ms-select-all-fixed" @select-all="handleSelectAll"
:height="screenHeight"
@select="handleSelect">
<el-table-column type="selection"/>
<el-table-column width="40" :resizable="false" align="center">
<ms-table-header-select-popover v-show="total>0"
:page-size="pageSize > total ? total : pageSize"
:total="total"
@selectPageAll="isSelectDataAll(false)"
@selectAll="isSelectDataAll(true)"/>
<el-table-column width="20" :resizable="false" align="center">
<template v-slot:default="{row}">
<show-more-btn :is-show="isSelect(row)" :buttons="buttons" :size="selectRows.size"/>
<show-more-btn :is-show="isSelect(row)" :buttons="buttons" :size="selectDataCounts"/>
</template>
</el-table-column>
<template v-for="(item, index) in tableLabel">
<el-table-column
v-if="item.id == 'num'"
prop="num"
min-width="80px"
label="ID"
:key="index"/>
<el-table-column v-if="item.id == 'name'" prop="name" :label="$t('api_test.automation.scenario_name')"
<el-table-column v-if="item.id == 'name'" prop="name" :label="$t('api_test.automation.scenario_name')" min-width="120px"
show-overflow-tooltip :key="index"/>
<el-table-column v-if="item.id == 'level'" prop="level" :label="$t('api_test.automation.case_level')"
<el-table-column v-if="item.id == 'level'" prop="level" :label="$t('api_test.automation.case_level')" min-width="100px"
show-overflow-tooltip :key="index">
<template v-slot:default="scope">
<ms-tag v-if="scope.row.level == 'P0'" type="info" effect="plain" content="P0"/>
@ -35,23 +42,23 @@
</el-table-column>
<el-table-column v-if="item.id == 'tagNames'" prop="tagNames" :label="$t('api_test.automation.tag')"
width="200px" :key="index">
min-width="100px" :key="index">
<template v-slot:default="scope">
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain"
:content="itemName" style="margin-left: 0px; margin-right: 2px"/>
</template>
</el-table-column>
<el-table-column v-if="item.id == 'userId'" prop="userId" :label="$t('api_test.automation.creator')"
<el-table-column v-if="item.id == 'userId'" prop="userId" :label="$t('api_test.automation.creator')" min-width="100px"
show-overflow-tooltip :key="index"/>
<el-table-column v-if="item.id == 'updateTime'" prop="updateTime"
<el-table-column v-if="item.id == 'updateTime'" prop="updateTime" min-width="120px"
:label="$t('api_test.automation.update_time')" width="180" :key="index">
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column v-if="item.id == 'stepTotal'" prop="stepTotal" :label="$t('api_test.automation.step')"
<el-table-column v-if="item.id == 'stepTotal'" prop="stepTotal" :label="$t('api_test.automation.step')" min-width="80px"
show-overflow-tooltip :key="index"/>
<el-table-column v-if="item.id == 'lastResult'" prop="lastResult"
<el-table-column v-if="item.id == 'lastResult'" prop="lastResult" min-width="100px"
:label="$t('api_test.automation.last_result')" :key="index">
<template v-slot:default="{row}">
<el-link type="success" @click="showReport(row)" v-if="row.lastResult === 'Success'">
@ -62,11 +69,11 @@
</el-link>
</template>
</el-table-column>
<el-table-column v-if="item.id == 'passRate'" prop="passRate"
<el-table-column v-if="item.id == 'passRate'" prop="passRate" min-width="80px"
:label="$t('api_test.automation.passing_rate')"
show-overflow-tooltip :key="index"/>
</template>
<el-table-column :label="$t('commons.operating')" width="200px" v-if="!referenced">
<el-table-column :label="$t('commons.operating')" fixed="right" min-width="100px" v-if="!referenced">
<template slot="header">
<header-label-operate @exec="customHeader"/>
</template>
@ -109,13 +116,26 @@ import MsTableMoreBtn from "../../../../../api/automation/scenario/TableMoreBtn"
import MsScenarioExtendButtons from "@/business/components/api/automation/scenario/ScenarioExtendBtns";
import MsTestPlanList from "../../../../../api/automation/scenario/testplan/TestPlanList";
import TestPlanScenarioListHeader from "./TestPlanScenarioListHeader";
import {_handleSelect, _handleSelectAll, getLabel} from "../../../../../../../common/js/tableUtils";
import {
_handleSelect,
_handleSelectAll,
getLabel,
getSelectDataCounts,
setUnSelectIds,
_filter,
_sort,
initCondition,
buildBatchParam,
toggleAllSelection,
checkTableRowIsSelect
} from "../../../../../../../common/js/tableUtils";
import MsTableOperatorButton from "../../../../../common/components/MsTableOperatorButton";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {TEST_CASE_LIST, TEST_PLAN_SCENARIO_CASE} from "@/common/js/constants";
import {Test_Plan_Scenario_Case, Track_Test_Case} from "@/business/components/common/model/JsonData";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
import BatchEdit from "@/business/components/track/case/components/BatchEdit";
import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover";
export default {
name: "MsTestPlanApiScenarioList",
@ -132,7 +152,8 @@ export default {
MsApiReportDetail,
MsScenarioExtendButtons,
MsTestPlanList,
BatchEdit
BatchEdit,
MsTableHeaderSelectPopover
},
props: {
referenced: {
@ -148,6 +169,7 @@ export default {
return {
type: TEST_PLAN_SCENARIO_CASE,
headerItems: Test_Plan_Scenario_Case,
screenHeight: document.documentElement.clientHeight - 348,//
tableLabel: [],
loading: false,
condition: {},
@ -156,6 +178,7 @@ export default {
selectAll: false,
tableData: [],
currentPage: 1,
selectDataCounts:0,
pageSize: 10,
total: 0,
reportId: "",
@ -203,6 +226,7 @@ export default {
this.$refs.headerCustom.open(this.tableLabel)
},
search() {
initCondition(this.condition,this.condition.selectAll);
this.selectRows = new Set();
this.loading = true;
this.condition.moduleIds = this.selectNodeIds;
@ -227,6 +251,12 @@ export default {
}
});
this.loading = false;
if (this.$refs.scenarioTable) {
setTimeout(this.$refs.scenarioTable.doLayout, 200);
}
this.$nextTick(() => {
checkTableRowIsSelect(this,this.condition,this.tableData,this.$refs.scenarioTable,this.selectRows);
})
});
}
if (this.reviewId) {
@ -242,6 +272,12 @@ export default {
}
});
this.loading = false;
if (this.$refs.scenarioTable) {
setTimeout(this.$refs.scenarioTable.doLayout, 200);
}
this.$nextTick(() => {
checkTableRowIsSelect(this,this.condition,this.tableData,this.$refs.scenarioTable,this.selectRows);
})
});
}
getLabel(this, TEST_PLAN_SCENARIO_CASE);
@ -256,13 +292,20 @@ export default {
})
},
handleBatchExecute() {
if (this.reviewId) {
this.selectRows.forEach(row => {
let param = this.buildExecuteParam(row);
this.$post("/test/case/review/scenario/case/run", param, response => {
});
});
}
// if (this.reviewId) {} By.Song Tianyang
// if (this.reviewId) {
// this.selectRows.forEach(row => {
// let param = this.buildExecuteParam(row);
// this.$post("/test/case/review/scenario/case/run", param, response => {
// });
// });
// }
if(this.condition != null && this.condition.selectAll){
this.$alert(this.$t('commons.option_cannot_spread_pages'), '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
if (this.planId) {
this.selectRows.forEach(row => {
let param = this.buildExecuteParam(row);
@ -272,6 +315,21 @@ export default {
}
this.$message('任务执行中,请稍后刷新查看结果');
this.search();
}
}
});
}else {
if (this.planId) {
this.selectRows.forEach(row => {
let param = this.buildExecuteParam(row);
this.$post("/test/plan/scenario/case/run", param, response => {
});
});
}
this.$message('任务执行中,请稍后刷新查看结果');
this.search();
}
},
execute(row) {
this.infoDb = false;
@ -328,16 +386,20 @@ export default {
},
handleSelectAll(selection) {
_handleSelectAll(this, selection, this.tableData, this.selectRows);
setUnSelectIds(this.tableData, this.condition, this.selectRows);
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
},
handleSelect(selection, row) {
_handleSelect(this, selection, row, this.selectRows);
setUnSelectIds(this.tableData, this.condition, this.selectRows);
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
},
handleDeleteBatch() {
this.$alert(this.$t('api_test.definition.request.delete_confirm') + "", '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
let param = {};
let param = buildBatchParam(this);
param.ids = Array.from(this.selectRows).map(row => row.id);
if (this.planId) {
param.planId = this.planId;
@ -369,19 +431,46 @@ export default {
let param = {};
param.mapping = strMapToObj(form.map);
param.envMap = strMapToObj(form.projectEnvMap);
if(this.condition != null && this.condition.selectAll){
this.$alert(this.$t('commons.option_cannot_spread_pages'), '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
if (this.planId) {
this.$post('/test/plan/scenario/case/batch/update/env', param, () => {
this.$success(this.$t('commons.save_success'));
this.search();
})
}
if (this.reviewId) {
this.$post('/test/case/review/scenario/case/batch/update/env', param, () => {
}
}
});
}else {
if (this.planId) {
this.$post('/test/plan/scenario/case/batch/update/env', param, () => {
this.$success(this.$t('commons.save_success'));
this.search();
})
}
}
// if (this.reviewId) {
// this.$post('/test/case/review/scenario/case/batch/update/env', param, () => {
// this.$success(this.$t('commons.save_success'));
// this.search();
// })
// }
},
isSelectDataAll(data) {
this.condition.selectAll = data;
//
toggleAllSelection(this.$refs.scenarioTable, this.tableData, this.selectRows);
//
_handleSelectAll(this, this.tableData, this.tableData, this.selectRows);
//ID()
this.condition.unSelectIds = [];
//
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
},
}
}
@ -391,4 +480,7 @@ export default {
/deep/ .el-drawer__header {
margin-bottom: 0px;
}
/deep/ .el-table__fixed-body-wrapper {
top: 59px !important;
}
</style>

View File

@ -26,12 +26,13 @@
<el-table
ref="table"
class="adjust-table"
class="test-content adjust-table ms-select-all-fixed"
border
@select-all="handleSelectAll"
@filter-change="filter"
@sort-change="sort"
@select="handleSelectionChange"
:height="screenHeight"
row-key="id"
@row-click="showDetail"
@header-dragend="headerDragend"
@ -39,9 +40,14 @@
<el-table-column
type="selection"/>
<el-table-column width="40" :resizable="false" align="center">
<ms-table-header-select-popover v-show="total>0"
:page-size="pageSize > total ? total : pageSize"
:total="total"
@selectPageAll="isSelectDataAll(false)"
@selectAll="isSelectDataAll(true)"/>
<el-table-column width="30" :resizable="false" align="center">
<template v-slot:default="scope">
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectRows.size"/>
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectDataCounts"/>
</template>
</el-table-column>
<template v-for="(item, index) in tableLabel">
@ -296,11 +302,22 @@ import BatchEdit from "../../../../case/components/BatchEdit";
import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
import {hub} from "@/business/components/track/plan/event-bus";
import MsTag from "@/business/components/common/components/MsTag";
import {_filter, _sort, getLabel} from "@/common/js/tableUtils";
import {
_filter,
_handleSelect,
_handleSelectAll,
_sort,
buildBatchParam,
getLabel,
getSelectDataCounts,
initCondition,
setUnSelectIds,
toggleAllSelection
} from "@/common/js/tableUtils";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {Test_Plan_Function_Test_Case} from "@/business/components/common/model/JsonData";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover";
export default {
name: "FunctionalTestCaseList",
@ -315,12 +332,13 @@ export default {
StatusTableItem,
PriorityTableItem, StatusEdit, ExecutorEdit, MsTipButton, MsTablePagination,
MsTableHeader, NodeBreadcrumb, MsTableButton, ShowMoreBtn,
BatchEdit, MsTag
BatchEdit, MsTag,MsTableHeaderSelectPopover
},
data() {
return {
type: TEST_PLAN_FUNCTION_TEST_CASE,
headerItems: Test_Plan_Function_Test_Case,
screenHeight: document.documentElement.clientHeight-365,
tableLabel: [],
result: {},
deletePath: "/test/case/delete",
@ -389,6 +407,8 @@ export default {
// 'increaseIndent','decreaseIndent'
toolbar: [],
},
selectDataCounts: 0,
selectDataRange: "all"
}
},
props: {
@ -427,6 +447,7 @@ export default {
},
initTableData() {
initCondition(this.condition, this.condition.selectAll);
this.autoCheckStatus();
if (this.planId) {
// param.planId = this.planId;
@ -470,8 +491,12 @@ export default {
}
this.selectRows.clear();
if (this.$refs.table) {
setTimeout(this.$refs.table.doLayout, 200)
setTimeout(this.$refs.table.doLayout, 200);
}
this.$nextTick(() => {
this.checkTableRowIsSelect();
})
});
}
getLabel(this, TEST_PLAN_FUNCTION_TEST_CASE);
@ -541,8 +566,16 @@ export default {
callback: (action) => {
if (action === 'confirm') {
if (this.selectRows.size > 0) {
if(this.condition.selectAll){
let param = buildBatchParam(this);
this.$post('/test/plan/case/idList/all', param, res => {
let ids = res.data;
this._handleBatchDelete(ids);
})
}else {
let ids = Array.from(this.selectRows).map(row => row.id);
this._handleBatchDelete(ids);
}
} else {
if (this.planId) {
this.condition.planId = this.planId;
@ -576,26 +609,14 @@ export default {
});
},
handleSelectAll(selection) {
if (selection.length > 0) {
this.tableData.forEach(item => {
this.$set(item, "showMore", true);
this.selectRows.add(item);
});
} else {
this.selectRows.clear();
this.tableData.forEach(row => {
this.$set(row, "showMore", false);
})
}
_handleSelectAll(this, selection, this.tableData, this.selectRows);
setUnSelectIds(this.tableData, this.condition, this.selectRows);
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
},
handleSelectionChange(selection, row) {
if (this.selectRows.has(row)) {
this.$set(row, "showMore", false);
this.selectRows.delete(row);
} else {
this.$set(row, "showMore", true);
this.selectRows.add(row);
}
_handleSelect(this, selection, row, this.selectRows);
setUnSelectIds(this.tableData, this.condition, this.selectRows);
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
},
handleBatch(type) {
if (this.selectRows.size < 1) {
@ -660,7 +681,7 @@ export default {
column.realWidth = finalWidth;
},
batchEdit(form) {
let param = {};
let param = buildBatchParam(this);
param[form.type] = form.value;
param.ids = Array.from(this.selectRows).map(row => row.id);
this.$post('/test/plan/case/batch/edit', param, () => {
@ -686,7 +707,41 @@ export default {
return {text: u.id + '(' + u.name + ')', value: u.id};
});
});
},
checkTableRowIsSelect() {
//
if (this.condition.selectAll) {
let unSelectIds = this.condition.unSelectIds;
this.tableData.forEach(row => {
if (unSelectIds.indexOf(row.id) < 0) {
this.$refs.table.toggleRowSelection(row, true);
//selectRows
if (!this.selectRows.has(row)) {
this.$set(row, "showMore", true);
this.selectRows.add(row);
}
} else {
//selectRow
if (this.selectRows.has(row)) {
this.$set(row, "showMore", false);
this.selectRows.delete(row);
}
}
})
}
},
isSelectDataAll(data) {
this.condition.selectAll = data;
//
toggleAllSelection(this.$refs.table, this.tableData, this.selectRows);
//
_handleSelectAll(this, this.tableData, this.tableData, this.selectRows);
//ID()
this.condition.unSelectIds = [];
//
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
},
}
}
</script>
@ -714,6 +769,6 @@ export default {
}
/deep/ .el-table__fixed-body-wrapper {
top: 60px !important;
top: 59px !important;
}
</style>

View File

@ -10,31 +10,38 @@
/>
</template>
<el-table v-loading="result.loading"
<el-table v-loading="result.loading" ref="table"
border
:data="tableData" row-key="id" class="test-content adjust-table"
:data="tableData" row-key="id" class="test-content adjust-table ms-select-all-fixed"
@select-all="handleSelectAll"
@filter-change="filter"
@sort-change="sort"
@select="handleSelectionChange" :height="screenHeight">
<el-table-column type="selection"/>
<el-table-column width="40" :resizable="false" align="center">
<ms-table-header-select-popover v-show="total>0"
:page-size="pageSize > total ? total : pageSize"
:total="total"
@selectPageAll="isSelectDataAll(false)"
@selectAll="isSelectDataAll(true)"/>
<el-table-column min-width="40" :resizable="false" align="center">
<template v-slot:default="scope">
<show-more-btn :is-show="scope.row.showMore && !isReadOnly" :buttons="buttons" :size="selectRows.size"/>
<show-more-btn :is-show="scope.row.showMore && !isReadOnly" :buttons="buttons" :size="selectDataCounts"/>
</template>
</el-table-column>
<template v-for="(item, index) in tableLabel">
<el-table-column v-if="item.id == 'num'" prop="num" label="ID" show-overflow-tooltip :key="index"/>
<el-table-column v-if="item.id == 'num'" prop="num" min-width="80" label="ID" show-overflow-tooltip :key="index"/>
<el-table-column
v-if="item.id == 'caseName'"
prop="caseName"
:label="$t('commons.name')"
min-width="120"
show-overflow-tooltip
:key="index">
</el-table-column>
<el-table-column
v-if="item.id == 'projectName'"
prop="projectName"
min-width="120"
:label="$t('load_test.project_name')"
show-overflow-tooltip
:key="index">
@ -42,6 +49,7 @@
<el-table-column
v-if="item.id == 'userName'"
prop="userName"
min-width="100"
:label="$t('load_test.user_name')"
show-overflow-tooltip
:key="index">
@ -50,6 +58,7 @@
v-if="item.id == 'createTime'"
sortable
prop="createTime"
min-width="160"
:label="$t('commons.create_time')"
:key="index">
<template v-slot:default="scope">
@ -62,6 +71,7 @@
column-key="status"
:filters="statusFilters"
:label="$t('commons.status')"
min-width="80"
:key="index">
<template v-slot:default="{row}">
<ms-performance-test-status :row="row"/>
@ -69,6 +79,7 @@
</el-table-column>
<el-table-column
v-if="item.id == 'caseStatus'"
min-width="100"
prop="caseStatus"
:label="$t('test_track.plan.load_case.execution_status')"
:key="index">
@ -88,6 +99,7 @@
<el-table-column
v-if="item.id == 'loadReportId'"
:label="$t('test_track.plan.load_case.report')"
min-width="80"
show-overflow-tooltip
:key="index">
<template v-slot:default="scope">
@ -100,7 +112,7 @@
</template>
</el-table-column>
</template>
<el-table-column v-if="!isReadOnly" :label="$t('commons.operating')" >
<el-table-column v-if="!isReadOnly" fixed="right" min-width="100" :label="$t('commons.operating')" >
<template slot="header">
<header-label-operate @exec="customHeader"/>
</template>
@ -131,12 +143,25 @@ import MsTablePagination from "@/business/components/common/pagination/TablePagi
import MsPerformanceTestStatus from "@/business/components/performance/test/PerformanceTestStatus";
import MsTableOperatorButton from "@/business/components/common/components/MsTableOperatorButton";
import LoadCaseReport from "@/business/components/track/plan/view/comonents/load/LoadCaseReport";
import {_filter, _sort, getLabel} from "@/common/js/tableUtils";
import {
_filter,
_handleSelect,
_handleSelectAll,
_sort,
getLabel,
getSelectDataCounts,
setUnSelectIds,
buildBatchParam,
initCondition,
toggleAllSelection,
checkTableRowIsSelect
} from "@/common/js/tableUtils";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {TEST_CASE_LIST, TEST_PLAN_LOAD_CASE} from "@/common/js/constants";
import {TAPD, TEST_CASE_LIST, TEST_PLAN_LOAD_CASE} from "@/common/js/constants";
import {Test_Plan_Load_Case, Track_Test_Case} from "@/business/components/common/model/JsonData";
import {getCurrentUser} from "@/common/js/utils";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover";
export default {
name: "TestPlanLoadCaseList",
@ -148,7 +173,8 @@ export default {
ShowMoreBtn,
MsTablePagination,
MsPerformanceTestStatus,
MsTableOperatorButton
MsTableOperatorButton,
MsTableHeaderSelectPopover
},
data() {
return {
@ -162,8 +188,9 @@ export default {
currentPage: 1,
pageSize: 10,
total: 0,
selectDataCounts:0,
status: 'default',
screenHeight: document.documentElement.clientHeight - 330,//
screenHeight: document.documentElement.clientHeight - 368,//
buttons: [
{
name: this.$t('test_track.plan.load_case.unlink_in_bulk'), handleClick: this.handleDeleteBatch
@ -235,6 +262,12 @@ export default {
let {itemCount, listObject} = data;
this.total = itemCount;
this.tableData = listObject;
if (this.$refs.table) {
setTimeout(this.$refs.table.doLayout, 200);
}
this.$nextTick(() => {
checkTableRowIsSelect(this,this.condition,this.tableData,this.$refs.table,this.selectRows);
})
})
}
if (this.reviewId) {
@ -244,6 +277,12 @@ export default {
let {itemCount, listObject} = data;
this.total = itemCount;
this.tableData = listObject;
if (this.$refs.table) {
setTimeout(this.$refs.table.doLayout, 200);
}
this.$nextTick(() => {
checkTableRowIsSelect(this,this.condition,this.tableData,this.$refs.table,this.selectRows);
})
})
}
getLabel(this, TEST_PLAN_LOAD_CASE);
@ -264,26 +303,14 @@ export default {
}, 8000);
},
handleSelectAll(selection) {
if (selection.length > 0) {
this.tableData.forEach(item => {
this.$set(item, "showMore", true);
this.selectRows.add(item);
});
} else {
this.selectRows.clear();
this.tableData.forEach(row => {
this.$set(row, "showMore", false);
})
}
_handleSelectAll(this, selection, this.tableData, this.selectRows);
setUnSelectIds(this.tableData, this.condition, this.selectRows);
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
},
handleSelectionChange(selection, row) {
if (this.selectRows.has(row)) {
this.$set(row, "showMore", false);
this.selectRows.delete(row);
} else {
this.$set(row, "showMore", true);
this.selectRows.add(row);
}
_handleSelect(this, selection, row, this.selectRows);
setUnSelectIds(this.tableData, this.condition, this.selectRows);
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
},
handleDeleteBatch() {
this.$alert(this.$t('test_track.plan_view.confirm_cancel_relevance') + "", '', {
@ -292,7 +319,8 @@ export default {
if (action === 'confirm') {
let ids = Array.from(this.selectRows).map(row => row.id);
if (this.planId) {
this.result = this.$post('/test/plan/load/case/batch/delete', ids, () => {
let param = buildBatchParam(this);
this.result = this.$post('/test/plan/load/case/batch/delete', param, () => {
this.selectRows.clear();
this.initTable();
this.$success(this.$t('test_track.cancel_relevance_success'));
@ -310,10 +338,24 @@ export default {
})
},
handleRunBatch() {
if(this.condition != null && this.condition.selectAll){
this.$alert(this.$t('commons.option_cannot_spread_pages'), '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
this.selectRows.forEach(loadCase => {
this._run(loadCase);
})
});
this.refreshStatus();
}
}
});
}else {
this.selectRows.forEach(loadCase => {
this._run(loadCase);
});
this.refreshStatus();
}
},
run(loadCase) {
this._run(loadCase);
@ -385,7 +427,18 @@ export default {
if (this.refreshScheduler) {
clearInterval(this.refreshScheduler);
}
}
},
isSelectDataAll(data) {
this.condition.selectAll = data;
//
toggleAllSelection(this.$refs.table, this.tableData, this.selectRows);
//
_handleSelectAll(this, this.tableData, this.tableData, this.selectRows);
//ID()
this.condition.unSelectIds = [];
//
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
},
},
beforeDestroy() {
console.log('beforeDestroy')
@ -399,4 +452,7 @@ export default {
background-color: #409EFF;
border-color: #409EFF;
}
/deep/ .el-table__fixed-body-wrapper {
top: 59px !important;
}
</style>

View File

@ -8,8 +8,10 @@
<el-table border :data="tableData"
@select-all="handleSelectAll"
@select="handleSelect"
:height="screenHeight"
ref="testPlanReportTable"
row-key="id" class="test-content adjust-table ms-select-all"
@filter-change="filter" @sort-change="sort" ref="testPlanReportTable">
@filter-change="filter" @sort-change="sort" >
<el-table-column width="50" type="selection"/>
<ms-table-select-all
@ -71,8 +73,15 @@ import ReportTriggerModeItem from "@/business/components/common/tableItem/Report
import MsTag from "@/business/components/common/components/MsTag";
import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn";
import MsTableSelectAll from "@/business/components/common/components/table/MsTableSelectAll";
import {_filter, _sort} from "@/common/js/tableUtils";
import {
_filter,
_handleSelect,
_handleSelectAll,
_sort, checkTableRowIsSelect,
getSelectDataCounts,
initCondition,
setUnSelectIds, toggleAllSelection,
} from "@/common/js/tableUtils";
export default {
name: "TestPlanReportList",
@ -94,6 +103,7 @@ export default {
pageSize: 10,
isTestManagerOrTestUser: false,
selectRows: new Set(),
screenHeight: document.documentElement.clientHeight - 296,//
total: 0,
tableData: [],
statusFilters: [
@ -109,8 +119,6 @@ export default {
buttons: [
{name: this.$t('api_test.definition.request.batch_delete'), handleClick: this.handleDeleteBatch},
],
selectAll: false,
unSelection: [],
selectDataCounts: 0,
}
},
@ -131,10 +139,8 @@ export default {
},
methods: {
initTableData() {
initCondition(this.condition, this.condition.selectAll);
this.selectRows = new Set();
this.selectAll = false;
this.unSelection = [];
this.selectDataCounts = 0;
if (this.planId) {
this.condition.planId = this.planId;
}
@ -148,51 +154,26 @@ export default {
let data = response.data;
this.total = data.itemCount;
this.tableData = data.listObject;
this.unSelection = data.listObject.map(s => s.id);
if (this.$refs.testPlanReportTable) {
// setTimeout(this.$refs.testPlanReportTable,200);
}
this.$nextTick(() => {
checkTableRowIsSelect(this,this.condition,this.tableData,this.$refs.testPlanReportTable,this.selectRows);
});
});
},
buildPagePath(path) {
return path + "/" + this.currentPage + "/" + this.pageSize;
},
handleSelect(selection, row) {
row.hashTree = [];
if (this.selectRows.has(row)) {
this.$set(row, "showMore", false);
this.selectRows.delete(row);
} else {
this.$set(row, "showMore", true);
this.selectRows.add(row);
}
let arr = Array.from(this.selectRows);
// 1
if (this.selectRows.size === 1) {
this.$set(arr[0], "showMore", true);
} else if (this.selectRows.size === 2) {
arr.forEach(row => {
this.$set(row, "showMore", true);
})
}
this.selectRowsCount(this.selectRows)
_handleSelect(this, selection, row, this.selectRows);
setUnSelectIds(this.tableData, this.condition, this.selectRows);
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
},
handleSelectAll(selection) {
if (selection.length > 0) {
if (selection.length === 1) {
selection.hashTree = [];
this.selectRows.add(selection[0]);
} else {
this.tableData.forEach(item => {
item.hashTree = [];
this.$set(item, "showMore", true);
this.selectRows.add(item);
});
}
} else {
this.selectRows.clear();
this.tableData.forEach(row => {
this.$set(row, "showMore", false);
})
}
this.selectRowsCount(this.selectRows)
_handleSelectAll(this, selection, this.tableData, this.selectRows);
setUnSelectIds(this.tableData, this.condition, this.selectRows);
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
},
handleDelete(testPlanReport) {
this.$alert(this.$t('report.delete_confirm') + ' ' + testPlanReport.name + " ", '', {
@ -217,8 +198,8 @@ export default {
let ids = Array.from(this.selectRows).map(row => row.id);
deleteParam.dataIds = ids;
deleteParam.projectId = this.projectId;
deleteParam.selectAllDate = this.isSelectAllDate;
deleteParam.unSelectIds = this.unSelection;
deleteParam.selectAllDate = this.condition.selectAll;
deleteParam.unSelectIds = this.condition.unSelection;
deleteParam = Object.assign(deleteParam, this.condition);
this.$post('/test/plan/report/deleteBatchByParams/', deleteParam, () => {
this.$success(this.$t('commons.delete_success'));
@ -247,25 +228,16 @@ export default {
this.$refs.testPlanReportView.open(planId);
}
},
isSelectDataAll(dataType) {
this.isSelectAllDate = dataType;
this.selectRowsCount(this.selectRows)
//
if (this.selectRows.size != this.tableData.length) {
this.$refs.testPlanReportTable.toggleAllSelection(true);
}
},
selectRowsCount(selection) {
let selectedIDs = this.getIds(selection);
let allIDs = this.tableData.map(s => s.id);
this.unSelection = allIDs.filter(function (val) {
return selectedIDs.indexOf(val) === -1
});
if (this.isSelectAllDate) {
this.selectDataCounts = this.total - this.unSelection.length;
} else {
this.selectDataCounts = selection.size;
}
isSelectDataAll(data) {
this.condition.selectAll = data;
//
toggleAllSelection(this.$refs.testPlanReportTable, this.tableData, this.selectRows);
//
_handleSelectAll(this, this.tableData, this.tableData, this.selectRows);
//ID()
this.condition.unSelectIds = [];
//
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
},
}
}

View File

@ -18,21 +18,30 @@
<el-table
v-loading="result.loading"
class="adjust-table"
class="test-content adjust-table ms-select-all-fixed"
border
@select-all="handleSelectAll"
@filter-change="filter"
@sort-change="sort"
@select="handleSelectionChange"
row-key="id"
:height="screenHeight"
style="margin-top: 5px"
@row-click="showDetail"
ref="caseTable"
:data="tableData">
<el-table-column
type="selection"/>
<el-table-column width="50" type="selection"/>
<ms-table-header-select-popover v-show="total>0"
:page-size="pageSize > total ? total : pageSize"
:total="total"
@selectPageAll="isSelectDataAll(false)"
@selectAll="isSelectDataAll(true)"/>
<el-table-column width="40" :resizable="false" align="center">
<template v-slot:default="scope">
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectRows.size"/>
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectDataCounts"/>
</template>
</el-table-column>
<template v-for="(item, index) in tableLabel">
@ -40,6 +49,7 @@
v-if="item.id == 'num'"
prop="num"
sortable="custom"
min-width="100"
:label="$t('commons.id')"
show-overflow-tooltip
:key="index"
@ -48,6 +58,7 @@
<el-table-column
v-if="item.id == 'name'"
prop="name"
min-width="100"
:label="$t('commons.name')"
show-overflow-tooltip
:key="index"
@ -58,6 +69,7 @@
prop="priority"
:filters="priorityFilters"
column-key="priority"
min-width="100"
:label="$t('test_track.case.priority')"
:key="index">
<template v-slot:default="scope">
@ -70,6 +82,7 @@
prop="type"
:filters="typeFilters"
column-key="type"
min-width="100"
:label="$t('test_track.case.type')"
show-overflow-tooltip
:key="index">
@ -78,22 +91,10 @@
</template>
</el-table-column>
<!-- <el-table-column
v-if="item.id=='method'"
prop="method"
:filters="methodFilters"
column-key="method"
:label="$t('test_track.case.method')"
show-overflow-tooltip
:key="index">
<template v-slot:default="scope">
<method-table-item :value="scope.row.method"/>
</template>
</el-table-column>-->
<el-table-column
v-if="item.id=='nodePath'"
prop="nodePath"
min-width="180"
:label="$t('test_track.case.module')"
show-overflow-tooltip
:key="index"
@ -103,6 +104,7 @@
<el-table-column
v-if="item.id=='projectName'"
prop="projectName"
min-width="180"
:label="$t('test_track.review.review_project')"
show-overflow-tooltip
:key="index">
@ -111,6 +113,7 @@
<el-table-column
v-if="item.id=='reviewerName'"
prop="reviewerName"
min-width="80"
:label="$t('test_track.review.reviewer')"
show-overflow-tooltip
:key="index"
@ -121,6 +124,7 @@
v-if="item.id=='reviewStatus'"
:filters="statusFilters"
column-key="status"
min-width="100"
:label="$t('test_track.review_view.execute_result')"
:key="index">
<template v-slot:default="scope">
@ -136,6 +140,7 @@
prop="updateTime"
:label="$t('commons.update_time')"
show-overflow-tooltip
min-width="120"
:key="index">
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
@ -144,6 +149,7 @@
</template>
<el-table-column
min-width="100"
fixed="right"
:label="$t('commons.operating')"
>
<template slot="header">
@ -203,10 +209,22 @@ import {
} from "../../../../../../common/js/constants";
import TestReviewTestCaseEdit from "./TestReviewTestCaseEdit";
import ReviewStatus from "@/business/components/track/case/components/ReviewStatus";
import {_filter, _sort, getLabel} from "@/common/js/tableUtils";
import {
_filter,
_handleSelect,
_handleSelectAll,
buildBatchParam,
initCondition,
_sort,
getLabel,
getSelectDataCounts,
setUnSelectIds,
toggleAllSelection
} from "@/common/js/tableUtils";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {Test_Case_Review_Case_List, Track_Test_Case} from "@/business/components/common/model/JsonData";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover";
export default {
name: "TestReviewTestCaseList",
@ -216,12 +234,13 @@ export default {
MsTableOperatorButton, MsTableOperator, MethodTableItem, TypeTableItem,
StatusTableItem, PriorityTableItem, StatusEdit,
ExecutorEdit, MsTipButton, TestReviewTestCaseEdit, MsTableHeader,
NodeBreadcrumb, MsTableButton, ShowMoreBtn, BatchEdit, MsTablePagination, ReviewStatus
NodeBreadcrumb, MsTableButton, ShowMoreBtn, BatchEdit, MsTablePagination, ReviewStatus,MsTableHeaderSelectPopover
},
data() {
return {
type: TEST_CASE_REVIEW_CASE_LIST,
headerItems: Test_Case_Review_Case_List,
screenHeight: document.documentElement.clientHeight - 278,
tableLabel: [],
result: {},
condition: {},
@ -233,6 +252,7 @@ export default {
testReview: {},
isReadOnly: false,
isTestManagerOrTestUser: false,
selectDataCounts:0,
priorityFilters: [
{text: 'P0', value: 'P0'},
{text: 'P1', value: 'P1'},
@ -301,6 +321,7 @@ export default {
this.$refs.headerCustom.open(this.tableLabel)
},
initTableData() {
initCondition(this.condition, this.condition.selectAll);
if (this.reviewId) {
this.condition.reviewId = this.reviewId;
}
@ -319,11 +340,41 @@ export default {
this.total = data.itemCount;
this.tableData = data.listObject;
this.selectRows.clear();
this.$nextTick(function () {
if (this.$refs.caseTable) {
setTimeout(this.$refs.caseTable.doLayout, 200);
}
this.checkTableRowIsSelect();
})
});
}
getLabel(this, TEST_CASE_REVIEW_CASE_LIST);
},
checkTableRowIsSelect() {
//
if (this.condition.selectAll) {
let unSelectIds = this.condition.unSelectIds;
this.tableData.forEach(row => {
if (unSelectIds.indexOf(row.id) < 0) {
this.$refs.caseTable.toggleRowSelection(row, true);
//selectRows
if (!this.selectRows.has(row)) {
this.$set(row, "showMore", true);
this.selectRows.add(row);
}
} else {
//selectRow
if (this.selectRows.has(row)) {
this.$set(row, "showMore", false);
this.selectRows.delete(row);
}
}
})
}
},
showDetail(row, event, column) {
this.isReadOnly = true;
this.$refs.testReviewTestCaseEdit.openTestCaseEdit(row);
@ -373,8 +424,9 @@ export default {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
let ids = Array.from(this.selectRows).map(row => row.id);
this.$post('/test/review/case/batch/delete', {ids: ids, reviewId: this.reviewId}, () => {
let param = buildBatchParam(this);
param.reviewId = this.reviewId;
this.$post('/test/review/case/batch/delete', param, () => {
this.selectRows.clear();
this.$emit("refresh");
this.$success(this.$t('test_track.cancel_relevance_success'));
@ -395,7 +447,7 @@ export default {
},
batchEdit(form) {
let reviewId = this.reviewId;
let param = {};
let param = buildBatchParam(this);
param[form.type] = form.value;
param.ids = Array.from(this.selectRows).map(row => row.caseId);
param.reviewId = reviewId;
@ -421,13 +473,16 @@ export default {
}
},
handleSelectionChange(selection, row) {
if (this.selectRows.has(row)) {
this.$set(row, "showMore", false);
this.selectRows.delete(row);
} else {
this.$set(row, "showMore", true);
this.selectRows.add(row);
}
_handleSelect(this, selection, row, this.selectRows);
setUnSelectIds(this.tableData, this.condition, this.selectRows);
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
// if (this.selectRows.has(row)) {
// this.$set(row, "showMore", false);
// this.selectRows.delete(row);
// } else {
// this.$set(row, "showMore", true);
// this.selectRows.add(row);
// }
},
openTestReport() {
this.$refs.testReportTemplateList.open(this.reviewId);
@ -459,20 +514,36 @@ export default {
} else {
this.$warning(this.$t('test_track.review.no_link_case'));
}
}
},
isSelectDataAll(data) {
this.condition.selectAll = data;
//
toggleAllSelection(this.$refs.caseTable, this.tableData, this.selectRows);
//
_handleSelectAll(this, this.tableData, this.tableData, this.selectRows);
//ID()
this.condition.unSelectIds = [];
//
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
},
}
}
</script>
<style scoped>
.ms-table-header {
margin: 20px;
}
/*.ms-table-header {*/
/* margin: 5px;*/
/*}*/
/deep/ .table-title {
height: 0px;
font-weight: bold;
font-size: 0px;
}
/deep/ .el-table__fixed-body-wrapper {
top: 59px !important;
}
</style>

View File

@ -17,7 +17,7 @@ export function _handleSelectAll(component, selection, tableData, selectRows) {
selectRows.clear();
tableData.forEach(item => {
component.$set(item, "showMore", false);
})
});
}
}
@ -33,15 +33,21 @@ export function _handleSelect(component, selection, row, selectRows) {
let arr = Array.from(selectRows);
arr.forEach(row => {
component.$set(row, "showMore", true);
})
});
}
// 设置 unSelectIds 查询条件,返回当前选中的条数
export function setUnSelectIds(tableData, condition, selectRows) {
let ids = Array.from(selectRows).map(o => o.id);
let allIDs = tableData.map(o => o.id);
condition.unSelectIds = allIDs.filter(function (val) {
return ids.indexOf(val) === -1
let thisUnSelectIds = allIDs.filter(function (val) {
return ids.indexOf(val) === -1;
});
let needPushIds = thisUnSelectIds.filter(function (val) {
return condition.unSelectIds.indexOf(val) === -1;
});
needPushIds.forEach(id => {
condition.unSelectIds.push(id);
});
}
@ -61,6 +67,31 @@ export function toggleAllSelection(table, tableData, selectRows) {
}
}
//检查表格每一行是否应该选择(使用场景:全选数据时进行翻页操作)
export function checkTableRowIsSelect(component, condition, tableData, table, selectRows) {
//如果默认全选的话,则选中应该选中的行
if (condition.selectAll) {
let unSelectIds = condition.unSelectIds;
tableData.forEach(row => {
if (unSelectIds.indexOf(row.id) < 0) {
table.toggleRowSelection(row, true);
//默认全选需要把选中对行添加到selectRows中。不然会影响到勾选函数统计
if (!selectRows.has(row)) {
component.$set(row, "showMore", true);
selectRows.add(row);
}
} else {
//不勾选的行也要判断是否被加入了selectRow中。加入了的话就去除。
if (selectRows.has(row)) {
component.$set(row, "showMore", false);
selectRows.delete(row);
}
}
});
}
}
//表格数据过滤
export function _filter(filters, condition) {
@ -109,22 +140,22 @@ export function initCondition(condition,isSelectAll) {
}
export function getLabel(vueObj, type) {
let param = {}
let param = {};
param.userId = getCurrentUser().id;
param.type = type;
vueObj.result = vueObj.$post('/system/header/info', param, response => {
if (response.data != null) {
vueObj.tableLabel = eval(response.data.props);
} else {
let param = {}
param.type=type
let param = {};
param.type = type;
vueObj.result = vueObj.$post('/system/system/header', param, response => {
if (response.data != null) {
vueObj.tableLabel = eval(response.data.props);
}
})
});
}
})
});
}

View File

@ -19,6 +19,7 @@ export default {
examples: 'examples',
help_documentation: 'Help documentation',
delete_cancelled: 'Delete cancelled',
option_cannot_spread_pages: 'This options not support spread pages.Do you want continue?',
workspace: 'Workspace',
organization: 'Organization',
setting: 'Setting',
@ -985,6 +986,15 @@ export default {
unit_of_measurement: "",
unit_of_count: "",
unit_of_times: "times",
formula:{
completion: "finished api / all api * 100%",
coverage: "apis whitch have test case / all apis * 100%",
pass: "scenarios whitch final execute is sucess / all scenarios * 100%",
success: "execute success count number / all execute count number * 100%",
interface_coverage: "api whitch in scenario's step / all api * 100%",
review: "reviewd cases / all cases * 100%",
testplan_coverage: "relevance function cases / all function cases * 100%",
},
api_count_card: {
title: "API count",
},

View File

@ -37,6 +37,7 @@ export default {
copy_success: '复制成功',
modify_success: '修改成功',
delete_cancel: '已取消删除',
option_cannot_spread_pages: '这个操作不支持跨页,是否继续?',
confirm: '确定',
cancel: '取消',
prompt: '提示',
@ -989,6 +990,15 @@ export default {
unit_of_measurement: "个",
unit_of_count: "个",
unit_of_times: "次",
formula:{
completion: "已完成的接口/接口总数*100%",
coverage: "有案例的接口/接口总数*100%",
pass: "最后一次执行成功的场景/场景总数*100%",
success: "执行成功的次数/执行总次数*100%",
interface_coverage: "被场景步骤包含的接口/接口总数*100%",
review: "评审通过的功能案例/所有功能案例 * 100%",
testplan_coverage: "关联的功能案例/所有功能案例 * 100%",
},
api_count_card: {
title: "接口数量统计",
},

View File

@ -37,6 +37,7 @@ export default {
copy_success: '復制成功',
modify_success: '修改成功',
delete_cancel: '已取消刪除',
option_cannot_spread_pages: '這個操作不能跨頁,是否繼續?',
confirm: '確定',
cancel: '取消',
prompt: '提示',
@ -987,6 +988,15 @@ export default {
unit_of_measurement: "個",
unit_of_count: "個",
unit_of_times: "次",
formula:{
completion: "已完成的接口/接口總數*100%",
coverage: "有案例的接口/接口總數*100%",
pass: "最後一次執行成功的場景/場景總數*100%",
success: "執行成功的次數/执行總次數*100%",
interface_coverage: "被場景步驟包含的接口/接口總數*100%",
review: "評審通過的功能案例/所有功能案例 * 100%",
testplan_coverage: "關聯的功能案例數/所有功能案例 * 100%",
},
api_count_card: {
title: "接口數量統計",
},