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"/> <show-more-btn :is-show="isSelect(scope.row)" :buttons="buttons" :size="selectDataCounts"/>
</template> </template>
</el-table-column> </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" column-key="last_result" min-width="120px" :key="index">
sortable="custom" <template v-slot:default="{row}">
min-width="120px" <el-link type="success" @click="showReport(row)" v-if="row.lastResult === 'Success'">
show-overflow-tooltip> {{ $t('api_test.automation.success') }}
<template slot-scope="scope"> </el-link>
<el-tooltip content="编辑"> <el-link type="danger" @click="showReport(row)" v-if="row.lastResult === 'Fail'">
<a style="cursor:pointer" @click="edit(scope.row)"> {{ scope.row.num }} </a> {{ $t('api_test.automation.fail') }}
</el-tooltip> </el-link>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="name" <el-table-column v-if="item.prop == 'passRate'" prop="passRate"
sortable="custom" :label="$t('api_test.automation.passing_rate')"
:label="$t('api_test.automation.scenario_name')" min-width="120px"
show-overflow-tooltip show-overflow-tooltip :key="index"/>
min-width="120px"/> </template>
<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/>
<el-table-column fixed="right" :label="$t('commons.operating')" width="190px" v-if="!referenced"> <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}"> <template v-slot:default="{row}">
<div v-if="trashEnable"> <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('commons.reduction')" icon="el-icon-refresh-left"
<ms-table-operator-button :tip="$t('api_test.automation.remove')" icon="el-icon-delete" @exec="remove(row)" type="danger" v-tester/> @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>
<div v-else> <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 :tip="$t('api_test.automation.edit')" icon="el-icon-edit" @exec="edit(row)"
<ms-table-operator-button class="run-button" :is-tester-permission="true" :tip="$t('api_test.automation.execute')" v-tester/>
<ms-table-operator-button class="run-button" :is-tester-permission="true"
:tip="$t('api_test.automation.execute')"
icon="el-icon-video-play" icon="el-icon-video-play"
@exec="execute(row)" v-tester/> @exec="execute(row)" v-tester/>
<ms-table-operator-button :tip="$t('api_test.automation.copy')" icon="el-icon-document-copy" type="" <ms-table-operator-button :tip="$t('api_test.automation.copy')" icon="el-icon-document-copy" type=""
@ -123,6 +137,7 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </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" <ms-table-pagination :change="search" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/> :total="total"/>
<div> <div>
@ -155,7 +170,7 @@ import MsTableHeader from "@/business/components/common/components/MsTableHeader
import MsTablePagination from "@/business/components/common/pagination/TablePagination"; import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn"; import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn";
import MsTag from "../../../common/components/MsTag"; 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 MsApiReportDetail from "../report/ApiReportDetail";
import MsTableMoreBtn from "./TableMoreBtn"; import MsTableMoreBtn from "./TableMoreBtn";
import MsScenarioExtendButtons from "@/business/components/api/automation/scenario/ScenarioExtendBtns"; 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 PriorityTableItem from "../../../track/common/tableItems/planview/PriorityTableItem";
import PlanStatusTableItem from "../../../track/common/tableItems/plan/PlanStatusTableItem"; import PlanStatusTableItem from "../../../track/common/tableItems/plan/PlanStatusTableItem";
import BatchEdit from "../../../track/case/components/BatchEdit"; 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 EnvironmentSelect from "../../definition/components/environment/EnvironmentSelect";
import BatchMove from "../../../track/case/components/BatchMove"; import BatchMove from "../../../track/case/components/BatchMove";
import {_filter, _sort} from "@/common/js/tableUtils"; 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 { export default {
name: "MsApiScenarioList", name: "MsApiScenarioList",
components: { components: {
HeaderCustom,
BatchMove, BatchMove,
EnvironmentSelect, EnvironmentSelect,
BatchEdit, BatchEdit,
@ -182,8 +200,8 @@ export default {
MsTableHeaderSelectPopover, MsTableHeaderSelectPopover,
MsTablePagination, MsTablePagination,
MsTableMoreBtn, MsTableMoreBtn,
ShowMoreBtn, ShowMoreBtn,
MsTableHeader, MsTableHeader,
MsTag, MsTag,
MsApiReportDetail, MsApiReportDetail,
MsScenarioExtendButtons, MsScenarioExtendButtons,
@ -215,6 +233,9 @@ export default {
}, },
data() { data() {
return { return {
type: API_SCENARIO_LIST,
headerItems: Api_Scenario_List,
tableLabel: Api_Scenario_List,
loading: false, loading: false,
screenHeight: document.documentElement.clientHeight - 280,//, screenHeight: document.documentElement.clientHeight - 280,//,
condition: { condition: {
@ -326,11 +347,15 @@ export default {
} }
}, },
methods: { methods: {
customHeader() {
this.$refs.headerCustom.open(this.tableLabel)
},
selectByParam() { selectByParam() {
this.changeSelectDataRangeAll(); this.changeSelectDataRangeAll();
this.search(); this.search();
}, },
search() { search() {
this.getLabel()
this.condition.moduleIds = this.selectNodeIds; this.condition.moduleIds = this.selectNodeIds;
if (this.trashEnable) { if (this.trashEnable) {
this.condition.filters = {status: ["Trash"]}; 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) { handleCommand(cmd) {
let table = this.$refs.scenarioTable; let table = this.$refs.scenarioTable;
switch (cmd) { switch (cmd) {

View File

@ -21,82 +21,99 @@
<el-table-column type="selection" width="50"/> <el-table-column type="selection" width="50"/>
<ms-table-header-select-popover v-show="total>0" <ms-table-header-select-popover v-show="total>0"
:page-size="pageSize>total?total:pageSize" :page-size="pageSize>total?total:pageSize"
:total="total" :total="total"
@selectPageAll="isSelectDataAll(false)" @selectPageAll="isSelectDataAll(false)"
@selectAll="isSelectDataAll(true)"/> @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"> <template v-slot:default="scope">
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectDataCounts"/> <show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectDataCounts"/>
</template> </template>
</el-table-column> </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> <el-table-column v-if="item.prop == 'name'" prop="name" min-width="160px" :label="$t('test_track.case.name')"
<template slot-scope="scope"> show-overflow-tooltip :key="index"/>
<el-tooltip content="编辑">
<a style="cursor:pointer" @click="handleTestCase(scope.row)"> {{ scope.row.num }} </a> <el-table-column
</el-tooltip> 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> </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"> <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> </template>
</el-table-column> </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> </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" <ms-table-pagination :change="initTable" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/> :total="total"/>
</api-list-container> </api-list-container>
@ -129,7 +146,7 @@ import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
import MsBatchEdit from "../basis/BatchEdit"; import MsBatchEdit from "../basis/BatchEdit";
import {API_METHOD_COLOUR, CASE_PRIORITY, DUBBO_METHOD, REQ_METHOD, SQL_METHOD, TCP_METHOD} from "../../model/JsonData"; 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 ApiListContainer from "./ApiListContainer";
import PriorityTableItem from "../../../../track/common/tableItems/planview/PriorityTableItem"; import PriorityTableItem from "../../../../track/common/tableItems/planview/PriorityTableItem";
import MsApiCaseTableExtendBtns from "../reference/ApiCaseTableExtendBtns"; 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 MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
import {API_CASE_CONFIGS} from "@/business/components/common/components/search/search-components"; import {API_CASE_CONFIGS} from "@/business/components/common/components/search/search-components";
import {_filter, _handleSelect, _handleSelectAll, _sort,} from "@/common/js/tableUtils"; 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 { export default {
name: "ApiCaseSimpleList", name: "ApiCaseSimpleList",
components: { components: {
MsTableHeaderSelectPopover, HeaderCustom,
MsSetEnvironment, MsTableHeaderSelectPopover,
ApiCaseList, MsSetEnvironment,
PriorityTableItem, ApiCaseList,
ApiListContainer, PriorityTableItem,
MsTableOperatorButton, ApiListContainer,
MsTableOperator, MsTableOperatorButton,
MsTablePagination, MsTableOperator,
MsTag, MsTablePagination,
MsApiCaseList, MsTag,
MsApiCaseList,
MsContainer, MsContainer,
MsBottomContainer, MsBottomContainer,
ShowMoreBtn, ShowMoreBtn,
@ -166,6 +187,9 @@ export default {
}, },
data() { data() {
return { return {
type: API_CASE_LIST,
headerItems: Api_Case_List,
tableLabel: Api_Case_List,
condition: { condition: {
components: API_CASE_CONFIGS components: API_CASE_CONFIGS
}, },
@ -267,10 +291,14 @@ export default {
}, },
}, },
methods: { methods: {
customHeader() {
this.$refs.headerCustom.open(this.tableLabel)
},
isApiListEnableChange(data) { isApiListEnableChange(data) {
this.$emit('isApiListEnableChange', data); this.$emit('isApiListEnableChange', data);
}, },
initTable() { initTable() {
this.getLabel()
this.selectRows = new Set(); this.selectRows = new Set();
this.condition.status = ""; this.condition.status = "";
this.condition.moduleIds = this.selectNodeIds; 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() { open() {
this.$refs.searchBar.open(); this.$refs.searchBar.open();
}, },

View File

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

View File

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

View File

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

View File

@ -14,23 +14,30 @@
@filter-change="filter" @filter-change="filter"
@sort-change="sort" @sort-change="sort"
@row-click="intoPlan"> @row-click="intoPlan">
<el-table-column <template v-for="(item, index) in tableLabel">
prop="name" <el-table-column
:label="$t('commons.name')" v-if="item.prop == 'name'"
show-overflow-tooltip> prop="name"
</el-table-column> :label="$t('commons.name')"
<el-table-column show-overflow-tooltip
prop="userName" :key="index">
:label="$t('test_track.plan.plan_principal')" </el-table-column>
show-overflow-tooltip> <el-table-column
</el-table-column> v-if="item.prop == 'userName'"
<el-table-column prop="userName"
prop="status" :label="$t('test_track.plan.plan_principal')"
column-key="status" show-overflow-tooltip
:filters="statusFilters" :key="index">
:label="$t('test_track.plan.plan_status')" </el-table-column>
show-overflow-tooltip> <el-table-column
<template v-slot:default="scope"> 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'"> <span @click.stop="clickt = 'stop'">
<el-dropdown class="test-case-status" @command="statusChange"> <el-dropdown class="test-case-status" @command="statusChange">
<span class="el-dropdown-link"> <span class="el-dropdown-link">
@ -51,76 +58,98 @@
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</span> </span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="stage" v-if="item.prop == 'stage'"
column-key="stage" prop="stage"
:filters="stageFilters" column-key="stage"
:label="$t('test_track.plan.plan_stage')" :filters="stageFilters"
show-overflow-tooltip> :label="$t('test_track.plan.plan_stage')"
<template v-slot:default="scope"> show-overflow-tooltip
<plan-stage-table-item :stage="scope.row.stage"/> :key="index">
</template> <template v-slot:default="scope">
</el-table-column> <plan-stage-table-item :stage="scope.row.stage"/>
<el-table-column </template>
prop="projectName" </el-table-column>
:label="$t('test_track.home.test_rate')" <el-table-column
min-width="100" v-if="item.prop == 'testRate'"
show-overflow-tooltip> prop="testRate"
<template v-slot:default="scope"> :label="$t('test_track.home.test_rate')"
<el-progress :percentage="scope.row.testRate"></el-progress> min-width="100"
</template> show-overflow-tooltip
</el-table-column> :key="index">
<el-table-column <template v-slot:default="scope">
prop="projectName" <el-progress :percentage="scope.row.testRate"></el-progress>
:label="$t('test_track.plan.plan_project')" </template>
show-overflow-tooltip> </el-table-column>
</el-table-column> <el-table-colum
<el-table-column v-if="item.prop == 'projectName'"
sortable prop="projectName"
prop="plannedStartTime" :label="$t('test_track.plan.plan_project')"
:label="$t('test_track.plan.planned_start_time')" show-overflow-tooltip
show-overflow-tooltip> :key="index">
<template v-slot:default="scope"> </el-table-colum>
<span>{{ scope.row.plannedStartTime | timestampFormatDate }}</span> <el-table-column
</template> v-if="item.prop == 'plannedStartTime'"
</el-table-column> sortable
<el-table-column prop="plannedStartTime"
sortable :label="$t('test_track.plan.planned_start_time')"
prop="plannedEndTime" show-overflow-tooltip
:label="$t('test_track.plan.planned_end_time')" :key="index">
show-overflow-tooltip> <template v-slot:default="scope">
<template v-slot:default="scope"> <span>{{ scope.row.plannedStartTime | timestampFormatDate }}</span>
<span>{{ scope.row.plannedEndTime | timestampFormatDate }}</span> </template>
</template> </el-table-column>
</el-table-column> <el-table-column
<el-table-column v-if="item.prop == 'plannedEndTime'"
sortable sortable
prop="actualStartTime" prop="plannedEndTime"
:label="$t('test_track.plan.actual_start_time')" :label="$t('test_track.plan.planned_end_time')"
show-overflow-tooltip> show-overflow-tooltip
<template v-slot:default="scope"> :key="index">
<span>{{ scope.row.actualStartTime | timestampFormatDate }}</span> <template v-slot:default="scope">
</template> <span>{{ scope.row.plannedEndTime | timestampFormatDate }}</span>
</el-table-column> </template>
<el-table-column </el-table-column>
sortable <el-table-column
prop="actualEndTime" v-if="item.prop == 'actualStartTime'"
:label="$t('test_track.plan.actual_end_time')" sortable
show-overflow-tooltip> prop="actualStartTime"
<template v-slot:default="scope"> :label="$t('test_track.plan.actual_start_time')"
<span>{{ scope.row.actualEndTime | timestampFormatDate }}</span> show-overflow-tooltip
</template> :key="index">
</el-table-column> <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 <el-table-column
min-width="150" min-width="150"
: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"> <template v-slot:default="scope">
<ms-table-operator :is-tester-permission="true" @editClick="handleEdit(scope.row)" <ms-table-operator :is-tester-permission="true" @editClick="handleEdit(scope.row)"
@deleteClick="handleDelete(scope.row)"> @deleteClick="handleDelete(scope.row)">
<template v-slot:middle> <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" :tip="$t('test_track.plan_view.create_report')" icon="el-icon-s-data"
@exec="openTestReportTemplate(scope.row)"/> @exec="openTestReportTemplate(scope.row)"/>
<ms-table-operator-button v-if="scope.row.reportId" <ms-table-operator-button v-if="scope.row.reportId"
@ -128,24 +157,30 @@
@exec="openReport(scope.row.id, scope.row.reportId)"/> @exec="openReport(scope.row.id, scope.row.reportId)"/>
</template> </template>
</ms-table-operator> </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" :tip="$t('commons.trigger_mode.schedule')" icon="el-icon-time"
@exec="scheduleTask(scope.row)"/> @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" :tip="$t('commons.trigger_mode.schedule')" icon="el-icon-time"
@exec="scheduleTask(scope.row)"/> @exec="scheduleTask(scope.row)"/>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </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" <ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/> :total="total"/>
<test-report-template-list @openReport="openReport" ref="testReportTemplateList"/> <test-report-template-list @openReport="openReport" ref="testReportTemplateList"/>
<test-case-report-view @refresh="initTableData" ref="testCaseReportView"/> <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"> <ms-delete-confirm :title="$t('test_track.plan.plan_delete')" @delete="_handleDelete" ref="deleteConfirm"
{{$t('test_track.plan.plan_delete_tip')}} :with-tip="enableDeleteTip">
{{ $t('test_track.plan.plan_delete_tip') }}
</ms-delete-confirm> </ms-delete-confirm>
<ms-schedule-maintain ref="scheduleMaintain" @refreshTable="initTableData" /> <ms-schedule-maintain ref="scheduleMaintain" @refreshTable="initTableData"/>
</el-card> </el-card>
</template> </template>
@ -158,7 +193,7 @@ import MsTableOperatorButton from "../../../common/components/MsTableOperatorBut
import MsTableOperator from "../../../common/components/MsTableOperator"; import MsTableOperator from "../../../common/components/MsTableOperator";
import PlanStatusTableItem from "../../common/tableItems/plan/PlanStatusTableItem"; import PlanStatusTableItem from "../../common/tableItems/plan/PlanStatusTableItem";
import PlanStageTableItem from "../../common/tableItems/plan/PlanStageTableItem"; 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 TestReportTemplateList from "../view/comonents/TestReportTemplateList";
import TestCaseReportView from "../view/comonents/report/TestCaseReportView"; import TestCaseReportView from "../view/comonents/report/TestCaseReportView";
import MsDeleteConfirm from "../../../common/components/MsDeleteConfirm"; 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 {getCurrentProjectID} from "../../../../../common/js/utils";
import MsScheduleMaintain from "@/business/components/api/automation/schedule/ScheduleMaintain" import MsScheduleMaintain from "@/business/components/api/automation/schedule/ScheduleMaintain"
import {_filter, _sort} from "@/common/js/tableUtils"; 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 { export default {
name: "TestPlanList", name: "TestPlanList",
components: { components: {
HeaderCustom,
MsDeleteConfirm, MsDeleteConfirm,
TestCaseReportView, TestCaseReportView,
TestReportTemplateList, TestReportTemplateList,
@ -182,6 +221,9 @@ export default {
}, },
data() { data() {
return { return {
type: TEST_PLAN_LIST,
headerItems: Test_Plan_List,
tableLabel: Test_Plan_List,
result: {}, result: {},
enableDeleteTip: false, enableDeleteTip: false,
queryPath: "/test/plan/list", queryPath: "/test/plan/list",
@ -219,7 +261,11 @@ export default {
this.initTableData(); this.initTableData();
}, },
methods: { methods: {
customHeader() {
this.$refs.headerCustom.open(this.tableLabel)
},
initTableData() { initTableData() {
this.getLabel()
if (this.planId) { if (this.planId) {
this.condition.planId = this.planId; this.condition.planId = this.planId;
} }
@ -235,7 +281,7 @@ export default {
this.tableData = data.listObject; this.tableData = data.listObject;
for (let i = 0; i < this.tableData.length; i++) { for (let i = 0; i < this.tableData.length; i++) {
let path = "/test/plan/project"; 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 arr = res.data;
let projectIds = arr.filter(d => d.id !== this.tableData[i].projectId).map(data => data.id); let projectIds = arr.filter(d => d.id !== this.tableData[i].projectId).map(data => data.id);
this.$set(this.tableData[i], "projectIds", projectIds); 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) { buildPagePath(path) {
return path + "/" + this.currentPage + "/" + this.pageSize; 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"/> <show-more-btn :is-show="scope.row.showMore && !isReadOnly" :buttons="buttons" :size="selectRows.size"/>
</template> </template>
</el-table-column> </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
<el-table-column prop="name" sortable="custom" :label="$t('api_test.definition.api_name')" show-overflow-tooltip/> 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 <el-table-column
prop="priority" v-if="item.prop == 'path'"
:filters="priorityFilters" prop="path"
sortable="custom" :label="$t('api_test.definition.api_path')"
column-key="priority" show-overflow-tooltip
:label="$t('test_track.case.priority')" :key="index"/>
show-overflow-tooltip>
<template v-slot:default="scope">
<priority-table-item :value="scope.row.priority"/>
</template>
</el-table-column>
<el-table-column <el-table-column
prop="path" v-if="item.prop == 'createUser'"
:label="$t('api_test.definition.api_path')" prop="createUser"
show-overflow-tooltip/> column-key="user_id"
sortable="custom"
:filters="userFilters"
:label="'创建人'"
show-overflow-tooltip
:key="index"/>
<el-table-column <el-table-column
prop="createUser" v-if="item.prop == 'custom'"
column-key="user_id" sortable="custom"
sortable="custom" width="160"
:filters="userFilters" :label="$t('api_test.definition.api_last_time')"
:label="'创建人'" prop="updateTime"
show-overflow-tooltip/> :key="index">
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column <el-table-column
sortable="custom" v-if="item.prop == 'tags'"
width="160" prop="tags"
:label="$t('api_test.definition.api_last_time')" :label="$t('commons.tag')"
prop="updateTime"> :key="index">
<template v-slot:default="scope"> <template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span> <div v-for="(itemName,index) in scope.row.tags" :key="index">
</template> <ms-tag type="success" effect="plain" :content="itemName"/>
</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 }}
</div> </div>
</div> </template>
</template> </el-table-column>
</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"> <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"> <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/> @exec="singleRun(scope.row)" v-tester/>
<ms-table-operator-button :is-tester-permission="true" :tip="$t('test_track.plan_view.cancel_relevance')" <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/> icon="el-icon-unlock" type="danger" @exec="handleDelete(scope.row)" v-tester/>
@ -102,6 +122,8 @@
</el-table-column> </el-table-column>
</el-table> </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" <ms-table-pagination :change="initTable" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/> :total="total"/>
@ -129,7 +151,7 @@ import MsBottomContainer from "../../../../../api/definition/components/BottomCo
import ShowMoreBtn from "../../../../case/components/ShowMoreBtn"; import ShowMoreBtn from "../../../../case/components/ShowMoreBtn";
import MsBatchEdit from "../../../../../api/definition/components/basis/BatchEdit"; import MsBatchEdit from "../../../../../api/definition/components/basis/BatchEdit";
import {API_METHOD_COLOUR, CASE_PRIORITY, RESULT_MAP} from "../../../../../api/definition/model/JsonData"; 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 ApiListContainer from "../../../../../api/definition/components/list/ApiListContainer";
import PriorityTableItem from "../../../../common/tableItems/planview/PriorityTableItem"; import PriorityTableItem from "../../../../common/tableItems/planview/PriorityTableItem";
import {getBodyUploadFiles, getUUID} from "../../../../../../../common/js/utils"; import {getBodyUploadFiles, getUUID} from "../../../../../../../common/js/utils";
@ -138,13 +160,16 @@ import MsRun from "../../../../../api/definition/components/Run";
import TestPlanApiCaseResult from "./TestPlanApiCaseResult"; import TestPlanApiCaseResult from "./TestPlanApiCaseResult";
import TestPlan from "../../../../../api/definition/components/jmeter/components/test-plan"; import TestPlan from "../../../../../api/definition/components/jmeter/components/test-plan";
import ThreadGroup from "../../../../../api/definition/components/jmeter/components/thread-group"; import ThreadGroup from "../../../../../api/definition/components/jmeter/components/thread-group";
import {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 {_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 { export default {
name: "TestPlanApiCaseList", name: "TestPlanApiCaseList",
components: { components: {
HeaderCustom,
TestPlanApiCaseResult, TestPlanApiCaseResult,
MsRun, MsRun,
TestPlanCaseListHeader, TestPlanCaseListHeader,
@ -163,11 +188,14 @@ export default {
}, },
data() { data() {
return { return {
type: TEST_PLAN_API_CASE,
headerItems: Test_Plan_Api_Case,
tableLabel: Test_Plan_Api_Case,
condition: {}, condition: {},
selectCase: {}, selectCase: {},
result: {}, result: {},
moduleId: "", moduleId: "",
status:'default', status: 'default',
deletePath: "/test/case/delete", deletePath: "/test/case/delete",
selectRows: new Set(), selectRows: new Set(),
buttons: [ buttons: [
@ -228,14 +256,14 @@ export default {
} }
}, },
planId: String, planId: String,
clickType:String clickType: String
}, },
created: function () { created: function () {
this.getMaintainerOptions(); this.getMaintainerOptions();
this.initTable(); this.initTable();
}, },
activated() { activated() {
this.status ='default' this.status = 'default'
}, },
watch: { watch: {
selectNodeIds() { selectNodeIds() {
@ -263,6 +291,9 @@ export default {
}, },
}, },
methods: { methods: {
customHeader() {
this.$refs.headerCustom.open(this.tableLabel)
},
getMaintainerOptions() { getMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID); let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => { this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
@ -276,6 +307,7 @@ export default {
this.$emit('isApiListEnableChange', data); this.$emit('isApiListEnableChange', data);
}, },
initTable() { initTable() {
this.getLabel()
this.selectRows = new Set(); this.selectRows = new Set();
this.condition.status = ""; this.condition.status = "";
this.condition.moduleIds = this.selectNodeIds; this.condition.moduleIds = this.selectNodeIds;
@ -285,10 +317,10 @@ export default {
if (this.currentProtocol != null) { if (this.currentProtocol != null) {
this.condition.protocol = this.currentProtocol; this.condition.protocol = this.currentProtocol;
} }
if(this.clickType){ if (this.clickType) {
if(this.status =='default'){ if (this.status == 'default') {
this.condition.status = this.clickType; this.condition.status = this.clickType;
}else{ } else {
this.condition.status = null; this.condition.status = null;
} }
this.status = 'all'; 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) { handleSelect(selection, row) {
row.hashTree = []; row.hashTree = [];
if (this.selectRows.has(row)) { if (this.selectRows.has(row)) {

View File

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

View File

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

View File

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

View File

@ -14,62 +14,88 @@
@filter-change="filter" @filter-change="filter"
@sort-change="sort" @sort-change="sort"
@row-click="intoReview"> @row-click="intoReview">
<el-table-column <template v-for="(item, index) in tableLabel">
prop="name" <el-table-column
:label="$t('test_track.review.review_name')" v-if="item.prop=='name'"
show-overflow-tooltip> prop="name"
</el-table-column> :label="$t('test_track.review.review_name')"
<el-table-column show-overflow-tooltip
prop="reviewer" :key="index">
:label="$t('test_track.review.reviewer')" </el-table-column>
show-overflow-tooltip> <el-table-column
</el-table-column> v-if="item.prop=='reviewer'"
<el-table-column prop="reviewer"
prop="projectName" :label="$t('test_track.review.reviewer')"
:label="$t('test_track.review.review_project')" show-overflow-tooltip
show-overflow-tooltip> :key="index">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="creatorName" v-if="item.prop=='projectName'"
:label="$t('test_track.review.review_creator')" prop="projectName"
show-overflow-tooltip> :label="$t('test_track.review.review_project')"
</el-table-column> show-overflow-tooltip
<el-table-column :key="index">
prop="status" </el-table-column>
column-key="status" <el-table-column
:label="$t('test_track.review.review_status')" v-if="item.prop=='creatorName'"
show-overflow-tooltip> prop="creatorName"
<template v-slot:default="scope"> :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"> <span class="el-dropdown-link">
<plan-status-table-item :value="scope.row.status"/> <plan-status-table-item :value="scope.row.status"/>
</span> </span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="createTime" v-if="item.prop=='createTime'"
:label="$t('commons.create_time')" prop="createTime"
show-overflow-tooltip> :label="$t('commons.create_time')"
<template v-slot:default="scope"> show-overflow-tooltip
<span>{{ scope.row.createTime | timestampFormatDate }}</span> :key="index"
</template> >
</el-table-column> <template v-slot:default="scope">
<el-table-column <span>{{ scope.row.createTime | timestampFormatDate }}</span>
prop="endTime" </template>
:label="$t('test_track.review.end_time')" </el-table-column>
show-overflow-tooltip> <el-table-column
<template v-slot:default="scope"> v-if="item.prop=='endTime'"
<span>{{ scope.row.endTime | timestampFormatDate }}</span> prop="endTime"
</template> :label="$t('test_track.review.end_time')"
</el-table-column> show-overflow-tooltip
:key="index">
<template v-slot:default="scope">
<span>{{ scope.row.endTime | timestampFormatDate }}</span>
</template>
</el-table-column>
</template>
<el-table-column <el-table-column
min-width="100" 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"> <template v-slot:default="scope">
<ms-table-operator :is-tester-permission="true" @editClick="handleEdit(scope.row)" <ms-table-operator :is-tester-permission="true" @editClick="handleEdit(scope.row)"
@deleteClick="handleDelete(scope.row)"> @deleteClick="handleDelete(scope.row)">
</ms-table-operator> </ms-table-operator>
</template> </template>
</el-table-column> </el-table-column>
<header-custom ref="headerCustom" :initTableData="initTableData" :optionalFields=headerItems
:type=type></header-custom>
</el-table> </el-table>
<ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize" <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 MsTablePagination from "../../../common/pagination/TablePagination";
import { import {
checkoutTestManagerOrTestUser, checkoutTestManagerOrTestUser,
getCurrentProjectID, getCurrentProjectID, getCurrentUser,
getCurrentWorkspaceId getCurrentWorkspaceId
} from "../../../../../common/js/utils"; } from "../../../../../common/js/utils";
import {_filter, _sort} from "@/common/js/tableUtils"; import {_filter, _sort} from "@/common/js/tableUtils";
import PlanStatusTableItem from "../../common/tableItems/plan/PlanStatusTableItem"; 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 { export default {
name: "TestCaseReviewList", name: "TestCaseReviewList",
components: { components: {
HeaderCustom,
MsDeleteConfirm, MsDeleteConfirm,
MsTableOperator, MsTableOperator,
MsTableOperatorButton, MsTableOperatorButton,
@ -109,6 +139,9 @@ export default {
}, },
data() { data() {
return { return {
type: TEST_CASE_REVIEW_LIST,
headerItems: Test_Case_Review,
tableLabel: Test_Case_Review,
result: {}, result: {},
condition: {}, condition: {},
tableData: [], tableData: [],
@ -135,7 +168,12 @@ export default {
this.initTableData(); this.initTableData();
}, },
methods: { methods: {
customHeader() {
this.$refs.headerCustom.open(this.tableLabel)
},
initTableData() { initTableData() {
this.getLabel()
let lastWorkspaceId = getCurrentWorkspaceId(); let lastWorkspaceId = getCurrentWorkspaceId();
this.condition.workspaceId = lastWorkspaceId; this.condition.workspaceId = lastWorkspaceId;
if (!getCurrentProjectID()) { 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) { intoReview(row) {
this.$router.push('/track/review/view/' + row.id); 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"/> <show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectRows.size"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <template v-for="(item, index) in tableLabel">
prop="num" <el-table-column
sortable="custom" v-if="item.prop == 'num'"
:label="$t('commons.id')" prop="num"
show-overflow-tooltip> sortable="custom"
</el-table-column> :label="$t('commons.id')"
<el-table-column show-overflow-tooltip
prop="name" :key="index"
:label="$t('commons.name')" >
show-overflow-tooltip> </el-table-column>
</el-table-column> <el-table-column
<el-table-column v-if="item.prop == 'name'"
prop="priority" prop="name"
:filters="priorityFilters" :label="$t('commons.name')"
column-key="priority" show-overflow-tooltip
:label="$t('test_track.case.priority')"> :key="index"
<template v-slot:default="scope"> >
<priority-table-item :value="scope.row.priority" ref="priority"/> </el-table-column>
</template> <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 <el-table-column
prop="type" v-if="item.prop == 'type'"
:filters="typeFilters" prop="type"
column-key="type" :filters="typeFilters"
:label="$t('test_track.case.type')" column-key="type"
show-overflow-tooltip> :label="$t('test_track.case.type')"
<template v-slot:default="scope"> show-overflow-tooltip
<type-table-item :value="scope.row.type"/> :key="index">
</template> <template v-slot:default="scope">
</el-table-column> <type-table-item :value="scope.row.type"/>
</template>
</el-table-column>
<el-table-column <el-table-column
prop="method" v-if="item.prop=='method'"
:filters="methodFilters" prop="method"
column-key="method" :filters="methodFilters"
:label="$t('test_track.case.method')" column-key="method"
show-overflow-tooltip> :label="$t('test_track.case.method')"
<template v-slot:default="scope"> show-overflow-tooltip
<method-table-item :value="scope.row.method"/> :key="index">
</template> <template v-slot:default="scope">
</el-table-column> <method-table-item :value="scope.row.method"/>
</template>
</el-table-column>
<el-table-column <el-table-column
prop="nodePath" v-if="item.prop=='nodePath'"
:label="$t('test_track.case.module')" prop="nodePath"
show-overflow-tooltip> :label="$t('test_track.case.module')"
</el-table-column> show-overflow-tooltip
:key="index"
>
</el-table-column>
<el-table-column <el-table-column
prop="projectName" v-if="item.prop=='projectName'"
:label="$t('test_track.review.review_project')" prop="projectName"
show-overflow-tooltip> :label="$t('test_track.review.review_project')"
</el-table-column> show-overflow-tooltip
:key="index">
</el-table-column>
<el-table-column <el-table-column
prop="reviewerName" v-if="item.prop=='reviewerName'"
:label="$t('test_track.review.reviewer')" prop="reviewerName"
show-overflow-tooltip :label="$t('test_track.review.reviewer')"
> show-overflow-tooltip
</el-table-column> :key="index"
>
</el-table-column>
<el-table-column <el-table-column
:filters="statusFilters" v-if="item.prop=='reviewStatus'"
column-key="status" :filters="statusFilters"
:label="$t('test_track.review_view.execute_result')"> column-key="status"
<template v-slot:default="scope"> :label="$t('test_track.review_view.execute_result')"
:key="index">
<template v-slot:default="scope">
<span class="el-dropdown-link"> <span class="el-dropdown-link">
<review-status :value="scope.row.reviewStatus"/> <review-status :value="scope.row.reviewStatus"/>
</span> </span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
sortable v-if="item.prop=='updateTime'"
prop="updateTime" sortable
:label="$t('commons.update_time')" prop="updateTime"
show-overflow-tooltip> :label="$t('commons.update_time')"
<template v-slot:default="scope"> show-overflow-tooltip
<span>{{ scope.row.updateTime | timestampFormatDate }}</span> :key="index">
</template> <template v-slot:default="scope">
</el-table-column> <span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
</template>
<el-table-column <el-table-column
min-width="100" 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"> <template v-slot:default="scope">
<ms-table-operator-button :is-tester-permission="true" :tip="$t('commons.edit')" icon="el-icon-edit" <ms-table-operator-button :is-tester-permission="true" :tip="$t('commons.edit')" icon="el-icon-edit"
@exec="handleEdit(scope.row)"/> @exec="handleEdit(scope.row)"/>
@ -134,6 +165,8 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </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" <ms-table-pagination :change="search" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/> :total="total"/>
@ -169,16 +202,24 @@ import MsTableButton from "../../../../common/components/MsTableButton";
import ShowMoreBtn from "../../../case/components/ShowMoreBtn"; import ShowMoreBtn from "../../../case/components/ShowMoreBtn";
import BatchEdit from "../../../case/components/BatchEdit"; import BatchEdit from "../../../case/components/BatchEdit";
import MsTablePagination from '../../../../common/pagination/TablePagination'; 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 {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 TestReviewTestCaseEdit from "./TestReviewTestCaseEdit";
import ReviewStatus from "@/business/components/track/case/components/ReviewStatus"; import ReviewStatus from "@/business/components/track/case/components/ReviewStatus";
import {_filter, _sort} from "@/common/js/tableUtils"; 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 { export default {
name: "TestReviewTestCaseList", name: "TestReviewTestCaseList",
components: { components: {
HeaderCustom,
MsTableOperatorButton, MsTableOperator, MethodTableItem, TypeTableItem, MsTableOperatorButton, MsTableOperator, MethodTableItem, TypeTableItem,
StatusTableItem, PriorityTableItem, StatusEdit, StatusTableItem, PriorityTableItem, StatusEdit,
ExecutorEdit, MsTipButton, TestReviewTestCaseEdit, MsTableHeader, ExecutorEdit, MsTipButton, TestReviewTestCaseEdit, MsTableHeader,
@ -186,6 +227,9 @@ export default {
}, },
data() { data() {
return { return {
type: TEST_CASE_REVIEW_CASE_LIST,
headerItems: Test_Case_Review_Case_List,
tableLabel: Test_Case_Review_Case_List,
result: {}, result: {},
condition: {}, condition: {},
tableData: [], tableData: [],
@ -261,7 +305,11 @@ export default {
this.isTestManagerOrTestUser = checkoutTestManagerOrTestUser(); this.isTestManagerOrTestUser = checkoutTestManagerOrTestUser();
}, },
methods: { methods: {
customHeader() {
this.$refs.headerCustom.open(this.tableLabel)
},
initTableData() { initTableData() {
this.getLabel()
if (this.reviewId) { if (this.reviewId) {
this.condition.reviewId = 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) { showDetail(row, event, column) {
this.isReadOnly = true; this.isReadOnly = true;
this.$refs.testReviewTestCaseEdit.openTestCaseEdit(row); 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 TokenKey = 'Admin-Token';
export const LicenseKey = 'License'; export const LicenseKey = 'License';
export const DEFAULT_LANGUAGE = 'default_language'; export const DEFAULT_LANGUAGE = 'default_language';