Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
xiaofang li
MeterSphere
Commits
20626175
Commit
20626175
authored
4 years ago
by
chenjianxing
Browse files
Options
Download
Email Patches
Plain Diff
fix: 列表展示自定义字段
parent
2f1b6a33
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
frontend/src/business/components/api/automation/scenario/api/RelevanceCaseList.vue
+53
-77
...ponents/api/automation/scenario/api/RelevanceCaseList.vue
frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue
+0
-7
...ents/api/definition/components/list/ApiCaseSimpleList.vue
frontend/src/business/components/common/components/table/Ms-table-column.vue
+1
-1
...ss/components/common/components/table/Ms-table-column.vue
frontend/src/business/components/track/case/components/TestCaseList.vue
+14
-17
...usiness/components/track/case/components/TestCaseList.vue
frontend/src/business/components/track/issue/IssueList.vue
+6
-11
frontend/src/business/components/track/issue/IssueList.vue
frontend/src/common/js/custom_field.js
+14
-0
frontend/src/common/js/custom_field.js
frontend/src/common/js/default-table-header.js
+6
-7
frontend/src/common/js/default-table-header.js
with
94 additions
and
120 deletions
+94
-120
frontend/src/business/components/api/automation/scenario/api/RelevanceCaseList.vue
+
53
-
77
View file @
20626175
...
@@ -17,87 +17,66 @@
...
@@ -17,87 +17,66 @@
operator-width=
"170px"
operator-width=
"170px"
ref=
"table"
ref=
"table"
>
>
<template
v-for=
"(item, index) in tableLabel"
>
<ms-table-column
<ms-table-column
v-if=
"item.id == 'num'"
prop=
"num"
prop=
"num"
label=
"ID"
label=
"ID"
width=
"80px"
show-overflow-tooltip
sortable=
true
>
width=
"80px"
<template
slot-scope=
"scope"
>
sortable=
true
<!-- 判断为只读用户的话不可点击ID进行编辑操作 -->
:key=
"index"
>
<span
style=
"cursor:pointer"
v-if=
"isReadOnly"
>
{{
scope
.
row
.
num
}}
</span>
<template
slot-scope=
"scope"
>
<el-tooltip
v-else
content=
"编辑"
>
<!-- 判断为只读用户的话不可点击ID进行编辑操作 -->
<a
style=
"cursor:pointer"
@
click=
"editApi(scope.row)"
>
{{
scope
.
row
.
num
}}
</a>
<span
style=
"cursor:pointer"
v-if=
"isReadOnly"
>
{{
scope
.
row
.
num
}}
</span>
</el-tooltip>
<el-tooltip
v-else
content=
"编辑"
>
</
template
>
<a
style=
"cursor:pointer"
@
click=
"editApi(scope.row)"
>
{{
scope
.
row
.
num
}}
</a>
</ms-table-column>
</el-tooltip>
</
template
>
</ms-table-column>
<ms-table-column
v-if=
"item.id == 'name'"
prop=
"name"
width=
"160px"
:label=
"$t('test_track.case.name')"
<ms-table-column
prop=
"name"
width=
"160px"
:label=
"$t('test_track.case.name')"
/>
show-overflow-tooltip
:key=
"index"
/>
<ms-table-column
<ms-table-column
v-if=
"item.id == 'priority'"
prop=
"priority"
prop=
"priority"
:filters=
"priorityFilters"
:filters=
"priorityFilters"
column-key=
"priority"
column-key=
"priority"
width=
"120px"
width=
"120px"
:label=
"$t('test_track.case.priority')"
>
:label=
"$t('test_track.case.priority')"
<
template
v-slot:default=
"scope"
>
show-overflow-tooltip
<priority-table-item
:value=
"scope.row.priority"
/>
:key=
"index"
>
</
template
>
<
template
v-slot:default=
"scope"
>
</ms-table-column>
<priority-table-item
:value=
"scope.row.priority"
/>
</
template
>
</ms-table-column>
<ms-table-column
<ms-table-column
v-if=
"item.id == 'path'"
sortable=
"custom"
sortable=
"custom"
prop=
"path"
prop=
"path"
width=
"180px"
width=
"180px"
:label=
"'API'+ $t('api_test.definition.api_path')"
/>
:label=
"'API'+ $t('api_test.definition.api_path')"
show-overflow-tooltip
:key=
"index"
/>
<ms-table-column
<ms-table-column
v-if=
"item.id == 'casePath'"
sortable=
"custom"
sortable=
"custom"
prop=
"casePath"
prop=
"casePath"
width=
"180px"
width=
"180px"
:label=
"$t('api_test.definition.request.case')+ $t('api_test.definition.api_path')"
/>
:label=
"$t('api_test.definition.request.case')+ $t('api_test.definition.api_path')"
show-overflow-tooltip
:key=
"index"
/>
<ms-table-column
v-if=
"item.id=='tags'"
prop=
"tags"
width=
"120px"
:label=
"$t('commons.tag')"
<ms-table-column
prop=
"tags"
width=
"120px"
:label=
"$t('commons.tag')"
>
:key=
"index"
>
<
template
v-slot:default=
"scope"
>
<
template
v-slot:default=
"scope"
>
<ms-tag
v-for=
"(itemName,index) in scope.row.tags"
:key=
"index"
type=
"success"
effect=
"plain"
<ms-tag
v-for=
"(itemName,index) in scope.row.tags"
:key=
"index"
type=
"success"
effect=
"plain"
:content=
"itemName"
style=
"margin-left: 0px; margin-right: 2px"
/>
:content=
"itemName"
style=
"margin-left: 0px; margin-right: 2px"
/>
</
template
>
</
template
>
</ms-table-column>
</ms-table-column>
<ms-table-column
<ms-table-column
v-if=
"item.id=='createUser'"
prop=
"createUser"
prop=
"createUser"
:label=
"'创建人'"
/>
:label=
"'创建人'"
show-overflow-tooltip
:key=
"index"
/>
<ms-table-column
<ms-table-column
v-if=
"item.id=='updateTime'"
sortable=
"updateTime"
sortable=
"updateTime"
width=
"160px"
width=
"160px"
:label=
"$t('api_test.definition.api_last_time')"
:label=
"$t('api_test.definition.api_last_time')"
prop=
"updateTime"
>
prop=
"updateTime"
<
template
v-slot:default=
"scope"
>
:key=
"index"
>
<span>
{{
scope
.
row
.
updateTime
|
timestampFormatDate
}}
</span>
<
template
v-slot:default=
"scope"
>
</
template
>
<span>
{{
scope
.
row
.
updateTime
|
timestampFormatDate
}}
</span>
</ms-table-column>
</
template
>
</ms-table-column>
</template>
</ms-table>
</ms-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"
/>
...
@@ -121,12 +100,11 @@ import MsBottomContainer from "../../../definition/components/BottomContainer";
...
@@ -121,12 +100,11 @@ import MsBottomContainer from "../../../definition/components/BottomContainer";
import
ShowMoreBtn
from
"
../../../../track/case/components/ShowMoreBtn
"
;
import
ShowMoreBtn
from
"
../../../../track/case/components/ShowMoreBtn
"
;
import
MsBatchEdit
from
"
../../../definition/components/basis/BatchEdit
"
;
import
MsBatchEdit
from
"
../../../definition/components/basis/BatchEdit
"
;
import
{
API_METHOD_COLOUR
,
CASE_PRIORITY
}
from
"
../../../definition/model/JsonData
"
;
import
{
API_METHOD_COLOUR
,
CASE_PRIORITY
}
from
"
../../../definition/model/JsonData
"
;
import
{
getCurrentProjectID
}
from
"
@/common/js/utils
"
;
import
ApiListContainer
from
"
../../../definition/components/list/ApiListContainer
"
;
import
ApiListContainer
from
"
../../../definition/components/list/ApiListContainer
"
;
import
PriorityTableItem
from
"
../../../../track/common/tableItems/planview/PriorityTableItem
"
;
import
PriorityTableItem
from
"
../../../../track/common/tableItems/planview/PriorityTableItem
"
;
import
MsEnvironmentSelect
from
"
../../../definition/components/case/MsEnvironmentSelect
"
;
import
MsEnvironmentSelect
from
"
../../../definition/components/case/MsEnvironmentSelect
"
;
import
TableSelectCountBar
from
"
./TableSelectCountBar
"
;
import
TableSelectCountBar
from
"
./TableSelectCountBar
"
;
import
{
_filter
,
_handleSelect
,
_handleSelectAll
,
_sort
,
buildBatchParam
,
getLabel
}
from
"
@/common/js/tableUtils
"
;
import
{
_filter
,
_sort
,
buildBatchParam
}
from
"
@/common/js/tableUtils
"
;
import
{
API_CASE_LIST
}
from
"
@/common/js/constants
"
;
import
{
API_CASE_LIST
}
from
"
@/common/js/constants
"
;
export
default
{
export
default
{
...
@@ -152,7 +130,6 @@ export default {
...
@@ -152,7 +130,6 @@ export default {
selectCase
:
{},
selectCase
:
{},
result
:
{},
result
:
{},
moduleId
:
""
,
moduleId
:
""
,
tableLabel
:
[],
typeArr
:
[
typeArr
:
[
{
id
:
'
priority
'
,
name
:
this
.
$t
(
'
test_track.case.priority
'
)},
{
id
:
'
priority
'
,
name
:
this
.
$t
(
'
test_track.case.priority
'
)},
],
],
...
@@ -256,7 +233,6 @@ export default {
...
@@ -256,7 +233,6 @@ export default {
}
}
});
});
});
});
getLabel
(
this
,
API_CASE_LIST
);
},
},
clear
()
{
clear
()
{
if
(
this
.
$refs
.
table
)
{
if
(
this
.
$refs
.
table
)
{
...
...
This diff is collapsed.
Click to expand it.
frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue
+
0
-
7
View file @
20626175
...
@@ -675,11 +675,4 @@ export default {
...
@@ -675,11 +675,4 @@ export default {
top
:
-2px
;
top
:
-2px
;
}
}
/
deep
/
.el-table__fixed
{
height
:
100%
!important
;
}
/
deep
/
.el-table__fixed-body-wrapper
{
top
:
60px
!important
;
}
</
style
>
</
style
>
This diff is collapsed.
Click to expand it.
frontend/src/business/components/common/components/table/Ms-table-column.vue
+
1
-
1
View file @
20626175
...
@@ -25,7 +25,7 @@ export default {
...
@@ -25,7 +25,7 @@ export default {
prop
:
String
,
prop
:
String
,
label
:
String
,
label
:
String
,
width
:
String
,
width
:
String
,
minWidth
:
String
,
minWidth
:
[
String
,
Number
],
fixed
:
String
,
fixed
:
String
,
// 排序列, 后端mapper处理filters
// 排序列, 后端mapper处理filters
filters
:
Array
,
filters
:
Array
,
...
...
This diff is collapsed.
Click to expand it.
frontend/src/business/components/track/case/components/TestCaseList.vue
+
14
-
17
View file @
20626175
...
@@ -61,18 +61,6 @@
...
@@ -61,18 +61,6 @@
:label=
"$t('custom_field.case_maintainer')"
:label=
"$t('custom_field.case_maintainer')"
min-width=
"120"
/>
min-width=
"120"
/>
<ms-table-column
prop=
"priority"
:field=
"item"
:fields-width=
"fieldsWidth"
:filters=
"priorityFilters"
min-width=
"120px"
:label=
"$t('test_track.case.priority')"
>
<template
v-slot:default=
"scope"
>
<priority-table-item
:value=
"scope.row.priority"
/>
</
template
>
</ms-table-column>
<ms-table-column
<ms-table-column
prop=
"reviewStatus"
prop=
"reviewStatus"
min-width=
"100px"
min-width=
"100px"
...
@@ -95,6 +83,7 @@
...
@@ -95,6 +83,7 @@
<
template
v-slot:default=
"scope"
>
<
template
v-slot:default=
"scope"
>
<ms-tag
v-for=
"(itemName,index) in scope.row.tags"
:key=
"index"
type=
"success"
effect=
"plain"
<ms-tag
v-for=
"(itemName,index) in scope.row.tags"
:key=
"index"
type=
"success"
effect=
"plain"
:content=
"itemName"
style=
"margin-left: 0px; margin-right: 2px"
/>
:content=
"itemName"
style=
"margin-left: 0px; margin-right: 2px"
/>
<span/>
</
template
>
</
template
>
</ms-table-column>
</ms-table-column>
...
@@ -118,12 +107,19 @@
...
@@ -118,12 +107,19 @@
</ms-table-column>
</ms-table-column>
<ms-table-column
v-for=
"field in testCaseTemplate.customFields"
:key=
"field.id"
<ms-table-column
v-for=
"field in testCaseTemplate.customFields"
:key=
"field.id"
:filters=
"field.name === '用例等级' ? priorityFilters : null"
:field=
"item"
:field=
"item"
:fields-width=
"fieldsWidth"
:fields-width=
"fieldsWidth"
:label=
"field.name"
:label=
"field.name"
:min-width=
"90"
:prop=
"field.name"
>
:prop=
"field.name"
>
<
template
v-slot=
"scope"
>
<
template
v-slot=
"scope"
>
{{
getCustomFieldValue
(
scope
.
row
,
field
)
}}
<span
v-if=
"field.name === '用例等级'"
>
<priority-table-item
:value=
"getCustomFieldValue(scope.row, field) ? getCustomFieldValue(scope.row, field) : scope.row.priority"
/>
</span>
<span
v-else
>
{{
getCustomFieldValue
(
scope
.
row
,
field
)
}}
</span>
</
template
>
</
template
>
</ms-table-column>
</ms-table-column>
...
@@ -428,6 +424,7 @@ export default {
...
@@ -428,6 +424,7 @@ export default {
this
.
condition
.
filters
.
reviewStatus
=
[
this
.
selectDataRange
];
this
.
condition
.
filters
.
reviewStatus
=
[
this
.
selectDataRange
];
break
;
break
;
}
}
this
.
condition
.
filters
.
priority
=
this
.
condition
.
filters
[
'
用例等级
'
];
if
(
this
.
projectId
)
{
if
(
this
.
projectId
)
{
this
.
condition
.
projectId
=
this
.
projectId
;
this
.
condition
.
projectId
=
this
.
projectId
;
this
.
$emit
(
'
setCondition
'
,
this
.
condition
);
this
.
$emit
(
'
setCondition
'
,
this
.
condition
);
...
@@ -437,11 +434,11 @@ export default {
...
@@ -437,11 +434,11 @@ export default {
this
.
page
.
data
=
data
.
listObject
;
this
.
page
.
data
=
data
.
listObject
;
// this.selectIds.clear();
// this.selectIds.clear();
this
.
$refs
.
table
.
clear
();
this
.
$refs
.
table
.
clear
();
/*
this.
tableD
ata.forEach(item => {
this
.
page
.
d
ata
.
forEach
(
item
=>
{
if (item.
tags && item.tags.length > 0
) {
if
(
item
.
customFields
)
{
item.
tag
s = JSON.parse(item.
tag
s);
item
.
customField
s
=
JSON
.
parse
(
item
.
customField
s
);
}
}
})
*/
})
;
this
.
page
.
data
.
forEach
((
item
)
=>
{
this
.
page
.
data
.
forEach
((
item
)
=>
{
item
.
tags
=
JSON
.
parse
(
item
.
tags
);
item
.
tags
=
JSON
.
parse
(
item
.
tags
);
});
});
...
...
This diff is collapsed.
Click to expand it.
frontend/src/business/components/track/issue/IssueList.vue
+
6
-
11
View file @
20626175
...
@@ -48,16 +48,6 @@
...
@@ -48,16 +48,6 @@
prop=
"title"
>
prop=
"title"
>
</ms-table-column>
</ms-table-column>
<ms-table-column
:field=
"item"
:fields-width=
"fieldsWidth"
:label=
"$t('test_track.issue.status')"
prop=
"status"
>
<
template
v-slot=
"scope"
>
<span>
{{
issueStatusMap
[
scope
.
row
.
status
]
?
issueStatusMap
[
scope
.
row
.
status
]
:
scope
.
row
.
status
}}
</span>
</
template
>
</ms-table-column>
<ms-table-column
<ms-table-column
:field=
"item"
:field=
"item"
:fields-width=
"fieldsWidth"
:fields-width=
"fieldsWidth"
...
@@ -95,7 +85,12 @@
...
@@ -95,7 +85,12 @@
:label=
"field.name"
:label=
"field.name"
:prop=
"field.name"
>
:prop=
"field.name"
>
<
template
v-slot=
"scope"
>
<
template
v-slot=
"scope"
>
{{
getCustomFieldValue
(
scope
.
row
,
field
)
}}
<span
v-if=
"field.name === '状态'"
>
{{
getCustomFieldValue
(
scope
.
row
,
field
)
?
getCustomFieldValue
(
scope
.
row
,
field
)
:
issueStatusMap
[
scope
.
row
.
status
]
}}
</span>
<span
v-else
>
{{
getCustomFieldValue
(
scope
.
row
,
field
)
}}
</span>
</
template
>
</
template
>
</ms-table-column>
</ms-table-column>
...
...
This diff is collapsed.
Click to expand it.
frontend/src/common/js/custom_field.js
+
14
-
0
View file @
20626175
...
@@ -86,6 +86,20 @@ export function buildCustomFields(data, param, template) {
...
@@ -86,6 +86,20 @@ export function buildCustomFields(data, param, template) {
data
.
customFields
=
[];
data
.
customFields
=
[];
}
}
let
customFields
=
data
.
customFields
;
let
customFields
=
data
.
customFields
;
// 去重操作
if
(
customFields
)
{
let
nameSet
=
new
Set
();
for
(
let
i
=
customFields
.
length
-
1
;
i
>=
0
;
i
--
){
let
name
=
customFields
[
i
].
name
;
if
(
nameSet
.
has
(
name
)){
customFields
.
splice
(
i
,
1
);
}
nameSet
.
add
(
name
);
}
}
template
.
customFields
.
forEach
(
item
=>
{
template
.
customFields
.
forEach
(
item
=>
{
let
hasField
=
false
;
let
hasField
=
false
;
for
(
const
index
in
customFields
)
{
for
(
const
index
in
customFields
)
{
...
...
This diff is collapsed.
Click to expand it.
frontend/src/common/js/default-table-header.js
+
6
-
7
View file @
20626175
...
@@ -175,13 +175,12 @@ export const CUSTOM_TABLE_HEADER = {
...
@@ -175,13 +175,12 @@ export const CUSTOM_TABLE_HEADER = {
TRACK_TEST_CASE
:
[
TRACK_TEST_CASE
:
[
{
id
:
'
num
'
,
key
:
'
1
'
,
label
:
i18n
.
t
(
'
commons.id
'
)},
{
id
:
'
num
'
,
key
:
'
1
'
,
label
:
i18n
.
t
(
'
commons.id
'
)},
{
id
:
'
name
'
,
key
:
'
2
'
,
label
:
i18n
.
t
(
'
commons.name
'
)},
{
id
:
'
name
'
,
key
:
'
2
'
,
label
:
i18n
.
t
(
'
commons.name
'
)},
{
id
:
'
priority
'
,
key
:
'
3
'
,
label
:
i18n
.
t
(
'
test_track.case.priority
'
)},
{
id
:
'
reviewStatus
'
,
key
:
'
3
'
,
label
:
i18n
.
t
(
'
test_track.case.status
'
)},
{
id
:
'
reviewStatus
'
,
key
:
'
4
'
,
label
:
i18n
.
t
(
'
test_track.case.status
'
)},
{
id
:
'
tags
'
,
key
:
'
4
'
,
label
:
i18n
.
t
(
'
commons.tag
'
)},
{
id
:
'
tags
'
,
key
:
'
5
'
,
label
:
i18n
.
t
(
'
commons.tag
'
)},
{
id
:
'
nodePath
'
,
key
:
'
5
'
,
label
:
i18n
.
t
(
'
test_track.case.module
'
)},
{
id
:
'
nodePath
'
,
key
:
'
6
'
,
label
:
i18n
.
t
(
'
test_track.case.module
'
)},
{
id
:
'
updateTime
'
,
key
:
'
6
'
,
label
:
i18n
.
t
(
'
commons.update_time
'
)},
{
id
:
'
updateTime
'
,
key
:
'
7
'
,
label
:
i18n
.
t
(
'
commons.update_time
'
)},
{
id
:
'
createUser
'
,
key
:
'
7
'
,
label
:
i18n
.
t
(
'
commons.create_user
'
)},
{
id
:
'
createUser
'
,
key
:
'
8
'
,
label
:
i18n
.
t
(
'
commons.create_user
'
)},
{
id
:
'
maintainer
'
,
key
:
'
8
'
,
label
:
i18n
.
t
(
'
custom_field.case_maintainer
'
)},
{
id
:
'
maintainer
'
,
key
:
'
9
'
,
label
:
i18n
.
t
(
'
custom_field.case_maintainer
'
)},
],
],
//缺陷列表
//缺陷列表
ISSUE_LIST
:
[
ISSUE_LIST
:
[
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help