feat: 显示标签列

This commit is contained in:
Captain.B 2021-01-07 17:53:36 +08:00
parent a2c1baece6
commit 460b4daff6
4 changed files with 627 additions and 578 deletions

View File

@ -18,7 +18,7 @@
<select id="list" resultType="io.metersphere.api.dto.definition.TestPlanApiCaseDTO">
select
t.id, t.environment_id, t.create_time, t.update_time,
c.id as case_id, c.project_id, c.name, c.api_definition_id, c.priority, c.description, c.create_user_id, c.update_user_id, c.num,
c.id as case_id, c.project_id, c.name, c.api_definition_id, c.priority, c.description, c.create_user_id, c.update_user_id, c.num, c.tags,
a.module_id, a.path, a.protocol, t.status execResult
from
test_plan_api_case t

View File

@ -47,7 +47,8 @@
:label="$t('api_test.definition.api_type')"
show-overflow-tooltip>
<template v-slot:default="scope" class="request-method">
<el-tag size="mini" :style="{'background-color': getColor(true, scope.row.method), border: getColor(true, scope.row.method)}" class="api-el-tag">
<el-tag size="mini" :style="{'background-color': getColor(true, scope.row.method), border: getColor(true, scope.row.method)}"
class="api-el-tag">
{{ scope.row.method }}
</el-tag>
</template>
@ -63,6 +64,15 @@
:label="$t('api_test.definition.api_principal')"
show-overflow-tooltip/>
<el-table-column prop="tags" :label="$t('commons.tag')">
<template v-slot:default="scope">
<ms-tag v-for="(tag, index) in scope.row.showTags"
:key="tag + '_' + index"
:effect="'light'"
:content="tag"/>
</template>
</el-table-column>
<el-table-column width="160" :label="$t('api_test.definition.api_last_time')" prop="updateTime">
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
@ -110,7 +120,6 @@
import MsTableOperator from "../../../../common/components/MsTableOperator";
import MsTableOperatorButton from "../../../../common/components/MsTableOperatorButton";
import MsTableButton from "../../../../common/components/MsTableButton";
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
import MsTablePagination from "../../../../common/pagination/TablePagination";
import MsTag from "../../../../common/components/MsTag";
import MsApiCaseList from "../case/ApiCaseList";
@ -118,9 +127,9 @@
import MsBottomContainer from "../BottomContainer";
import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
import MsBatchEdit from "../basis/BatchEdit";
import {API_METHOD_COLOUR, REQ_METHOD, API_STATUS} from "../../model/JsonData";
import {API_METHOD_COLOUR, API_STATUS, REQ_METHOD} from "../../model/JsonData";
import {getCurrentProjectID} from "@/common/js/utils";
import {WORKSPACE_ID} from '../../../../../../common/js/constants';
import {WORKSPACE_ID} from '@/common/js/constants';
import ApiListContainer from "./ApiListContainer";
import MsTableSelectAll from "../../../../common/components/table/MsTableSelectAll";
@ -268,6 +277,10 @@
this.total = response.data.itemCount;
this.tableData = response.data.listObject;
this.unSelection = response.data.listObject.map(s => s.id);
this.tableData.forEach(row => {
row.showTags = JSON.parse(row.tags);
})
});
}
},
@ -528,6 +541,7 @@
padding: 5px;
width: 30px;
}
.api-list >>> th:nth-child(2) > .cell {
/*background-color: black;*/
}
@ -536,4 +550,8 @@
float: left;
}
.el-tag {
margin-left: 10px;
}
</style>

View File

@ -111,6 +111,15 @@
</template>
</el-table-column>
<el-table-column prop="tags" :label="$t('commons.tag')">
<template v-slot:default="scope">
<ms-tag v-for="(tag, index) in scope.row.showTags"
:key="tag + '_' + index"
:effect="'light'"
:content="tag"/>
</template>
</el-table-column>
<el-table-column
prop="nodePath"
:label="$t('test_track.case.module')"
@ -175,6 +184,7 @@ import StatusTableItem from "@/business/components/track/common/tableItems/planv
import TestCaseDetail from "./TestCaseDetail";
import ReviewStatus from "@/business/components/track/case/components/ReviewStatus";
import {getCurrentProjectID} from "../../../../../common/js/utils";
import MsTag from "@/business/components/common/components/MsTag";
export default {
name: "TestCaseList",
@ -195,7 +205,8 @@ export default {
BatchEdit,
StatusTableItem,
TestCaseDetail,
ReviewStatus
ReviewStatus,
MsTag,
},
data() {
return {
@ -308,6 +319,9 @@ export default {
this.tableData = data.listObject;
// this.selectIds.clear();
this.selectRows.clear();
this.tableData.forEach(row => {
row.showTags = JSON.parse(row.tags);
})
});
}
},
@ -537,4 +551,7 @@ export default {
cursor: pointer;
}
.el-tag {
margin-left: 10px;
}
</style>

View File

@ -60,6 +60,15 @@
</template>
</el-table-column>
<el-table-column prop="tags" :label="$t('commons.tag')">
<template v-slot:default="scope">
<ms-tag v-for="(tag, index) in scope.row.showTags"
:key="tag + '_' + index"
:effect="'light'"
:content="tag"/>
</template>
</el-table-column>
<el-table-column :label="'执行状态'" min-width="130" align="center">
<template v-slot:default="scope">
<div v-loading="rowLoading === scope.row.id">
@ -108,10 +117,10 @@
import MsTableOperator from "../../../../../common/components/MsTableOperator";
import MsTableOperatorButton from "../../../../../common/components/MsTableOperatorButton";
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
import MsTablePagination from "../../../../../common/pagination/TablePagination";
import MsTag from "../../../../../common/components/MsTag";
import MsApiCaseList from "../../../../../api/definition/components/case/ApiCaseList";
import ApiCaseList from "../../../../../api/definition/components/case/ApiCaseList";
import MsContainer from "../../../../../common/components/MsContainer";
import MsBottomContainer from "../../../../../api/definition/components/BottomContainer";
import ShowMoreBtn from "../../../../case/components/ShowMoreBtn";
@ -120,8 +129,7 @@
import {getCurrentProjectID} from "@/common/js/utils";
import ApiListContainer from "../../../../../api/definition/components/list/ApiListContainer";
import PriorityTableItem from "../../../../common/tableItems/planview/PriorityTableItem";
import ApiCaseList from "../../../../../api/definition/components/case/ApiCaseList";
import {_filter, _sort, getUUID, getBodyUploadFiles} from "../../../../../../../common/js/utils";
import {_filter, _sort, getBodyUploadFiles, getUUID} from "../../../../../../../common/js/utils";
import TestPlanCaseListHeader from "./TestPlanCaseListHeader";
import MsRun from "../../../../../api/definition/components/Run";
import TestPlanApiCaseResult from "./TestPlanApiCaseResult";
@ -257,6 +265,9 @@
this.result = this.$post('/test/plan/api/case/list/' + this.currentPage + "/" + this.pageSize, this.condition, response => {
this.total = response.data.itemCount;
this.tableData = response.data.listObject;
this.tableData.forEach(row => {
row.showTags = JSON.parse(row.tags);
})
});
},
handleSelect(selection, row) {
@ -468,4 +479,7 @@
margin-right: 20px;
}
.el-tag {
margin-left: 10px;
}
</style>