Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
b3e14a64
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,发现更多精彩内容 >>
提交
b3e14a64
编写于
4月 02, 2020
作者:
C
chenjianxing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
关联测试用例页面
上级
d800a15a
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
95 addition
and
115 deletion
+95
-115
backend/src/main/java/io/metersphere/controller/TestCaseController.java
...in/java/io/metersphere/controller/TestCaseController.java
+1
-1
backend/src/main/java/io/metersphere/controller/TestCaseNodeController.java
...ava/io/metersphere/controller/TestCaseNodeController.java
+5
-0
backend/src/main/java/io/metersphere/service/TestCaseNodeService.java
...main/java/io/metersphere/service/TestCaseNodeService.java
+10
-0
frontend/src/business/components/track/plan/TestPlanView.vue
frontend/src/business/components/track/plan/TestPlanView.vue
+2
-3
frontend/src/business/components/track/plan/components/PlanNodeTree.vue
...usiness/components/track/plan/components/PlanNodeTree.vue
+6
-15
frontend/src/business/components/track/plan/components/TestCasePlanList.vue
...ess/components/track/plan/components/TestCasePlanList.vue
+2
-2
frontend/src/business/components/track/plan/components/TestCaseRelevance.vue
...ss/components/track/plan/components/TestCaseRelevance.vue
+69
-94
未找到文件。
backend/src/main/java/io/metersphere/controller/TestCaseController.java
浏览文件 @
b3e14a64
...
...
@@ -34,7 +34,7 @@ public class TestCaseController {
}
@PostMapping
(
"/list"
)
public
List
<
TestCase
>
getTestCaseBy
Project
Id
(
@RequestBody
List
<
Integer
>
nodeIds
){
public
List
<
TestCase
>
getTestCaseBy
Node
Id
(
@RequestBody
List
<
Integer
>
nodeIds
){
return
testCaseService
.
getTestCaseByNodeId
(
nodeIds
);
}
...
...
backend/src/main/java/io/metersphere/controller/TestCaseNodeController.java
浏览文件 @
b3e14a64
...
...
@@ -20,6 +20,11 @@ public class TestCaseNodeController {
return
testCaseNodeService
.
getNodeTreeByProjectId
(
projectId
);
}
@GetMapping
(
"/list/all/plan/{planId}"
)
public
List
<
TestCaseNodeDTO
>
getAllNodeByPlanId
(
@PathVariable
String
planId
){
return
testCaseNodeService
.
getAllNodeByPlanId
(
planId
);
}
@GetMapping
(
"/list/plan/{planId}"
)
public
List
<
TestCaseNodeDTO
>
getNodeByPlanId
(
@PathVariable
String
planId
){
return
testCaseNodeService
.
getNodeByPlanId
(
planId
);
...
...
backend/src/main/java/io/metersphere/service/TestCaseNodeService.java
浏览文件 @
b3e14a64
...
...
@@ -113,6 +113,12 @@ public class TestCaseNodeService {
return
testCaseNodeMapper
.
deleteByExample
(
testCaseNodeExample
);
}
/**
* 获取当前计划下
* 有关联数据的节点
* @param planId
* @return
*/
public
List
<
TestCaseNodeDTO
>
getNodeByPlanId
(
String
planId
)
{
TestPlan
testPlan
=
testPlanMapper
.
selectByPrimaryKey
(
planId
);
...
...
@@ -177,4 +183,8 @@ public class TestCaseNodeService {
return
false
;
}
public
List
<
TestCaseNodeDTO
>
getAllNodeByPlanId
(
String
planId
)
{
TestPlan
testPlan
=
testPlanMapper
.
selectByPrimaryKey
(
planId
);
return
getNodeTreeByProjectId
(
testPlan
.
getProjectId
());
}
}
frontend/src/business/components/track/plan/TestPlanView.vue
浏览文件 @
b3e14a64
...
...
@@ -51,9 +51,8 @@
get
()
{
},
openTestCaseRelevanceDialog
(
data
)
{
this
.
$refs
.
testCaseRelevance
.
dialogFormVisible
=
true
;
this
.
$refs
.
testCaseRelevance
.
getCaseNames
(
this
.
planId
);
openTestCaseRelevanceDialog
()
{
this
.
$refs
.
testCaseRelevance
.
openTestCaseRelevanceDialog
(
this
.
planId
);
},
getCaseByNodeIds
()
{
...
...
frontend/src/business/components/track/plan/components/PlanNodeTree.vue
浏览文件 @
b3e14a64
...
...
@@ -18,12 +18,11 @@
</el-tree>
</div>
</
template
>
<
script
>
export
default
{
name
:
"
NodeTree
"
,
name
:
"
Plan
NodeTree
"
,
data
()
{
return
{
filterText
:
''
,
...
...
@@ -31,31 +30,23 @@
children
:
'
children
'
,
label
:
'
label
'
},
form
:
{
name
:
''
,
},
formLabelWidth
:
'
80px
'
,
dialogTableVisible
:
false
,
dialogFormVisible
:
false
,
editType
:
''
,
editData
:
{},
treeNodes
:
[],
defaultKeys
:
[]
};
},
props
:
{
planId
:
{
type
:
String
}
},
treeNodes
:
{
Array
},
},
watch
:
{
filterText
(
val
)
{
this
.
$refs
.
tree
.
filter
(
val
);
}
},
created
()
{
this
.
getNodeTree
();
},
methods
:
{
handleDragEnd
(
draggingNode
,
dropNode
,
dropType
,
ev
)
{
let
param
=
{};
...
...
@@ -91,7 +82,7 @@
if
(
!
value
)
return
true
;
return
data
.
label
.
indexOf
(
value
)
!==
-
1
;
},
getNodeTree
()
{
getNodeTree
ByNodeIds
()
{
if
(
this
.
planId
){
this
.
$get
(
"
/case/node/list/plan/
"
+
this
.
planId
,
response
=>
{
this
.
treeNodes
=
response
.
data
;
...
...
frontend/src/business/components/track/plan/components/TestCasePlanList.vue
浏览文件 @
b3e14a64
...
...
@@ -8,9 +8,9 @@
<span
class=
"title"
>
{{
$t
(
'
test_track.test_case
'
)
}}
</span>
</el-col>
<el-col
:span=
"1"
:offset=
"
8
"
>
<el-col
:span=
"1"
:offset=
"
6
"
>
<el-button
icon=
"el-icon-circle-plus-outline"
size=
"small"
round
@
click=
"$emit('openTestCaseRelevanceDialog')"
>
{{
$t
(
'
commons.create
'
)
}}
</el-button>
@
click=
"$emit('openTestCaseRelevanceDialog')"
>
关联测试用例
</el-button>
</el-col>
<el-col
:span=
"1"
>
...
...
frontend/src/business/components/track/plan/components/TestCaseRelevance.vue
浏览文件 @
b3e14a64
...
...
@@ -2,32 +2,35 @@
<div>
<el-dialog
:title=
"$t('test_track.create')
"
<el-dialog
title=
"关联测试用例
"
:visible.sync=
"dialogFormVisible"
width=
"65%"
>
<el-container
style=
"min-height: 350px"
>
<el-aside
class=
"node_tree"
width=
"200px"
style=
"background-color: rgb(238, 241, 246)"
>
<plan-node-tree></plan-node-tree>
<el-container
class=
"main-content"
>
<el-aside
class=
"node-tree"
width=
"250px"
>
<plan-node-tree
:tree-nodes=
"treeNodes"
ref=
"tree"
></plan-node-tree>
</el-aside>
<el-container>
<el-header
>
<el-checkbox
></el-checkbox>
</el-header>
<el-main
style=
"height: 100px;"
>
<el-main
class=
"case-content"
>
<el-scrollbar
style=
"height:100%"
>
<el-table
:data=
"testCases"
>
:data=
"testCases"
row-key=
"id"
@
select-all=
"handleSelectAll"
@
select=
"handleSelectionChange"
ref=
"table"
>
<el-table-column
type=
"selection"
:reserve-selection=
"true"
></el-table-column>
<el-table-column
prop=
"name"
label=
"用例名称"
style=
"width: 100%"
>
<template
slot=
"header"
>
<el-checkbox
v-model=
"checkAll"
></el-checkbox>
用例名称
</
template
>
<template
slot-scope=
"scope"
>
<el-checkbox
v-model=
"scope.row.checked"
></el-checkbox>
{{
scope
.
row
.
name
}}
</
template
>
</el-table-column>
...
...
@@ -35,11 +38,8 @@
</el-scrollbar>
</el-main>
</el-container>
</el-container>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"dialogFormVisible = false"
>
...
...
@@ -47,13 +47,12 @@
</el-button>
<el-button
type=
"primary"
@
click=
"saveCase"
>
@
click=
"saveCase
Relevance
"
>
{{$t('test_track.confirm')}}
</el-button>
</div>
</el-dialog>
</div>
...
...
@@ -61,94 +60,31 @@
<
script
>
import
{
CURRENT_PROJECT
}
from
'
../../../../../common/constants
'
;
import
PlanNodeTree
from
'
./PlanNodeTree
'
;
export
default
{
name
:
"
TestCase
Edit
"
,
name
:
"
TestCase
Relevance
"
,
components
:
{
PlanNodeTree
},
data
()
{
return
{
dialogFormVisible
:
false
,
count
:
6
,
checkAll
:
false
,
isCheckAll
:
false
,
testCases
:
[],
form
:
{
name
:
''
,
}
selectIds
:
new
Set
(),
treeNodes
:
[]
};
},
methods
:
{
openTestCaseEditDialog
(
testCase
)
{
this
.
resetForm
();
this
.
operationType
=
'
add
'
;
if
(
testCase
){
//修改
this
.
operationType
=
'
edit
'
;
let
tmp
=
{};
Object
.
assign
(
tmp
,
testCase
);
tmp
.
steps
=
JSON
.
parse
(
testCase
.
steps
);
Object
.
assign
(
this
.
form
,
tmp
);
this
.
form
.
module
=
testCase
.
nodeId
;
}
openTestCaseRelevanceDialog
(
planId
)
{
console
.
log
(
planId
);
this
.
getNodeTreeByPlanId
(
planId
);
console
.
log
(
this
.
$refs
);
this
.
getCaseNames
(
planId
);
this
.
dialogFormVisible
=
true
;
},
handleAddStep
(
index
,
data
)
{
let
step
=
{};
step
.
num
=
data
.
num
+
1
;
step
.
desc
=
null
;
step
.
result
=
null
;
this
.
form
.
steps
.
forEach
(
step
=>
{
if
(
step
.
num
>
data
.
num
){
step
.
num
++
;
}
});
this
.
form
.
steps
.
push
(
step
);
},
handleDeleteStep
(
index
,
data
)
{
this
.
form
.
steps
.
splice
(
index
,
1
);
this
.
form
.
steps
.
forEach
(
step
=>
{
if
(
step
.
num
>
data
.
num
){
step
.
num
--
;
}
});
},
saveCase
(){
this
.
$refs
[
'
relevanceFrom
'
].
validate
((
valid
)
=>
{
if
(
valid
)
{
let
param
=
{};
Object
.
assign
(
param
,
this
.
form
);
param
.
steps
=
JSON
.
stringify
(
this
.
form
.
steps
);
param
.
nodeId
=
this
.
form
.
module
;
this
.
moduleOptions
.
forEach
(
item
=>
{
if
(
this
.
form
.
module
===
item
.
id
){
param
.
nodePath
=
item
.
path
;
}
});
if
(
localStorage
.
getItem
(
CURRENT_PROJECT
))
{
param
.
projectId
=
JSON
.
parse
(
localStorage
.
getItem
(
CURRENT_PROJECT
)).
id
;
}
this
.
$post
(
'
/test/case/
'
+
this
.
operationType
,
param
,
()
=>
{
this
.
$message
.
success
(
this
.
$t
(
'
commons.save_success
'
));
this
.
dialogFormVisible
=
false
;
this
.
$emit
(
"
refresh
"
);
});
}
else
{
return
false
;
}
});
}
,
resetForm
()
{
if
(
this
.
$refs
[
'
relevanceFrom
'
])
{
this
.
$refs
[
'
relevanceFrom
'
].
resetFields
();
}
saveCaseRelevance
(){
},
load
()
{
this
.
count
+=
2
},
getCaseNames
(
planId
)
{
if
(
planId
){
let
param
=
{};
...
...
@@ -160,7 +96,37 @@
});
});
}
},
checkAll
()
{
this
.
testCases
.
forEach
(
item
=>
{
item
.
checked
=
this
.
isCheckAll
;
});
this
.
dialogFormVisible
=
true
;
},
handleSelectAll
(
selection
)
{
if
(
selection
.
length
>
0
){
this
.
testCases
.
forEach
(
item
=>
{
this
.
selectIds
.
add
(
item
.
id
);
});
}
else
{
this
.
selectIds
.
clear
();
}
},
handleSelectionChange
(
selection
,
row
)
{
if
(
this
.
selectIds
.
has
(
row
.
id
)){
this
.
selectIds
.
delete
(
row
.
id
);
}
else
{
this
.
selectIds
.
add
(
row
.
id
);
}
},
getNodeTreeByPlanId
(
planId
)
{
if
(
planId
){
this
.
$get
(
"
/case/node/list/all/plan/
"
+
planId
,
response
=>
{
this
.
treeNodes
=
response
.
data
;
});
}
}
}
}
</
script
>
...
...
@@ -180,10 +146,11 @@
}
.node
_
tree
{
.node
-
tree
{
/*border-radius: 1px;*/
/*padding-top: 5px ;*/
/*height: 100%;*/
margin-right
:
5px
;
/*box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);*/
}
...
...
@@ -195,7 +162,15 @@
}
.el-aside
{
color
:
#333
;
/*color: #333;*/
/*background-color: rgb(238, 241, 246)*/
}
.case-content
{
height
:
100%
;
}
.main-content
{
min-height
:
300px
;
}
</
style
>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录