fix: 列表展示自定义字段
This commit is contained in:
parent
8829a8caaf
commit
aa0dbb0a3c
|
@ -17,87 +17,66 @@
|
|||
operator-width="170px"
|
||||
ref="table"
|
||||
>
|
||||
<template v-for="(item, index) in tableLabel">
|
||||
|
||||
<ms-table-column
|
||||
v-if="item.id == 'num'"
|
||||
prop="num"
|
||||
label="ID"
|
||||
show-overflow-tooltip
|
||||
width="80px"
|
||||
sortable=true
|
||||
:key="index">
|
||||
<template slot-scope="scope">
|
||||
<!-- 判断为只读用户的话不可点击ID进行编辑操作 -->
|
||||
<span style="cursor:pointer" v-if="isReadOnly"> {{ scope.row.num }} </span>
|
||||
<el-tooltip v-else content="编辑">
|
||||
<a style="cursor:pointer" @click="editApi(scope.row)"> {{ scope.row.num }} </a>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</ms-table-column>
|
||||
<ms-table-column
|
||||
prop="num"
|
||||
label="ID"
|
||||
width="80px"
|
||||
sortable=true>
|
||||
<template slot-scope="scope">
|
||||
<!-- 判断为只读用户的话不可点击ID进行编辑操作 -->
|
||||
<span style="cursor:pointer" v-if="isReadOnly"> {{ scope.row.num }} </span>
|
||||
<el-tooltip v-else content="编辑">
|
||||
<a style="cursor:pointer" @click="editApi(scope.row)"> {{ scope.row.num }} </a>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</ms-table-column>
|
||||
|
||||
<ms-table-column v-if="item.id == 'name'" prop="name" width="160px" :label="$t('test_track.case.name')"
|
||||
show-overflow-tooltip :key="index"/>
|
||||
<ms-table-column prop="name" width="160px" :label="$t('test_track.case.name')"/>
|
||||
|
||||
<ms-table-column
|
||||
v-if="item.id == 'priority'"
|
||||
prop="priority"
|
||||
:filters="priorityFilters"
|
||||
column-key="priority"
|
||||
width="120px"
|
||||
:label="$t('test_track.case.priority')"
|
||||
show-overflow-tooltip
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<priority-table-item :value="scope.row.priority"/>
|
||||
</template>
|
||||
</ms-table-column>
|
||||
<ms-table-column
|
||||
prop="priority"
|
||||
:filters="priorityFilters"
|
||||
column-key="priority"
|
||||
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
|
||||
v-if="item.id == 'path'"
|
||||
sortable="custom"
|
||||
prop="path"
|
||||
width="180px"
|
||||
:label="'API'+ $t('api_test.definition.api_path')"
|
||||
show-overflow-tooltip
|
||||
:key="index"/>
|
||||
<ms-table-column
|
||||
sortable="custom"
|
||||
prop="path"
|
||||
width="180px"
|
||||
:label="'API'+ $t('api_test.definition.api_path')"/>
|
||||
|
||||
<ms-table-column
|
||||
v-if="item.id == 'casePath'"
|
||||
sortable="custom"
|
||||
prop="casePath"
|
||||
width="180px"
|
||||
:label="$t('api_test.definition.request.case')+ $t('api_test.definition.api_path')"
|
||||
show-overflow-tooltip
|
||||
:key="index"/>
|
||||
<ms-table-column
|
||||
sortable="custom"
|
||||
prop="casePath"
|
||||
width="180px"
|
||||
:label="$t('api_test.definition.request.case')+ $t('api_test.definition.api_path')"/>
|
||||
|
||||
<ms-table-column v-if="item.id=='tags'" prop="tags" width="120px" :label="$t('commons.tag')"
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<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"/>
|
||||
</template>
|
||||
</ms-table-column>
|
||||
<ms-table-column prop="tags" width="120px" :label="$t('commons.tag')">
|
||||
<template v-slot:default="scope">
|
||||
<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"/>
|
||||
</template>
|
||||
</ms-table-column>
|
||||
|
||||
<ms-table-column
|
||||
v-if="item.id=='createUser'"
|
||||
prop="createUser"
|
||||
:label="'创建人'"
|
||||
show-overflow-tooltip
|
||||
:key="index"/>
|
||||
<ms-table-column
|
||||
prop="createUser"
|
||||
:label="'创建人'"/>
|
||||
|
||||
<ms-table-column
|
||||
v-if="item.id=='updateTime'"
|
||||
sortable="updateTime"
|
||||
width="160px"
|
||||
:label="$t('api_test.definition.api_last_time')"
|
||||
prop="updateTime"
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</ms-table-column>
|
||||
</template>
|
||||
<ms-table-column
|
||||
sortable="updateTime"
|
||||
width="160px"
|
||||
:label="$t('api_test.definition.api_last_time')"
|
||||
prop="updateTime">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</ms-table-column>
|
||||
</ms-table>
|
||||
<ms-table-pagination :change="initTable" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
||||
:total="total"/>
|
||||
|
@ -121,12 +100,11 @@ import MsBottomContainer from "../../../definition/components/BottomContainer";
|
|||
import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
|
||||
import MsBatchEdit from "../../../definition/components/basis/BatchEdit";
|
||||
import {API_METHOD_COLOUR, CASE_PRIORITY} from "../../../definition/model/JsonData";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
import ApiListContainer from "../../../definition/components/list/ApiListContainer";
|
||||
import PriorityTableItem from "../../../../track/common/tableItems/planview/PriorityTableItem";
|
||||
import MsEnvironmentSelect from "../../../definition/components/case/MsEnvironmentSelect";
|
||||
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";
|
||||
|
||||
export default {
|
||||
|
@ -152,7 +130,6 @@ export default {
|
|||
selectCase: {},
|
||||
result: {},
|
||||
moduleId: "",
|
||||
tableLabel: [],
|
||||
typeArr: [
|
||||
{id: 'priority', name: this.$t('test_track.case.priority')},
|
||||
],
|
||||
|
@ -256,7 +233,6 @@ export default {
|
|||
}
|
||||
});
|
||||
});
|
||||
getLabel(this, API_CASE_LIST);
|
||||
},
|
||||
clear() {
|
||||
if (this.$refs.table) {
|
||||
|
|
|
@ -675,11 +675,4 @@ export default {
|
|||
top: -2px;
|
||||
}
|
||||
|
||||
/deep/ .el-table__fixed {
|
||||
height: 100% !important;
|
||||
}
|
||||
|
||||
/deep/ .el-table__fixed-body-wrapper {
|
||||
top: 60px !important;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -25,7 +25,7 @@ export default {
|
|||
prop: String,
|
||||
label: String,
|
||||
width: String,
|
||||
minWidth: String,
|
||||
minWidth: [String, Number],
|
||||
fixed: String,
|
||||
// 排序列, 后端mapper处理filters
|
||||
filters: Array,
|
||||
|
|
|
@ -61,18 +61,6 @@
|
|||
:label="$t('custom_field.case_maintainer')"
|
||||
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
|
||||
prop="reviewStatus"
|
||||
min-width="100px"
|
||||
|
@ -95,6 +83,7 @@
|
|||
<template v-slot:default="scope">
|
||||
<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"/>
|
||||
<span/>
|
||||
</template>
|
||||
</ms-table-column>
|
||||
|
||||
|
@ -118,12 +107,19 @@
|
|||
</ms-table-column>
|
||||
|
||||
<ms-table-column v-for="field in testCaseTemplate.customFields" :key="field.id"
|
||||
:filters="field.name === '用例等级' ? priorityFilters : null"
|
||||
:field="item"
|
||||
:fields-width="fieldsWidth"
|
||||
:label="field.name"
|
||||
:min-width="90"
|
||||
:prop="field.name">
|
||||
<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>
|
||||
</ms-table-column>
|
||||
|
||||
|
@ -428,6 +424,7 @@ export default {
|
|||
this.condition.filters.reviewStatus = [this.selectDataRange];
|
||||
break;
|
||||
}
|
||||
this.condition.filters.priority = this.condition.filters['用例等级'];
|
||||
if (this.projectId) {
|
||||
this.condition.projectId = this.projectId;
|
||||
this.$emit('setCondition', this.condition);
|
||||
|
@ -437,11 +434,11 @@ export default {
|
|||
this.page.data = data.listObject;
|
||||
// this.selectIds.clear();
|
||||
this.$refs.table.clear();
|
||||
/*this.tableData.forEach(item => {
|
||||
if (item.tags && item.tags.length > 0) {
|
||||
item.tags = JSON.parse(item.tags);
|
||||
this.page.data.forEach(item => {
|
||||
if (item.customFields) {
|
||||
item.customFields = JSON.parse(item.customFields);
|
||||
}
|
||||
})*/
|
||||
});
|
||||
this.page.data.forEach((item) => {
|
||||
item.tags = JSON.parse(item.tags);
|
||||
});
|
||||
|
|
|
@ -48,16 +48,6 @@
|
|||
prop="title">
|
||||
</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
|
||||
:field="item"
|
||||
:fields-width="fieldsWidth"
|
||||
|
@ -95,7 +85,12 @@
|
|||
:label="field.name"
|
||||
:prop="field.name">
|
||||
<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>
|
||||
</ms-table-column>
|
||||
|
||||
|
|
|
@ -86,6 +86,20 @@ export function buildCustomFields(data, param, template) {
|
|||
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 => {
|
||||
let hasField = false;
|
||||
for (const index in customFields) {
|
||||
|
|
|
@ -175,13 +175,12 @@ export const CUSTOM_TABLE_HEADER = {
|
|||
TRACK_TEST_CASE: [
|
||||
{id: 'num', key: '1', label: i18n.t('commons.id')},
|
||||
{id: 'name', key: '2', label: i18n.t('commons.name')},
|
||||
{id: 'priority', key: '3', label: i18n.t('test_track.case.priority')},
|
||||
{id: 'reviewStatus', key: '4', label: i18n.t('test_track.case.status')},
|
||||
{id: 'tags', key: '5', label: i18n.t('commons.tag')},
|
||||
{id: 'nodePath', key: '6', label: i18n.t('test_track.case.module')},
|
||||
{id: 'updateTime', key: '7', label: i18n.t('commons.update_time')},
|
||||
{id: 'createUser', key: '8', label: i18n.t('commons.create_user')},
|
||||
{id: 'maintainer', key: '9', label: i18n.t('custom_field.case_maintainer')},
|
||||
{id: 'reviewStatus', key: '3', label: i18n.t('test_track.case.status')},
|
||||
{id: 'tags', key: '4', label: i18n.t('commons.tag')},
|
||||
{id: 'nodePath', key: '5', label: i18n.t('test_track.case.module')},
|
||||
{id: 'updateTime', key: '6', label: i18n.t('commons.update_time')},
|
||||
{id: 'createUser', key: '7', label: i18n.t('commons.create_user')},
|
||||
{id: 'maintainer', key: '8', label: i18n.t('custom_field.case_maintainer')},
|
||||
],
|
||||
//缺陷列表
|
||||
ISSUE_LIST: [
|
||||
|
|
Loading…
Reference in New Issue