feat: 自定义表头

This commit is contained in:
wenyann 2021-02-08 17:22:27 +08:00
parent 67a420e78e
commit 21b6481b8b
11 changed files with 498 additions and 480 deletions

View File

@ -1,231 +1,229 @@
<?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.SwaggerUrlProjectMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.SwaggerUrlProject">
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="project_id" jdbcType="VARCHAR" property="projectId"/>
<result column="swagger_url" jdbcType="VARCHAR" property="swaggerUrl"/>
<result column="module_id" jdbcType="VARCHAR" property="moduleId"/>
<result column="module_path" jdbcType="VARCHAR" property="modulePath"/>
<result column="mode_id" jdbcType="VARCHAR" property="modeId"/>
</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>
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.SwaggerUrlProject">
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="project_id" jdbcType="VARCHAR" property="projectId"/>
<result column="swagger_url" jdbcType="VARCHAR" property="swaggerUrl"/>
<result column="module_id" jdbcType="VARCHAR" property="moduleId"/>
<result column="module_path" jdbcType="VARCHAR" property="modulePath"/>
<result column="mode_id" jdbcType="VARCHAR" property="modeId"/>
</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>
</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>
</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>
</where>
</sql>
<sql id="Base_Column_List">
id, project_id, swagger_url, module_id, module_path, mode_id
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.SwaggerUrlProjectExample"
resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</trim>
</if>
<include refid="Base_Column_List"/>
from swagger_url_project
<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 swagger_url_project
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete
from swagger_url_project
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.SwaggerUrlProjectExample">
delete from swagger_url_project
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.SwaggerUrlProject">
insert into swagger_url_project (id, project_id, swagger_url,
module_id, module_path, mode_id)
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{swaggerUrl,jdbcType=VARCHAR},
#{moduleId,jdbcType=VARCHAR}, #{modulePath,jdbcType=VARCHAR}, #{modeId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.SwaggerUrlProject">
insert into swagger_url_project
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="projectId != null">
project_id,
</if>
<if test="swaggerUrl != null">
swagger_url,
</if>
<if test="moduleId != null">
module_id,
</if>
<if test="modulePath != null">
module_path,
</if>
<if test="modeId != null">
mode_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="projectId != null">
#{projectId,jdbcType=VARCHAR},
</if>
<if test="swaggerUrl != null">
#{swaggerUrl,jdbcType=VARCHAR},
</if>
<if test="moduleId != null">
#{moduleId,jdbcType=VARCHAR},
</if>
<if test="modulePath != null">
#{modulePath,jdbcType=VARCHAR},
</if>
<if test="modeId != null">
#{modeId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.SwaggerUrlProjectExample"
resultType="java.lang.Long">
select count(*) from swagger_url_project
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update swagger_url_project
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.projectId != null">
project_id = #{record.projectId,jdbcType=VARCHAR},
</if>
<if test="record.swaggerUrl != null">
swagger_url = #{record.swaggerUrl,jdbcType=VARCHAR},
</if>
<if test="record.moduleId != null">
module_id = #{record.moduleId,jdbcType=VARCHAR},
</if>
<if test="record.modulePath != null">
module_path = #{record.modulePath,jdbcType=VARCHAR},
</if>
<if test="record.modeId != null">
mode_id = #{record.modeId,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExample" parameterType="map">
update swagger_url_project
set id = #{record.id,jdbcType=VARCHAR},
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, project_id, swagger_url, module_id, module_path, mode_id
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.SwaggerUrlProjectExample"
resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
from swagger_url_project
<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 swagger_url_project
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete
from swagger_url_project
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.SwaggerUrlProjectExample">
delete from swagger_url_project
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.SwaggerUrlProject">
insert into swagger_url_project (id, project_id, swagger_url,
module_id, module_path, mode_id)
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{swaggerUrl,jdbcType=VARCHAR},
#{moduleId,jdbcType=VARCHAR}, #{modulePath,jdbcType=VARCHAR}, #{modeId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.SwaggerUrlProject">
insert into swagger_url_project
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="projectId != null">
project_id,
</if>
<if test="swaggerUrl != null">
swagger_url,
</if>
<if test="moduleId != null">
module_id,
</if>
<if test="modulePath != null">
module_path,
</if>
<if test="modeId != null">
mode_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="projectId != null">
#{projectId,jdbcType=VARCHAR},
</if>
<if test="swaggerUrl != null">
#{swaggerUrl,jdbcType=VARCHAR},
</if>
<if test="moduleId != null">
#{moduleId,jdbcType=VARCHAR},
</if>
<if test="modulePath != null">
#{modulePath,jdbcType=VARCHAR},
</if>
<if test="modeId != null">
#{modeId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.SwaggerUrlProjectExample"
resultType="java.lang.Long">
select count(*) from swagger_url_project
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update swagger_url_project
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.projectId != null">
project_id = #{record.projectId,jdbcType=VARCHAR},
</if>
<if test="record.swaggerUrl != null">
swagger_url = #{record.swaggerUrl,jdbcType=VARCHAR},
</if>
<if test="record.moduleId != null">
module_id = #{record.moduleId,jdbcType=VARCHAR},
</if>
<if test="record.modulePath != null">
module_path = #{record.modulePath,jdbcType=VARCHAR},
mode_id = #{record.modeId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.SwaggerUrlProject">
update swagger_url_project
<set>
<if test="projectId != null">
project_id = #{projectId,jdbcType=VARCHAR},
</if>
<if test="swaggerUrl != null">
swagger_url = #{swaggerUrl,jdbcType=VARCHAR},
</if>
<if test="moduleId != null">
module_id = #{moduleId,jdbcType=VARCHAR},
</if>
<if test="modulePath != null">
module_path = #{modulePath,jdbcType=VARCHAR},
</if>
<if test="modeId != null">
mode_id = #{modeId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.SwaggerUrlProject">
update swagger_url_project
set project_id = #{projectId,jdbcType=VARCHAR},
swagger_url = #{swaggerUrl,jdbcType=VARCHAR},
module_id = #{moduleId,jdbcType=VARCHAR},
module_path = #{modulePath,jdbcType=VARCHAR},
mode_id = #{modeId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</if>
<if test="record.modeId != null">
mode_id = #{record.modeId,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExample" parameterType="map">
update swagger_url_project
set id = #{record.id,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
swagger_url = #{record.swaggerUrl,jdbcType=VARCHAR},
module_id = #{record.moduleId,jdbcType=VARCHAR},
module_path = #{record.modulePath,jdbcType=VARCHAR},
mode_id = #{record.modeId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.SwaggerUrlProject">
update swagger_url_project
<set>
<if test="projectId != null">
project_id = #{projectId,jdbcType=VARCHAR},
</if>
<if test="swaggerUrl != null">
swagger_url = #{swaggerUrl,jdbcType=VARCHAR},
</if>
<if test="moduleId != null">
module_id = #{moduleId,jdbcType=VARCHAR},
</if>
<if test="modulePath != null">
module_path = #{modulePath,jdbcType=VARCHAR},
</if>
<if test="modeId != null">
mode_id = #{modeId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.SwaggerUrlProject">
update swagger_url_project
set project_id = #{projectId,jdbcType=VARCHAR},
swagger_url = #{swaggerUrl,jdbcType=VARCHAR},
module_id = #{moduleId,jdbcType=VARCHAR},
module_path = #{modulePath,jdbcType=VARCHAR},
mode_id = #{modeId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -1,8 +1,10 @@
package io.metersphere.controller;
import io.metersphere.base.domain.SystemParameter;
import io.metersphere.base.domain.UserHeader;
import io.metersphere.commons.constants.ParamConstants;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.controller.request.HeaderRequest;
import io.metersphere.dto.BaseSystemConfigDTO;
import io.metersphere.ldap.domain.LdapInfo;
import io.metersphere.notice.domain.MailInfo;
@ -67,4 +69,13 @@ public class SystemParameterController {
return SystemParameterService.getLdapInfo(ParamConstants.Classify.LDAP.getValue());
}
@PostMapping("save/header")
public void saveHeader(@RequestBody UserHeader userHeader) {
SystemParameterService.saveHeader(userHeader);
}
@PostMapping("/header/info")
public UserHeader getHeaderInfo(@RequestBody HeaderRequest headerRequest) {
return SystemParameterService.queryUserHeader(headerRequest);
}
}

