Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
93ae4926
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,发现更多精彩内容 >>
提交
93ae4926
编写于
5月 12, 2020
作者:
C
chenjianxing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
抽取表格过滤排序代码
上级
dd740968
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
47 addition
and
65 deletion
+47
-65
frontend/src/business/components/track/case/components/TestCaseList.vue
...usiness/components/track/case/components/TestCaseList.vue
+6
-34
frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseList.vue
...onents/track/plan/view/comonents/TestPlanTestCaseList.vue
+3
-31
frontend/src/common/js/utils.js
frontend/src/common/js/utils.js
+38
-0
未找到文件。
frontend/src/business/components/track/case/components/TestCaseList.vue
浏览文件 @
93ae4926
...
...
@@ -115,7 +115,7 @@
import
MsTableOperator
from
"
../../../common/components/MsTableOperator
"
;
import
MsTableOperatorButton
from
"
../../../common/components/MsTableOperatorButton
"
;
import
MsTableButton
from
"
../../../common/components/MsTableButton
"
;
import
{
humpToLine
}
from
"
../../../../../common/js/utils
"
;
import
{
_filter
,
_sort
,
humpToLine
}
from
"
../../../../../common/js/utils
"
;
export
default
{
name
:
"
TestCaseList
"
,
...
...
@@ -225,19 +225,6 @@
this
.
selectIds
.
clear
();
this
.
$emit
(
'
refresh
'
);
},
filter
(
filters
)
{
if
(
!
this
.
condition
.
filters
)
{
this
.
condition
.
filters
=
{};
}
for
(
let
filter
in
filters
)
{
if
(
filters
[
filter
]
&&
filters
[
filter
].
length
>
0
)
{
this
.
condition
.
filters
[
filter
]
=
filters
[
filter
];
}
else
{
this
.
condition
.
filters
[
filter
]
=
null
;
}
}
this
.
initTableData
();
},
showDetail
(
row
,
event
,
column
)
{
this
.
$emit
(
'
testCaseDetail
'
,
row
);
},
...
...
@@ -263,27 +250,12 @@
moveToNode
()
{
this
.
$emit
(
'
moveToNode
'
,
this
.
selectIds
);
},
filter
(
filters
)
{
_filter
(
filters
,
this
.
condition
);
this
.
initTableData
();
},
sort
(
column
)
{
column
.
prop
=
humpToLine
(
column
.
prop
);
if
(
column
.
order
==
'
descending
'
)
{
column
.
order
=
'
desc
'
;
}
else
{
column
.
order
=
'
asc
'
;
}
if
(
!
this
.
condition
.
orders
)
{
this
.
condition
.
orders
=
[];
}
let
hasProp
=
false
;
this
.
condition
.
orders
.
forEach
(
order
=>
{
if
(
order
.
name
==
column
.
prop
)
{
order
.
type
=
column
.
order
;
hasProp
=
true
;
return
;
}
});
if
(
!
hasProp
)
{
this
.
condition
.
orders
.
push
({
name
:
column
.
prop
,
type
:
column
.
order
});
}
_sort
(
column
,
this
.
condition
);
this
.
initTableData
();
}
}
...
...
frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseList.vue
浏览文件 @
93ae4926
...
...
@@ -127,7 +127,7 @@
import
NodeBreadcrumb
from
'
../../../common/NodeBreadcrumb
'
;
import
{
TokenKey
}
from
'
../../../../../../common/js/constants
'
;
import
{
humpToLine
,
tableFilter
}
from
'
../../../../../../common/js/utils
'
;
import
{
_filter
,
_sort
,
humpToLine
,
tableFilter
}
from
'
../../../../../../common/js/utils
'
;
import
PriorityTableItem
from
"
../../../common/tableItems/planview/PriorityTableItem
"
;
import
StatusTableItem
from
"
../../../common/tableItems/planview/StatusTableItem
"
;
import
TypeTableItem
from
"
../../../common/tableItems/planview/TypeTableItem
"
;
...
...
@@ -316,39 +316,11 @@
this
.
$refs
.
testCaseReportView
.
open
(
id
);
},
filter
(
filters
)
{
if
(
!
this
.
condition
.
filters
)
{
this
.
condition
.
filters
=
{};
}
for
(
let
filter
in
filters
)
{
if
(
filters
[
filter
]
&&
filters
[
filter
].
length
>
0
)
{
this
.
condition
.
filters
[
filter
]
=
filters
[
filter
];
}
else
{
this
.
condition
.
filters
[
filter
]
=
null
;
}
}
_filter
(
filters
,
this
.
condition
);
this
.
initTableData
();
},
sort
(
column
)
{
column
.
prop
=
humpToLine
(
column
.
prop
);
if
(
column
.
order
==
'
descending
'
)
{
column
.
order
=
'
desc
'
;
}
else
{
column
.
order
=
'
asc
'
;
}
if
(
!
this
.
condition
.
orders
)
{
this
.
condition
.
orders
=
[];
}
let
hasProp
=
false
;
this
.
condition
.
orders
.
forEach
(
order
=>
{
if
(
order
.
name
==
column
.
prop
)
{
order
.
type
=
column
.
order
;
hasProp
=
true
;
return
;
}
});
if
(
!
hasProp
)
{
this
.
condition
.
orders
.
push
({
name
:
column
.
prop
,
type
:
column
.
order
});
}
_sort
(
column
,
this
.
condition
);
this
.
initTableData
();
}
}
...
...
frontend/src/common/js/utils.js
浏览文件 @
93ae4926
...
...
@@ -89,3 +89,41 @@ export function mapToJson(strMap) {
export
function
humpToLine
(
name
)
{
return
name
.
replace
(
/
([
A-Z
])
/g
,
"
_$1
"
).
toLowerCase
();
}
//表格数据过滤
export
function
_filter
(
filters
,
condition
)
{
if
(
!
condition
.
filters
)
{
condition
.
filters
=
{};
}
for
(
let
filter
in
filters
)
{
if
(
filters
[
filter
]
&&
filters
[
filter
].
length
>
0
)
{
condition
.
filters
[
filter
]
=
filters
[
filter
];
}
else
{
condition
.
filters
[
filter
]
=
null
;
}
}
}
//表格数据排序
export
function
_sort
(
column
,
condition
)
{
column
.
prop
=
humpToLine
(
column
.
prop
);
if
(
column
.
order
==
'
descending
'
)
{
column
.
order
=
'
desc
'
;
}
else
{
column
.
order
=
'
asc
'
;
}
if
(
!
condition
.
orders
)
{
condition
.
orders
=
[];
}
let
hasProp
=
false
;
condition
.
orders
.
forEach
(
order
=>
{
if
(
order
.
name
==
column
.
prop
)
{
order
.
type
=
column
.
order
;
hasProp
=
true
;
return
;
}
});
if
(
!
hasProp
)
{
condition
.
orders
.
push
({
name
:
column
.
prop
,
type
:
column
.
order
});
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录