Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
b9c369ec
M
metersphere
项目概览
MeterSphere
/
metersphere
上一次同步 大约 3 年
通知
25
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
metersphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b9c369ec
编写于
7月 13, 2020
作者:
S
shiziyuan9527
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 关联测试用例页面添加高级搜索
上级
b2d036a8
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
200 addition
and
15 deletion
+200
-15
backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml
...java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml
+110
-3
backend/src/main/java/io/metersphere/track/request/testcase/QueryTestCaseRequest.java
...ersphere/track/request/testcase/QueryTestCaseRequest.java
+2
-0
frontend/src/business/components/common/components/search/MsTableAdvSearchBar.vue
...mponents/common/components/search/MsTableAdvSearchBar.vue
+1
-1
frontend/src/business/components/common/components/search/search-components.js
.../components/common/components/search/search-components.js
+65
-0
frontend/src/business/components/track/plan/view/comonents/TestCaseRelevance.vue
...omponents/track/plan/view/comonents/TestCaseRelevance.vue
+22
-11
未找到文件。
backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml
浏览文件 @
b9c369ec
...
...
@@ -2,13 +2,120 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"io.metersphere.base.mapper.ext.ExtTestCaseMapper"
>
<sql
id=
"condition"
>
<choose>
<when
test=
'${object}.operator == "like"'
>
like CONCAT('%', #{${object}.value},'%')
</when>
<when
test=
'${object}.operator == "not like"'
>
not like CONCAT('%', #{${object}.value},'%')
</when>
<when
test=
'${object}.operator == "in"'
>
in
<foreach
collection=
"${object}.value"
item=
"v"
separator=
","
open=
"("
close=
")"
>
#{v}
</foreach>
</when>
<when
test=
'${object}.operator == "not in"'
>
not in
<foreach
collection=
"${object}.value"
item=
"v"
separator=
","
open=
"("
close=
")"
>
#{v}
</foreach>
</when>
<when
test=
'${object}.operator == "between"'
>
between #{${object}.value[0]} and #{${object}.value[1]}
</when>
<when
test=
'${object}.operator == "gt"'
>
>
#{${object}.value}
</when>
<when
test=
'${object}.operator == "lt"'
>
<
#{${object}.value}
</when>
<when
test=
'${object}.operator == "ge"'
>
>
= #{${object}.value}
</when>
<when
test=
'${object}.operator == "le"'
>
<
= #{${object}.value}
</when>
<when
test=
'${object}.operator == "current user"'
>
= '${@io.metersphere.commons.utils.SessionUtils@getUserId()}'
</when>
<otherwise>
= #{${object}.value}
</otherwise>
</choose>
</sql>
<sql
id=
"combine"
>
<if
test=
"${condition}.name != null"
>
and test_case.name
<include
refid=
"condition"
>
<property
name=
"object"
value=
"${condition}.name"
/>
</include>
</if>
<if
test=
"${condition}.module != null"
>
and test_case.node_path
<include
refid=
"condition"
>
<property
name=
"object"
value=
"${condition}.module"
/>
</include>
</if>
<if
test=
"${condition}.priority != null"
>
and test_case.priority
<include
refid=
"condition"
>
<property
name=
"object"
value=
"${condition}.priority"
/>
</include>
</if>
<if
test=
"${condition}.createTime != null"
>
and test_case.create_time
<include
refid=
"condition"
>
<property
name=
"object"
value=
"${condition}.createTime"
/>
</include>
</if>
<if
test=
"${condition}.type != null"
>
and test_case.type
<include
refid=
"condition"
>
<property
name=
"object"
value=
"${condition}.type"
/>
</include>
</if>
<if
test=
"${condition}.updateTime != null"
>
and test_case.update_time
<include
refid=
"condition"
>
<property
name=
"object"
value=
"${condition}.updateTime"
/>
</include>
</if>
<if
test=
"${condition}.method != null"
>
and test_case.method
<include
refid=
"condition"
>
<property
name=
"object"
value=
"${condition}.method"
/>
</include>
</if>
<if
test=
"${condition}.creator != null"
>
and test_case.maintainer
<include
refid=
"condition"
>
<property
name=
"object"
value=
"${condition}.creator"
/>
</include>
</if>
</sql>
<select
id=
"getTestCaseNames"
resultType=
"io.metersphere.base.domain.TestCase"
>
select test_case.id, test_case.name, test_case.priority, test_case.type
from test_case
<where>
<if
test=
"request.name != null"
>
and test_case.name like CONCAT('%', #{request.name},'%')
</if>
<choose>
<!--高级-->
<when
test=
"request.combine != null"
>
<include
refid=
"combine"
>
<property
name=
"condition"
value=
"request.combine"
/>
</include>
</when>
<!--普通-->
<otherwise>
<if
test=
"request.name != null"
>
and test_case.name like CONCAT('%', #{request.name},'%')
</if>
</otherwise>
</choose>
<if
test=
"request.projectId != null"
>
AND test_case.project_id = #{request.projectId}
</if>
...
...
backend/src/main/java/io/metersphere/track/request/testcase/QueryTestCaseRequest.java
浏览文件 @
b9c369ec
...
...
@@ -23,4 +23,6 @@ public class QueryTestCaseRequest extends TestCase {
private
String
planId
;
private
String
workspaceId
;
private
Map
<
String
,
Object
>
combine
;
}
frontend/src/business/components/common/components/search/MsTableAdvSearchBar.vue
浏览文件 @
b9c369ec
<
template
>
<span
class=
"adv-search-bar"
>
<el-link
type=
"primary"
@
click=
"open"
>
{{
$t
(
'
commons.adv_search.title
'
)
}}
</el-link>
<el-dialog
:title=
"$t('commons.adv_search.combine')"
:visible.sync=
"visible"
width=
"70%"
>
<el-dialog
:title=
"$t('commons.adv_search.combine')"
:visible.sync=
"visible"
width=
"70%"
:append-to-body=
"true"
>
<div>
<!-- 如果有需求再加上-->
<!--
<div
class=
"search-label"
>
{{
$t
(
'
commons.adv_search.combine
'
)
}}
:
</div>
-->
...
...
frontend/src/business/components/common/components/search/search-components.js
浏览文件 @
b9c369ec
...
...
@@ -161,6 +161,67 @@ export const TRIGGER_MODE = {
}
}
export
const
PRIORITY
=
{
key
:
"
priority
"
,
name
:
'
MsTableSearchSelect
'
,
label
:
i18n
.
t
(
"
test_track.case.priority
"
),
operator
:
{
options
:
[
OPERATORS
.
IN
,
OPERATORS
.
NOT_IN
]
},
options
:
[
{
label
:
"
P0
"
,
value
:
"
P0
"
},
{
label
:
"
P1
"
,
value
:
"
P1
"
},
{
label
:
"
P2
"
,
value
:
"
P2
"
},
{
label
:
"
P3
"
,
value
:
"
P3
"
},
],
props
:
{
multiple
:
true
}
}
export
const
TYPE
=
{
key
:
"
type
"
,
name
:
'
MsTableSearchSelect
'
,
label
:
i18n
.
t
(
"
test_track.case.type
"
),
operator
:
{
options
:
[
OPERATORS
.
IN
,
OPERATORS
.
NOT_IN
]
},
options
:
[
{
label
:
i18n
.
t
(
'
commons.functional
'
),
value
:
'
functional
'
},
{
label
:
i18n
.
t
(
'
commons.performance
'
),
value
:
'
performance
'
},
{
label
:
i18n
.
t
(
'
commons.api
'
),
value
:
'
api
'
}
],
props
:
{
multiple
:
true
}
}
export
const
METHOD
=
{
key
:
"
method
"
,
name
:
'
MsTableSearchSelect
'
,
label
:
i18n
.
t
(
"
test_track.case.method
"
),
operator
:
{
options
:
[
OPERATORS
.
IN
,
OPERATORS
.
NOT_IN
]
},
options
:
[
{
label
:
i18n
.
t
(
'
test_track.case.manual
'
),
value
:
'
manual
'
},
{
label
:
i18n
.
t
(
'
test_track.case.auto
'
),
value
:
'
auto
'
}
],
props
:
{
multiple
:
true
}
}
export
const
MODULE
=
{
key
:
"
module
"
,
name
:
'
MsTableSearchInput
'
,
label
:
i18n
.
t
(
"
test_track.case.module
"
),
operator
:
{
value
:
OPERATORS
.
LIKE
.
value
,
// 如果未设置value初始值,则value初始值为options[0]
options
:
[
OPERATORS
.
LIKE
,
OPERATORS
.
NOT_LIKE
]
// 运算符候选项
},
}
export
const
getTestConfigs
=
()
=>
{
return
_
.
cloneDeep
([
NAME
,
UPDATE_TIME
,
PROJECT_NAME
,
CREATE_TIME
,
STATUS
,
CREATOR
]);
}
...
...
@@ -168,3 +229,7 @@ export const getTestConfigs = () => {
export
const
getReportConfigs
=
()
=>
{
return
_
.
cloneDeep
([
NAME
,
TEST_NAME
,
PROJECT_NAME
,
CREATE_TIME
,
STATUS
,
CREATOR
,
TRIGGER_MODE
]);
}
export
const
getTestCaseConfigs
=
()
=>
{
return
_
.
cloneDeep
([
NAME
,
MODULE
,
PRIORITY
,
CREATE_TIME
,
TYPE
,
UPDATE_TIME
,
METHOD
,
CREATOR
]);
}
frontend/src/business/components/track/plan/view/comonents/TestCaseRelevance.vue
浏览文件 @
b9c369ec
...
...
@@ -19,11 +19,7 @@
<el-container>
<el-main
class=
"case-content"
v-loading=
"result.loading"
>
<el-row>
<el-col
:offset=
"16"
:span=
"8"
>
<ms-table-search-bar
:condition.sync=
"condition"
@
change=
"initData"
/>
</el-col>
</el-row>
<ms-table-header
:condition.sync=
"condition"
@
search=
"getCaseNames"
title=
""
:show-create=
"false"
/>
<el-table
:data=
"testCases"
@
filter-change=
"filter"
...
...
@@ -86,10 +82,21 @@
import
TypeTableItem
from
"
../../../common/tableItems/planview/TypeTableItem
"
;
import
{
_filter
}
from
"
../../../../../../common/js/utils
"
;
import
MsTableSearchBar
from
"
../../../../common/components/MsTableSearchBar
"
;
import
MsTableAdvSearchBar
from
"
../../../../common/components/search/MsTableAdvSearchBar
"
;
import
MsTableHeader
from
"
../../../../common/components/MsTableHeader
"
;
import
{
getTestCaseConfigs
}
from
"
../../../../common/components/search/search-components
"
;
export
default
{
name
:
"
TestCaseRelevance
"
,
components
:
{
NodeTree
,
MsDialogFooter
,
PriorityTableItem
,
TypeTableItem
,
MsTableSearchBar
},
components
:
{
NodeTree
,
MsDialogFooter
,
PriorityTableItem
,
TypeTableItem
,
MsTableSearchBar
,
MsTableAdvSearchBar
,
MsTableHeader
},
data
()
{
return
{
result
:
{},
...
...
@@ -100,7 +107,9 @@
treeNodes
:
[],
selectNodeIds
:
[],
selectNodeNames
:
[],
condition
:
{},
condition
:
{
components
:
getTestCaseConfigs
()
},
priorityFilters
:
[
{
text
:
'
P0
'
,
value
:
'
P0
'
},
{
text
:
'
P1
'
,
value
:
'
P1
'
},
...
...
@@ -143,17 +152,19 @@
this
.
$emit
(
'
refresh
'
);
});
},
getCaseNames
()
{
getCaseNames
(
combine
)
{
let
param
=
{};
// 只有在点击高级搜索的查询按钮时combine才有值
let
condition
=
combine
?
{
combine
:
combine
}
:
this
.
condition
;
if
(
this
.
planId
)
{
// param.planId = this.planId;
this
.
condition
.
planId
=
this
.
planId
;
condition
.
planId
=
this
.
planId
;
}
if
(
this
.
selectNodeIds
&&
this
.
selectNodeIds
.
length
>
0
)
{
// param.nodeIds = this.selectNodeIds;
this
.
condition
.
nodeIds
=
this
.
selectNodeIds
;
condition
.
nodeIds
=
this
.
selectNodeIds
;
}
this
.
result
=
this
.
$post
(
'
/test/case/name
'
,
this
.
condition
,
response
=>
{
this
.
result
=
this
.
$post
(
'
/test/case/name
'
,
condition
,
response
=>
{
this
.
testCases
=
response
.
data
;
this
.
testCases
.
forEach
(
item
=>
{
item
.
checked
=
false
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录