View File

@ -0,0 +1,11 @@
package io.metersphere.controller.request;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class HeaderRequest {
private String userId;
private String type;
}

View File

@ -2,12 +2,16 @@ package io.metersphere.service;
import io.metersphere.base.domain.SystemParameter;
import io.metersphere.base.domain.SystemParameterExample;
import io.metersphere.base.domain.UserHeader;
import io.metersphere.base.domain.UserHeaderExample;
import io.metersphere.base.mapper.SystemParameterMapper;
import io.metersphere.base.mapper.UserHeaderMapper;
import io.metersphere.base.mapper.ext.ExtSystemParameterMapper;
import io.metersphere.commons.constants.ParamConstants;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.EncryptUtils;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.controller.request.HeaderRequest;
import io.metersphere.dto.BaseSystemConfigDTO;
import io.metersphere.i18n.Translator;
import io.metersphere.ldap.domain.LdapInfo;
@ -29,7 +33,8 @@ import java.util.*;
@Service
@Transactional(rollbackFor = Exception.class)
public class SystemParameterService {
@Resource
private UserHeaderMapper userHeaderMapper;
@Resource
private SystemParameterMapper systemParameterMapper;
@Resource
@ -233,4 +238,16 @@ public class SystemParameterService {
example.clear();
});
}
//保存表头
public void saveHeader(UserHeader userHeader) {
userHeader.setId(UUID.randomUUID().toString());
userHeaderMapper.insert(userHeader);
}
public UserHeader queryUserHeader(HeaderRequest headerRequest) {
UserHeaderExample example = new UserHeaderExample();
example.createCriteria().andUserIdEqualTo(headerRequest.getUserId()).andTypeEqualTo(headerRequest.getType());
return userHeaderMapper.selectByExample(example).get(0);
}
}

