fix: 自定义表头

This commit is contained in:
wenyann 2021-02-19 16:34:22 +08:00
parent 8e4ce8a197
commit 245b46dc19
18 changed files with 2399 additions and 975 deletions

View File

@ -0,0 +1,17 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class UserHeader implements Serializable {
private String id;
private String userId;
private String props;
private String type;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,480 @@
package io.metersphere.base.domain;
import java.util.ArrayList;
import java.util.List;
public class UserHeaderExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public UserHeaderExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(String value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("id like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("id not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andUserIdIsNull() {
addCriterion("user_id is null");
return (Criteria) this;
}
public Criteria andUserIdIsNotNull() {
addCriterion("user_id is not null");
return (Criteria) this;
}
public Criteria andUserIdEqualTo(String value) {
addCriterion("user_id =", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotEqualTo(String value) {
addCriterion("user_id <>", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThan(String value) {
addCriterion("user_id >", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThanOrEqualTo(String value) {
addCriterion("user_id >=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThan(String value) {
addCriterion("user_id <", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThanOrEqualTo(String value) {
addCriterion("user_id <=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLike(String value) {
addCriterion("user_id like", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotLike(String value) {
addCriterion("user_id not like", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdIn(List<String> values) {
addCriterion("user_id in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotIn(List<String> values) {
addCriterion("user_id not in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdBetween(String value1, String value2) {
addCriterion("user_id between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotBetween(String value1, String value2) {
addCriterion("user_id not between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andPropsIsNull() {
addCriterion("props is null");
return (Criteria) this;
}
public Criteria andPropsIsNotNull() {
addCriterion("props is not null");
return (Criteria) this;
}
public Criteria andPropsEqualTo(String value) {
addCriterion("props =", value, "props");
return (Criteria) this;
}
public Criteria andPropsNotEqualTo(String value) {
addCriterion("props <>", value, "props");
return (Criteria) this;
}
public Criteria andPropsGreaterThan(String value) {
addCriterion("props >", value, "props");
return (Criteria) this;
}
public Criteria andPropsGreaterThanOrEqualTo(String value) {
addCriterion("props >=", value, "props");
return (Criteria) this;
}
public Criteria andPropsLessThan(String value) {
addCriterion("props <", value, "props");
return (Criteria) this;
}
public Criteria andPropsLessThanOrEqualTo(String value) {
addCriterion("props <=", value, "props");
return (Criteria) this;
}
public Criteria andPropsLike(String value) {
addCriterion("props like", value, "props");
return (Criteria) this;
}
public Criteria andPropsNotLike(String value) {
addCriterion("props not like", value, "props");
return (Criteria) this;
}
public Criteria andPropsIn(List<String> values) {
addCriterion("props in", values, "props");
return (Criteria) this;
}
public Criteria andPropsNotIn(List<String> values) {
addCriterion("props not in", values, "props");
return (Criteria) this;
}
public Criteria andPropsBetween(String value1, String value2) {
addCriterion("props between", value1, value2, "props");
return (Criteria) this;
}
public Criteria andPropsNotBetween(String value1, String value2) {
addCriterion("props not between", value1, value2, "props");
return (Criteria) this;
}
public Criteria andTypeIsNull() {
addCriterion("`type` is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("`type` is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(String value) {
addCriterion("`type` =", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(String value) {
addCriterion("`type` <>", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThan(String value) {
addCriterion("`type` >", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(String value) {
addCriterion("`type` >=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThan(String value) {
addCriterion("`type` <", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(String value) {
addCriterion("`type` <=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLike(String value) {
addCriterion("`type` like", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotLike(String value) {
addCriterion("`type` not like", value, "type");
return (Criteria) this;
}
public Criteria andTypeIn(List<String> values) {
addCriterion("`type` in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<String> values) {
addCriterion("`type` not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(String value1, String value2) {
addCriterion("`type` between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(String value1, String value2) {
addCriterion("`type` not between", value1, value2, "type");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -0,0 +1,30 @@
package io.metersphere.base.mapper;
import io.metersphere.base.domain.UserHeader;
import io.metersphere.base.domain.UserHeaderExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface UserHeaderMapper {
long countByExample(UserHeaderExample example);
int deleteByExample(UserHeaderExample example);
int deleteByPrimaryKey(String id);
int insert(UserHeader record);
int insertSelective(UserHeader record);
List<UserHeader> selectByExample(UserHeaderExample example);
UserHeader selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") UserHeader record, @Param("example") UserHeaderExample example);
int updateByExample(@Param("record") UserHeader record, @Param("example") UserHeaderExample example);
int updateByPrimaryKeySelective(UserHeader record);
int updateByPrimaryKey(UserHeader record);
}

View File

@ -0,0 +1,196 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.UserHeaderMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.UserHeader">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="user_id" jdbcType="VARCHAR" property="userId" />
<result column="props" jdbcType="VARCHAR" property="props" />
<result column="type" jdbcType="VARCHAR" property="type" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, user_id, props, `type`
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.UserHeaderExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from user_header
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from user_header
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from user_header
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.UserHeaderExample">
delete from user_header
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.UserHeader">
insert into user_header (id, user_id, props,
`type`)
values (#{id,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{props,jdbcType=VARCHAR},
#{type,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.UserHeader">
insert into user_header
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="props != null">
props,
</if>
<if test="type != null">
`type`,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="userId != null">
#{userId,jdbcType=VARCHAR},
</if>
<if test="props != null">
#{props,jdbcType=VARCHAR},
</if>
<if test="type != null">
#{type,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.UserHeaderExample" resultType="java.lang.Long">
select count(*) from user_header
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update user_header
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=VARCHAR},
</if>
<if test="record.props != null">
props = #{record.props,jdbcType=VARCHAR},
</if>
<if test="record.type != null">
`type` = #{record.type,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update user_header
set id = #{record.id,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR},
props = #{record.props,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.UserHeader">
update user_header
<set>
<if test="userId != null">
user_id = #{userId,jdbcType=VARCHAR},
</if>
<if test="props != null">
props = #{props,jdbcType=VARCHAR},
</if>
<if test="type != null">
`type` = #{type,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.UserHeader">
update user_header
set user_id = #{userId,jdbcType=VARCHAR},
props = #{props,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -27,92 +27,106 @@
<show-more-btn :is-show="isSelect(scope.row)" :buttons="buttons" :size="selectDataCounts"/>
</template>
</el-table-column>
<template v-for="(item, index) in tableLabel">
<el-table-column v-if="item.prop == 'num'" prop="num" label="ID"
sortable="custom"
min-width="120px"
show-overflow-tooltip :key="index">
<template slot-scope="scope">
<el-tooltip content="编辑">
<a style="cursor:pointer" @click="edit(scope.row)"> {{ scope.row.num }} </a>
</el-tooltip>
</template>
</el-table-column>
<el-table-column v-if="item.prop == 'name'" prop="name"
sortable="custom"
:label="$t('api_test.automation.scenario_name')"
show-overflow-tooltip
min-width="120px"
:key="index"
/>
<el-table-column v-if="item.prop == 'level'" prop="level"
sortable="custom"
column-key="level"
:filters="levelFilters"
min-width="120px"
:label="$t('api_test.automation.case_level')"
show-overflow-tooltip :key="index">
<template v-slot:default="scope">
<priority-table-item :value="scope.row.level"/>
</template>
</el-table-column>
<el-table-column v-if="item.prop == 'status'" prop="status" :label="$t('test_track.plan.plan_status')"
sortable="custom"
column-key="status"
:filters="statusFilters"
show-overflow-tooltip min-width="120px" :key="index">
<template v-slot:default="scope">
<plan-status-table-item :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column v-if="item.prop == 'tags'" prop="tags" min-width="120px"
:label="$t('api_test.automation.tag')" :key="index">
<template v-slot:default="scope">
<div v-for="(itemName,index) in scope.row.tags" :key="index">
<ms-tag type="success" effect="plain" :content="itemName"/>
</div>
</template>
</el-table-column>
<el-table-column v-if="item.prop == 'userId'" prop="userId" min-width="120px"
:label="$t('api_test.automation.creator')"
:filters="userFilters"
column-key="user_id"
sortable="custom"
show-overflow-tooltip
:key="index"/>
<el-table-column v-if="item.prop == 'updateTime'" prop="updateTime"
:label="$t('api_test.automation.update_time')" sortable="custom" min-width="180px"
:key="index">
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column v-if="item.prop == 'stepTotal'" prop="stepTotal" :label="$t('api_test.automation.step')"
min-width="80px"
show-overflow-tooltip :key="index"/>
<el-table-column v-if="item.prop == 'lastResult'" prop="lastResult"
:label="$t('api_test.automation.last_result')"
:filters="resultFilters"
<el-table-column prop="num" label="ID"
sortable="custom"
min-width="120px"
show-overflow-tooltip>
<template slot-scope="scope">
<el-tooltip content="编辑">
<a style="cursor:pointer" @click="edit(scope.row)"> {{ scope.row.num }} </a>
</el-tooltip>
</template>
</el-table-column>
<el-table-column prop="name"
sortable="custom"
:label="$t('api_test.automation.scenario_name')"
show-overflow-tooltip
min-width="120px"/>
<el-table-column prop="level"
sortable="custom"
column-key="level"
:filters="levelFilters"
min-width="120px"
:label="$t('api_test.automation.case_level')"
show-overflow-tooltip>
<template v-slot:default="scope">
<priority-table-item :value="scope.row.level"/>
</template>
</el-table-column>
<el-table-column prop="status" :label="$t('test_track.plan.plan_status')"
sortable="custom"
column-key="status"
:filters="statusFilters"
show-overflow-tooltip min-width="120px">
<template v-slot:default="scope">
<plan-status-table-item :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column prop="tags" min-width="120px"
:label="$t('api_test.automation.tag')">
<template v-slot:default="scope">
<div v-for="(itemName,index) in scope.row.tags" :key="index">
<ms-tag type="success" effect="plain" :content="itemName"/>
</div>
</template>
</el-table-column>
<el-table-column prop="userId" min-width="120px"
:label="$t('api_test.automation.creator')"
:filters="userFilters"
column-key="user_id"
sortable="custom"
show-overflow-tooltip/>
<el-table-column prop="updateTime" :label="$t('api_test.automation.update_time')" sortable="custom" min-width="180px"
>
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column prop="stepTotal" :label="$t('api_test.automation.step')" min-width="80px"
show-overflow-tooltip/>
<el-table-column prop="lastResult" :label="$t('api_test.automation.last_result')"
:filters="resultFilters"
sortable="custom" column-key="last_result" min-width="120px">
<template v-slot:default="{row}">
<el-link type="success" @click="showReport(row)" v-if="row.lastResult === 'Success'">
{{ $t('api_test.automation.success') }}
</el-link>
<el-link type="danger" @click="showReport(row)" v-if="row.lastResult === 'Fail'">
{{ $t('api_test.automation.fail') }}
</el-link>
</template>
</el-table-column>
<el-table-column prop="passRate" :label="$t('api_test.automation.passing_rate')"
min-width="120px"
show-overflow-tooltip/>
sortable="custom" column-key="last_result" min-width="120px" :key="index">
<template v-slot:default="{row}">
<el-link type="success" @click="showReport(row)" v-if="row.lastResult === 'Success'">
{{ $t('api_test.automation.success') }}
</el-link>
<el-link type="danger" @click="showReport(row)" v-if="row.lastResult === 'Fail'">
{{ $t('api_test.automation.fail') }}
</el-link>
</template>
</el-table-column>
<el-table-column v-if="item.prop == 'passRate'" prop="passRate"
:label="$t('api_test.automation.passing_rate')"
min-width="120px"
show-overflow-tooltip :key="index"/>
</template>
<el-table-column fixed="right" :label="$t('commons.operating')" width="190px" v-if="!referenced">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
</template>
<template v-slot:default="{row}">
<div v-if="trashEnable">
<ms-table-operator-button :tip="$t('commons.reduction')" icon="el-icon-refresh-left" @exec="reductionApi(row)" v-tester/>
<ms-table-operator-button :tip="$t('api_test.automation.remove')" icon="el-icon-delete" @exec="remove(row)" type="danger" v-tester/>
<ms-table-operator-button :tip="$t('commons.reduction')" icon="el-icon-refresh-left"
@exec="reductionApi(row)" v-tester/>
<ms-table-operator-button :tip="$t('api_test.automation.remove')" icon="el-icon-delete"
@exec="remove(row)" type="danger" v-tester/>
</div>
<div v-else>
<ms-table-operator-button :tip="$t('api_test.automation.edit')" icon="el-icon-edit" @exec="edit(row)" v-tester/>
<ms-table-operator-button class="run-button" :is-tester-permission="true" :tip="$t('api_test.automation.execute')"
<ms-table-operator-button :tip="$t('api_test.automation.edit')" icon="el-icon-edit" @exec="edit(row)"
v-tester/>
<ms-table-operator-button class="run-button" :is-tester-permission="true"
:tip="$t('api_test.automation.execute')"
icon="el-icon-video-play"
@exec="execute(row)" v-tester/>
<ms-table-operator-button :tip="$t('api_test.automation.copy')" icon="el-icon-document-copy" type=""
@ -123,6 +137,7 @@
</template>
</el-table-column>
</el-table>
<header-custom ref="headerCustom" :initTableData="search" :optionalFields=headerItems :type=type></header-custom>
<ms-table-pagination :change="search" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
<div>
@ -155,7 +170,7 @@ import MsTableHeader from "@/business/components/common/components/MsTableHeader
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn";
import MsTag from "../../../common/components/MsTag";
import {getCurrentProjectID, getUUID} from "@/common/js/utils";
import {getCurrentProjectID, getCurrentUser, getUUID} from "@/common/js/utils";
import MsApiReportDetail from "../report/ApiReportDetail";
import MsTableMoreBtn from "./TableMoreBtn";
import MsScenarioExtendButtons from "@/business/components/api/automation/scenario/ScenarioExtendBtns";
@ -166,14 +181,17 @@ import MsTableOperatorButton from "@/business/components/common/components/MsTab
import PriorityTableItem from "../../../track/common/tableItems/planview/PriorityTableItem";
import PlanStatusTableItem from "../../../track/common/tableItems/plan/PlanStatusTableItem";
import BatchEdit from "../../../track/case/components/BatchEdit";
import {WORKSPACE_ID} from "../../../../../common/js/constants";
import {API_SCENARIO_LIST, TEST_CASE_LIST, TEST_PLAN_LIST, WORKSPACE_ID} from "../../../../../common/js/constants";
import EnvironmentSelect from "../../definition/components/environment/EnvironmentSelect";
import BatchMove from "../../../track/case/components/BatchMove";
import {_filter, _sort} from "@/common/js/tableUtils";
import {Api_Scenario_List, Track_Test_Case} from "@/business/components/common/model/JsonData";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
export default {
name: "MsApiScenarioList",
components: {
HeaderCustom,
BatchMove,
EnvironmentSelect,
BatchEdit,
@ -182,8 +200,8 @@ export default {
MsTableHeaderSelectPopover,
MsTablePagination,
MsTableMoreBtn,
ShowMoreBtn,
MsTableHeader,
ShowMoreBtn,
MsTableHeader,
MsTag,
MsApiReportDetail,
MsScenarioExtendButtons,
@ -215,6 +233,9 @@ export default {
},
data() {
return {
type: API_SCENARIO_LIST,
headerItems: Api_Scenario_List,
tableLabel: Api_Scenario_List,
loading: false,
screenHeight: document.documentElement.clientHeight - 280,//,
condition: {
@ -326,11 +347,15 @@ export default {
}
},
methods: {
customHeader() {
this.$refs.headerCustom.open(this.tableLabel)
},
selectByParam() {
this.changeSelectDataRangeAll();
this.search();
},
search() {
this.getLabel()
this.condition.moduleIds = this.selectNodeIds;
if (this.trashEnable) {
this.condition.filters = {status: ["Trash"]};
@ -380,6 +405,24 @@ export default {
});
}
},
getLabel() {
let param = {}
param.userId = getCurrentUser().id;
param.type = API_SCENARIO_LIST
this.result = this.$post('/system/header/info', param, response => {
if (response.data != null) {
let arry = eval(response.data.props);
let obj = {};
for (let key in arry) {
obj[key] = arry[key];
}
let newObj = Object.keys(obj).map(val => ({
prop: obj[val]
}))
this.tableLabel = newObj
}
})
},
handleCommand(cmd) {
let table = this.$refs.scenarioTable;
switch (cmd) {

View File

@ -21,82 +21,99 @@
<el-table-column type="selection" width="50"/>
<ms-table-header-select-popover v-show="total>0"
:page-size="pageSize>total?total:pageSize"
:total="total"
@selectPageAll="isSelectDataAll(false)"
@selectAll="isSelectDataAll(true)"/>
:page-size="pageSize>total?total:pageSize"
:total="total"
@selectPageAll="isSelectDataAll(false)"
@selectAll="isSelectDataAll(true)"/>
<el-table-column width="30" :resizable="false" min-width="30px" align="center">
<el-table-column width="30" :resizable="false" min-width="30px" 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 v-if="item.prop == 'num'" prop="num" label="ID" min-width="120px" show-overflow-tooltip
:key="index">
<template slot-scope="scope">
<el-tooltip content="编辑">
<a style="cursor:pointer" @click="handleTestCase(scope.row)"> {{ scope.row.num }} </a>
</el-tooltip>
</template>
</el-table-column>
<el-table-column prop="num" label="ID" min-width="120px" show-overflow-tooltip>
<template slot-scope="scope">
<el-tooltip content="编辑">
<a style="cursor:pointer" @click="handleTestCase(scope.row)"> {{ scope.row.num }} </a>
</el-tooltip>
<el-table-column v-if="item.prop == 'name'" prop="name" min-width="160px" :label="$t('test_track.case.name')"
show-overflow-tooltip :key="index"/>
<el-table-column
v-if="item.prop == 'priority'"
prop="priority"
:filters="priorityFilters"
column-key="priority"
min-width="120px"
:label="$t('test_track.case.priority')"
show-overflow-tooltip
:key="index">
<template v-slot:default="scope">
<priority-table-item :value="scope.row.priority"/>
</template>
</el-table-column>
<el-table-column
v-if="item.prop == 'custom'"
sortable="custom"
prop="path"
min-width="180px"
:label="$t('api_test.definition.api_path')"
show-overflow-tooltip
:key="index"/>
<el-table-column v-if="item.prop=='tags'" prop="tags" min-width="120px" :label="$t('commons.tag')"
:key="index">
<template v-slot:default="scope">
<div v-for="(itemName,index) in scope.row.tags" :key="index">
<ms-tag type="success" effect="plain" :content="itemName"/>
</div>
</template>
</el-table-column>
<el-table-column
v-if="item.prop=='createUser'"
prop="createUser"
:label="'创建人'"
show-overflow-tooltip
:key="index"/>
<el-table-column
v-if="item.prop=='custom'"
sortable="custom"
min-width="160"
:label="$t('api_test.definition.api_last_time')"
prop="updateTime"
:key="index">
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
</template>
<el-table-column fixed="right" v-if="!isReadOnly" :label="$t('commons.operating')" min-width="130"
align="center">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
</template>
</el-table-column>
<el-table-column prop="name" min-width="160px" :label="$t('test_track.case.name')" show-overflow-tooltip/>
<el-table-column
prop="priority"
:filters="priorityFilters"
column-key="priority"
min-width="120px"
:label="$t('test_track.case.priority')"
show-overflow-tooltip>
<template v-slot:default="scope">
<priority-table-item :value="scope.row.priority"/>
<ms-table-operator-button :tip="$t('commons.edit')" icon="el-icon-edit" @exec="handleTestCase(scope.row)"
v-tester/>
<ms-table-operator-button :tip="$t('commons.delete')" icon="el-icon-delete" @exec="handleDelete(scope.row)"
type="danger" v-tester/>
<ms-api-case-table-extend-btns @showCaseRef="showCaseRef" @showEnvironment="showEnvironment"
@createPerformance="createPerformance" :row="scope.row" v-tester/>
</template>
</el-table-column>
<el-table-column
sortable="custom"
prop="path"
min-width="180px"
:label="$t('api_test.definition.api_path')"
show-overflow-tooltip/>
<el-table-column prop="tags" min-width="120px" :label="$t('commons.tag')">
<template v-slot:default="scope">
<div v-for="(itemName,index) in scope.row.tags" :key="index">
<ms-tag type="success" effect="plain" :content="itemName"/>
</div>
</template>
</el-table-column>
<el-table-column
prop="createUser"
:label="'创建人'"
show-overflow-tooltip/>
<el-table-column
sortable="custom"
min-width="160"
:label="$t('api_test.definition.api_last_time')"
prop="updateTime">
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column fixed="right" v-if="!isReadOnly" :label="$t('commons.operating')" min-width="130" align="center">
<template v-slot:default="scope">
<ms-table-operator-button :tip="$t('commons.edit')" icon="el-icon-edit" @exec="handleTestCase(scope.row)" v-tester/>
<ms-table-operator-button :tip="$t('commons.delete')" icon="el-icon-delete" @exec="handleDelete(scope.row)" type="danger" v-tester/>
<ms-api-case-table-extend-btns @showCaseRef="showCaseRef" @showEnvironment="showEnvironment" @createPerformance="createPerformance" :row="scope.row" v-tester/>
</template>
</el-table-column>
</el-table>
<header-custom ref="headerCustom" :initTableData="initTable" :optionalFields=headerItems
:type=type></header-custom>
<ms-table-pagination :change="initTable" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
</api-list-container>
@ -129,7 +146,7 @@ import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
import MsBatchEdit from "../basis/BatchEdit";
import {API_METHOD_COLOUR, CASE_PRIORITY, DUBBO_METHOD, REQ_METHOD, SQL_METHOD, TCP_METHOD} from "../../model/JsonData";
import {getBodyUploadFiles, getCurrentProjectID} from "@/common/js/utils";
import {getBodyUploadFiles, getCurrentProjectID, getCurrentUser} from "@/common/js/utils";
import ApiListContainer from "./ApiListContainer";
import PriorityTableItem from "../../../../track/common/tableItems/planview/PriorityTableItem";
import MsApiCaseTableExtendBtns from "../reference/ApiCaseTableExtendBtns";
@ -142,20 +159,24 @@ import MsTableHeaderSelectPopover from "@/business/components/common/components/
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
import {API_CASE_CONFIGS} from "@/business/components/common/components/search/search-components";
import {_filter, _handleSelect, _handleSelectAll, _sort,} from "@/common/js/tableUtils";
import {API_CASE_LIST, TEST_CASE_LIST} from "@/common/js/constants";
import {Api_Case_List, Track_Test_Case} from "@/business/components/common/model/JsonData";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
export default {
name: "ApiCaseSimpleList",
components: {
MsTableHeaderSelectPopover,
MsSetEnvironment,
ApiCaseList,
PriorityTableItem,
ApiListContainer,
MsTableOperatorButton,
MsTableOperator,
MsTablePagination,
MsTag,
MsApiCaseList,
name: "ApiCaseSimpleList",
components: {
HeaderCustom,
MsTableHeaderSelectPopover,
MsSetEnvironment,
ApiCaseList,
PriorityTableItem,
ApiListContainer,
MsTableOperatorButton,
MsTableOperator,
MsTablePagination,
MsTag,
MsApiCaseList,
MsContainer,
MsBottomContainer,
ShowMoreBtn,
@ -166,6 +187,9 @@ export default {
},
data() {
return {
type: API_CASE_LIST,
headerItems: Api_Case_List,
tableLabel: Api_Case_List,
condition: {
components: API_CASE_CONFIGS
},
@ -267,10 +291,14 @@ export default {
},
},
methods: {
customHeader() {
this.$refs.headerCustom.open(this.tableLabel)
},
isApiListEnableChange(data) {
this.$emit('isApiListEnableChange', data);
},
initTable() {
this.getLabel()
this.selectRows = new Set();
this.condition.status = "";
this.condition.moduleIds = this.selectNodeIds;
@ -314,6 +342,24 @@ export default {
});
}
},
getLabel() {
let param = {}
param.userId = getCurrentUser().id;
param.type = API_CASE_LIST
this.result = this.$post('/system/header/info', param, response => {
if (response.data != null) {
let arry = eval(response.data.props);
let obj = {};
for (let key in arry) {
obj[key] = arry[key];
}
let newObj = Object.keys(obj).map(val => ({
prop: obj[val]
}))
this.tableLabel = newObj
}
})
},
open() {
this.$refs.searchBar.open();
},

View File

@ -32,113 +32,142 @@
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectDataCounts"/>
</template>
</el-table-column>
<el-table-column prop="num" label="ID" show-overflow-tooltip
min-width="80px"
sortable="custom">
<template slot-scope="scope">
<el-tooltip content="编辑">
<a style="cursor:pointer" @click="editApi(scope.row)"> {{ scope.row.num }} </a>
</el-tooltip>
</template>
</el-table-column>
<el-table-column prop="name" :label="$t('api_test.definition.api_name')"
show-overflow-tooltip
sortable="custom" min-width="120px"/>
<el-table-column
prop="status"
column-key="status"
sortable="custom"
:filters="statusFilters"
:label="$t('api_test.definition.api_status')" min-width="120px">
<template v-slot:default="scope">
<template v-for="(item, index) in tableLabel">
<el-table-column
v-if="item.prop == 'num'"
prop="num"
label="ID"
show-overflow-tooltip
min-width="80px"
sortable="custom"
:key="index">
<template slot-scope="scope">
<el-tooltip content="编辑">
<a style="cursor:pointer" @click="editApi(scope.row)"> {{ scope.row.num }} </a>
</el-tooltip>
</template>
</el-table-column>
<el-table-column
v-if="item.prop == 'name'"
prop="name"
:label="$t('api_test.definition.api_name')"
show-overflow-tooltip
sortable="custom"
min-width="120px"
:key="index"/>
<el-table-column
v-if="item.prop == 'status'"
prop="status"
column-key="status"
sortable="custom"
:filters="statusFilters"
:label="$t('api_test.definition.api_status')"
min-width="120px"
:key="index">
<template v-slot:default="scope">
<span class="el-dropdown-link">
<api-status :value="scope.row.status"/>
</span>
</template>
</el-table-column>
</template>
</el-table-column>
<el-table-column
prop="method"
sortable="custom"
column-key="method"
:filters="methodFilters"
<el-table-column
v-if="item.prop == 'method'"
prop="method"
sortable="custom"
column-key="method"
:filters="methodFilters"
:label="$t('api_test.definition.api_type')"
show-overflow-tooltip min-width="120px"
:key="index">
<template v-slot:default="scope" class="request-method">
<el-tag size="mini"
:style="{'background-color': getColor(true, scope.row.method), border: getColor(true, scope.row.method)}"
class="api-el-tag">
{{ scope.row.method }}
</el-tag>
</template>
</el-table-column>
:label="$t('api_test.definition.api_type')"
show-overflow-tooltip min-width="120px">
<template v-slot:default="scope" class="request-method">
<el-tag size="mini"
:style="{'background-color': getColor(true, scope.row.method), border: getColor(true, scope.row.method)}"
class="api-el-tag">
{{ scope.row.method }}
</el-tag>
</template>
</el-table-column>
<el-table-column
v-if="item.prop == 'userName'"
prop="userName"
sortable="custom"
:filters="userFilters"
column-key="user_id"
:label="$t('api_test.definition.api_principal')"
show-overflow-tooltip
min-width="100px"
:key="index"/>
<el-table-column
prop="userName"
sortable="custom"
:filters="userFilters"
column-key="user_id"
<el-table-column
v-if="item.prop == 'path'"
prop="path"
min-width="120px"
:label="$t('api_test.definition.api_path')"
show-overflow-tooltip
:key="index"/>
:label="$t('api_test.definition.api_principal')"
show-overflow-tooltip min-width="100px"/>
<el-table-column
v-if="item.prop == 'tags'"
prop="tags"
:label="$t('commons.tag')"
min-width="80px"
:key="index"
>
<template v-slot:default="scope">
<div v-for="(itemName,index) in scope.row.tags" :key="index">
<ms-tag type="success" effect="plain" :content="itemName"/>
</div>
</template>
</el-table-column>
<el-table-column
prop="path"
min-width="120px"
<el-table-column
v-if="item.prop == 'updateTime'"
width="160"
:label="$t('api_test.definition.api_last_time')"
sortable="custom"
min-width="160px"
prop="updateTime"
:key="index">
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
:label="$t('api_test.definition.api_path')"
show-overflow-tooltip/>
<el-table-column
v-if="item.prop == 'caseTotal'"
prop="caseTotal"
min-width="80px"
:label="$t('api_test.definition.api_case_number')"
show-overflow-tooltip
:key="index"/>
<el-table-column prop="tags" :label="$t('commons.tag')" min-width="80px"
>
<template v-slot:default="scope">
<div v-for="(itemName,index) in scope.row.tags" :key="index">
<ms-tag type="success" effect="plain" :content="itemName"/>
</div>
</template>
</el-table-column>
<el-table-column
v-if="item.prop == 'caseStatus'"
prop="caseStatus"
min-width="80px"
:label="$t('api_test.definition.api_case_status')"
show-overflow-tooltip
:key="index"/>
<el-table-column
width="160"
:label="$t('api_test.definition.api_last_time')"
sortable="custom"
min-width="160px"
prop="updateTime">
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column
prop="caseTotal"
min-width="80px"
:label="$t('api_test.definition.api_case_number')"
show-overflow-tooltip/>
<el-table-column
prop="caseStatus"
min-width="80px"
:label="$t('api_test.definition.api_case_status')"
show-overflow-tooltip/>
<el-table-column
prop="casePassingRate"
:width="100"
min-width="100px"
:label="$t('api_test.definition.api_case_passing_rate')"
show-overflow-tooltip/>
<el-table-column
v-if="item.prop == 'casePassingRate'"
prop="casePassingRate"
:width="100"
min-width="100px"
:label="$t('api_test.definition.api_case_passing_rate')"
show-overflow-tooltip
:key="index"/>
</template>
<el-table-column fixed="right" v-if="!isReadOnly" :label="$t('commons.operating')" min-width="130"
align="center">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
</template>
<template v-slot:default="scope">
<ms-table-operator-button :tip="$t('commons.reduction')" icon="el-icon-refresh-left"
@exec="reductionApi(scope.row)" v-if="trashEnable" v-tester/>
@ -160,6 +189,8 @@
type="danger" v-tester/>
</template>
</el-table-column>
<header-custom ref="headerCustom" :initTableData="initTable" :optionalFields=headerItems
:type=type></header-custom>
</el-table>
<ms-table-pagination :change="initTable" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
@ -188,8 +219,8 @@ import MsBottomContainer from "../BottomContainer";
import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
import MsBatchEdit from "../basis/BatchEdit";
import {API_METHOD_COLOUR, API_STATUS, DUBBO_METHOD, REQ_METHOD, SQL_METHOD, TCP_METHOD} from "../../model/JsonData";
import {getCurrentProjectID} from "@/common/js/utils";
import {WORKSPACE_ID} from '@/common/js/constants';
import {getCurrentProjectID, getCurrentUser} from "@/common/js/utils";
import {API_LIST, TEST_CASE_LIST, WORKSPACE_ID} from '@/common/js/constants';
import ApiListContainer from "./ApiListContainer";
import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover";
import ApiStatus from "@/business/components/api/definition/components/list/ApiStatus";
@ -198,11 +229,14 @@ import {API_DEFINITION_CONFIGS} from "@/business/components/common/components/se
import MsTipButton from "@/business/components/common/components/MsTipButton";
import CaseBatchMove from "@/business/components/api/definition/components/basis/BatchMove";
import {_filter, _sort} from "@/common/js/tableUtils";
import {Api_List, Track_Test_Case} from "@/business/components/common/model/JsonData";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
export default {
name: "ApiList",
components: {
HeaderCustom,
CaseBatchMove,
ApiStatus,
MsTableHeaderSelectPopover,
@ -223,6 +257,9 @@ export default {
},
data() {
return {
type: API_LIST,
headerItems: Api_List,
tableLabel: Api_List,
condition: {
components: API_DEFINITION_CONFIGS
},
@ -343,6 +380,9 @@ export default {
}
},
methods: {
customHeader() {
this.$refs.headerCustom.open(this.tableLabel)
},
handleBatchMove() {
this.$refs.testCaseBatchMove.open(this.moduleTree, [], this.moduleOptions);
},
@ -351,6 +391,7 @@ export default {
this.$emit('isApiListEnableChange', data);
},
initTable() {
this.getLabel()
this.selectRows = new Set();
this.selectAll = false;
this.unSelection = [];
@ -399,6 +440,25 @@ export default {
});
}
},
getLabel() {
let param = {}
param.userId = getCurrentUser().id;
param.type = API_LIST
this.result = this.$post('/system/header/info', param, response => {
if (response.data != null) {
let arry = eval(response.data.props);
let obj = {};
for (let key in arry) {
obj[key] = arry[key];
}
let newObj = Object.keys(obj).map(val => ({
prop: obj[val]
}))
this.tableLabel = newObj
}
})
},
genProtocalFilter(protocalType) {
if (protocalType === "HTTP") {
this.methodFilters = [
@ -595,7 +655,7 @@ export default {
param.selectAllDate = this.isSelectAllDate;
param.unSelectIds = this.unSelection;
param = Object.assign(param, this.condition);
param.moduleId=param.nodeId;
param.moduleId = param.nodeId;
this.$post('/api/definition/batch/editByParams', param, () => {
this.$success(this.$t('commons.save_success'));
this.$refs.testCaseBatchMove.close();
@ -696,9 +756,9 @@ export default {
_filter(filters, this.condition);
this.initTable();
},
headerDragend(newWidth,oldWidth,column,event){
headerDragend(newWidth, oldWidth, column, event) {
let finalWidth = newWidth;
if(column.minWidth>finalWidth){
if (column.minWidth > finalWidth) {
finalWidth = column.minWidth;
}
column.width = finalWidth;
@ -708,7 +768,7 @@ export default {
this.$refs.searchBar.open();
}
},
}
}
</script>
<style scoped>

View File

@ -9,7 +9,8 @@
label: 'label'
}"
:data="optionalField"
></el-transfer>
style="margin-left: 10%"
></el-transfer>
</template>
<template v-slot:footer>
<ms-dialog-footer
@ -24,36 +25,46 @@
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
import {getCurrentUser} from "@/common/js/utils";
import {TEST_CASE_LIST} from "@/common/js/constants";
import {Track_Test_Case} from "@/business/components/common/model/JsonData";
export default {
name: "HeaderCustom",
components: {MsDialogFooter},
data() {
return {
dialogTableVisible: false,
optionalField: [],
optionalField: this.optionalFields,
value: [],
fieldSelected:[]
fieldSelected: []
}
},
props: {
initTableData: {
type: Function,
default: null
},
optionalFields: Array,
type: String
},
methods: {
open(items) {
console.log(items)
this.dialogTableVisible = true
this.optionalField = items
/*this.optionalField = items*/
},
saveHeader() {
let param={
userId:getCurrentUser().id,
type:TEST_CASE_LIST,
props:JSON.stringify(this.value)
console.log(this.type)
let param = {
userId: getCurrentUser().id,
type: this.type,
props: JSON.stringify(this.value)
}
this.$post("/system/save/header",param,response=>{
this.$post("/system/save/header", param, response => {
this.$success(this.$t("commons.save_success"));
this.dialogTableVisible = false
this.initTableData()
})
},
close() {
this.dialogTableVisible = false
}
}
}

View File

@ -1,15 +1,133 @@
import i18n from '../../../../i18n/i18n'
//自定义默认表头
export const Track_Test_Case=[
//测试用例
export const Track_Test_Case = [
{prop: 'num', label: i18n.t('commons.id')},
{prop: 'name', label: i18n.t('commons.name')},
{prop: 'priority', label: i18n.t('test_track.case.priority')},
{prop: 'type', label: i18n.t('test_track.case.type')},
{prop: 'method', label: i18n.t('test_track.case.method')},
{prop: 'reviewStatus', label:i18n.t('test_track.case.status')},
{prop: 'reviewStatus', label: i18n.t('test_track.case.status')},
{prop: 'tags', label: i18n.t('commons.tag')},
{prop: 'nodePath', label: i18n.t('test_track.case.module')},
{prop: 'updateTime', label: i18n.t('commons.update_time')},
{prop: 'operating', label: i18n.t('commons.operating')},
]
//用例评审-测试用例
export const Test_Case_Review = [
{prop: 'name', label: i18n.t('test_track.review.review_name')},
{prop: 'reviewer', label: i18n.t('test_track.review.reviewer')},
{prop: 'projectName', label: i18n.t('test_track.review.review_project')},
{prop: 'creatorName', label: i18n.t('test_track.review.review_creator')},
{prop: 'status', label: i18n.t('test_track.review.review_status')},
{prop: 'createTime', label: i18n.t('commons.create_time')},
{prop: 'endTime', label: i18n.t('test_track.review.end_time')},
]
//测试计划-测试用例
export const Test_Plan_List = [
{prop: 'name', label: i18n.t('commons.name')},
{prop: 'userName', label: i18n.t('test_track.plan.plan_principal')},
{prop: 'status', label: i18n.t('test_track.plan.plan_status')},
{prop: 'stage', label: i18n.t('test_track.plan.plan_stage')},
{prop: 'testRate', label: i18n.t('test_track.home.test_rate')},
{prop: 'projectName', label: i18n.t('test_track.plan.plan_project')},
{prop: 'plannedStartTime', label: i18n.t('test_track.plan.planned_start_time')},
{prop: 'plannedEndTime', label: i18n.t('test_track.plan.planned_end_time')},
{prop: 'actualStartTime', label: i18n.t('test_track.plan.actual_start_time')},
{prop: 'actualEndTime', label: i18n.t('test_track.plan.actual_end_time')},
]
//接口定义-api列表
export const Api_List = [
{prop: 'num', label: "ID"},
{prop: 'name', label: i18n.t('api_test.definition.api_name')},
{prop: 'method', label: i18n.t('api_test.definition.api_type')},
{prop: 'userName', label: i18n.t('api_test.definition.api_principal')},
{prop: 'path', label: i18n.t('api_test.definition.api_path')},
{prop: 'tags', label: i18n.t('commons.tag')},
{prop: 'updateTime', label: i18n.t('api_test.definition.api_last_time')},
{prop: 'caseTotal', label: i18n.t('api_test.definition.api_case_number')},
{prop: 'caseStatus', label: i18n.t('api_test.definition.api_case_status')},
{prop: 'casePassingRate', label: i18n.t('api_test.definition.api_case_passing_rate')},
]
//接口定义-case列表
export const Api_Case_List = [
{prop: 'num', label: "ID"},
{prop: 'name', label: i18n.t('test_track.case.name')},
{prop: 'priority', label: i18n.t('test_track.case.priority')},
{prop: 'path', label: i18n.t('api_test.definition.api_path')},
{prop: 'tags', label: i18n.t('commons.tag')},
{prop: 'createUser', label: "创建人"},
{prop: 'updateTime', label: i18n.t('api_test.definition.api_last_time')},
]
//接口自动化-场景列表
export const Api_Scenario_List = [
{prop: 'num', label: "ID"},
{prop: 'name', label: i18n.t('test_track.case.name')},
{prop: 'priority', label: i18n.t('test_track.case.priority')},
{prop: 'path', label: i18n.t('api_test.definition.api_path')},
{prop: 'tags', label: i18n.t('commons.tag')},
{prop: 'createUser', label: '创建人'},
{prop: 'updateTime', label: i18n.t('api_test.definition.api_last_time')},
]
//测试评审-测试用例
export const Test_Case_Review_Case_List = [
{prop: 'num', label: i18n.t('commons.id')},
{prop: 'name', label: i18n.t('commons.name')},
{prop: 'priority', label: i18n.t('test_track.case.priority')},
{prop: 'type', label: i18n.t('test_track.case.type')},
{prop: 'method', label: i18n.t('test_track.case.method')},
{prop: 'nodePath', label: i18n.t('test_track.case.module')},
{prop: 'projectName', label: i18n.t('test_track.review.review_project')},
{prop: 'reviewerName', label: i18n.t('test_track.review.reviewer')},
{prop: 'reviewStatus', label: i18n.t('test_track.case.status')},
{prop: 'updateTime', label: i18n.t('commons.update_time')},
]
//测试计划-功能用例
export const Test_Plan_Function_Test_Case = [
{prop: 'num', label: i18n.t('commons.id')},
{prop: 'name', label: i18n.t('commons.name')},
{prop: 'priority', label: i18n.t('test_track.case.priority')},
{prop: 'type', label: i18n.t('test_track.case.type')},
{prop: 'tags', label: i18n.t('commons.tag')},
{prop: 'method', label: i18n.t('test_track.case.method')},
{prop: 'nodePath', label: i18n.t('test_track.case.module')},
{prop: 'projectName', label: i18n.t('test_track.review.review_project')},
{prop: 'issuesContent', label: i18n.t('test_track.issue.issue')},
{prop: 'executorName', label: i18n.t('test_track.plan_view.executor')},
{prop: 'status', label: i18n.t('test_track.plan_view.execute_result')},
{prop: 'updateTime', label: i18n.t('commons.update_time')},
]
//测试计划-api用例
export const Test_Plan_Api_Case = [
{prop: 'num', label: i18n.t('commons.id')},
{prop: 'name', label: i18n.t('commons.name')},
{prop: 'priority', label: i18n.t('test_track.case.priority')},
{prop: 'path', label: i18n.t('api_test.definition.api_path')},
{prop: 'createUser', label: '创建人'},
{prop: 'custom', label: i18n.t('api_test.definition.api_last_time')},
{prop: 'tags', label: i18n.t('commons.tag')},
{prop: 'execResult', label: '执行状态'},
]
//测试计划-性能用例
export const Test_Plan_Load_Case = [
{prop: 'num', label: i18n.t('commons.id')},
{prop: 'caseName', label: i18n.t('commons.name')},
{prop: 'projectName', label: i18n.t('load_test.project_name')},
{prop: 'userName', label: i18n.t('load_test.user_name')},
{prop: 'createTime', label: i18n.t('commons.create_time')},
{prop: 'status', label: i18n.t('commons.status')},
{prop: 'caseStatus', label: i18n.t('test_track.plan.load_case.execution_status')},
{prop: 'loadReportId', label: i18n.t('test_track.plan.load_case.view_report')},
]
//测试计划-场景用例
export const Test_Plan_Scenario_Case = [
{prop: 'num', label: i18n.t('commons.id')},
{prop: 'name', label: i18n.t('commons.name')},
{prop: 'level', label: i18n.t('api_test.automation.case_level')},
{prop: 'tagNames', label: i18n.t('api_test.automation.tag')},
{prop: 'userId', label: i18n.t('api_test.automation.creator')},
{prop: 'updateTime', label: i18n.t('api_test.automation.update_time')},
{prop: 'stepTotal', label: i18n.t('api_test.automation.success')},
{prop: 'lastResult', label: i18n.t('api_test.automation.fail')},
{prop: 'passRate', label: i18n.t('api_test.automation.passing_rate')},
]

View File

@ -162,25 +162,26 @@
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column v-if="item.prop=='operating'" fixed="right" min-width="150" :key="index">
<template slot="header">
</template>
<el-table-column fixed="right" min-width="150">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
</template>
<template v-slot:default="scope">
<ms-table-operator :is-tester-permission="true" @editClick="handleEdit(scope.row)"
@deleteClick="handleDelete(scope.row)">
<template v-slot:middle>
<ms-table-operator-button :is-tester-permission="true" :tip="$t('commons.copy')"
</template>
<template v-slot:default="scope">
<ms-table-operator :is-tester-permission="true" @editClick="handleEdit(scope.row)"
@deleteClick="handleDelete(scope.row)">
<template v-slot:middle>
<ms-table-operator-button :is-tester-permission="true" :tip="$t('commons.copy')"
icon="el-icon-document-copy"
type="success" @exec="handleCopy(scope.row)"/>
</template>
</ms-table-operator>
</template>
</el-table-column>
</template>
<header-custom ref="headerCustom"></header-custom>
<header-custom ref="headerCustom" :initTableData="initTableData" :optionalFields=headerItems
:type=type></header-custom>
<ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
</el-table>
@ -231,6 +232,7 @@ import {
import BatchMove from "./BatchMove";
import {Track_Test_Case} from "@/business/components/common/model/JsonData";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import i18n from "@/i18n/i18n";
export default {
name: "TestCaseList",
@ -259,8 +261,9 @@ export default {
},
data() {
return {
//
tableLabel:Track_Test_Case,
type: TEST_CASE_LIST,
headerItems: Track_Test_Case,
tableLabel: Track_Test_Case,
result: {},
deletePath: "/test/case/delete",
condition: {
@ -383,18 +386,18 @@ export default {
let param={}
param.userId=getCurrentUser().id;
param.type=TEST_CASE_LIST
this.result=this.$post('/system/header/info',param,response=>{
if(response.data){
response.data.map((v,i)=>{
if(this.tableLabel [i]){
this.tableLabel [i].prop=v
}
})
console.log(this.tableLabel)
}else{
this.tableLabel=Track_Test_Case
this.result=this.$post('/system/header/info',param,response=> {
if (response.data != null) {
let arry = eval(response.data.props);
let obj = {};
for (let key in arry) {
obj[key] = arry[key];
}
let newObj = Object.keys(obj).map(val => ({
prop: obj[val]
}))
this.tableLabel = newObj
}
})
},
getData() {

View File

@ -14,23 +14,30 @@
@filter-change="filter"
@sort-change="sort"
@row-click="intoPlan">
<el-table-column
prop="name"
:label="$t('commons.name')"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="userName"
:label="$t('test_track.plan.plan_principal')"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="status"
column-key="status"
:filters="statusFilters"
:label="$t('test_track.plan.plan_status')"
show-overflow-tooltip>
<template v-slot:default="scope">
<template v-for="(item, index) in tableLabel">
<el-table-column
v-if="item.prop == 'name'"
prop="name"
:label="$t('commons.name')"
show-overflow-tooltip
:key="index">
</el-table-column>
<el-table-column
v-if="item.prop == 'userName'"
prop="userName"
:label="$t('test_track.plan.plan_principal')"
show-overflow-tooltip
:key="index">
</el-table-column>
<el-table-column
v-if="item.prop == 'status'"
prop="status"
column-key="status"
:filters="statusFilters"
:label="$t('test_track.plan.plan_status')"
show-overflow-tooltip
:key="index">
<template v-slot:default="scope">
<span @click.stop="clickt = 'stop'">
<el-dropdown class="test-case-status" @command="statusChange">
<span class="el-dropdown-link">
@ -51,76 +58,98 @@
</el-dropdown-menu>
</el-dropdown>
</span>
</template>
</el-table-column>
<el-table-column
prop="stage"
column-key="stage"
:filters="stageFilters"
:label="$t('test_track.plan.plan_stage')"
show-overflow-tooltip>
<template v-slot:default="scope">
<plan-stage-table-item :stage="scope.row.stage"/>
</template>
</el-table-column>
<el-table-column
prop="projectName"
:label="$t('test_track.home.test_rate')"
min-width="100"
show-overflow-tooltip>
<template v-slot:default="scope">
<el-progress :percentage="scope.row.testRate"></el-progress>
</template>
</el-table-column>
<el-table-column
prop="projectName"
:label="$t('test_track.plan.plan_project')"
show-overflow-tooltip>
</el-table-column>
<el-table-column
sortable
prop="plannedStartTime"
:label="$t('test_track.plan.planned_start_time')"
show-overflow-tooltip>
<template v-slot:default="scope">
<span>{{ scope.row.plannedStartTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column
sortable
prop="plannedEndTime"
:label="$t('test_track.plan.planned_end_time')"
show-overflow-tooltip>
<template v-slot:default="scope">
<span>{{ scope.row.plannedEndTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column
sortable
prop="actualStartTime"
:label="$t('test_track.plan.actual_start_time')"
show-overflow-tooltip>
<template v-slot:default="scope">
<span>{{ scope.row.actualStartTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column
sortable
prop="actualEndTime"
:label="$t('test_track.plan.actual_end_time')"
show-overflow-tooltip>
<template v-slot:default="scope">
<span>{{ scope.row.actualEndTime | timestampFormatDate }}</span>
</template>
</el-table-column>
</template>
</el-table-column>
<el-table-column
v-if="item.prop == 'stage'"
prop="stage"
column-key="stage"
:filters="stageFilters"
:label="$t('test_track.plan.plan_stage')"
show-overflow-tooltip
:key="index">
<template v-slot:default="scope">
<plan-stage-table-item :stage="scope.row.stage"/>
</template>
</el-table-column>
<el-table-column
v-if="item.prop == 'testRate'"
prop="testRate"
:label="$t('test_track.home.test_rate')"
min-width="100"
show-overflow-tooltip
:key="index">
<template v-slot:default="scope">
<el-progress :percentage="scope.row.testRate"></el-progress>
</template>
</el-table-column>
<el-table-colum
v-if="item.prop == 'projectName'"
prop="projectName"
:label="$t('test_track.plan.plan_project')"
show-overflow-tooltip
:key="index">
</el-table-colum>
<el-table-column
v-if="item.prop == 'plannedStartTime'"
sortable
prop="plannedStartTime"
:label="$t('test_track.plan.planned_start_time')"
show-overflow-tooltip
:key="index">
<template v-slot:default="scope">
<span>{{ scope.row.plannedStartTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column
v-if="item.prop == 'plannedEndTime'"
sortable
prop="plannedEndTime"
:label="$t('test_track.plan.planned_end_time')"
show-overflow-tooltip
:key="index">
<template v-slot:default="scope">
<span>{{ scope.row.plannedEndTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column
v-if="item.prop == 'actualStartTime'"
sortable
prop="actualStartTime"
:label="$t('test_track.plan.actual_start_time')"
show-overflow-tooltip
:key="index">
<template v-slot:default="scope">
<span>{{ scope.row.actualStartTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column
v-if="item.prop == 'actualEndTime'"
sortable
prop="actualEndTime"
:label="$t('test_track.plan.actual_end_time')"
show-overflow-tooltip
:key="index">
<template v-slot:default="scope">
<span>{{ scope.row.actualEndTime | timestampFormatDate }}</span>
</template>
</el-table-column>
</template>
<el-table-column
min-width="150"
:label="$t('commons.operating')">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
</template>
<template v-slot:default="scope">
<ms-table-operator :is-tester-permission="true" @editClick="handleEdit(scope.row)"
@deleteClick="handleDelete(scope.row)">
<template v-slot:middle>
<ms-table-operator-button :isTesterPermission="true" style="background-color: #85888E;border-color: #85888E" v-if="!scope.row.reportId"
<ms-table-operator-button :isTesterPermission="true"
style="background-color: #85888E;border-color: #85888E"
v-if="!scope.row.reportId"
:tip="$t('test_track.plan_view.create_report')" icon="el-icon-s-data"
@exec="openTestReportTemplate(scope.row)"/>
<ms-table-operator-button v-if="scope.row.reportId"
@ -128,24 +157,30 @@
@exec="openReport(scope.row.id, scope.row.reportId)"/>
</template>
</ms-table-operator>
<ms-table-operator-button style="margin-left: 10px;color:#85888E;border-color: #85888E; border-width: thin;" v-if="!scope.row.scheduleOpen" type="text"
<ms-table-operator-button style="margin-left: 10px;color:#85888E;border-color: #85888E; border-width: thin;"
v-if="!scope.row.scheduleOpen" type="text"
:tip="$t('commons.trigger_mode.schedule')" icon="el-icon-time"
@exec="scheduleTask(scope.row)"/>
<ms-table-operator-button style="margin-left: 10px;color:#6C317C; border-color: #6C317C; border-width: thin;" v-if="scope.row.scheduleOpen" type="text"
<ms-table-operator-button style="margin-left: 10px;color:#6C317C; border-color: #6C317C; border-width: thin;"
v-if="scope.row.scheduleOpen" type="text"
:tip="$t('commons.trigger_mode.schedule')" icon="el-icon-time"
@exec="scheduleTask(scope.row)"/>
</template>
</el-table-column>
</el-table>
<header-custom ref="headerCustom" :initTableData="initTableData" :optionalFields=headerItems
:type=type></header-custom>
<ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
<test-report-template-list @openReport="openReport" ref="testReportTemplateList"/>
<test-case-report-view @refresh="initTableData" ref="testCaseReportView"/>
<ms-delete-confirm :title="$t('test_track.plan.plan_delete')" @delete="_handleDelete" ref="deleteConfirm" :with-tip="enableDeleteTip">
{{$t('test_track.plan.plan_delete_tip')}}
<ms-delete-confirm :title="$t('test_track.plan.plan_delete')" @delete="_handleDelete" ref="deleteConfirm"
:with-tip="enableDeleteTip">
{{ $t('test_track.plan.plan_delete_tip') }}
</ms-delete-confirm>
<ms-schedule-maintain ref="scheduleMaintain" @refreshTable="initTableData" />
<ms-schedule-maintain ref="scheduleMaintain" @refreshTable="initTableData"/>
</el-card>
</template>
@ -158,7 +193,7 @@ import MsTableOperatorButton from "../../../common/components/MsTableOperatorBut
import MsTableOperator from "../../../common/components/MsTableOperator";
import PlanStatusTableItem from "../../common/tableItems/plan/PlanStatusTableItem";
import PlanStageTableItem from "../../common/tableItems/plan/PlanStageTableItem";
import {checkoutTestManagerOrTestUser} from "@/common/js/utils";
import {checkoutTestManagerOrTestUser, getCurrentUser} from "@/common/js/utils";
import TestReportTemplateList from "../view/comonents/TestReportTemplateList";
import TestCaseReportView from "../view/comonents/report/TestCaseReportView";
import MsDeleteConfirm from "../../../common/components/MsDeleteConfirm";
@ -167,11 +202,15 @@ import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEve
import {getCurrentProjectID} from "../../../../../common/js/utils";
import MsScheduleMaintain from "@/business/components/api/automation/schedule/ScheduleMaintain"
import {_filter, _sort} from "@/common/js/tableUtils";
import {TEST_CASE_LIST, TEST_PLAN_LIST} from "@/common/js/constants";
import {Test_Plan_List, Track_Test_Case} from "@/business/components/common/model/JsonData";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
export default {
name: "TestPlanList",
components: {
HeaderCustom,
MsDeleteConfirm,
TestCaseReportView,
TestReportTemplateList,
@ -182,6 +221,9 @@ export default {
},
data() {
return {
type: TEST_PLAN_LIST,
headerItems: Test_Plan_List,
tableLabel: Test_Plan_List,
result: {},
enableDeleteTip: false,
queryPath: "/test/plan/list",
@ -219,7 +261,11 @@ export default {
this.initTableData();
},
methods: {
customHeader() {
this.$refs.headerCustom.open(this.tableLabel)
},
initTableData() {
this.getLabel()
if (this.planId) {
this.condition.planId = this.planId;
}
@ -235,7 +281,7 @@ export default {
this.tableData = data.listObject;
for (let i = 0; i < this.tableData.length; i++) {
let path = "/test/plan/project";
this.$post(path,{planId: this.tableData[i].id}, res => {
this.$post(path, {planId: this.tableData[i].id}, res => {
let arr = res.data;
let projectIds = arr.filter(d => d.id !== this.tableData[i].projectId).map(data => data.id);
this.$set(this.tableData[i], "projectIds", projectIds);
@ -243,6 +289,24 @@ export default {
}
});
},
getLabel() {
let param = {}
param.userId = getCurrentUser().id;
param.type = TEST_PLAN_LIST
this.result = this.$post('/system/header/info', param, response => {
if (response.data != null) {
let arry = eval(response.data.props);
let obj = {};
for (let key in arry) {
obj[key] = arry[key];
}
let newObj = Object.keys(obj).map(val => ({
prop: obj[val]
}))
this.tableLabel = newObj
}
})
},
buildPagePath(path) {
return path + "/" + this.currentPage + "/" + this.pageSize;
},

View File

@ -25,76 +25,96 @@
<show-more-btn :is-show="scope.row.showMore && !isReadOnly" :buttons="buttons" :size="selectRows.size"/>
</template>
</el-table-column>
<template v-for="(item, index) in tableLabel">
<el-table-column v-if="item.prop == 'num'" prop="num" sortable="custom" label="ID" show-overflow-tooltip
:key="index"/>
<el-table-column v-if="item.prop == 'name'" prop="name" sortable="custom"
:label="$t('api_test.definition.api_name')" show-overflow-tooltip :key="index"/>
<el-table-column prop="num" sortable="custom" label="ID" show-overflow-tooltip/>
<el-table-column prop="name" sortable="custom" :label="$t('api_test.definition.api_name')" show-overflow-tooltip/>
<el-table-column
v-if="item.prop == 'priority'"
prop="priority"
:filters="priorityFilters"
sortable="custom"
column-key="priority"
:label="$t('test_track.case.priority')"
show-overflow-tooltip
:key="index">
<template v-slot:default="scope">
<priority-table-item :value="scope.row.priority"/>
</template>
</el-table-column>
<el-table-column
prop="priority"
:filters="priorityFilters"
sortable="custom"
column-key="priority"
:label="$t('test_track.case.priority')"
show-overflow-tooltip>
<template v-slot:default="scope">
<priority-table-item :value="scope.row.priority"/>
</template>
</el-table-column>
<el-table-column
v-if="item.prop == 'path'"
prop="path"
:label="$t('api_test.definition.api_path')"
show-overflow-tooltip
:key="index"/>
<el-table-column
prop="path"
:label="$t('api_test.definition.api_path')"
show-overflow-tooltip/>
<el-table-column
v-if="item.prop == 'createUser'"
prop="createUser"
column-key="user_id"
sortable="custom"
:filters="userFilters"
:label="'创建人'"
show-overflow-tooltip
:key="index"/>
<el-table-column
prop="createUser"
column-key="user_id"
sortable="custom"
:filters="userFilters"
:label="'创建人'"
show-overflow-tooltip/>
<el-table-column
v-if="item.prop == 'custom'"
sortable="custom"
width="160"
:label="$t('api_test.definition.api_last_time')"
prop="updateTime"
:key="index">
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column
sortable="custom"
width="160"
:label="$t('api_test.definition.api_last_time')"
prop="updateTime">
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column prop="tags" :label="$t('commons.tag')">
<template v-slot:default="scope">
<div v-for="(itemName,index) in scope.row.tags" :key="index">
<ms-tag type="success" effect="plain" :content="itemName"/>
</div>
</template>
</el-table-column>
<el-table-column :label="'执行状态'" min-width="130" align="center">
<template v-slot:default="scope">
<div v-loading="rowLoading === scope.row.id">
<el-link type="danger"
v-if="scope.row.execResult && scope.row.execResult === 'error'"
@click="getReportResult(scope.row)" v-text="getResult(scope.row.execResult)"/>
<el-link v-else-if="scope.row.execResult && scope.row.execResult === 'success'"
@click="getReportResult(scope.row)" v-text="getResult(scope.row.execResult)">
</el-link>
<div v-else v-text="getResult(scope.row.execResult)"/>
<div v-if="scope.row.id" style="color: #999999;font-size: 12px">
<span> {{ scope.row.updateTime | timestampFormatDate }}</span>
{{ scope.row.updateUser }}
<el-table-column
v-if="item.prop == 'tags'"
prop="tags"
:label="$t('commons.tag')"
:key="index">
<template v-slot:default="scope">
<div v-for="(itemName,index) in scope.row.tags" :key="index">
<ms-tag type="success" effect="plain" :content="itemName"/>
</div>
</div>
</template>
</el-table-column>
</template>
</el-table-column>
<el-table-column v-if="item.prop == 'execResult'" :label="'执行状态'" min-width="130" align="center" :key="index">
<template v-slot:default="scope">
<div v-loading="rowLoading === scope.row.id">
<el-link type="danger"
v-if="scope.row.execResult && scope.row.execResult === 'error'"
@click="getReportResult(scope.row)" v-text="getResult(scope.row.execResult)"/>
<el-link v-else-if="scope.row.execResult && scope.row.execResult === 'success'"
@click="getReportResult(scope.row)" v-text="getResult(scope.row.execResult)">
</el-link>
<div v-else v-text="getResult(scope.row.execResult)"/>
<div v-if="scope.row.id" style="color: #999999;font-size: 12px">
<span> {{ scope.row.updateTime | timestampFormatDate }}</span>
{{ scope.row.updateUser }}
</div>
</div>
</template>
</el-table-column>
</template>
<el-table-column v-if="!isReadOnly" :label="$t('commons.operating')" align="center">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
</template>
<template v-slot:default="scope">
<ms-table-operator-button class="run-button" :is-tester-permission="true" :tip="$t('api_test.run')" icon="el-icon-video-play"
<ms-table-operator-button class="run-button" :is-tester-permission="true" :tip="$t('api_test.run')"
icon="el-icon-video-play"
@exec="singleRun(scope.row)" v-tester/>
<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)" v-tester/>
@ -102,6 +122,8 @@
</el-table-column>
</el-table>
<header-custom ref="headerCustom" :initTableData="initTable" :optionalFields=headerItems
:type=type></header-custom>
<ms-table-pagination :change="initTable" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
@ -129,7 +151,7 @@ import MsBottomContainer from "../../../../../api/definition/components/BottomCo
import ShowMoreBtn from "../../../../case/components/ShowMoreBtn";
import MsBatchEdit from "../../../../../api/definition/components/basis/BatchEdit";
import {API_METHOD_COLOUR, CASE_PRIORITY, RESULT_MAP} from "../../../../../api/definition/model/JsonData";
import {getCurrentProjectID} from "@/common/js/utils";
import {getCurrentProjectID, getCurrentUser} from "@/common/js/utils";
import ApiListContainer from "../../../../../api/definition/components/list/ApiListContainer";
import PriorityTableItem from "../../../../common/tableItems/planview/PriorityTableItem";
import {getBodyUploadFiles, getUUID} from "../../../../../../../common/js/utils";
@ -138,13 +160,16 @@ import MsRun from "../../../../../api/definition/components/Run";
import TestPlanApiCaseResult from "./TestPlanApiCaseResult";
import TestPlan from "../../../../../api/definition/components/jmeter/components/test-plan";
import ThreadGroup from "../../../../../api/definition/components/jmeter/components/thread-group";
import {WORKSPACE_ID} from "@/common/js/constants";
import {TEST_CASE_LIST, TEST_PLAN_API_CASE, WORKSPACE_ID} from "@/common/js/constants";
import {_filter, _sort} from "@/common/js/tableUtils";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {Test_Plan_Api_Case, Track_Test_Case} from "@/business/components/common/model/JsonData";
export default {
name: "TestPlanApiCaseList",
components: {
HeaderCustom,
TestPlanApiCaseResult,
MsRun,
TestPlanCaseListHeader,
@ -163,11 +188,14 @@ export default {
},
data() {
return {
type: TEST_PLAN_API_CASE,
headerItems: Test_Plan_Api_Case,
tableLabel: Test_Plan_Api_Case,
condition: {},
selectCase: {},
result: {},
moduleId: "",
status:'default',
status: 'default',
deletePath: "/test/case/delete",
selectRows: new Set(),
buttons: [
@ -228,14 +256,14 @@ export default {
}
},
planId: String,
clickType:String
clickType: String
},
created: function () {
this.getMaintainerOptions();
this.initTable();
},
activated() {
this.status ='default'
this.status = 'default'
},
watch: {
selectNodeIds() {
@ -263,6 +291,9 @@ export default {
},
},
methods: {
customHeader() {
this.$refs.headerCustom.open(this.tableLabel)
},
getMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
@ -276,6 +307,7 @@ export default {
this.$emit('isApiListEnableChange', data);
},
initTable() {
this.getLabel()
this.selectRows = new Set();
this.condition.status = "";
this.condition.moduleIds = this.selectNodeIds;
@ -285,10 +317,10 @@ export default {
if (this.currentProtocol != null) {
this.condition.protocol = this.currentProtocol;
}
if(this.clickType){
if(this.status =='default'){
if (this.clickType) {
if (this.status == 'default') {
this.condition.status = this.clickType;
}else{
} else {
this.condition.status = null;
}
this.status = 'all';
@ -303,6 +335,25 @@ export default {
})
});
},
getLabel() {
let param = {}
param.userId = getCurrentUser().id;
param.type = TEST_PLAN_API_CASE
this.result = this.$post('/system/header/info', param, response => {
if (response.data != null) {
let arry = eval(response.data.props);
let obj = {};
for (let key in arry) {
obj[key] = arry[key];
}
let newObj = Object.keys(obj).map(val => ({
prop: obj[val]
}))
this.tableLabel = newObj
}
})
},
handleSelect(selection, row) {
row.hashTree = [];
if (this.selectRows.has(row)) {

View File

@ -8,62 +8,87 @@
@relevanceCase="$emit('relevanceCase', 'scenario')"/>
</template>
<el-table ref="scenarioTable" border :data="tableData" class="adjust-table" @select-all="handleSelectAll" @select="handleSelect">
<el-table ref="scenarioTable" border :data="tableData" class="adjust-table" @select-all="handleSelectAll"
@select="handleSelect">
<el-table-column type="selection"/>
<el-table-column width="40" :resizable="false" align="center">
<template v-slot:default="{row}">
<show-more-btn :is-show="isSelect(row)" :buttons="buttons" :size="selectRows.length"/>
</template>
</el-table-column>
<el-table-column prop="num" label="ID"/>
<el-table-column prop="name" :label="$t('api_test.automation.scenario_name')"
show-overflow-tooltip/>
<el-table-column prop="level" :label="$t('api_test.automation.case_level')"
show-overflow-tooltip>
<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 == 'P1'" type="warning" effect="plain" content="P1"/>
<ms-tag v-if="scope.row.level == 'P2'" type="success" effect="plain" content="P2"/>
<ms-tag v-if="scope.row.level == 'P3'" type="danger" effect="plain" content="P3"/>
</template>
<template v-for="(item, index) in tableLabel">
<el-table-column
v-if="item.prop == 'num'"
prop="num"
label="ID"
:key="index"/>
<el-table-column v-if="item.prop == 'name'" prop="name" :label="$t('api_test.automation.scenario_name')"
show-overflow-tooltip :key="index"/>
<el-table-column v-if="item.prop == 'level'" prop="level" :label="$t('api_test.automation.case_level')"
show-overflow-tooltip :key="index">
<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 == 'P1'" type="warning" effect="plain" content="P1"/>
<ms-tag v-if="scope.row.level == 'P2'" type="success" effect="plain" content="P2"/>
<ms-tag v-if="scope.row.level == 'P3'" type="danger" effect="plain" content="P3"/>
</template>
</el-table-column>
<el-table-column prop="tagNames" :label="$t('api_test.automation.tag')" width="200px">
<template v-slot:default="scope">
<div v-for="(itemName,index) in scope.row.tags" :key="index">
<ms-tag type="success" effect="plain" :content="itemName"/>
</div>
</template>
</el-table-column>
<el-table-column prop="userId" :label="$t('api_test.automation.creator')" show-overflow-tooltip/>
<el-table-column prop="updateTime" :label="$t('api_test.automation.update_time')" width="180">
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column prop="stepTotal" :label="$t('api_test.automation.step')" show-overflow-tooltip/>
<el-table-column prop="lastResult" :label="$t('api_test.automation.last_result')">
<template v-slot:default="{row}">
<el-link type="success" @click="showReport(row)" v-if="row.lastResult === 'Success'">{{ $t('api_test.automation.success') }}</el-link>
<el-link type="danger" @click="showReport(row)" v-if="row.lastResult === 'Fail'">{{ $t('api_test.automation.fail') }}</el-link>
</template>
</el-table-column>
<el-table-column prop="passRate" :label="$t('api_test.automation.passing_rate')"
show-overflow-tooltip/>
</el-table-column>
<el-table-column v-if="item.prop == 'tagNames'" prop="tagNames" :label="$t('api_test.automation.tag')"
width="200px" :key="index">
<template v-slot:default="scope">
<div v-for="(itemName,index) in scope.row.tags" :key="index">
<ms-tag type="success" effect="plain" :content="itemName"/>
</div>
</template>
</el-table-column>
<el-table-column v-if="item.prop == 'userId'" prop="userId" :label="$t('api_test.automation.creator')"
show-overflow-tooltip :key="index"/>
<el-table-column v-if="item.prop == 'updateTime'" prop="updateTime"
:label="$t('api_test.automation.update_time')" width="180" :key="index">
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column v-if="item.prop == 'stepTotal'" prop="stepTotal" :label="$t('api_test.automation.step')"
show-overflow-tooltip :key="index"/>
<el-table-column v-if="item.prop == 'lastResult'" prop="lastResult"
:label="$t('api_test.automation.last_result')" :key="index">
<template v-slot:default="{row}">
<el-link type="success" @click="showReport(row)" v-if="row.lastResult === 'Success'">
{{ $t('api_test.automation.success') }}
</el-link>
<el-link type="danger" @click="showReport(row)" v-if="row.lastResult === 'Fail'">
{{ $t('api_test.automation.fail') }}
</el-link>
</template>
</el-table-column>
<el-table-column v-if="item.prop == 'passRate'" prop="passRate"
:label="$t('api_test.automation.passing_rate')"
show-overflow-tooltip :key="index"/>
</template>
<el-table-column :label="$t('commons.operating')" width="200px" v-if="!referenced">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
</template>
<template v-slot:default="{row}">
<ms-table-operator-button class="run-button" :is-tester-permission="true" :tip="$t('api_test.run')" icon="el-icon-video-play"
<ms-table-operator-button class="run-button" :is-tester-permission="true" :tip="$t('api_test.run')"
icon="el-icon-video-play"
@exec="execute(row)" v-tester/>
<ms-table-operator-button :is-tester-permission="true" :tip="$t('test_track.plan_view.cancel_relevance')"
icon="el-icon-unlock" type="danger" @exec="remove(row)" v-tester/>
</template>
</el-table-column>
</el-table>
<header-custom ref="headerCustom" :initTableData="search" :optionalFields=headerItems :type=type></header-custom>
<ms-table-pagination :change="search" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
<div>
<!-- 执行结果 -->
<el-drawer :visible.sync="runVisible" :destroy-on-close="true" direction="ltr" :withHeader="true" :modal="false" size="90%">
<el-drawer :visible.sync="runVisible" :destroy-on-close="true" direction="ltr" :withHeader="true" :modal="false"
size="90%">
<ms-api-report-detail @refresh="search" :infoDb="infoDb" :report-id="reportId" :currentProjectId="projectId"/>
</el-drawer>
</div>
@ -73,182 +98,220 @@
</template>
<script>
import MsTableHeader from "@/business/components/common/components/MsTableHeader";
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn";
import MsTag from "../../../../../common/components/MsTag";
import {getUUID, getCurrentProjectID} from "@/common/js/utils";
import MsApiReportDetail from "../../../../../api/automation/report/ApiReportDetail";
import MsTableMoreBtn from "../../../../../api/automation/scenario/TableMoreBtn";
import MsScenarioExtendButtons from "@/business/components/api/automation/scenario/ScenarioExtendBtns";
import MsTestPlanList from "../../../../../api/automation/scenario/testplan/TestPlanList";
import TestPlanScenarioListHeader from "./TestPlanScenarioListHeader";
import {_handleSelect, _handleSelectAll} from "../../../../../../../common/js/tableUtils";
import MsTableOperatorButton from "../../../../../common/components/MsTableOperatorButton";
import MsTableHeader from "@/business/components/common/components/MsTableHeader";
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn";
import MsTag from "../../../../../common/components/MsTag";
import {getUUID, getCurrentProjectID, getCurrentUser} from "@/common/js/utils";
import MsApiReportDetail from "../../../../../api/automation/report/ApiReportDetail";
import MsTableMoreBtn from "../../../../../api/automation/scenario/TableMoreBtn";
import MsScenarioExtendButtons from "@/business/components/api/automation/scenario/ScenarioExtendBtns";
import MsTestPlanList from "../../../../../api/automation/scenario/testplan/TestPlanList";
import TestPlanScenarioListHeader from "./TestPlanScenarioListHeader";
import {_handleSelect, _handleSelectAll} from "../../../../../../../common/js/tableUtils";
import MsTableOperatorButton from "../../../../../common/components/MsTableOperatorButton";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {TEST_CASE_LIST, TEST_PLAN_SCENARIO_CASE} from "@/common/js/constants";
import {Test_Plan_Scenario_Case, Track_Test_Case} from "@/business/components/common/model/JsonData";
export default {
name: "MsTestPlanApiScenarioList",
components: {
MsTableOperatorButton,
TestPlanScenarioListHeader,
MsTablePagination, MsTableMoreBtn, ShowMoreBtn, MsTableHeader, MsTag, MsApiReportDetail, MsScenarioExtendButtons, MsTestPlanList},
props: {
referenced: {
type: Boolean,
default: false,
},
selectNodeIds: Array,
planId: String,
clickType:String
export default {
name: "MsTestPlanApiScenarioList",
components: {
HeaderCustom,
MsTableOperatorButton,
TestPlanScenarioListHeader,
MsTablePagination,
MsTableMoreBtn,
ShowMoreBtn,
MsTableHeader,
MsTag,
MsApiReportDetail,
MsScenarioExtendButtons,
MsTestPlanList
},
props: {
referenced: {
type: Boolean,
default: false,
},
data() {
return {
loading: false,
condition: {},
currentScenario: {},
schedule: {},
selectAll: false,
tableData: [],
currentPage: 1,
pageSize: 10,
total: 0,
reportId: "",
status:'default',
infoDb: false,
runVisible: false,
projectId: "",
runData: [],
buttons: [
{
name: this.$t('test_track.case.batch_unlink'), handleClick: this.handleDeleteBatch
},
{
name: this.$t('api_test.automation.batch_execute'), handleClick: this.handleBatchExecute
}
],
selectRows: new Set()
}
},
created() {
this.projectId = getCurrentProjectID();
selectNodeIds: Array,
planId: String,
clickType: String
},
data() {
return {
type: TEST_PLAN_SCENARIO_CASE,
headerItems: Test_Plan_Scenario_Case,
tableLabel: Test_Plan_Scenario_Case,
loading: false,
condition: {},
currentScenario: {},
schedule: {},
selectAll: false,
tableData: [],
currentPage: 1,
pageSize: 10,
total: 0,
reportId: "",
status: 'default',
infoDb: false,
runVisible: false,
projectId: "",
runData: [],
buttons: [
{
name: this.$t('test_track.case.batch_unlink'), handleClick: this.handleDeleteBatch
},
{
name: this.$t('api_test.automation.batch_execute'), handleClick: this.handleBatchExecute
}
],
selectRows: new Set()
}
},
created() {
this.projectId = getCurrentProjectID();
this.search();
},
watch: {
selectNodeIds() {
this.search();
},
watch: {
selectNodeIds() {
this.search();
},
planId() {
this.search();
}
planId() {
this.search();
}
},
methods: {
customHeader() {
this.$refs.headerCustom.open(this.tableLabel)
},
methods: {
search() {
this.selectRows = new Set();
this.loading = true;
this.condition.moduleIds = this.selectNodeIds;
this.condition.planId = this.planId;
if(this.clickType){
if(this.status =='default'){
this.condition.status = this.clickType;
}else{
this.condition.status = null;
}
this.status = 'all';
search() {
this.getLabel()
this.selectRows = new Set();
this.loading = true;
this.condition.moduleIds = this.selectNodeIds;
this.condition.planId = this.planId;
if (this.clickType) {
if (this.status == 'default') {
this.condition.status = this.clickType;
} else {
this.condition.status = null;
}
let url = "/test/plan/scenario/case/list/" + this.currentPage + "/" + this.pageSize;
this.$post(url, this.condition, response => {
let data = response.data;
this.total = data.itemCount;
this.tableData = data.listObject;
this.tableData.forEach(item => {
if (item.tags && item.tags.length > 0) {
item.tags = JSON.parse(item.tags);
}
});
this.loading = false;
this.status = 'all';
}
let url = "/test/plan/scenario/case/list/" + this.currentPage + "/" + this.pageSize;
this.$post(url, this.condition, response => {
let data = response.data;
this.total = data.itemCount;
this.tableData = data.listObject;
this.tableData.forEach(item => {
if (item.tags && item.tags.length > 0) {
item.tags = JSON.parse(item.tags);
}
});
},
reductionApi(row) {
row.scenarioDefinition = null;
let rows = [row];
this.$post("/api/automation/reduction", rows, response => {
this.$success(this.$t('commons.save_success'));
this.search();
})
},
handleBatchExecute() {
this.selectRows.forEach(row => {
let param = this.buildExecuteParam(row);
this.$post("/test/plan/scenario/case/run", param, response => {
});
});
this.$message('任务执行中,请稍后刷新查看结果');
this.loading = false;
});
},
getLabel() {
let param = {}
param.userId = getCurrentUser().id;
param.type = TEST_PLAN_SCENARIO_CASE
this.result = this.$post('/system/header/info', param, response => {
if (response.data != null) {
let arry = eval(response.data.props);
let obj = {};
for (let key in arry) {
obj[key] = arry[key];
}
let newObj = Object.keys(obj).map(val => ({
prop: obj[val]
}))
this.tableLabel = newObj
}
})
},
reductionApi(row) {
row.scenarioDefinition = null;
let rows = [row];
this.$post("/api/automation/reduction", rows, response => {
this.$success(this.$t('commons.save_success'));
this.search();
},
execute(row) {
this.infoDb = false;
})
},
handleBatchExecute() {
this.selectRows.forEach(row => {
let param = this.buildExecuteParam(row);
this.$post("/test/plan/scenario/case/run", param, response => {
this.runVisible = true;
this.reportId = response.data;
});
},
buildExecuteParam(row) {
let param = {};
// param.id = row.id;
param.id = getUUID();
param.planScenarioId = row.id;
param.projectId = row.projectId;
param.planCaseIds = [];
param.planCaseIds.push(row.id);
return param;
},
showReport(row) {
});
this.$message('任务执行中,请稍后刷新查看结果');
this.search();
},
execute(row) {
this.infoDb = false;
let param = this.buildExecuteParam(row);
this.$post("/test/plan/scenario/case/run", param, response => {
this.runVisible = true;
this.infoDb = true;
this.reportId = row.reportId;
},
remove(row) {
this.$get('/test/plan/scenario/case/delete/' + row.id, () => {
this.$success(this.$t('test_track.cancel_relevance_success'));
this.$emit('refresh');
this.search();
});
return;
},
isSelect(row) {
return this.selectRows.has(row);
},
handleSelectAll(selection) {
_handleSelectAll(this, selection, this.tableData, this.selectRows);
},
handleSelect(selection, row) {
_handleSelect(this, selection, row, this.selectRows);
},
handleDeleteBatch() {
this.$alert(this.$t('api_test.definition.request.delete_confirm') + "", '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
let param = {};
param.ids = Array.from(this.selectRows).map(row => row.id);
param.planId = this.planId;
this.$post('/test/plan/scenario/case/batch/delete', param, () => {
this.selectRows.clear();
this.search();
this.$success(this.$t('test_track.cancel_relevance_success'));
this.$emit('refresh');
});
}
this.reportId = response.data;
});
},
buildExecuteParam(row) {
let param = {};
// param.id = row.id;
param.id = getUUID();
param.planScenarioId = row.id;
param.projectId = row.projectId;
param.planCaseIds = [];
param.planCaseIds.push(row.id);
return param;
},
showReport(row) {
this.runVisible = true;
this.infoDb = true;
this.reportId = row.reportId;
},
remove(row) {
this.$get('/test/plan/scenario/case/delete/' + row.id, () => {
this.$success(this.$t('test_track.cancel_relevance_success'));
this.$emit('refresh');
this.search();
});
return;
},
isSelect(row) {
return this.selectRows.has(row);
},
handleSelectAll(selection) {
_handleSelectAll(this, selection, this.tableData, this.selectRows);
},
handleSelect(selection, row) {
_handleSelect(this, selection, row, this.selectRows);
},
handleDeleteBatch() {
this.$alert(this.$t('api_test.definition.request.delete_confirm') + "", '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
let param = {};
param.ids = Array.from(this.selectRows).map(row => row.id);
param.planId = this.planId;
this.$post('/test/plan/scenario/case/batch/delete', param, () => {
this.selectRows.clear();
this.search();
this.$success(this.$t('test_track.cancel_relevance_success'));
this.$emit('refresh');
});
}
});
}
}
});
}
}
}
</script>
<style scoped>
/deep/ .el-drawer__header {
margin-bottom: 0px;
}
/deep/ .el-drawer__header {
margin-bottom: 0px;
}
</style>

View File

@ -45,134 +45,146 @@
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectRows.size"/>
</template>
</el-table-column>
<el-table-column
prop="num"
sortable="custom"
:label="$t('commons.id')"
min-width="120px"
<template v-for="(item, index) in tableLabel">
<el-table-column
v-if="item.prop == 'num'"
prop="num"
sortable="custom"
:label="$t('commons.id')"
min-width="120px"
show-overflow-tooltip
:key="index">
</el-table-column>
<el-table-column
v-if="item.prop=='name'"
prop="name"
:label="$t('commons.name')"
min-width="120px"
:key="index"
show-overflow-tooltip>
</el-table-column>
<el-table-column
v-if="item.prop=='priority'"
prop="priority"
:filters="priorityFilters"
column-key="priority"
min-width="100px"
:key="index"
:label="$t('test_track.case.priority')">
<template v-slot:default="scope">
<priority-table-item :value="scope.row.priority" ref="priority"/>
</template>
</el-table-column>
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="name"
:label="$t('commons.name')"
min-width="120px"
<el-table-column
v-if="item.prop=='type'"
prop="type"
:filters="typeFilters"
column-key="type"
:label="$t('test_track.case.type')"
min-width="80px"
:key="index"
show-overflow-tooltip>
<template v-slot:default="scope">
<type-table-item :value="scope.row.type"/>
</template>
</el-table-column>
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="priority"
:filters="priorityFilters"
column-key="priority"
min-width="100px"
<el-table-column v-if="item.prop=='tags'" prop="tags" :label="$t('commons.tag')" min-width="120px"
:key="index"
>
<template v-slot:default="scope">
<div v-for="(tag, index) in scope.row.showTags" :key="tag + '_' + index">
<ms-tag type="success" effect="plain" :content="tag"/>
</div>
</template>
</el-table-column>
:label="$t('test_track.case.priority')">
<template v-slot:default="scope">
<priority-table-item :value="scope.row.priority" ref="priority"/>
</template>
</el-table-column>
<el-table-column
v-if="item.prop=='method'"
prop="method"
:filters="methodFilters"
column-key="method"
:label="$t('test_track.case.method')"
min-width="100px"
:key="index"
show-overflow-tooltip>
<template v-slot:default="scope">
<method-table-item :value="scope.row.method"/>
</template>
</el-table-column>
<el-table-column
prop="type"
:filters="typeFilters"
column-key="type"
:label="$t('test_track.case.type')"
min-width="80px"
<el-table-column
v-if="item.prop=='nodePath'"
prop="nodePath"
:label="$t('test_track.case.module')"
min-width="120px"
:key="index"
show-overflow-tooltip>
</el-table-column>
show-overflow-tooltip>
<template v-slot:default="scope">
<type-table-item :value="scope.row.type"/>
</template>
</el-table-column>
<el-table-column
v-if="item.prop=='projectName'"
prop="projectName"
:label="$t('test_track.plan.plan_project')"
min-width="120px"
:key="index"
show-overflow-tooltip>
</el-table-column>
<el-table-column prop="tags" :label="$t('commons.tag')" min-width="120px"
>
<template v-slot:default="scope">
<div v-for="(tag, index) in scope.row.showTags" :key="tag + '_' + index">
<ms-tag type="success" effect="plain" :content="tag"/>
</div>
</template>
</el-table-column>
<el-table-column
prop="method"
:filters="methodFilters"
column-key="method"
:label="$t('test_track.case.method')"
min-width="100px"
show-overflow-tooltip>
<template v-slot:default="scope">
<method-table-item :value="scope.row.method"/>
</template>
</el-table-column>
<el-table-column
prop="nodePath"
:label="$t('test_track.case.module')"
min-width="120px"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="projectName"
:label="$t('test_track.plan.plan_project')"
min-width="120px"
show-overflow-tooltip>
</el-table-column>
<el-table-column
:label="$t('test_track.issue.issue')"
min-width="80px"
show-overflow-tooltip>
<template v-slot:default="scope">
<el-popover
placement="right"
width="400"
trigger="hover">
<el-table border class="adjust-table" :data="scope.row.issuesContent" style="width: 100%">
<el-table-column prop="title" :label="$t('test_track.issue.title')" show-overflow-tooltip/>
<el-table-column prop="description" :label="$t('test_track.issue.description')">
<template v-slot:default="scope">
<el-popover
placement="left"
width="400"
trigger="hover"
>
<ckeditor :editor="editor" disabled :config="editorConfig"
v-model="scope.row.description"/>
<el-button slot="reference" type="text">{{ $t('test_track.issue.preview') }}</el-button>
</el-popover>
</template>
</el-table-column>
<el-table-column prop="platform" :label="$t('test_track.issue.platform')"/>
</el-table>
<el-button slot="reference" type="text">{{ scope.row.issuesSize }}</el-button>
</el-popover>
</template>
</el-table-column>
<el-table-column
v-if="item.prop=='issuesContent'"
:label="$t('test_track.issue.issue')"
min-width="80px"
show-overflow-tooltip
:key="index">
<template v-slot:default="scope">
<el-popover
placement="right"
width="400"
trigger="hover">
<el-table border class="adjust-table" :data="scope.row.issuesContent" style="width: 100%">
<el-table-column prop="title" :label="$t('test_track.issue.title')" show-overflow-tooltip/>
<el-table-column prop="description" :label="$t('test_track.issue.description')">
<template v-slot:default="scope">
<el-popover
placement="left"
width="400"
trigger="hover"
>
<ckeditor :editor="editor" disabled :config="editorConfig"
v-model="scope.row.description"/>
<el-button slot="reference" type="text">{{ $t('test_track.issue.preview') }}</el-button>
</el-popover>
</template>
</el-table-column>
<el-table-column prop="platform" :label="$t('test_track.issue.platform')"/>
</el-table>
<el-button slot="reference" type="text">{{ scope.row.issuesSize }}</el-button>
</el-popover>
</template>
</el-table-column>
<el-table-column
prop="executorName"
:filters="executorFilters"
min-width="100px"
<el-table-column
v-if="item.prop == 'executorName'"
prop="executorName"
:filters="executorFilters"
min-width="100px"
:key="index"
column-key="executor"
:label="$t('test_track.plan_view.executor')">
</el-table-column>
column-key="executor"
:label="$t('test_track.plan_view.executor')">
</el-table-column>
<el-table-column
prop="status"
:filters="statusFilters"
column-key="status"
min-width="100px"
:label="$t('test_track.plan_view.execute_result')">
<template v-slot:default="scope">
<el-table-column
v-if="item.prop == 'status'"
prop="status"
:filters="statusFilters"
column-key="status"
min-width="100px"
:key="index"
:label="$t('test_track.plan_view.execute_result')">
<template v-slot:default="scope">
<span @click.stop="clickt = 'stop'">
<el-dropdown class="test-case-status" @command="statusChange">
<span class="el-dropdown-link">
@ -196,24 +208,32 @@
</el-dropdown-menu>
</el-dropdown>
</span>
</template>
</el-table-column>
</template>
</el-table-column>
<el-table-column
sortable
prop="updateTime"
:label="$t('commons.update_time')"
min-width="120px"
<el-table-column
v-if="item.prop == 'updateTime'"
show-overflow-tooltip>
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
sortable
prop="updateTime"
:label="$t('commons.update_time')"
min-width="120px"
:key="index"
show-overflow-tooltip>
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
</template>
<el-table-column
fixed="right"
min-width="100"
:label="$t('commons.operating')">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
</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)"/>
@ -222,7 +242,8 @@
</template>
</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"
:total="total"/>
@ -249,8 +270,15 @@ import MsTableHeader from '../../../../../common/components/MsTableHeader';
import MsTableButton from '../../../../../common/components/MsTableButton';
import NodeBreadcrumb from '../../../../common/NodeBreadcrumb';
import {ROLE_TEST_MANAGER, ROLE_TEST_USER, TokenKey, WORKSPACE_ID} from "@/common/js/constants";
import {checkoutTestManagerOrTestUser, hasRoles} from "@/common/js/utils";
import {
ROLE_TEST_MANAGER,
ROLE_TEST_USER,
TEST_CASE_LIST,
TEST_PLAN_FUNCTION_TEST_CASE,
TokenKey,
WORKSPACE_ID
} from "@/common/js/constants";
import {checkoutTestManagerOrTestUser, getCurrentUser, hasRoles} from "@/common/js/utils";
import PriorityTableItem from "../../../../common/tableItems/planview/PriorityTableItem";
import StatusTableItem from "../../../../common/tableItems/planview/StatusTableItem";
import TypeTableItem from "../../../../common/tableItems/planview/TypeTableItem";
@ -264,11 +292,14 @@ import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
import {hub} from "@/business/components/track/plan/event-bus";
import MsTag from "@/business/components/common/components/MsTag";
import {_filter, _sort} from "@/common/js/tableUtils";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {Test_Plan_Function_Test_Case} from "@/business/components/common/model/JsonData";
export default {
name: "FunctionalTestCaseList",
components: {
HeaderCustom,
FunctionalTestCaseEdit,
MsTableOperatorButton,
MsTableOperator,
@ -281,6 +312,9 @@ export default {
},
data() {
return {
type: TEST_PLAN_FUNCTION_TEST_CASE,
headerItems: Test_Plan_Function_Test_Case,
tableLabel: Test_Plan_Function_Test_Case,
result: {},
deletePath: "/test/case/delete",
condition: {
@ -383,7 +417,12 @@ export default {
hub.$off("openFailureTestCase");
},
methods: {
customHeader() {
this.$refs.headerCustom.open(this.tableLabel)
},
initTableData() {
this.getLabel()
if (this.planId) {
// param.planId = this.planId;
this.condition.planId = this.planId;
@ -428,6 +467,24 @@ export default {
});
}
},
getLabel() {
let param = {}
param.userId = getCurrentUser().id;
param.type = TEST_PLAN_FUNCTION_TEST_CASE
this.result = this.$post('/system/header/info', param, response => {
if (response.data != null) {
let arry = eval(response.data.props);
let obj = {};
for (let key in arry) {
obj[key] = arry[key];
}
let newObj = Object.keys(obj).map(val => ({
prop: obj[val]
}))
this.tableLabel = newObj
}
})
},
showDetail(row, event, column) {
this.isReadOnly = true;
this.$refs.testPlanTestCaseEdit.openTestCaseEdit(row);
@ -596,9 +653,9 @@ export default {
_sort(column, this.condition);
this.initTableData();
},
headerDragend(newWidth,oldWidth,column,event){
headerDragend(newWidth, oldWidth, column, event) {
let finalWidth = newWidth;
if(column.minWidth>finalWidth){
if (column.minWidth > finalWidth) {
finalWidth = column.minWidth;
}
column.width = finalWidth;

View File

@ -3,10 +3,10 @@
<el-card class="card-content" v-loading="result.loading">
<template v-slot:header>
<test-plan-load-case-list-header
:condition="condition"
:plan-id="planId"
@refresh="initTable"
@relevanceCase="$emit('relevanceCase')"
:condition="condition"
:plan-id="planId"
@refresh="initTable"
@relevanceCase="$emit('relevanceCase')"
/>
</template>
@ -23,69 +23,89 @@
<show-more-btn :is-show="scope.row.showMore && !isReadOnly" :buttons="buttons" :size="selectRows.size"/>
</template>
</el-table-column>
<el-table-column prop="num" label="ID" show-overflow-tooltip/>
<el-table-column
prop="caseName"
:label="$t('commons.name')"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="projectName"
:label="$t('load_test.project_name')"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="userName"
:label="$t('load_test.user_name')"
show-overflow-tooltip>
</el-table-column>
<el-table-column
sortable
prop="createTime"
:label="$t('commons.create_time')">
<template v-slot:default="scope">
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column
prop="status"
column-key="status"
:filters="statusFilters"
:label="$t('commons.status')">
<template v-slot:default="{row}">
<ms-performance-test-status :row="row"/>
</template>
</el-table-column>
<el-table-column
prop="caseStatus"
:label="$t('test_track.plan.load_case.execution_status')">
<template v-slot:default="{row}">
<el-tag size="mini" type="danger" v-if="row.caseStatus === 'error'">
{{ row.caseStatus }}
</el-tag>
<el-tag size="mini" type="success" v-else-if="row.caseStatus === 'success'">
{{ row.caseStatus }}
</el-tag>
<el-tag size="mini" v-else-if="row.caseStatus === 'run'">
{{ row.caseStatus }}
</el-tag>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column
:label="$t('test_track.plan.load_case.report')"
show-overflow-tooltip>
<template v-slot:default="scope">
<div v-loading="loading === scope.row.id">
<el-link type="info" @click="getReport(scope.row)" v-if="scope.row.loadReportId">
{{ $t('test_track.plan.load_case.view_report') }}
</el-link>
<span v-else> - </span>
</div>
</template>
</el-table-column>
<template v-for="(item, index) in tableLabel">
<el-table-column v-if="item.prop == 'num'" prop="num" label="ID" show-overflow-tooltip :key="index"/>
<el-table-column
v-if="item.prop == 'caseName'"
prop="caseName"
:label="$t('commons.name')"
show-overflow-tooltip
:key="index">
</el-table-column>
<el-table-column
v-if="item.prop == 'projectName'"
prop="projectName"
:label="$t('load_test.project_name')"
show-overflow-tooltip
:key="index">
</el-table-column>
<el-table-column
v-if="item.prop == 'userName'"
prop="userName"
:label="$t('load_test.user_name')"
show-overflow-tooltip
:key="index">
</el-table-column>
<el-table-column
v-if="item.prop == 'createTime'"
sortable
prop="createTime"
:label="$t('commons.create_time')"
:key="index">
<template v-slot:default="scope">
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column
v-if="item.prop == 'status'"
prop="status"
column-key="status"
:filters="statusFilters"
:label="$t('commons.status')"
:key="index">
<template v-slot:default="{row}">
<ms-performance-test-status :row="row"/>
</template>
</el-table-column>
<el-table-column
v-if="item.prop == 'caseStatus'"
prop="caseStatus"
:label="$t('test_track.plan.load_case.execution_status')"
:key="index">
<template v-slot:default="{row}">
<el-tag size="mini" type="danger" v-if="row.caseStatus === 'error'">
{{ row.caseStatus }}
</el-tag>
<el-tag size="mini" type="success" v-else-if="row.caseStatus === 'success'">
{{ row.caseStatus }}
</el-tag>
<el-tag size="mini" v-else-if="row.caseStatus === 'run'">
{{ row.caseStatus }}
</el-tag>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column
v-if="item.prop == 'loadReportId'"
:label="$t('test_track.plan.load_case.report')"
show-overflow-tooltip
:key="index">
<template v-slot:default="scope">
<div v-loading="loading === scope.row.id">
<el-link type="info" @click="getReport(scope.row)" v-if="scope.row.loadReportId">
{{ $t('test_track.plan.load_case.view_report') }}
</el-link>
<span v-else> - </span>
</div>
</template>
</el-table-column>
</template>
<el-table-column v-if="!isReadOnly" :label="$t('commons.operating')" align="center">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
</template>
<template v-slot:default="scope">
<ms-table-operator-button class="run-button" :is-tester-permission="true" :tip="$t('api_test.run')"
icon="el-icon-video-play"
@ -95,6 +115,8 @@
</template>
</el-table-column>
</el-table>
<header-custom ref="headerCustom" :initTableData="initTable" :optionalFields=headerItems
:type=type></header-custom>
<ms-table-pagination :change="initTable" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
</el-card>
@ -112,10 +134,15 @@ import MsPerformanceTestStatus from "@/business/components/performance/test/Perf
import MsTableOperatorButton from "@/business/components/common/components/MsTableOperatorButton";
import LoadCaseReport from "@/business/components/track/plan/view/comonents/load/LoadCaseReport";
import {_filter, _sort} from "@/common/js/tableUtils";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {TEST_CASE_LIST, TEST_PLAN_LOAD_CASE} from "@/common/js/constants";
import {Test_Plan_Load_Case, Track_Test_Case} from "@/business/components/common/model/JsonData";
import {getCurrentUser} from "@/common/js/utils";
export default {
name: "TestPlanLoadCaseList",
components: {
HeaderCustom,
LoadCaseReport,
TestPlanLoadCaseListHeader,
ShowMoreBtn,
@ -125,6 +152,9 @@ export default {
},
data() {
return {
type: TEST_PLAN_LOAD_CASE,
headerItems: Test_Plan_Load_Case,
tableLabel: Test_Plan_Load_Case,
condition: {},
result: {},
tableData: [],
@ -177,7 +207,11 @@ export default {
}
},
methods: {
customHeader() {
this.$refs.headerCustom.open(this.tableLabel)
},
initTable() {
this.getLabel()
this.selectRows = new Set();
this.condition.testPlanId = this.planId;
if (this.selectProjectId && this.selectProjectId !== 'root') {
@ -186,7 +220,7 @@ export default {
if (this.clickType) {
if (this.status == 'default') {
this.condition.status = this.clickType;
}else{
} else {
this.condition.status = null;
}
this.status = 'all';
@ -198,6 +232,24 @@ export default {
this.tableData = listObject;
})
},
getLabel() {
let param = {}
param.userId = getCurrentUser().id;
param.type = TEST_PLAN_LOAD_CASE
this.result = this.$post('/system/header/info', param, response => {
if (response.data != null) {
let arry = eval(response.data.props);
let obj = {};
for (let key in arry) {
obj[key] = arry[key];
}
let newObj = Object.keys(obj).map(val => ({
prop: obj[val]
}))
this.tableLabel = newObj
}
})
},
refreshStatus() {
this.refreshScheduler = setInterval(() => {
//

View File

@ -14,62 +14,88 @@
@filter-change="filter"
@sort-change="sort"
@row-click="intoReview">
<el-table-column
prop="name"
:label="$t('test_track.review.review_name')"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="reviewer"
:label="$t('test_track.review.reviewer')"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="projectName"
:label="$t('test_track.review.review_project')"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="creatorName"
:label="$t('test_track.review.review_creator')"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="status"
column-key="status"
:label="$t('test_track.review.review_status')"
show-overflow-tooltip>
<template v-slot:default="scope">
<template v-for="(item, index) in tableLabel">
<el-table-column
v-if="item.prop=='name'"
prop="name"
:label="$t('test_track.review.review_name')"
show-overflow-tooltip
:key="index">
</el-table-column>
<el-table-column
v-if="item.prop=='reviewer'"
prop="reviewer"
:label="$t('test_track.review.reviewer')"
show-overflow-tooltip
:key="index">
</el-table-column>
<el-table-column
v-if="item.prop=='projectName'"
prop="projectName"
:label="$t('test_track.review.review_project')"
show-overflow-tooltip
:key="index">
</el-table-column>
<el-table-column
v-if="item.prop=='creatorName'"
prop="creatorName"
:label="$t('test_track.review.review_creator')"
show-overflow-tooltip
:key="index"
>
</el-table-column>
<el-table-column
v-if="item.prop=='status'"
prop="status"
column-key="status"
:label="$t('test_track.review.review_status')"
show-overflow-tooltip
:key="index"
>
<template v-slot:default="scope">
<span class="el-dropdown-link">
<plan-status-table-item :value="scope.row.status"/>
</span>
</template>
</el-table-column>
<el-table-column
prop="createTime"
:label="$t('commons.create_time')"
show-overflow-tooltip>
<template v-slot:default="scope">
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column
prop="endTime"
:label="$t('test_track.review.end_time')"
show-overflow-tooltip>
<template v-slot:default="scope">
<span>{{ scope.row.endTime | timestampFormatDate }}</span>
</template>
</el-table-column>
</template>
</el-table-column>
<el-table-column
v-if="item.prop=='createTime'"
prop="createTime"
:label="$t('commons.create_time')"
show-overflow-tooltip
:key="index"
>
<template v-slot:default="scope">
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column
v-if="item.prop=='endTime'"
prop="endTime"
:label="$t('test_track.review.end_time')"
show-overflow-tooltip
:key="index">
<template v-slot:default="scope">
<span>{{ scope.row.endTime | timestampFormatDate }}</span>
</template>
</el-table-column>
</template>
<el-table-column
min-width="100"
:label="$t('commons.operating')">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
</template>
<template v-slot:default="scope">
<ms-table-operator :is-tester-permission="true" @editClick="handleEdit(scope.row)"
@deleteClick="handleDelete(scope.row)">
</ms-table-operator>
</template>
</el-table-column>
<header-custom ref="headerCustom" :initTableData="initTableData" :optionalFields=headerItems
:type=type></header-custom>
</el-table>
<ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize"
@ -89,15 +115,19 @@ import MsCreateBox from "../../../settings/CreateBox";
import MsTablePagination from "../../../common/pagination/TablePagination";
import {
checkoutTestManagerOrTestUser,
getCurrentProjectID,
getCurrentProjectID, getCurrentUser,
getCurrentWorkspaceId
} from "../../../../../common/js/utils";
import {_filter, _sort} from "@/common/js/tableUtils";
import PlanStatusTableItem from "../../common/tableItems/plan/PlanStatusTableItem";
import {Test_Case_Review} from "@/business/components/common/model/JsonData";
import {TEST_CASE_LIST, TEST_CASE_REVIEW_LIST} from "@/common/js/constants";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
export default {
name: "TestCaseReviewList",
components: {
HeaderCustom,
MsDeleteConfirm,
MsTableOperator,
MsTableOperatorButton,
@ -109,6 +139,9 @@ export default {
},
data() {
return {
type: TEST_CASE_REVIEW_LIST,
headerItems: Test_Case_Review,
tableLabel: Test_Case_Review,
result: {},
condition: {},
tableData: [],
@ -135,7 +168,12 @@ export default {
this.initTableData();
},
methods: {
customHeader() {
this.$refs.headerCustom.open(this.tableLabel)
},
initTableData() {
this.getLabel()
let lastWorkspaceId = getCurrentWorkspaceId();
this.condition.workspaceId = lastWorkspaceId;
if (!getCurrentProjectID()) {
@ -163,6 +201,24 @@ export default {
}
});
},
getLabel() {
let param = {}
param.userId = getCurrentUser().id;
param.type = TEST_CASE_REVIEW_LIST
this.result = this.$post('/system/header/info', param, response => {
if (response.data != null) {
let arry = eval(response.data.props);
let obj = {};
for (let key in arry) {
obj[key] = arry[key];
}
let newObj = Object.keys(obj).map(val => ({
prop: obj[val]
}))
this.tableLabel = newObj
}
})
},
intoReview(row) {
this.$router.push('/track/review/view/' + row.id);
},

View File

@ -41,91 +41,122 @@
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectRows.size"/>
</template>
</el-table-column>
<el-table-column
prop="num"
sortable="custom"
:label="$t('commons.id')"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="name"
:label="$t('commons.name')"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="priority"
:filters="priorityFilters"
column-key="priority"
:label="$t('test_track.case.priority')">
<template v-slot:default="scope">
<priority-table-item :value="scope.row.priority" ref="priority"/>
</template>
</el-table-column>
<template v-for="(item, index) in tableLabel">
<el-table-column
v-if="item.prop == 'num'"
prop="num"
sortable="custom"
:label="$t('commons.id')"
show-overflow-tooltip
:key="index"
>
</el-table-column>
<el-table-column
v-if="item.prop == 'name'"
prop="name"
:label="$t('commons.name')"
show-overflow-tooltip
:key="index"
>
</el-table-column>
<el-table-column
v-if="item.prop == '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
prop="type"
:filters="typeFilters"
column-key="type"
:label="$t('test_track.case.type')"
show-overflow-tooltip>
<template v-slot:default="scope">
<type-table-item :value="scope.row.type"/>
</template>
</el-table-column>
<el-table-column
v-if="item.prop == 'type'"
prop="type"
:filters="typeFilters"
column-key="type"
:label="$t('test_track.case.type')"
show-overflow-tooltip
:key="index">
<template v-slot:default="scope">
<type-table-item :value="scope.row.type"/>
</template>
</el-table-column>
<el-table-column
prop="method"
:filters="methodFilters"
column-key="method"
:label="$t('test_track.case.method')"
show-overflow-tooltip>
<template v-slot:default="scope">
<method-table-item :value="scope.row.method"/>
</template>
</el-table-column>
<el-table-column
v-if="item.prop=='method'"
prop="method"
:filters="methodFilters"
column-key="method"
:label="$t('test_track.case.method')"
show-overflow-tooltip
:key="index">
<template v-slot:default="scope">
<method-table-item :value="scope.row.method"/>
</template>
</el-table-column>
<el-table-column
prop="nodePath"
:label="$t('test_track.case.module')"
show-overflow-tooltip>
</el-table-column>
<el-table-column
v-if="item.prop=='nodePath'"
prop="nodePath"
:label="$t('test_track.case.module')"
show-overflow-tooltip
:key="index"
>
</el-table-column>
<el-table-column
prop="projectName"
:label="$t('test_track.review.review_project')"
show-overflow-tooltip>
</el-table-column>
<el-table-column
v-if="item.prop=='projectName'"
prop="projectName"
:label="$t('test_track.review.review_project')"
show-overflow-tooltip
:key="index">
</el-table-column>
<el-table-column
prop="reviewerName"
:label="$t('test_track.review.reviewer')"
show-overflow-tooltip
>
</el-table-column>
<el-table-column
v-if="item.prop=='reviewerName'"
prop="reviewerName"
:label="$t('test_track.review.reviewer')"
show-overflow-tooltip
:key="index"
>
</el-table-column>
<el-table-column
:filters="statusFilters"
column-key="status"
:label="$t('test_track.review_view.execute_result')">
<template v-slot:default="scope">
<el-table-column
v-if="item.prop=='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">
<review-status :value="scope.row.reviewStatus"/>
</span>
</template>
</el-table-column>
</template>
</el-table-column>
<el-table-column
sortable
prop="updateTime"
:label="$t('commons.update_time')"
show-overflow-tooltip>
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column
v-if="item.prop=='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')">
:label="$t('commons.operating')"
>
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
</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)"/>
@ -134,6 +165,8 @@
</template>
</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"
:total="total"/>
@ -169,16 +202,24 @@ import MsTableButton from "../../../../common/components/MsTableButton";
import ShowMoreBtn from "../../../case/components/ShowMoreBtn";
import BatchEdit from "../../../case/components/BatchEdit";
import MsTablePagination from '../../../../common/pagination/TablePagination';
import {checkoutTestManagerOrTestUser, hasRoles} from "../../../../../../common/js/utils";
import {checkoutTestManagerOrTestUser, getCurrentUser, hasRoles} from "../../../../../../common/js/utils";
import {TEST_CASE_CONFIGS} from "../../../../common/components/search/search-components";
import {ROLE_TEST_MANAGER, ROLE_TEST_USER} from "../../../../../../common/js/constants";
import {
ROLE_TEST_MANAGER,
ROLE_TEST_USER,
TEST_CASE_LIST,
TEST_CASE_REVIEW_CASE_LIST, TEST_PLAN_LIST
} from "../../../../../../common/js/constants";
import TestReviewTestCaseEdit from "./TestReviewTestCaseEdit";
import ReviewStatus from "@/business/components/track/case/components/ReviewStatus";
import {_filter, _sort} from "@/common/js/tableUtils";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {Test_Case_Review_Case_List, Track_Test_Case} from "@/business/components/common/model/JsonData";
export default {
name: "TestReviewTestCaseList",
components: {
HeaderCustom,
MsTableOperatorButton, MsTableOperator, MethodTableItem, TypeTableItem,
StatusTableItem, PriorityTableItem, StatusEdit,
ExecutorEdit, MsTipButton, TestReviewTestCaseEdit, MsTableHeader,
@ -186,6 +227,9 @@ export default {
},
data() {
return {
type: TEST_CASE_REVIEW_CASE_LIST,
headerItems: Test_Case_Review_Case_List,
tableLabel: Test_Case_Review_Case_List,
result: {},
condition: {},
tableData: [],
@ -261,7 +305,11 @@ export default {
this.isTestManagerOrTestUser = checkoutTestManagerOrTestUser();
},
methods: {
customHeader() {
this.$refs.headerCustom.open(this.tableLabel)
},
initTableData() {
this.getLabel()
if (this.reviewId) {
this.condition.reviewId = this.reviewId;
}
@ -275,6 +323,24 @@ export default {
});
}
},
getLabel() {
let param = {}
param.userId = getCurrentUser().id;
param.type = TEST_CASE_REVIEW_CASE_LIST
this.result = this.$post('/system/header/info', param, response => {
if (response.data != null) {
let arry = eval(response.data.props);
let obj = {};
for (let key in arry) {
obj[key] = arry[key];
}
let newObj = Object.keys(obj).map(val => ({
prop: obj[val]
}))
this.tableLabel = newObj
}
})
},
showDetail(row, event, column) {
this.isReadOnly = true;
this.$refs.testReviewTestCaseEdit.openTestCaseEdit(row);

View File

@ -1,4 +1,15 @@
export const TEST_CASE_LIST='test_case_list'
export const TEST_CASE_LIST = 'test_case_list'
export const TEST_CASE_REVIEW_LIST = 'test_case_review_list'
export const API_LIST = 'api_list'
export const API_CASE_LIST = 'api_case_list'
export const API_SCENARIO_LIST = 'api_scenario_list'
export const TEST_CASE_REVIEW_CASE_LIST = 'test_case_review_case_list'
export const TEST_PLAN_LIST = 'test_plan_list'
export const TEST_PLAN_FUNCTION_TEST_CASE = 'test_plan_function_test_case'
export const TEST_PLAN_API_CASE = 'test_plan_api_case'
export const TEST_PLAN_LOAD_CASE = 'test_plan_load_case'
export const TEST_PLAN_SCENARIO_CASE = 'test_plan_scenario_case'
export const TokenKey = 'Admin-Token';
export const LicenseKey = 'License';
export const DEFAULT_LANGUAGE = 'default_language';