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; package io.metersphere.api.controller;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import io.metersphere.api.dto.*; 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.ExecutedCaseInfoDTO;
import io.metersphere.api.dto.datacount.response.TaskInfoResult; import io.metersphere.api.dto.datacount.response.TaskInfoResult;
import io.metersphere.api.dto.definition.RunDefinitionRequest; 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.dto.scenario.request.dubbo.RegistryCenter;
import io.metersphere.api.service.*; import io.metersphere.api.service.*;
import io.metersphere.base.domain.*; import io.metersphere.base.domain.*;
@ -34,10 +37,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import static io.metersphere.commons.utils.JsonPathUtils.getListJson; import static io.metersphere.commons.utils.JsonPathUtils.getListJson;
@ -70,6 +70,8 @@ public class APITestController {
private CheckPermissionService checkPermissionService; private CheckPermissionService checkPermissionService;
@Resource @Resource
private HistoricalDataUpgradeService historicalDataUpgradeService; private HistoricalDataUpgradeService historicalDataUpgradeService;
@Resource
private ApiTestEnvironmentService environmentService;
@GetMapping("recent/{count}") @GetMapping("recent/{count}")
public List<APITestResult> recentTest(@PathVariable int count) { public List<APITestResult> recentTest(@PathVariable int count) {
@ -396,7 +398,18 @@ public class APITestController {
@PostMapping(value = "/genPerformanceTestXml", consumes = {"multipart/form-data"}) @PostMapping(value = "/genPerformanceTestXml", consumes = {"multipart/form-data"})
public JmxInfoDTO genPerformanceTest(@RequestPart("request") RunDefinitionRequest runRequest, @RequestPart(value = "files") List<MultipartFile> bodyFiles) throws Exception { 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 jmxString = runRequest.getTestElement().getJmx(hashTree);
String testName = runRequest.getName(); 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> getNotRelevanceCaseIds(@Param("planId")String planId, @Param("relevanceProjectIds")List<String> relevanceProjectIds);
List<String> getStatusByTestPlanId(String id); List<String> getStatusByTestPlanId(String id);
List<String> selectIds(@Param("request") ApiTestCaseRequest request);
} }

View File

@ -108,6 +108,97 @@
</foreach> </foreach>
</if> </if>
</select> </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 id="getExecResultByPlanId" resultType="java.lang.String">
select status select status
from from

View File

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

View File

@ -68,6 +68,45 @@
</foreach> </foreach>
</if> </if>
</select> </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 id="getStatusByTestPlanId" resultType="java.lang.String">
select status from test_plan_load_case tplc where tplc.test_plan_id = #{planId} select status from test_plan_load_case tplc where tplc.test_plan_id = #{planId}
</select> </select>

View File

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

View File

@ -87,6 +87,77 @@
</foreach> </foreach>
</if> </if>
</select> </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 id="getExecResultByPlanId" resultType="java.lang.String">
select last_result select last_result
from from

View File

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

View File

@ -237,6 +237,104 @@
</foreach> </foreach>
</if> </if>
</select> </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 id="listTestCaseByProjectIds" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
select distinct * from test_plan_test_case, test_case select distinct * from test_plan_test_case, test_case

View File

@ -10,11 +10,14 @@ import java.util.List;
public interface ExtTestReviewCaseMapper { public interface ExtTestReviewCaseMapper {
List<TestReviewCaseDTO> list(@Param("request") QueryCaseReviewRequest request); List<TestReviewCaseDTO> list(@Param("request") QueryCaseReviewRequest request);
List<String> getStatusByReviewId(String reviewId); List<String> getStatusByReviewId(String reviewId);
List<String> findRelateTestReviewId(@Param("userId") String userId, @Param("workspaceId") String workspaceId, @Param("projectId") String projectId); List<String> findRelateTestReviewId(@Param("userId") String userId, @Param("workspaceId") String workspaceId, @Param("projectId") String projectId);
/** /**
* 根据项目 ids 查询 TestReviewCaseDTO 列表 * 根据项目 ids 查询 TestReviewCaseDTO 列表
*
* @param ids project id list * @param ids project id list
* @return List<TestReviewCaseDTO> * @return List<TestReviewCaseDTO>
*/ */
@ -22,8 +25,13 @@ public interface ExtTestReviewCaseMapper {
/** /**
* 获取 TestReviewTestCase 详细信息 * 获取 TestReviewTestCase 详细信息
*
* @param id TestReviewTestCase id * @param id TestReviewTestCase id
* @return TestReviewTestCase 详细信息 * @return TestReviewTestCase 详细信息
*/ */
TestReviewCaseDTO get(@Param("id") String id); 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> </if>
</select> </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 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 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 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.commons.utils.Pager;
import io.metersphere.performance.request.RunTestPlanRequest; import io.metersphere.performance.request.RunTestPlanRequest;
import io.metersphere.track.dto.TestPlanLoadCaseDTO; 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.LoadCaseReportRequest;
import io.metersphere.track.request.testplan.LoadCaseRequest; import io.metersphere.track.request.testplan.LoadCaseRequest;
import io.metersphere.track.service.TestPlanLoadCaseService; import io.metersphere.track.service.TestPlanLoadCaseService;
@ -56,8 +57,8 @@ public class TestPlanLoadCaseController {
} }
@PostMapping("/batch/delete") @PostMapping("/batch/delete")
public void batchDelete(@RequestBody List<String> ids) { public void batchDelete(@RequestBody LoadCaseReportBatchRequest request) {
testPlanLoadCaseService.batchDelete(ids); testPlanLoadCaseService.batchDelete(request);
} }
@PostMapping("/update") @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.Pager;
import io.metersphere.commons.utils.SessionUtils; import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.track.dto.RelevanceScenarioRequest; 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 io.metersphere.track.service.TestPlanScenarioCaseService;
import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles; import org.apache.shiro.authz.annotation.RequiresRoles;
@ -46,7 +46,7 @@ public class TestPlanScenarioCaseController {
@PostMapping("/batch/delete") @PostMapping("/batch/delete")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR) @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); 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.dto.TestPlanCaseDTO;
import io.metersphere.track.request.testcase.TestPlanCaseBatchRequest; import io.metersphere.track.request.testcase.TestPlanCaseBatchRequest;
import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest; import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest;
import io.metersphere.track.request.testplancase.TestPlanFuncCaseBatchRequest;
import io.metersphere.track.service.TestPlanTestCaseService; import io.metersphere.track.service.TestPlanTestCaseService;
import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles; import org.apache.shiro.authz.annotation.RequiresRoles;
@ -90,6 +91,12 @@ public class TestPlanTestCaseController {
return testPlanTestCaseService.list(request); return testPlanTestCaseService.list(request);
} }
@PostMapping("/idList/all")
public List<String> getTestPlanCases(@RequestBody TestPlanFuncCaseBatchRequest request) {
return testPlanTestCaseService.idList(request);
}
@PostMapping("/list/ids") @PostMapping("/list/ids")
public List<TestPlanCaseDTO> getTestPlanCaseIds(@RequestBody QueryTestPlanCaseRequest request) { public List<TestPlanCaseDTO> getTestPlanCaseIds(@RequestBody QueryTestPlanCaseRequest request) {
return testPlanTestCaseService.list(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对应关系 * 项目ID环境ID对应关系
*/ */
private Map<String, String> projectEnvMap; private Map<String, String> projectEnvMap;
private ApiCaseBatchCondition condition;
} }

View File

@ -1,6 +1,7 @@
package io.metersphere.track.request.testcase; package io.metersphere.track.request.testcase;
import io.metersphere.base.domain.TestPlanTestCase; import io.metersphere.base.domain.TestPlanTestCase;
import io.metersphere.track.request.testplancase.TestPlanFuncCaseConditions;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -10,4 +11,5 @@ import java.util.List;
@Setter @Setter
public class TestPlanCaseBatchRequest extends TestPlanTestCase { public class TestPlanCaseBatchRequest extends TestPlanTestCase {
private List<String> ids; 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; package io.metersphere.track.request.testplancase;
import io.metersphere.base.domain.TestCaseReviewTestCase; import io.metersphere.base.domain.TestCaseReviewTestCase;
import io.metersphere.track.request.testreview.QueryCaseReviewCondition;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -11,4 +12,5 @@ import java.util.List;
public class TestReviewCaseBatchRequest extends TestCaseReviewTestCase { public class TestReviewCaseBatchRequest extends TestCaseReviewTestCase {
private String reviewId; private String reviewId;
private List<String> ids; 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; 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) { public List<String> getExecResultByPlanId(String plan) {
return extTestPlanApiCaseMapper.getExecResultByPlanId(plan); return extTestPlanApiCaseMapper.getExecResultByPlanId(plan);
} }
@ -89,13 +96,18 @@ public class TestPlanApiCaseService {
} }
public void deleteApiCaseBath(TestPlanApiCaseBatchRequest request) { 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; return;
} }
apiDefinitionExecResultService.deleteByResourceIds(request.getIds()); apiDefinitionExecResultService.deleteByResourceIds(deleteIds);
TestPlanApiCaseExample example = new TestPlanApiCaseExample(); TestPlanApiCaseExample example = new TestPlanApiCaseExample();
example.createCriteria() example.createCriteria()
.andIdIn(request.getIds()) .andIdIn(deleteIds)
.andTestPlanIdEqualTo(request.getPlanId()); .andTestPlanIdEqualTo(request.getPlanId());
testPlanApiCaseMapper.deleteByExample(example); 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.request.RunTestPlanRequest;
import io.metersphere.performance.service.PerformanceTestService; import io.metersphere.performance.service.PerformanceTestService;
import io.metersphere.track.dto.TestPlanLoadCaseDTO; 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.LoadCaseReportRequest;
import io.metersphere.track.request.testplan.LoadCaseRequest; import io.metersphere.track.request.testplan.LoadCaseRequest;
import org.apache.ibatis.session.ExecutorType; import org.apache.ibatis.session.ExecutorType;
@ -66,6 +67,19 @@ public class TestPlanLoadCaseService {
return extTestPlanLoadCaseMapper.selectTestPlanLoadCaseList(request); 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) { public void relevanceCase(LoadCaseRequest request) {
List<String> caseIds = request.getCaseIds(); List<String> caseIds = request.getCaseIds();
String planId = request.getTestPlanId(); String planId = request.getTestPlanId();
@ -145,6 +159,23 @@ public class TestPlanLoadCaseService {
testPlanLoadCaseMapper.deleteByExample(example); 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) { public void update(TestPlanLoadCase testPlanLoadCase) {
if (!StringUtils.isEmpty(testPlanLoadCase.getId())) { if (!StringUtils.isEmpty(testPlanLoadCase.getId())) {
testPlanLoadCaseMapper.updateByPrimaryKeySelective(testPlanLoadCase); testPlanLoadCaseMapper.updateByPrimaryKeySelective(testPlanLoadCase);

View File

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

View File

@ -15,6 +15,8 @@ import io.metersphere.track.dto.TestCaseTestDTO;
import io.metersphere.track.dto.TestPlanCaseDTO; import io.metersphere.track.dto.TestPlanCaseDTO;
import io.metersphere.track.request.testcase.TestPlanCaseBatchRequest; import io.metersphere.track.request.testcase.TestPlanCaseBatchRequest;
import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest; 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.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -90,8 +92,15 @@ public class TestPlanTestCaseService {
} }
public void editTestCaseBath(TestPlanCaseBatchRequest request) { 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 testPlanTestCaseExample = new TestPlanTestCaseExample();
testPlanTestCaseExample.createCriteria().andIdIn(request.getIds()); testPlanTestCaseExample.createCriteria().andIdIn(ids);
TestPlanTestCaseWithBLOBs testPlanTestCase = new TestPlanTestCaseWithBLOBs(); TestPlanTestCaseWithBLOBs testPlanTestCase = new TestPlanTestCaseWithBLOBs();
BeanUtils.copyBean(testPlanTestCase, request); BeanUtils.copyBean(testPlanTestCase, request);
@ -200,4 +209,17 @@ public class TestPlanTestCaseService {
testPlanTestCaseMapper.updateByPrimaryKeySelective(item); 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.controller.request.member.QueryMemberRequest;
import io.metersphere.service.UserService; import io.metersphere.service.UserService;
import io.metersphere.track.dto.TestCaseTestDTO; import io.metersphere.track.dto.TestCaseTestDTO;
import io.metersphere.track.dto.TestPlanCaseDTO;
import io.metersphere.track.dto.TestReviewCaseDTO; import io.metersphere.track.dto.TestReviewCaseDTO;
import io.metersphere.track.request.testplancase.TestReviewCaseBatchRequest; import io.metersphere.track.request.testplancase.TestReviewCaseBatchRequest;
import io.metersphere.track.request.testreview.DeleteRelevanceRequest; import io.metersphere.track.request.testreview.DeleteRelevanceRequest;
@ -69,6 +68,12 @@ public class TestReviewTestCaseService {
return list; 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) { private List<String> getReviewUserIds(String reviewId) {
TestCaseReviewUsersExample testCaseReviewUsersExample = new TestCaseReviewUsersExample(); TestCaseReviewUsersExample testCaseReviewUsersExample = new TestCaseReviewUsersExample();
testCaseReviewUsersExample.createCriteria().andReviewIdEqualTo(reviewId); testCaseReviewUsersExample.createCriteria().andReviewIdEqualTo(reviewId);
@ -109,8 +114,15 @@ public class TestReviewTestCaseService {
public void deleteTestCaseBatch(TestReviewCaseBatchRequest request) { public void deleteTestCaseBatch(TestReviewCaseBatchRequest request) {
checkReviewer(request.getReviewId()); 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(); TestCaseReviewTestCaseExample example = new TestCaseReviewTestCaseExample();
example.createCriteria().andIdIn(request.getIds()); example.createCriteria().andIdIn(ids);
testCaseReviewTestCaseMapper.deleteByExample(example); testCaseReviewTestCaseMapper.deleteByExample(example);
} }
@ -175,6 +187,12 @@ public class TestReviewTestCaseService {
public void editTestCaseBatchStatus(TestReviewCaseBatchRequest request) { public void editTestCaseBatchStatus(TestReviewCaseBatchRequest request) {
List<String> ids = request.getIds(); 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)) { if (CollectionUtils.isEmpty(ids)) {
return; return;
} }

View File

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

View File

@ -124,7 +124,7 @@
createCase() { createCase() {
this.api = this.currentApi; this.api = this.currentApi;
this.sysAddition(); this.sysAddition();
} },
}, },
created() { created() {
this.api = this.currentApi; this.api = this.currentApi;
@ -149,6 +149,14 @@
this.getApiTest(true); this.getApiTest(true);
this.visible = 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) { saveApiAndCase(api) {
this.visible = true; this.visible = true;
this.api = api; this.api = api;
@ -211,9 +219,49 @@
selectAll(isSelectAll) { selectAll(isSelectAll) {
this.apiCaseList.forEach(item => { this.apiCaseList.forEach(item => {
this.$set(item, 'selected', isSelectAll); this.$set(item, 'selected', isSelectAll);
}) });
}, },
getApiTest(addCase) { 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 = ""; this.useEnvironment = "";
if (this.api) { if (this.api) {
this.condition.projectId = this.projectId; this.condition.projectId = this.projectId;
@ -247,9 +295,17 @@
this.useEnvironment = this.apiCaseList[0].request.useEnvironment; this.useEnvironment = this.apiCaseList[0].request.useEnvironment;
this.environment = this.useEnvironment; this.environment = this.useEnvironment;
} }
if (addCase && this.apiCaseList.length == 0 && !this.loaded) { if (this.apiCaseList.length === 0 && !this.loaded) {
this.addCase(); 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> </template>
</el-table-column> </el-table-column>
</template> </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"> align="center">
<template slot="header"> <template slot="header">
<header-label-operate @exec="customHeader"/> <header-label-operate @exec="customHeader"/>
</template> </template>
<template v-slot:default="scope"> <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)" <ms-table-operator-button :tip="$t('commons.edit')" icon="el-icon-edit" @exec="handleTestCase(scope.row)"
v-tester/> v-tester/>
<ms-table-operator-button :tip="$t('commons.delete')" icon="el-icon-delete" @exec="handleDelete(scope.row)" <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 () { this.$nextTick(function () {
if (this.$refs.caseTable) { if (this.$refs.caseTable) {
setTimeout(this.$refs.caseTable.doLayout, 200) setTimeout(this.$refs.caseTable.doLayout, 200);
} }
this.checkTableRowIsSelect(); this.checkTableRowIsSelect();
}) })
@ -412,7 +416,7 @@ export default {
}, },
handleSelectAll(selection) { handleSelectAll(selection) {
_handleSelectAll(this, selection, this.tableData, this.selectRows); _handleSelectAll(this, selection, this.tableData, this.selectRows);
this.selectRowsCount(this.selectRows) this.selectRowsCount(this.selectRows);
}, },
search() { search() {
this.changeSelectDataRangeAll(); this.changeSelectDataRangeAll();
@ -421,7 +425,23 @@ export default {
buildPagePath(path) { buildPagePath(path) {
return path + "/" + this.currentPage + "/" + this.pageSize; 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) { handleTestCase(testCase) {
this.$get('/api/definition/get/' + testCase.apiDefinitionId, (response) => { this.$get('/api/definition/get/' + testCase.apiDefinitionId, (response) => {
let api = response.data; let api = response.data;

View File

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

View File

@ -1,18 +1,18 @@
<template> <template>
<el-card class="table-card" v-loading="result.loading" body-style="padding:10px;"> <el-card class="table-card" v-loading="result.loading" body-style="padding:10px;">
<div slot="header" > <div slot="header">
<span class="title"> <span class="title">
{{$t('api_test.home_page.api_count_card.title')}} {{ $t('api_test.home_page.api_count_card.title') }}
</span> </span>
</div> </div>
<el-container> <el-container>
<el-aside width="120px"> <el-aside width="120px">
<div class="main-number-show"> <div class="main-number-show">
<span class="count-number"> <span class="count-number">
{{apiCountData.allApiDataCountNumber}} {{ apiCountData.allApiDataCountNumber }}
</span> </span>
<span style="color: #6C317C;"> <span style="color: #6C317C;">
{{$t('api_test.home_page.unit_of_measurement')}} {{ $t('api_test.home_page.unit_of_measurement') }}
</span> </span>
</div> </div>
</el-aside> </el-aside>
@ -20,13 +20,16 @@
<div style="width: 200px;margin:0 auto"> <div style="width: 200px;margin:0 auto">
<el-row align="center" class="hidden-lg-and-down"> <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> <div class="count-info-div" v-html="apiCountData.httpCountStr"></div>
</el-col> </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> <div class="count-info-div" v-html="apiCountData.rpcCountStr"></div>
</el-col> </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> <div class="count-info-div" v-html="apiCountData.tcpCountStr"></div>
</el-col> </el-col>
<el-col :span="6" style="padding: 5px;"> <el-col :span="6" style="padding: 5px;">
@ -34,13 +37,16 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row align="right" style="margin-left: 20px" class="hidden-xl-only"> <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> <div class="count-info-div" v-html="apiCountData.httpCountStr"></div>
</el-col> </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> <div class="count-info-div" v-html="apiCountData.rpcCountStr"></div>
</el-col> </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> <div class="count-info-div" v-html="apiCountData.tcpCountStr"></div>
</el-col> </el-col>
<el-col :span="6" style="padding: 5px;"> <el-col :span="6" style="padding: 5px;">
@ -54,10 +60,11 @@
<el-header style="height:20px;padding: 0px;margin-bottom: 10px;"> <el-header style="height:20px;padding: 0px;margin-bottom: 10px;">
<el-row> <el-row>
<el-col> <el-col>
{{$t('api_test.home_page.api_details_card.this_week_add')}} {{ $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> </el-link>
{{$t('api_test.home_page.unit_of_measurement')}} {{ $t('api_test.home_page.unit_of_measurement') }}
</el-col> </el-col>
</el-row> </el-row>
</el-header> </el-header>
@ -66,11 +73,15 @@
<el-aside width="60%" class="count-number-show" style="margin-bottom: 0px;margin-top: 0px"> <el-aside width="60%" class="count-number-show" style="margin-bottom: 0px;margin-top: 0px">
<el-container> <el-container>
<el-aside width="30%"> <el-aside width="30%">
{{$t('api_test.home_page.detail_card.rate.completion')+":"}} {{ $t('api_test.home_page.detail_card.rate.completion') + ":" }}
</el-aside> </el-aside>
<el-main style="padding: 0px 0px 0px 0px; line-height: 100px; text-align: center;"> <el-main style="padding: 0px 0px 0px 0px; line-height: 100px; text-align: center;">
<span class="count-number"> <span class="count-number">
{{apiCountData.completionRage}} {{ 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> </span>
</el-main> </el-main>
</el-container> </el-container>
@ -81,28 +92,28 @@
<el-row> <el-row>
<el-col> <el-col>
<span class="default-property"> <span class="default-property">
{{$t('api_test.home_page.detail_card.running')}} {{ $t('api_test.home_page.detail_card.running') }}
{{"\xa0\xa0"}} {{ "\xa0\xa0" }}
<el-link type="info" @click="redirectPage('Underway')" target="_blank" style="color: #000000"> <el-link type="info" @click="redirectPage('Underway')" target="_blank" style="color: #000000">
{{apiCountData.runningCount}} {{ apiCountData.runningCount }}
</el-link> </el-link>
</span> </span>
</el-col> </el-col>
<el-col style="margin-top: 5px;"> <el-col style="margin-top: 5px;">
<span class="default-property"> <span class="default-property">
{{$t('api_test.home_page.detail_card.not_started')}} {{ $t('api_test.home_page.detail_card.not_started') }}
{{"\xa0\xa0"}} {{ "\xa0\xa0" }}
<el-link type="info" @click="redirectPage('Prepare')" target="_blank" style="color: #000000"> <el-link type="info" @click="redirectPage('Prepare')" target="_blank" style="color: #000000">
{{apiCountData.notStartedCount}} {{ apiCountData.notStartedCount }}
</el-link> </el-link>
</span> </span>
</el-col> </el-col>
<el-col style="margin-top: 5px;"> <el-col style="margin-top: 5px;">
<span class="main-property"> <span class="main-property">
{{$t('api_test.home_page.detail_card.finished')}} {{ $t('api_test.home_page.detail_card.finished') }}
{{"\xa0\xa0"}} {{ "\xa0\xa0" }}
<el-link type="info" @click="redirectPage('Completed')" target="_blank" style="color: #000000"> <el-link type="info" @click="redirectPage('Completed')" target="_blank" style="color: #000000">
{{apiCountData.finishedCount}} {{ apiCountData.finishedCount }}
</el-link> </el-link>
</span> </span>
</el-col> </el-col>
@ -129,12 +140,12 @@ export default {
loading: false loading: false
} }
}, },
props:{ props: {
apiCountData:{}, apiCountData: {},
}, },
methods:{ methods: {
redirectPage(clickType){ redirectPage(clickType) {
this.$emit("redirectPage","api","api",clickType); this.$emit("redirectPage", "api", "api", clickType);
} }
} }
} }
@ -144,10 +155,12 @@ export default {
line-height: 100px; line-height: 100px;
text-align: center; text-align: center;
} }
.count-number{
font-family:'ArialMT', 'Arial', sans-serif; .count-number {
font-size:33px; font-family: 'ArialMT', 'Arial', sans-serif;
font-size: 33px;
color: var(--count_number); color: var(--count_number);
position: relative;
} }
.main-number-show { .main-number-show {
@ -156,24 +169,28 @@ export default {
border-style: solid; border-style: solid;
border-width: 7px; border-width: 7px;
border-color: var(--count_number_shallow); border-color: var(--count_number_shallow);
border-radius:50%; border-radius: 50%;
} }
.count-number-show{ .count-number-show {
margin:20px auto; margin: 20px auto;
} }
.detail-container{
.detail-container {
margin-top: 30px margin-top: 30px
} }
.no-shadow-card{
-webkit-box-shadow: 0 0px 0px 0 rgba(0,0,0,.1); .no-shadow-card {
box-shadow: 0 0px 0px 0 rgba(0,0,0,.1); -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{
.default-property {
font-size: 12px font-size: 12px
} }
.main-property{
.main-property {
color: #F39021; color: #F39021;
font-size: 12px font-size: 12px
} }
@ -182,10 +199,15 @@ export default {
border-bottom: 0px solid #EBEEF5; border-bottom: 0px solid #EBEEF5;
} }
.count-info-div{ .count-info-div {
margin: 3px; margin: 3px;
} }
.count-info-div >>>p{
.count-info-div >>> p {
font-size: 10px; font-size: 10px;
} }
.info-tool-tip{
position: absolute;
top: 0;
}
</style> </style>

View File

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

View File

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

View File

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

View File

@ -226,7 +226,7 @@ export default {
} }
if (this.$refs && this.$refs.testCaseEdit) { if (this.$refs && this.$refs.testCaseEdit) {
this.$refs.testCaseEdit.forEach(item => { this.$refs.testCaseEdit.forEach(item => {
/* item.removeListener();*/ /* item.removeListener();*/
}); // tab ctrl + s }); // tab ctrl + s
this.addListener(); this.addListener();
} }
@ -256,9 +256,9 @@ export default {
let index = this.tabs.findIndex(item => item.name === this.activeName); // tabindex let index = this.tabs.findIndex(item => item.name === this.activeName); // tabindex
if (index != -1) { // tab if (index != -1) { // tab
this.$nextTick(() => { this.$nextTick(() => {
/* /*
this.$refs.testCaseEdit[index].addListener(); this.$refs.testCaseEdit[index].addListener();
*/ */
}); });
} }
}, },
@ -355,15 +355,15 @@ export default {
// this.getProjectByCaseId(caseId); // this.getProjectByCaseId(caseId);
this.$get('/test/case/get/' + caseId, response => { this.$get('/test/case/get/' + caseId, response => {
if (response.data) { if (response.data) {
/* /*
this.$refs.testCaseEditDialog.open(response.data); this.$refs.testCaseEditDialog.open(response.data);
*/ */
} }
}); });
} else { } else {
/* /*
this.$refs.testCaseEditDialog.open(); this.$refs.testCaseEditDialog.open();
*/ */
} }
}, },
setTreeNodes(data) { setTreeNodes(data) {
@ -386,4 +386,9 @@ export default {
padding: 4px 1px !important; padding: 4px 1px !important;
} }
/deep/ .el-tabs__header {
margin: 0 0 0px;
/*width: calc(100% - 90px);*/
}
</style> </style>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,174 +1,180 @@
<template> <template>
<div class="card-container"> <div class="card-container">
<ms-table-header :tester-permission="true" :condition.sync="condition" @search="initTableData" <ms-table-header :tester-permission="true" :condition.sync="condition" @search="initTableData"
:show-create="false" :tip="$t('commons.search_by_name_or_id')"> :show-create="false" :tip="$t('commons.search_by_name_or_id')">
<template v-slot:button> <template v-slot:button>
<ms-table-button :is-tester-permission="true" icon="el-icon-video-play" <ms-table-button :is-tester-permission="true" icon="el-icon-video-play"
:content="$t('test_track.review_view.start_review')" @click="startReview"/> :content="$t('test_track.review_view.start_review')" @click="startReview"/>
<ms-table-button :is-tester-permission="true" icon="el-icon-connection" <ms-table-button :is-tester-permission="true" icon="el-icon-connection"
:content="$t('test_track.review_view.relevance_case')" :content="$t('test_track.review_view.relevance_case')"
@click="$emit('openTestReviewRelevanceDialog')"/> @click="$emit('openTestReviewRelevanceDialog')"/>
</template> </template>
</ms-table-header> </ms-table-header>
<executor-edit ref="executorEdit" :select-ids="new Set(Array.from(this.selectRows).map(row => row.id))" <executor-edit ref="executorEdit" :select-ids="new Set(Array.from(this.selectRows).map(row => row.id))"
@refresh="initTableData"/> @refresh="initTableData"/>
<status-edit ref="statusEdit" :plan-id="reviewId" <status-edit ref="statusEdit" :plan-id="reviewId"
:select-ids="new Set(Array.from(this.selectRows).map(row => row.id))" @refresh="initTableData"/> :select-ids="new Set(Array.from(this.selectRows).map(row => row.id))" @refresh="initTableData"/>
<el-table <el-table
v-loading="result.loading" v-loading="result.loading"
class="adjust-table" class="test-content adjust-table ms-select-all-fixed"
border border
@select-all="handleSelectAll" @select-all="handleSelectAll"
@filter-change="filter" @filter-change="filter"
@sort-change="sort" @sort-change="sort"
@select="handleSelectionChange" @select="handleSelectionChange"
row-key="id" row-key="id"
@row-click="showDetail" :height="screenHeight"
:data="tableData"> style="margin-top: 5px"
@row-click="showDetail"
ref="caseTable"
:data="tableData">
<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="selectDataCounts"/>
</template>
</el-table-column>
<template v-for="(item, index) in tableLabel">
<el-table-column <el-table-column
type="selection"/> v-if="item.id == 'num'"
<el-table-column width="40" :resizable="false" align="center"> prop="num"
sortable="custom"
min-width="100"
:label="$t('commons.id')"
show-overflow-tooltip
:key="index"
>
</el-table-column>
<el-table-column
v-if="item.id == 'name'"
prop="name"
min-width="100"
:label="$t('commons.name')"
show-overflow-tooltip
:key="index"
>
</el-table-column>
<el-table-column
v-if="item.id == 'priority'"
prop="priority"
:filters="priorityFilters"
column-key="priority"
min-width="100"
:label="$t('test_track.case.priority')"
:key="index">
<template v-slot:default="scope"> <template v-slot:default="scope">
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectRows.size"/> <priority-table-item :value="scope.row.priority" ref="priority"/>
</template> </template>
</el-table-column> </el-table-column>
<template v-for="(item, index) in tableLabel">
<el-table-column
v-if="item.id == 'num'"
prop="num"
sortable="custom"
:label="$t('commons.id')"
show-overflow-tooltip
:key="index"
>
</el-table-column>
<el-table-column
v-if="item.id == 'name'"
prop="name"
:label="$t('commons.name')"
show-overflow-tooltip
:key="index"
>
</el-table-column>
<el-table-column
v-if="item.id == 'priority'"
prop="priority"
:filters="priorityFilters"
column-key="priority"
:label="$t('test_track.case.priority')"
:key="index">
<template v-slot:default="scope">
<priority-table-item :value="scope.row.priority" ref="priority"/>
</template>
</el-table-column>
<el-table-column <el-table-column
v-if="item.id == 'type'" v-if="item.id == 'type'"
prop="type" prop="type"
:filters="typeFilters" :filters="typeFilters"
column-key="type" column-key="type"
:label="$t('test_track.case.type')" min-width="100"
show-overflow-tooltip :label="$t('test_track.case.type')"
:key="index"> show-overflow-tooltip
<template v-slot:default="scope"> :key="index">
<type-table-item :value="scope.row.type"/> <template v-slot:default="scope">
</template> <type-table-item :value="scope.row.type"/>
</el-table-column> </template>
</el-table-column>
<!-- <el-table-column <el-table-column
v-if="item.id=='method'" v-if="item.id=='nodePath'"
prop="method" prop="nodePath"
:filters="methodFilters" min-width="180"
column-key="method" :label="$t('test_track.case.module')"
:label="$t('test_track.case.method')" show-overflow-tooltip
show-overflow-tooltip :key="index"
:key="index"> >
<template v-slot:default="scope"> </el-table-column>
<method-table-item :value="scope.row.method"/>
</template>
</el-table-column>-->
<el-table-column <el-table-column
v-if="item.id=='nodePath'" v-if="item.id=='projectName'"
prop="nodePath" prop="projectName"
:label="$t('test_track.case.module')" min-width="180"
show-overflow-tooltip :label="$t('test_track.review.review_project')"
:key="index" show-overflow-tooltip
> :key="index">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
v-if="item.id=='projectName'" v-if="item.id=='reviewerName'"
prop="projectName" prop="reviewerName"
:label="$t('test_track.review.review_project')" min-width="80"
show-overflow-tooltip :label="$t('test_track.review.reviewer')"
:key="index"> show-overflow-tooltip
</el-table-column> :key="index"
>
</el-table-column>
<el-table-column <el-table-column
v-if="item.id=='reviewerName'" v-if="item.id=='reviewStatus'"
prop="reviewerName" :filters="statusFilters"
:label="$t('test_track.review.reviewer')" column-key="status"
show-overflow-tooltip min-width="100"
:key="index" :label="$t('test_track.review_view.execute_result')"
> :key="index">
</el-table-column> <template v-slot:default="scope">
<el-table-column
v-if="item.id=='reviewStatus'"
:filters="statusFilters"
column-key="status"
:label="$t('test_track.review_view.execute_result')"
:key="index">
<template v-slot:default="scope">
<span class="el-dropdown-link"> <span class="el-dropdown-link">
<review-status :value="scope.row.reviewStatus"/> <review-status :value="scope.row.reviewStatus"/>
</span> </span>
</template>
</el-table-column>
<el-table-column
v-if="item.id=='updateTime'"
sortable
prop="updateTime"
:label="$t('commons.update_time')"
show-overflow-tooltip
:key="index">
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
</template>
<el-table-column
min-width="100"
:label="$t('commons.operating')"
>
<template slot="header">
<header-label-operate @exec="customHeader"/>
</template>
<template v-slot:default="scope">
<ms-table-operator-button :is-tester-permission="true" :tip="$t('commons.edit')" icon="el-icon-edit"
@exec="handleEdit(scope.row)"/>
<ms-table-operator-button :is-tester-permission="true" :tip="$t('test_track.plan_view.cancel_relevance')"
icon="el-icon-unlock" type="danger" @exec="handleDelete(scope.row)"/>
</template> </template>
</el-table-column> </el-table-column>
</el-table>
<header-custom ref="headerCustom" :initTableData="initTableData" :optionalFields=headerItems
:type=type></header-custom>
<ms-table-pagination :change="search" :current-page.sync="currentPage" :page-size.sync="pageSize" <el-table-column
:total="total"/> v-if="item.id=='updateTime'"
sortable
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>
</template>
</el-table-column>
</template>
<el-table-column
min-width="100"
fixed="right"
:label="$t('commons.operating')"
>
<template slot="header">
<header-label-operate @exec="customHeader"/>
</template>
<template v-slot:default="scope">
<ms-table-operator-button :is-tester-permission="true" :tip="$t('commons.edit')" icon="el-icon-edit"
@exec="handleEdit(scope.row)"/>
<ms-table-operator-button :is-tester-permission="true" :tip="$t('test_track.plan_view.cancel_relevance')"
icon="el-icon-unlock" type="danger" @exec="handleDelete(scope.row)"/>
</template>
</el-table-column>
</el-table>
<header-custom ref="headerCustom" :initTableData="initTableData" :optionalFields=headerItems
:type=type></header-custom>
<test-review-test-case-edit <ms-table-pagination :change="search" :current-page.sync="currentPage" :page-size.sync="pageSize"
ref="testReviewTestCaseEdit" :total="total"/>
:search-param="condition"
@refresh="initTableData" <test-review-test-case-edit
:is-read-only="isReadOnly" ref="testReviewTestCaseEdit"
@refreshTable="search"/> :search-param="condition"
@refresh="initTableData"
:is-read-only="isReadOnly"
@refreshTable="search"/>
<batch-edit ref="batchEdit" @batchEdit="batchEdit" <batch-edit ref="batchEdit" @batchEdit="batchEdit"
@ -203,10 +209,22 @@ import {
} from "../../../../../../common/js/constants"; } from "../../../../../../common/js/constants";
import TestReviewTestCaseEdit from "./TestReviewTestCaseEdit"; import TestReviewTestCaseEdit from "./TestReviewTestCaseEdit";
import ReviewStatus from "@/business/components/track/case/components/ReviewStatus"; 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 HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {Test_Case_Review_Case_List, Track_Test_Case} from "@/business/components/common/model/JsonData"; import {Test_Case_Review_Case_List, Track_Test_Case} from "@/business/components/common/model/JsonData";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate"; import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover";
export default { export default {
name: "TestReviewTestCaseList", name: "TestReviewTestCaseList",
@ -216,12 +234,13 @@ export default {
MsTableOperatorButton, MsTableOperator, MethodTableItem, TypeTableItem, MsTableOperatorButton, MsTableOperator, MethodTableItem, TypeTableItem,
StatusTableItem, PriorityTableItem, StatusEdit, StatusTableItem, PriorityTableItem, StatusEdit,
ExecutorEdit, MsTipButton, TestReviewTestCaseEdit, MsTableHeader, ExecutorEdit, MsTipButton, TestReviewTestCaseEdit, MsTableHeader,
NodeBreadcrumb, MsTableButton, ShowMoreBtn, BatchEdit, MsTablePagination, ReviewStatus NodeBreadcrumb, MsTableButton, ShowMoreBtn, BatchEdit, MsTablePagination, ReviewStatus,MsTableHeaderSelectPopover
}, },
data() { data() {
return { return {
type: TEST_CASE_REVIEW_CASE_LIST, type: TEST_CASE_REVIEW_CASE_LIST,
headerItems: Test_Case_Review_Case_List, headerItems: Test_Case_Review_Case_List,
screenHeight: document.documentElement.clientHeight - 278,
tableLabel: [], tableLabel: [],
result: {}, result: {},
condition: {}, condition: {},
@ -233,6 +252,7 @@ export default {
testReview: {}, testReview: {},
isReadOnly: false, isReadOnly: false,
isTestManagerOrTestUser: false, isTestManagerOrTestUser: false,
selectDataCounts:0,
priorityFilters: [ priorityFilters: [
{text: 'P0', value: 'P0'}, {text: 'P0', value: 'P0'},
{text: 'P1', value: 'P1'}, {text: 'P1', value: 'P1'},
@ -301,6 +321,7 @@ export default {
this.$refs.headerCustom.open(this.tableLabel) this.$refs.headerCustom.open(this.tableLabel)
}, },
initTableData() { initTableData() {
initCondition(this.condition, this.condition.selectAll);
if (this.reviewId) { if (this.reviewId) {
this.condition.reviewId = this.reviewId; this.condition.reviewId = this.reviewId;
} }
@ -319,11 +340,41 @@ export default {
this.total = data.itemCount; this.total = data.itemCount;
this.tableData = data.listObject; this.tableData = data.listObject;
this.selectRows.clear(); 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); 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) { showDetail(row, event, column) {
this.isReadOnly = true; this.isReadOnly = true;
this.$refs.testReviewTestCaseEdit.openTestCaseEdit(row); this.$refs.testReviewTestCaseEdit.openTestCaseEdit(row);
@ -373,8 +424,9 @@ export default {
confirmButtonText: this.$t('commons.confirm'), confirmButtonText: this.$t('commons.confirm'),
callback: (action) => { callback: (action) => {
if (action === 'confirm') { if (action === 'confirm') {
let ids = Array.from(this.selectRows).map(row => row.id); let param = buildBatchParam(this);
this.$post('/test/review/case/batch/delete', {ids: ids, reviewId: this.reviewId}, () => { param.reviewId = this.reviewId;
this.$post('/test/review/case/batch/delete', param, () => {
this.selectRows.clear(); this.selectRows.clear();
this.$emit("refresh"); this.$emit("refresh");
this.$success(this.$t('test_track.cancel_relevance_success')); this.$success(this.$t('test_track.cancel_relevance_success'));
@ -395,7 +447,7 @@ export default {
}, },
batchEdit(form) { batchEdit(form) {
let reviewId = this.reviewId; let reviewId = this.reviewId;
let param = {}; let param = buildBatchParam(this);
param[form.type] = form.value; param[form.type] = form.value;
param.ids = Array.from(this.selectRows).map(row => row.caseId); param.ids = Array.from(this.selectRows).map(row => row.caseId);
param.reviewId = reviewId; param.reviewId = reviewId;
@ -421,13 +473,16 @@ export default {
} }
}, },
handleSelectionChange(selection, row) { handleSelectionChange(selection, row) {
if (this.selectRows.has(row)) { _handleSelect(this, selection, row, this.selectRows);
this.$set(row, "showMore", false); setUnSelectIds(this.tableData, this.condition, this.selectRows);
this.selectRows.delete(row); this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
} else { // if (this.selectRows.has(row)) {
this.$set(row, "showMore", true); // this.$set(row, "showMore", false);
this.selectRows.add(row); // this.selectRows.delete(row);
} // } else {
// this.$set(row, "showMore", true);
// this.selectRows.add(row);
// }
}, },
openTestReport() { openTestReport() {
this.$refs.testReportTemplateList.open(this.reviewId); this.$refs.testReportTemplateList.open(this.reviewId);
@ -459,20 +514,36 @@ export default {
} else { } else {
this.$warning(this.$t('test_track.review.no_link_case')); 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> </script>
<style scoped> <style scoped>
.ms-table-header { /*.ms-table-header {*/
margin: 20px; /* margin: 5px;*/
} /*}*/
/deep/ .table-title { /deep/ .table-title {
height: 0px; height: 0px;
font-weight: bold; font-weight: bold;
font-size: 0px; font-size: 0px;
} }
/deep/ .el-table__fixed-body-wrapper {
top: 59px !important;
}
</style> </style>

View File

@ -17,7 +17,7 @@ export function _handleSelectAll(component, selection, tableData, selectRows) {
selectRows.clear(); selectRows.clear();
tableData.forEach(item => { tableData.forEach(item => {
component.$set(item, "showMore", false); component.$set(item, "showMore", false);
}) });
} }
} }
@ -33,15 +33,21 @@ export function _handleSelect(component, selection, row, selectRows) {
let arr = Array.from(selectRows); let arr = Array.from(selectRows);
arr.forEach(row => { arr.forEach(row => {
component.$set(row, "showMore", true); component.$set(row, "showMore", true);
}) });
} }
// 设置 unSelectIds 查询条件,返回当前选中的条数 // 设置 unSelectIds 查询条件,返回当前选中的条数
export function setUnSelectIds(tableData, condition, selectRows) { export function setUnSelectIds(tableData, condition, selectRows) {
let ids = Array.from(selectRows).map(o => o.id); let ids = Array.from(selectRows).map(o => o.id);
let allIDs = tableData.map(o => o.id); let allIDs = tableData.map(o => o.id);
condition.unSelectIds = allIDs.filter(function (val) { let thisUnSelectIds = allIDs.filter(function (val) {
return ids.indexOf(val) === -1 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) { export function _filter(filters, condition) {
@ -101,30 +132,30 @@ export function _sort(column, condition) {
} }
} }
export function initCondition(condition,isSelectAll) { export function initCondition(condition, isSelectAll) {
if(!isSelectAll){ if (!isSelectAll) {
condition.selectAll = false; condition.selectAll = false;
condition.unSelectIds = []; condition.unSelectIds = [];
} }
} }
export function getLabel(vueObj, type) { export function getLabel(vueObj, type) {
let param = {} let param = {};
param.userId = getCurrentUser().id; param.userId = getCurrentUser().id;
param.type = type; param.type = type;
vueObj.result = vueObj.$post('/system/header/info', param, response => { vueObj.result = vueObj.$post('/system/header/info', param, response => {
if (response.data != null) { if (response.data != null) {
vueObj.tableLabel = eval(response.data.props); vueObj.tableLabel = eval(response.data.props);
}else{ } else {
let param = {} let param = {};
param.type=type param.type = type;
vueObj.result = vueObj.$post('/system/system/header',param, response => { vueObj.result = vueObj.$post('/system/system/header', param, response => {
if (response.data != null) { if (response.data != null) {
vueObj.tableLabel = eval(response.data.props); vueObj.tableLabel = eval(response.data.props);
} }
}) });
} }
}) });
} }

View File

@ -19,6 +19,7 @@ export default {
examples: 'examples', examples: 'examples',
help_documentation: 'Help documentation', help_documentation: 'Help documentation',
delete_cancelled: 'Delete cancelled', delete_cancelled: 'Delete cancelled',
option_cannot_spread_pages: 'This options not support spread pages.Do you want continue?',
workspace: 'Workspace', workspace: 'Workspace',
organization: 'Organization', organization: 'Organization',
setting: 'Setting', setting: 'Setting',
@ -985,6 +986,15 @@ export default {
unit_of_measurement: "", unit_of_measurement: "",
unit_of_count: "", unit_of_count: "",
unit_of_times: "times", 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: { api_count_card: {
title: "API count", title: "API count",
}, },

View File

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

View File

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