View File

@ -0,0 +1,10 @@
create table user_header
(
id varchar(50) not null,
user_id varchar(50) null,
props varchar(1000) null,
type varchar(150) null,
constraint user_header_pk
primary key (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4

View File

@ -66,6 +66,7 @@
<table tableName="auth_source"/>
<table tableName="swagger_url_project"/>
<table tableName="user_header"/>
<!--<table tableName="test_plan_api_scenario"/>-->
<!--<table tableName="test_plan"/>-->
<!--<table tableName="api_scenario_report"/>-->

View File

@ -0,0 +1,64 @@
<template>
<el-dialog title="表头显示字段" :visible.sync="dialogTableVisible" :append-to-body="true">
<template>
<el-transfer
:titles="['待选字段', '已选字段']"
v-model="value"
:props="{
key: 'prop',
label: 'label'
}"
:data="optionalField"
></el-transfer>
</template>
<template v-slot:footer>
<ms-dialog-footer
@cancel="close"
@confirm="saveHeader"
/>
</template>
</el-dialog>
</template>
<script>
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
import {getCurrentUser} from "@/common/js/utils";
import {TEST_CASE_LIST} from "@/common/js/constants";
export default {
name: "HeaderCustom",
components: {MsDialogFooter},
data() {
return {
dialogTableVisible: false,
optionalField: [],
value: [],
fieldSelected:[]
}
},
methods: {
open(items) {
console.log(items)
this.dialogTableVisible = true
this.optionalField = items
},
saveHeader() {
let param={
userId:getCurrentUser().id,
type:TEST_CASE_LIST,
props:JSON.stringify(this.value)
}
this.$post("/system/save/header",param,response=>{
this.$success(this.$t("commons.save_success"));
this.dialogTableVisible = false
})
},
close() {
}
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,15 @@
import i18n from '../../../../i18n/i18n'
//自定义默认表头
export const Track_Test_Case=[
{prop: 'num', label: i18n.t('commons.id')},
{prop: 'name', label: i18n.t('commons.name')},
{prop: 'priority', label: i18n.t('test_track.case.priority')},
{prop: 'type', label: i18n.t('test_track.case.type')},
{prop: 'method', label: i18n.t('test_track.case.method')},
{prop: 'reviewStatus', label:i18n.t('test_track.case.status')},
{prop: 'tags', label: i18n.t('commons.tag')},
{prop: 'nodePath', label: i18n.t('test_track.case.module')},
{prop: 'updateTime', label: i18n.t('commons.update_time')},
{prop: 'operating', label: i18n.t('commons.operating')},
]

View File

@ -1,136 +0,0 @@
<template>
<el-dialog
title="表头显示字段"
:visible.sync="centerDialogVisible"
width="50%"
>
<el-divider style="margin-top: 0;margin-right: 10px"></el-divider>
<el-form :inline="true" :model="headerItem" class="demo-form-inline" type="selection">
<el-row :gutter="20">
<el-col :span="10">
<label>可选择字段可选择字段:{{ this.headerItem.optionalField.length }}</label>
<div class="grid-content bg-purple" style="margin-top: 25px">
<el-form-item>
<el-card class="box-card">
<div v-for="item in headerItem.optionalField" :key="item.prop" class="text item"
@click="selectItem(item)">
<input type="checkbox"/>
<label>{{ item.name }}</label>
</div>
</el-card>
</el-form-item>
</div>
</el-col>
<el-col :span="4">
<div class="grid-content bg-purple" style="margin-top: 160px">
<el-form-item>
<el-button size="medium" round @click="addItem">添加</el-button>
<!-- <i class="el-icon-arrow-right" @click="addItem"></i>-->
</el-form-item>
<el-form-item>
<el-button size="medium" round>移除</el-button>
<!-- <i class="el-icon-arrow-right" @click="addItem"></i>-->
</el-form-item>
</div>
</el-col>
<el-col :span="10">
<label>已选择字段</label>
<div class="grid-content bg-purple" style="margin-top: 25px">
<el-form-item>
<el-card class="box-card">
<div v-for="item in headerItem.fieldSelected" :key="item.prop" class="text item"
@click="moveItem(item)">
<el-checkbox v-model="checked1">{{ item.name }}</el-checkbox>
</div>
</el-card>
</el-form-item>
</div>
</el-col>
</el-row>
<el-form-item>
<el-button type="primary" style="margin-right: 0" @click="save('headerItem')">保存</el-button>
</el-form-item>
</el-form>
</el-dialog>
</template>
<script>
export default {
name: "CustomHeader",
data() {
return {
centerDialogVisible: false,
headerItem: {
optionalField: [
{prop: 'name', name: '名称'},
{prop: 'name', name: '名称'},
{prop: 'name', name: '名称'},
{prop: 'name', name: '名称'},
{prop: 'name', name: '名称'},
{prop: 'name', name: '名称'},
{prop: 'name', name: '名称'},
{prop: 'name', name: '名称'},
],
fieldSelected: []
},
selectItems: [],
checked1: false
};
},
methods: {
open() {
this.centerDialogVisible = true
},
selectItem(item) {
this.checked1 = !this.checked1
this.selectItems.push(item)
},
//
moveItem(item) {
this.headerItem.fieldSelected.remove(item)
},
//
addItem() {
console.log(this.selectItems)
this.headerItem.fieldSelected = this.selectItems
console.log(this.headerItem.fieldSelected)
},
save(headerItem) {
}
}
}
</script>
<style scoped>
.text {
font-size: 14px;
}
.item {
margin-bottom: 18px;
}
.clearfix:before,
.clearfix:after {
display: table;
content: "";
}
.clearfix:after {
clear: both
}
.box-card {
width: 250px;
height: 400px;
overflow: auto;
}
</style>

View File

@ -34,7 +34,6 @@
row-key="id"
class="test-content adjust-table ms-select-all-fixed"
ref="table" @row-click="handleEdit">
<el-table-column
width="50"
type="selection"/>
@ -50,126 +49,141 @@
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectDataCounts"/>
</template>
</el-table-column>
<el-table-column
prop="num"
sortable="custom"
:label="$t('commons.id')"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="name"
:label="$t('commons.name')"
show-overflow-tooltip
>
<template v-slot:default="scope">
<!--<div @mouseover="showDetail(scope.row)">
<p>{{ scope.row.name }}</p>
</div>-->
<el-popover
placement="right-end"
:title="$t('test_track.case.view_case')"
trigger="hover"
>
<test-case-detail v-if="currentCaseId === scope.row.id" :test-case-id="currentCaseId"/>
<span slot="reference">{{ scope.row.name }}</span>
</el-popover>
</template>
</el-table-column>
<el-table-column
prop="priority"
:filters="priorityFilters"
column-key="priority"
min-width="100px"
:label="$t('test_track.case.priority')"
show-overflow-tooltip>
<template v-slot:default="scope">
<priority-table-item :value="scope.row.priority"/>
</template>
</el-table-column>
<el-table-column
prop="type"
:filters="typeFilters"
column-key="type"
:label="$t('test_track.case.type')"
show-overflow-tooltip>
<template v-slot:default="scope">
<type-table-item :value="scope.row.type"/>
</template>
</el-table-column>
<el-table-column
prop="method"
column-key="method"
:filters="methodFilters"
min-width="100px"
:label="$t('test_track.case.method')"
show-overflow-tooltip>
<template v-slot:default="scope">
<method-table-item :value="scope.row.method"/>
</template>
</el-table-column>
<template v-for="(item, index) in tableLabel">
<el-table-column
:filters="statusFilters"
column-key="status"
min-width="100px"
:label="$t('test_track.case.status')">
<template v-slot:default="scope">
<el-table-column
v-if="item.prop == 'num'"
prop="num"
sortable="custom"
:label="$t('commons.id')"
:key="index"
show-overflow-tooltip>
</el-table-column>
<el-table-column
v-if="item.prop == 'name'"
prop="name"
:label="$t('commons.name')"
show-overflow-tooltip
:key="index"
>
<template v-slot:default="scope">
<!--<div @mouseover="showDetail(scope.row)">
<p>{{ scope.row.name }}</p>
</div>-->
<el-popover
placement="right-end"
:title="$t('test_track.case.view_case')"
trigger="hover"
>
<test-case-detail v-if="currentCaseId === scope.row.id" :test-case-id="currentCaseId"/>
<span slot="reference">{{ scope.row.name }}</span>
</el-popover>
</template>
</el-table-column>
<el-table-column
v-if="item.prop == 'priority'"
prop="priority"
:filters="priorityFilters"
column-key="priority"
min-width="100px"
: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 == 'type'"
prop="type"
:filters="typeFilters"
column-key="type"
:label="$t('test_track.case.type')"
show-overflow-tooltip
:key="index">
<template v-slot:default="scope">
<type-table-item :value="scope.row.type"/>
</template>
</el-table-column>
<el-table-column
v-if="item.prop=='method'"
prop="method"
column-key="method"
:filters="methodFilters"
min-width="100px"
:label="$t('test_track.case.method')"
show-overflow-tooltip
:key="index">
<template v-slot:default="scope">
<method-table-item :value="scope.row.method"/>
</template>
</el-table-column>
<el-table-column
v-if="item.prop=='status'"
:filters="statusFilters"
column-key="status"
min-width="100px"
:label="$t('test_track.case.status')"
:key="index">
<template v-slot:default="scope">
<span class="el-dropdown-link">
<review-status :value="scope.row.reviewStatus"/>
</span>
</template>
</el-table-column>
</template>
</el-table-column>
<el-table-column 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 v-if="item.prop=='tags'" prop="tags" :label="$t('commons.tag')" :key="index">
<template v-slot:default="scope">
<div v-for="(itemName,index) in scope.row.tags" :key="index">
<ms-tag type="success" effect="plain" :content="itemName"/>
</div>
</template>
</el-table-column>
<el-table-column
prop="nodePath"
:label="$t('test_track.case.module')"
min-width="150px"
show-overflow-tooltip>
</el-table-column>
<el-table-column
v-if="item.prop=='nodePath'"
prop="nodePath"
:label="$t('test_track.case.module')"
min-width="150px"
show-overflow-tooltip
:key="index">
</el-table-column>
<el-table-column
prop="updateTime"
sortable="custom"
:label="$t('commons.update_time')"
min-width="150px"
show-overflow-tooltip>
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column fixed="right"
:label="$t('commons.operating')" min-width="150">
<el-table-column fixed="right" min-width="150">
<template slot="header">
<el-table-column
v-if="item.prop=='updateTime'"
prop="updateTime"
sortable="custom"
:label="$t('commons.update_time')"
min-width="150px"
show-overflow-tooltip
:key="index">
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column v-if="item.prop=='operating'" fixed="right" min-width="150" :key="index">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
</template>
<template v-slot:default="scope">
<ms-table-operator :is-tester-permission="true" @editClick="handleEdit(scope.row)"
@deleteClick="handleDelete(scope.row)">
<template v-slot:middle>
<ms-table-operator-button :is-tester-permission="true" :tip="$t('commons.copy')"
icon="el-icon-document-copy"
type="success" @exec="handleCopy(scope.row)"/>
</template>
</ms-table-operator>
</template>
</el-table-column>
</template>
<template v-slot:default="scope">
<ms-table-operator :is-tester-permission="true" @editClick="handleEdit(scope.row)"
@deleteClick="handleDelete(scope.row)">
<template v-slot:middle>
<ms-table-operator-button :is-tester-permission="true" :tip="$t('commons.copy')"
icon="el-icon-document-copy"
type="success" @exec="handleCopy(scope.row)"/>
</template>
</ms-table-operator>
</template>
</el-table-column>
</template>
<header-custom ref="headerCustom"></header-custom>
<ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
</el-table>
<custom-header ref="customHeader"/>
<ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
</el-card>
<batch-edit ref="batchEdit" @batchEdit="batchEdit"
@ -198,12 +212,12 @@ import MsTableButton from "../../../common/components/MsTableButton";
import {TEST_CASE_CONFIGS} from "../../../common/components/search/search-components";
import ShowMoreBtn from "./ShowMoreBtn";
import BatchEdit from "./BatchEdit";
import {WORKSPACE_ID} from "@/common/js/constants";
import {TEST_CASE_LIST, WORKSPACE_ID} from "@/common/js/constants";
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
import StatusTableItem from "@/business/components/track/common/tableItems/planview/StatusTableItem";
import TestCaseDetail from "./TestCaseDetail";
import ReviewStatus from "@/business/components/track/case/components/ReviewStatus";
import {getCurrentProjectID} from "../../../../../common/js/utils";
import {getCurrentProjectID, getCurrentUser} from "../../../../../common/js/utils";
import MsTag from "@/business/components/common/components/MsTag";
import {
_filter,
@ -215,12 +229,13 @@ import {
toggleAllSelection
} from "@/common/js/tableUtils";
import BatchMove from "./BatchMove";
import CustomHeader from "@/business/components/track/case/components/CustomHeader";
import {Track_Test_Case} from "@/business/components/common/model/JsonData";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
export default {
name: "TestCaseList",
components: {
CustomHeader,
HeaderCustom,
BatchMove,
MsTableHeaderSelectPopover,
MsTableButton,
@ -244,11 +259,8 @@ export default {
},
data() {
return {
cols: [{label: "id", prop: "num"},
{label: "名称", prop: "name"},
{label: "级别", prop: "priority"},
{label: "类型", prop: "type"},
{label: "测试方式", prop: "method"}],
//
tableLabel:Track_Test_Case,
result: {},
deletePath: "/test/case/delete",
condition: {
@ -347,10 +359,9 @@ export default {
},
methods: {
customHeader() {
this.$refs.customHeader.open()
this.$refs.headerCustom.open(this.tableLabel)
},
initTableData() {
this.projectId = getCurrentProjectID();
this.condition.planId = "";
this.condition.nodeIds = [];
@ -365,8 +376,23 @@ export default {
// param.nodeIds = this.selectNodeIds;
this.condition.nodeIds = this.selectNodeIds;
}
this.getLabel()
this.getData();
},
getLabel(){
let param={}
param.userId=getCurrentUser().id;
param.type=TEST_CASE_LIST
this.result=this.$post('/system/header/info',param,response=>{
console.log(response.data)
/*if(response.data){
this.tableLabel=response.data.props
}else{
this.tableLabel=Track_Test_Case
}*/
})
},
getData() {
if (this.projectId) {
this.condition.projectId = this.projectId;
@ -576,9 +602,9 @@ export default {
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
toggleAllSelection(this.$refs.table, this.tableData, this.selectRows);
},
headerDragend(newWidth,oldWidth,column,event){
headerDragend(newWidth, oldWidth, column, event) {
let finalWidth = newWidth;
if(column.minWidth>finalWidth){
if (column.minWidth > finalWidth) {
finalWidth = column.minWidth;
}
column.width = finalWidth;

View File

@ -1,3 +1,4 @@
export const TEST_CASE_LIST='test_case_list'
export const TokenKey = 'Admin-Token';
export const LicenseKey = 'License';
export const DEFAULT_LANGUAGE = 'default_language';