fix(测试跟踪): 高级搜索后切换项目-搜索条件未重置
--bug=1025858 --user=宋天阳 【测试跟踪】测试计划-关联接口用例-高级搜索后切换项目-搜索条件未重置 https://www.tapd.cn/55049933/s/1369161
This commit is contained in:
parent
f7e8e33148
commit
e2ef163c03
|
@ -1,13 +1,17 @@
|
||||||
<template>
|
<template>
|
||||||
<span>
|
<span>
|
||||||
<slot name="header"></slot>
|
<slot name="header"></slot>
|
||||||
<ms-search
|
<ms-search v-if="resetOver" :condition.sync="condition" @search="search">
|
||||||
:condition.sync="condition"
|
|
||||||
@search="search">
|
|
||||||
</ms-search>
|
</ms-search>
|
||||||
|
|
||||||
<ms-table :data="tableData" :select-node-ids="selectNodeIds" :condition="condition" :page-size="pageSize"
|
<ms-table
|
||||||
:total="total" enableSelection @selectCountChange="selectCountChange"
|
:data="tableData"
|
||||||
|
:select-node-ids="selectNodeIds"
|
||||||
|
:condition="condition"
|
||||||
|
:page-size="pageSize"
|
||||||
|
:total="total"
|
||||||
|
enableSelection
|
||||||
|
@selectCountChange="selectCountChange"
|
||||||
:screenHeight="screenHeight"
|
:screenHeight="screenHeight"
|
||||||
row-key="id"
|
row-key="id"
|
||||||
:reserve-option="true"
|
:reserve-option="true"
|
||||||
|
@ -15,19 +19,16 @@
|
||||||
operator-width="170px"
|
operator-width="170px"
|
||||||
@order="initTable"
|
@order="initTable"
|
||||||
@filter="search"
|
@filter="search"
|
||||||
ref="apitable">
|
ref="apitable"
|
||||||
<ms-table-column
|
>
|
||||||
prop="num"
|
<ms-table-column prop="num" label="ID" min-width="80px" sortable>
|
||||||
label="ID"
|
|
||||||
min-width="80px"
|
|
||||||
sortable>
|
|
||||||
|
|
||||||
</ms-table-column>
|
</ms-table-column>
|
||||||
<ms-table-column
|
<ms-table-column
|
||||||
prop="name"
|
prop="name"
|
||||||
:label="$t('api_test.definition.api_name')"
|
:label="$t('api_test.definition.api_name')"
|
||||||
sortable
|
sortable
|
||||||
width="120px"/>
|
width="120px"
|
||||||
|
/>
|
||||||
|
|
||||||
<ms-table-column
|
<ms-table-column
|
||||||
prop="method"
|
prop="method"
|
||||||
|
@ -35,11 +36,17 @@
|
||||||
column-key="method"
|
column-key="method"
|
||||||
:filters="methodFilters"
|
:filters="methodFilters"
|
||||||
:label="getApiRequestTypeName"
|
:label="getApiRequestTypeName"
|
||||||
width="120px">
|
width="120px"
|
||||||
|
>
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<el-tag size="mini"
|
<el-tag
|
||||||
:style="{'background-color': getColor(true, scope.row.method), border: getColor(true, scope.row.method)}"
|
size="mini"
|
||||||
class="api-el-tag">
|
:style="{
|
||||||
|
'background-color': getColor(true, scope.row.method),
|
||||||
|
border: getColor(true, scope.row.method),
|
||||||
|
}"
|
||||||
|
class="api-el-tag"
|
||||||
|
>
|
||||||
{{ scope.row.method }}
|
{{ scope.row.method }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
|
@ -51,14 +58,21 @@
|
||||||
:filters="userFilters"
|
:filters="userFilters"
|
||||||
column-key="user_id"
|
column-key="user_id"
|
||||||
:label="$t('api_test.definition.api_principal')"
|
:label="$t('api_test.definition.api_principal')"
|
||||||
width="100px"/>
|
width="100px"
|
||||||
|
/>
|
||||||
|
|
||||||
<ms-table-column
|
<ms-table-column
|
||||||
prop="path"
|
prop="path"
|
||||||
width="120px"
|
width="120px"
|
||||||
:label="$t('api_test.definition.api_path')"/>
|
:label="$t('api_test.definition.api_path')"
|
||||||
|
/>
|
||||||
|
|
||||||
<ms-table-column prop="tags" :label="$t('commons.tag')" width="120px" :show-overflow-tooltip="false">
|
<ms-table-column
|
||||||
|
prop="tags"
|
||||||
|
:label="$t('commons.tag')"
|
||||||
|
width="120px"
|
||||||
|
:show-overflow-tooltip="false"
|
||||||
|
>
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<el-tooltip class="item" effect="dark" placement="top">
|
<el-tooltip class="item" effect="dark" placement="top">
|
||||||
<div v-html="getTagToolTips(scope.row.tags)" slot="content"></div>
|
<div v-html="getTagToolTips(scope.row.tags)" slot="content"></div>
|
||||||
|
@ -68,9 +82,12 @@
|
||||||
:key="index"
|
:key="index"
|
||||||
type="success"
|
type="success"
|
||||||
effect="plain"
|
effect="plain"
|
||||||
:show-tooltip="scope.row.tags.length === 1 && itemName.length * 12 <= 100"
|
:show-tooltip="
|
||||||
|
scope.row.tags.length === 1 && itemName.length * 12 <= 100
|
||||||
|
"
|
||||||
:content="itemName"
|
:content="itemName"
|
||||||
style="margin-left: 0px; margin-right: 2px" />
|
style="margin-left: 0px; margin-right: 2px"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</template>
|
</template>
|
||||||
|
@ -81,7 +98,8 @@
|
||||||
:label="$t('project.version.name')"
|
:label="$t('project.version.name')"
|
||||||
:filters="versionFilters"
|
:filters="versionFilters"
|
||||||
min-width="100px"
|
min-width="100px"
|
||||||
prop="versionId">
|
prop="versionId"
|
||||||
|
>
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<span>{{ scope.row.versionName }}</span>
|
<span>{{ scope.row.versionName }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
@ -91,7 +109,8 @@
|
||||||
sortable="createTime"
|
sortable="createTime"
|
||||||
width="160px"
|
width="160px"
|
||||||
:label="$t('commons.create_time')"
|
:label="$t('commons.create_time')"
|
||||||
prop="createTime">
|
prop="createTime"
|
||||||
|
>
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<span>{{ scope.row.createTime | datetimeFormat }}</span>
|
<span>{{ scope.row.createTime | datetimeFormat }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
@ -101,7 +120,8 @@
|
||||||
width="160"
|
width="160"
|
||||||
:label="$t('api_test.definition.api_last_time')"
|
:label="$t('api_test.definition.api_last_time')"
|
||||||
sortable="custom"
|
sortable="custom"
|
||||||
prop="updateTime">
|
prop="updateTime"
|
||||||
|
>
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<span>{{ scope.row.updateTime | datetimeFormat }}</span>
|
<span>{{ scope.row.updateTime | datetimeFormat }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
@ -110,18 +130,19 @@
|
||||||
<ms-table-column
|
<ms-table-column
|
||||||
prop="caseTotal"
|
prop="caseTotal"
|
||||||
width="80px"
|
width="80px"
|
||||||
:label="$t('api_test.definition.api_case_number')"/>
|
:label="$t('api_test.definition.api_case_number')"
|
||||||
|
/>
|
||||||
</ms-table>
|
</ms-table>
|
||||||
<ms-table-pagination :change="pageChange" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
<ms-table-pagination
|
||||||
:total="total"/>
|
:change="pageChange"
|
||||||
|
:current-page.sync="currentPage"
|
||||||
|
:page-size.sync="pageSize"
|
||||||
|
:total="total"
|
||||||
|
/>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import MsTable from "../../../table/MsTable";
|
import MsTable from "../../../table/MsTable";
|
||||||
import MsTableColumn from "../../../table/MsTableColumn";
|
import MsTableColumn from "../../../table/MsTableColumn";
|
||||||
import MsTableOperator from "../../../MsTableOperator";
|
import MsTableOperator from "../../../MsTableOperator";
|
||||||
|
@ -131,15 +152,15 @@ import MsTag from "../../../MsTag";
|
||||||
import MsTableAdvSearchBar from "../../../search/MsTableAdvSearchBar";
|
import MsTableAdvSearchBar from "../../../search/MsTableAdvSearchBar";
|
||||||
import ShowMoreBtn from "../../../table/ShowMoreBtn";
|
import ShowMoreBtn from "../../../table/ShowMoreBtn";
|
||||||
import MsSearch from "../../../search/MsSearch";
|
import MsSearch from "../../../search/MsSearch";
|
||||||
import {API_METHOD_COLOUR} from "../../../../model/JsonData";
|
import { API_METHOD_COLOUR } from "../../../../model/JsonData";
|
||||||
import PriorityTableItem from "../PriorityTableItem";
|
import PriorityTableItem from "../PriorityTableItem";
|
||||||
import MsEnvironmentSelect from "./MsEnvironmentSelect";
|
import MsEnvironmentSelect from "./MsEnvironmentSelect";
|
||||||
import {getProtocolFilter} from "../api-definition";
|
import { getProtocolFilter } from "../api-definition";
|
||||||
import {getProjectMemberById} from "../../../../api/user";
|
import { getProjectMemberById } from "../../../../api/user";
|
||||||
import TableSelectCountBar from "../ext/TableSelectCountBar";
|
import TableSelectCountBar from "../ext/TableSelectCountBar";
|
||||||
|
|
||||||
import {hasLicense} from "../../../../utils/permission";
|
import { hasLicense } from "../../../../utils/permission";
|
||||||
import {isProjectVersionEnable} from "../../../../api/version";
|
import { isProjectVersionEnable } from "../../../../api/version";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ApiTableList",
|
name: "ApiTableList",
|
||||||
|
@ -155,19 +176,17 @@ export default {
|
||||||
MsTable,
|
MsTable,
|
||||||
MsTableColumn,
|
MsTableColumn,
|
||||||
MsTableAdvSearchBar,
|
MsTableAdvSearchBar,
|
||||||
MsSearch
|
MsSearch,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
moduleId: "",
|
moduleId: "",
|
||||||
typeArr: [
|
typeArr: [{ id: "priority", name: this.$t("test_track.case.priority") }],
|
||||||
{id: 'priority', name: this.$t('test_track.case.priority')},
|
|
||||||
],
|
|
||||||
priorityFilters: [
|
priorityFilters: [
|
||||||
{text: 'P0', value: 'P0'},
|
{ text: "P0", value: "P0" },
|
||||||
{text: 'P1', value: 'P1'},
|
{ text: "P1", value: "P1" },
|
||||||
{text: 'P2', value: 'P2'},
|
{ text: "P2", value: "P2" },
|
||||||
{text: 'P3', value: 'P3'}
|
{ text: "P3", value: "P3" },
|
||||||
],
|
],
|
||||||
methodColorMap: new Map(API_METHOD_COLOUR),
|
methodColorMap: new Map(API_METHOD_COLOUR),
|
||||||
methodFilters: [],
|
methodFilters: [],
|
||||||
|
@ -176,6 +195,7 @@ export default {
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
versionEnable: false,
|
versionEnable: false,
|
||||||
pageRefresh: false,
|
pageRefresh: false,
|
||||||
|
resetOver: true,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
@ -190,9 +210,9 @@ export default {
|
||||||
screenHeight: {
|
screenHeight: {
|
||||||
type: [Number, String],
|
type: [Number, String],
|
||||||
default() {
|
default() {
|
||||||
return 'calc(100vh - 400px)';
|
return "calc(100vh - 400px)";
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getUserFilter();
|
this.getUserFilter();
|
||||||
|
@ -215,9 +235,9 @@ export default {
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
if (this.$refs.apitable) {
|
if (this.$refs.apitable) {
|
||||||
this.$emit('setSelectRow', this.$refs.apitable.getSelectRows());
|
this.$emit("setSelectRow", this.$refs.apitable.getSelectRows());
|
||||||
} else {
|
} else {
|
||||||
this.$emit('setSelectRow', new Set());
|
this.$emit("setSelectRow", new Set());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.$refs.apitable) {
|
if (this.$refs.apitable) {
|
||||||
|
@ -226,20 +246,20 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
getApiRequestTypeName() {
|
getApiRequestTypeName() {
|
||||||
if (this.currentProtocol === 'TCP') {
|
if (this.currentProtocol === "TCP") {
|
||||||
return this.$t('api_test.definition.api_agreement');
|
return this.$t("api_test.definition.api_agreement");
|
||||||
} else {
|
} else {
|
||||||
return this.$t('api_test.definition.api_type');
|
return this.$t("api_test.definition.api_type");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
selectCountChange(value) {
|
selectCountChange(value) {
|
||||||
this.$emit('selectCountChange', value)
|
this.$emit("selectCountChange", value);
|
||||||
if (this.$refs.apitable) {
|
if (this.$refs.apitable) {
|
||||||
this.$emit('setSelectRow', this.$refs.apitable.getSelectRows());
|
this.$emit("setSelectRow", this.$refs.apitable.getSelectRows());
|
||||||
} else {
|
} else {
|
||||||
this.$emit('setSelectRow', new Set());
|
this.$emit("setSelectRow", new Set());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getColor(flag, method) {
|
getColor(flag, method) {
|
||||||
|
@ -261,21 +281,25 @@ export default {
|
||||||
},
|
},
|
||||||
initTable(data) {
|
initTable(data) {
|
||||||
this.pageRefresh = data === "page";
|
this.pageRefresh = data === "page";
|
||||||
this.$emit('refreshTable');
|
this.$emit("refreshTable");
|
||||||
},
|
},
|
||||||
clear() {
|
clear() {
|
||||||
if (this.$refs.apitable) {
|
if (this.$refs.apitable) {
|
||||||
this.$refs.apitable.clear();
|
this.$refs.apitable.clear();
|
||||||
}
|
}
|
||||||
|
this.resetOver = false;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.resetOver = true;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
checkVersionEnable() {
|
checkVersionEnable() {
|
||||||
if (!this.projectId) {
|
if (!this.projectId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (hasLicense()) {
|
if (hasLicense()) {
|
||||||
isProjectVersionEnable(this.projectId).then(res => {
|
isProjectVersionEnable(this.projectId).then((res) => {
|
||||||
this.versionEnable = res.data;
|
this.versionEnable = res.data;
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getUserFilter() {
|
getUserFilter() {
|
||||||
|
@ -283,21 +307,21 @@ export default {
|
||||||
if (!this.projectId) {
|
if (!this.projectId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
getProjectMemberById(this.projectId).then(res => {
|
getProjectMemberById(this.projectId).then((res) => {
|
||||||
this.userFilters = res.data.map(u => {
|
this.userFilters = res.data.map((u) => {
|
||||||
return {text: u.name, value: u.id};
|
return { text: u.name, value: u.id };
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getTagToolTips(tags) {
|
getTagToolTips(tags) {
|
||||||
try {
|
try {
|
||||||
let showTips = '';
|
let showTips = "";
|
||||||
tags.forEach((item) => {
|
tags.forEach((item) => {
|
||||||
showTips += item + ',';
|
showTips += item + ",";
|
||||||
});
|
});
|
||||||
return showTips.substr(0, showTips.length - 1);
|
return showTips.substr(0, showTips.length - 1);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return '';
|
return "";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -305,10 +329,9 @@ export default {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
.request-method {
|
.request-method {
|
||||||
padding: 0 5px;
|
padding: 0 5px;
|
||||||
color: #1E90FF;
|
color: #1e90ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.api-el-tag {
|
.api-el-tag {
|
||||||
|
@ -331,5 +354,4 @@ export default {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -2,19 +2,31 @@
|
||||||
<div v-loading="loading">
|
<div v-loading="loading">
|
||||||
<api-list-container
|
<api-list-container
|
||||||
:is-api-list-enable="isApiListEnable"
|
:is-api-list-enable="isApiListEnable"
|
||||||
@isApiListEnableChange="isApiListEnableChange">
|
@isApiListEnableChange="isApiListEnableChange"
|
||||||
|
>
|
||||||
<template>
|
<template>
|
||||||
<slot name="version"></slot>
|
<slot name="version"></slot>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<ms-environment-select :project-id="projectId" :is-read-only="isReadOnly"
|
<ms-environment-select
|
||||||
@setEnvironment="setEnvironment" ref="msEnvironmentSelect"/>
|
:project-id="projectId"
|
||||||
|
:is-read-only="isReadOnly"
|
||||||
|
@setEnvironment="setEnvironment"
|
||||||
|
ref="msEnvironmentSelect"
|
||||||
|
/>
|
||||||
<ms-search
|
<ms-search
|
||||||
:condition.sync="condition"
|
:condition.sync="condition"
|
||||||
@search="initTable">
|
v-if="clearOver"
|
||||||
|
@search="initTable"
|
||||||
|
>
|
||||||
</ms-search>
|
</ms-search>
|
||||||
<ms-table :data="tableData" :select-node-ids="selectNodeIds" :condition="condition" :page-size="pageSize"
|
<ms-table
|
||||||
:total="total" enableSelection
|
:data="tableData"
|
||||||
|
:select-node-ids="selectNodeIds"
|
||||||
|
:condition="condition"
|
||||||
|
:page-size="pageSize"
|
||||||
|
:total="total"
|
||||||
|
enableSelection
|
||||||
:screenHeight="screenHeight"
|
:screenHeight="screenHeight"
|
||||||
row-key="id"
|
row-key="id"
|
||||||
:reserve-option="true"
|
:reserve-option="true"
|
||||||
|
@ -22,25 +34,26 @@
|
||||||
@refresh="initTable"
|
@refresh="initTable"
|
||||||
@selectCountChange="selectCountChange"
|
@selectCountChange="selectCountChange"
|
||||||
operator-width="170px"
|
operator-width="170px"
|
||||||
ref="table">
|
ref="table"
|
||||||
|
>
|
||||||
<ms-table-column
|
<ms-table-column prop="num" label="ID" width="80px" sortable="true">
|
||||||
prop="num"
|
|
||||||
label="ID"
|
|
||||||
width="80px"
|
|
||||||
sortable=true>
|
|
||||||
</ms-table-column>
|
</ms-table-column>
|
||||||
|
|
||||||
<ms-table-column prop="name" width="160px" :label="$t('test_track.case.name')"/>
|
<ms-table-column
|
||||||
|
prop="name"
|
||||||
|
width="160px"
|
||||||
|
:label="$t('test_track.case.name')"
|
||||||
|
/>
|
||||||
|
|
||||||
<ms-table-column
|
<ms-table-column
|
||||||
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">
|
<template v-slot:default="scope">
|
||||||
<priority-table-item :value="scope.row.priority"/>
|
<priority-table-item :value="scope.row.priority" />
|
||||||
</template>
|
</template>
|
||||||
</ms-table-column>
|
</ms-table-column>
|
||||||
|
|
||||||
|
@ -48,9 +61,15 @@
|
||||||
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')"
|
||||||
|
/>
|
||||||
|
|
||||||
<ms-table-column prop="tags" width="120px" :label="$t('commons.tag')" :show-overflow-tooltip="false">
|
<ms-table-column
|
||||||
|
prop="tags"
|
||||||
|
width="120px"
|
||||||
|
:label="$t('commons.tag')"
|
||||||
|
:show-overflow-tooltip="false"
|
||||||
|
>
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<el-tooltip class="item" effect="dark" placement="top">
|
<el-tooltip class="item" effect="dark" placement="top">
|
||||||
<div v-html="getTagToolTips(scope.row.tags)" slot="content"></div>
|
<div v-html="getTagToolTips(scope.row.tags)" slot="content"></div>
|
||||||
|
@ -60,9 +79,12 @@
|
||||||
:key="index"
|
:key="index"
|
||||||
type="success"
|
type="success"
|
||||||
effect="plain"
|
effect="plain"
|
||||||
:show-tooltip="scope.row.tags.length === 1 && itemName.length * 12 <= 100"
|
:show-tooltip="
|
||||||
|
scope.row.tags.length === 1 && itemName.length * 12 <= 100
|
||||||
|
"
|
||||||
:content="itemName"
|
:content="itemName"
|
||||||
style="margin-left: 0px; margin-right: 2px" />
|
style="margin-left: 0px; margin-right: 2px"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</template>
|
</template>
|
||||||
|
@ -73,21 +95,21 @@
|
||||||
:label="$t('project.version.name')"
|
:label="$t('project.version.name')"
|
||||||
:filters="versionFilters"
|
:filters="versionFilters"
|
||||||
min-width="100px"
|
min-width="100px"
|
||||||
prop="versionId">
|
prop="versionId"
|
||||||
|
>
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<span>{{ scope.row.versionName }}</span>
|
<span>{{ scope.row.versionName }}</span>
|
||||||
</template>
|
</template>
|
||||||
</ms-table-column>
|
</ms-table-column>
|
||||||
|
|
||||||
<ms-table-column
|
<ms-table-column prop="createUser" :label="$t('commons.create_user')" />
|
||||||
prop="createUser"
|
|
||||||
:label="$t('commons.create_user')"/>
|
|
||||||
|
|
||||||
<ms-table-column
|
<ms-table-column
|
||||||
sortable="createTime"
|
sortable="createTime"
|
||||||
width="160px"
|
width="160px"
|
||||||
:label="$t('commons.create_time')"
|
:label="$t('commons.create_time')"
|
||||||
prop="createTime">
|
prop="createTime"
|
||||||
|
>
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<span>{{ scope.row.createTime | datetimeFormat }}</span>
|
<span>{{ scope.row.createTime | datetimeFormat }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
@ -97,38 +119,45 @@
|
||||||
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">
|
<template v-slot:default="scope">
|
||||||
<span>{{ scope.row.updateTime | datetimeFormat }}</span>
|
<span>{{ scope.row.updateTime | datetimeFormat }}</span>
|
||||||
</template>
|
</template>
|
||||||
</ms-table-column>
|
</ms-table-column>
|
||||||
</ms-table>
|
</ms-table>
|
||||||
<ms-table-pagination :change="pageChange" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
<ms-table-pagination
|
||||||
:total="total"/>
|
:change="pageChange"
|
||||||
|
:current-page.sync="currentPage"
|
||||||
|
:page-size.sync="pageSize"
|
||||||
|
:total="total"
|
||||||
|
/>
|
||||||
</api-list-container>
|
</api-list-container>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import MsTable from "metersphere-frontend/src/components/table/MsTable";
|
import MsTable from "metersphere-frontend/src/components/table/MsTable";
|
||||||
import MsTableColumn from "metersphere-frontend/src/components/table/MsTableColumn";
|
import MsTableColumn from "metersphere-frontend/src/components/table/MsTableColumn";
|
||||||
import MsTablePagination from "metersphere-frontend/src/components/pagination/TablePagination";
|
import MsTablePagination from "metersphere-frontend/src/components/pagination/TablePagination";
|
||||||
import MsTag from "metersphere-frontend/src/components/MsTag";
|
import MsTag from "metersphere-frontend/src/components/MsTag";
|
||||||
import {API_METHOD_COLOUR, CASE_PRIORITY} from "metersphere-frontend/src/model/JsonData";
|
import {
|
||||||
|
API_METHOD_COLOUR,
|
||||||
|
CASE_PRIORITY,
|
||||||
|
} from "metersphere-frontend/src/model/JsonData";
|
||||||
import MsEnvironmentSelect from "metersphere-frontend/src/components/environment/snippet/ext/MsEnvironmentSelect";
|
import MsEnvironmentSelect from "metersphere-frontend/src/components/environment/snippet/ext/MsEnvironmentSelect";
|
||||||
import MsTableAdvSearchBar from "metersphere-frontend/src/components/search/MsTableAdvSearchBar";
|
import MsTableAdvSearchBar from "metersphere-frontend/src/components/search/MsTableAdvSearchBar";
|
||||||
import {
|
import { TEST_PLAN_RELEVANCE_API_CASE_CONFIGS } from "metersphere-frontend/src/components/search/search-components";
|
||||||
TEST_PLAN_RELEVANCE_API_CASE_CONFIGS
|
|
||||||
} from "metersphere-frontend/src/components/search/search-components";
|
|
||||||
import MsSearch from "metersphere-frontend/src/components/search/MsSearch";
|
import MsSearch from "metersphere-frontend/src/components/search/MsSearch";
|
||||||
import ApiListContainer from "@/business/plan/view/comonents/api/ApiListContainer";
|
import ApiListContainer from "@/business/plan/view/comonents/api/ApiListContainer";
|
||||||
import {buildBatchParam, hasLicense, isProjectVersionEnable, parseTag} from "@/business/utils/sdk-utils";
|
import {
|
||||||
|
buildBatchParam,
|
||||||
|
hasLicense,
|
||||||
|
isProjectVersionEnable,
|
||||||
|
} from "@/business/utils/sdk-utils";
|
||||||
import PriorityTableItem from "@/business/common/tableItems/planview/PriorityTableItem";
|
import PriorityTableItem from "@/business/common/tableItems/planview/PriorityTableItem";
|
||||||
import {apiDefinitionGet} from "@/api/remote/api/api-definition";
|
import { apiDefinitionGet } from "@/api/remote/api/api-definition";
|
||||||
import {testPlanApiCaseRelevanceList} from "@/api/remote/plan/test-plan-api-case";
|
import { testPlanApiCaseRelevanceList } from "@/api/remote/plan/test-plan-api-case";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "RelevanceCaseList",
|
name: "RelevanceCaseList",
|
||||||
|
@ -141,37 +170,36 @@ export default {
|
||||||
MsTable,
|
MsTable,
|
||||||
MsTableColumn,
|
MsTableColumn,
|
||||||
MsSearch,
|
MsSearch,
|
||||||
MsTableAdvSearchBar
|
MsTableAdvSearchBar,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
condition: {
|
condition: {
|
||||||
components: TEST_PLAN_RELEVANCE_API_CASE_CONFIGS
|
components: TEST_PLAN_RELEVANCE_API_CASE_CONFIGS,
|
||||||
},
|
},
|
||||||
selectCase: {},
|
selectCase: {},
|
||||||
loading: false,
|
loading: false,
|
||||||
moduleId: "",
|
moduleId: "",
|
||||||
typeArr: [
|
typeArr: [{ id: "priority", name: this.$t("test_track.case.priority") }],
|
||||||
{id: 'priority', name: this.$t('test_track.case.priority')},
|
|
||||||
],
|
|
||||||
priorityFilters: [
|
priorityFilters: [
|
||||||
{text: 'P0', value: 'P0'},
|
{ text: "P0", value: "P0" },
|
||||||
{text: 'P1', value: 'P1'},
|
{ text: "P1", value: "P1" },
|
||||||
{text: 'P2', value: 'P2'},
|
{ text: "P2", value: "P2" },
|
||||||
{text: 'P3', value: 'P3'}
|
{ text: "P3", value: "P3" },
|
||||||
],
|
],
|
||||||
valueArr: {
|
valueArr: {
|
||||||
priority: CASE_PRIORITY,
|
priority: CASE_PRIORITY,
|
||||||
},
|
},
|
||||||
methodColorMap: new Map(API_METHOD_COLOUR),
|
methodColorMap: new Map(API_METHOD_COLOUR),
|
||||||
screenHeight: 'calc(100vh - 400px)',//屏幕高度
|
screenHeight: "calc(100vh - 400px)", //屏幕高度
|
||||||
tableData: [],
|
tableData: [],
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
|
clearOver: true,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
total: 0,
|
total: 0,
|
||||||
environmentId: "",
|
environmentId: "",
|
||||||
versionEnable: false,
|
versionEnable: false,
|
||||||
pageRefresh: false
|
pageRefresh: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
@ -189,7 +217,7 @@ export default {
|
||||||
},
|
},
|
||||||
isReadOnly: {
|
isReadOnly: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false,
|
||||||
},
|
},
|
||||||
projectId: String,
|
projectId: String,
|
||||||
planId: String,
|
planId: String,
|
||||||
|
@ -208,7 +236,7 @@ export default {
|
||||||
},
|
},
|
||||||
projectId() {
|
projectId() {
|
||||||
this.condition = {
|
this.condition = {
|
||||||
components: TEST_PLAN_RELEVANCE_API_CASE_CONFIGS
|
components: TEST_PLAN_RELEVANCE_API_CASE_CONFIGS,
|
||||||
};
|
};
|
||||||
this.selectNodeIds.length = 0;
|
this.selectNodeIds.length = 0;
|
||||||
this.initTable();
|
this.initTable();
|
||||||
|
@ -217,7 +245,7 @@ export default {
|
||||||
currentVersion() {
|
currentVersion() {
|
||||||
this.condition.versionId = this.currentVersion;
|
this.condition.versionId = this.currentVersion;
|
||||||
this.initTable();
|
this.initTable();
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
selectRows() {
|
selectRows() {
|
||||||
|
@ -226,14 +254,14 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
return new Set();
|
return new Set();
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
isApiListEnableChange(data) {
|
isApiListEnableChange(data) {
|
||||||
this.$emit('isApiListEnableChange', data);
|
this.$emit("isApiListEnableChange", data);
|
||||||
},
|
},
|
||||||
selectCountChange(data) {
|
selectCountChange(data) {
|
||||||
this.$emit('selectCountChange', data);
|
this.$emit("selectCountChange", data);
|
||||||
},
|
},
|
||||||
pageChange() {
|
pageChange() {
|
||||||
this.initTable(null, "page");
|
this.initTable(null, "page");
|
||||||
|
@ -242,7 +270,7 @@ export default {
|
||||||
this.pageRefresh = data === "page";
|
this.pageRefresh = data === "page";
|
||||||
this.condition.status = "";
|
this.condition.status = "";
|
||||||
this.condition.moduleIds = this.selectNodeIds;
|
this.condition.moduleIds = this.selectNodeIds;
|
||||||
if (projectId != null && typeof projectId === 'string') {
|
if (projectId != null && typeof projectId === "string") {
|
||||||
this.condition.projectId = projectId;
|
this.condition.projectId = projectId;
|
||||||
} else if (this.projectId != null) {
|
} else if (this.projectId != null) {
|
||||||
this.condition.projectId = this.projectId;
|
this.condition.projectId = this.projectId;
|
||||||
|
@ -252,12 +280,14 @@ export default {
|
||||||
}
|
}
|
||||||
this.condition.planId = this.planId;
|
this.condition.planId = this.planId;
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
testPlanApiCaseRelevanceList({pageNum: this.currentPage, pageSize: this.pageSize}, this.condition)
|
testPlanApiCaseRelevanceList(
|
||||||
.then(response => {
|
{ pageNum: this.currentPage, pageSize: this.pageSize },
|
||||||
|
this.condition
|
||||||
|
).then((response) => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.total = response.data.itemCount;
|
this.total = response.data.itemCount;
|
||||||
this.tableData = response.data.listObject;
|
this.tableData = response.data.listObject;
|
||||||
this.tableData.forEach(item => {
|
this.tableData.forEach((item) => {
|
||||||
if (item.tags && item.tags.length > 0) {
|
if (item.tags && item.tags.length > 0) {
|
||||||
item.tags = JSON.parse(item.tags);
|
item.tags = JSON.parse(item.tags);
|
||||||
}
|
}
|
||||||
|
@ -268,6 +298,10 @@ export default {
|
||||||
if (this.$refs.table) {
|
if (this.$refs.table) {
|
||||||
this.$refs.table.clear();
|
this.$refs.table.clear();
|
||||||
}
|
}
|
||||||
|
this.clearOver = false;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.clearOver = true;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
clearEnvAndSelect() {
|
clearEnvAndSelect() {
|
||||||
this.environmentId = "";
|
this.environmentId = "";
|
||||||
|
@ -279,29 +313,33 @@ export default {
|
||||||
},
|
},
|
||||||
getTagToolTips(tags) {
|
getTagToolTips(tags) {
|
||||||
try {
|
try {
|
||||||
let showTips = '';
|
let showTips = "";
|
||||||
tags.forEach((item) => {
|
tags.forEach((item) => {
|
||||||
showTips += item + ',';
|
showTips += item + ",";
|
||||||
});
|
});
|
||||||
return showTips.substr(0, showTips.length - 1);
|
return showTips.substr(0, showTips.length - 1);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return '';
|
return "";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
showExecResult(row) {
|
showExecResult(row) {
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
this.$emit('showExecResult', row);
|
this.$emit("showExecResult", row);
|
||||||
},
|
},
|
||||||
buildPagePath(path) {
|
buildPagePath(path) {
|
||||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||||
},
|
},
|
||||||
handleTestCase(testCase) {
|
handleTestCase(testCase) {
|
||||||
apiDefinitionGet(testCase.apiDefinitionId)
|
apiDefinitionGet(testCase.apiDefinitionId).then((response) => {
|
||||||
.then((response) => {
|
|
||||||
let api = response.data;
|
let api = response.data;
|
||||||
let selectApi = api;
|
let selectApi = api;
|
||||||
let request = {};
|
let request = {};
|
||||||
if (Object.prototype.toString.call(api.request).match(/\[object (\w+)\]/)[1].toLowerCase() === 'object') {
|
if (
|
||||||
|
Object.prototype.toString
|
||||||
|
.call(api.request)
|
||||||
|
.match(/\[object (\w+)\]/)[1]
|
||||||
|
.toLowerCase() === "object"
|
||||||
|
) {
|
||||||
request = api.request;
|
request = api.request;
|
||||||
} else {
|
} else {
|
||||||
request = JSON.parse(api.request);
|
request = JSON.parse(api.request);
|
||||||
|
@ -332,8 +370,8 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
param = batchParam;
|
param = batchParam;
|
||||||
}
|
}
|
||||||
param.ids = Array.from(sampleSelectRows).map(row => row.id);
|
param.ids = Array.from(sampleSelectRows).map((row) => row.id);
|
||||||
let tableDataIds = Array.from(this.tableData).map(row => row.id);
|
let tableDataIds = Array.from(this.tableData).map((row) => row.id);
|
||||||
param.ids.sort((a, b) => {
|
param.ids.sort((a, b) => {
|
||||||
return tableDataIds.indexOf(a) - tableDataIds.indexOf(b);
|
return tableDataIds.indexOf(a) - tableDataIds.indexOf(b);
|
||||||
});
|
});
|
||||||
|
@ -344,12 +382,11 @@ export default {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (hasLicense()) {
|
if (hasLicense()) {
|
||||||
isProjectVersionEnable(this.projectId)
|
isProjectVersionEnable(this.projectId).then((response) => {
|
||||||
.then(response => {
|
|
||||||
this.versionEnable = response.data;
|
this.versionEnable = response.data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -362,7 +399,7 @@ export default {
|
||||||
|
|
||||||
.request-method {
|
.request-method {
|
||||||
padding: 0 5px;
|
padding: 0 5px;
|
||||||
color: #1E90FF;
|
color: #1e90ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.api-el-tag {
|
.api-el-tag {
|
||||||
|
@ -385,5 +422,4 @@ export default {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
<ms-search
|
<ms-search
|
||||||
:base-search-tip="$t('api_test.definition.request.select_case')"
|
:base-search-tip="$t('api_test.definition.request.select_case')"
|
||||||
:condition.sync="condition"
|
:condition.sync="condition"
|
||||||
|
v-if="clearOver"
|
||||||
style="margin-top: 10px"
|
style="margin-top: 10px"
|
||||||
@search="filterSearch"
|
@search="filterSearch"
|
||||||
>
|
>
|
||||||
|
@ -167,8 +168,7 @@
|
||||||
<script>
|
<script>
|
||||||
import MsTableHeader from "metersphere-frontend/src/components/MsTableHeader";
|
import MsTableHeader from "metersphere-frontend/src/components/MsTableHeader";
|
||||||
import MsTablePagination from "metersphere-frontend/src/components/pagination/TablePagination";
|
import MsTablePagination from "metersphere-frontend/src/components/pagination/TablePagination";
|
||||||
import MsTag from "metersphere-frontend/src/components/MsTag";
|
import MsTag from "metersphere-frontend/src/components/MsTag"; // import MsApiReportDetail from "../../../../../api/automation/report/ApiReportDetail";
|
||||||
// import MsApiReportDetail from "../../../../../api/automation/report/ApiReportDetail";
|
|
||||||
import TestPlanScenarioListHeader from "./TestPlanScenarioListHeader";
|
import TestPlanScenarioListHeader from "./TestPlanScenarioListHeader";
|
||||||
import PriorityTableItem from "@/business/common/tableItems/planview/PriorityTableItem";
|
import PriorityTableItem from "@/business/common/tableItems/planview/PriorityTableItem";
|
||||||
import MsTableAdvSearchBar from "metersphere-frontend/src/components/search/MsTableAdvSearchBar";
|
import MsTableAdvSearchBar from "metersphere-frontend/src/components/search/MsTableAdvSearchBar";
|
||||||
|
@ -228,6 +228,7 @@ export default {
|
||||||
currentScenario: {},
|
currentScenario: {},
|
||||||
schedule: {},
|
schedule: {},
|
||||||
tableData: [],
|
tableData: [],
|
||||||
|
clearOver: true,
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
total: 0,
|
total: 0,
|
||||||
|
@ -320,6 +321,10 @@ export default {
|
||||||
},
|
},
|
||||||
clear() {
|
clear() {
|
||||||
this.selectRows.clear();
|
this.selectRows.clear();
|
||||||
|
this.clearOver = false;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.clearOver = true;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
setProjectEnvMap(projectEnvMap) {
|
setProjectEnvMap(projectEnvMap) {
|
||||||
this.projectEnvMap = projectEnvMap;
|
this.projectEnvMap = projectEnvMap;
|
||||||
|
|
Loading…
Reference in New Issue