fix(测试跟踪、接口测试): 更换router跳转的传参方式,解决跳转时param参数丢失的问题 (#17968)
--bug=1016776 --user=宋天阳 【接口测试】接口测试首页统计数字跳转后没有进行筛选 https://www.tapd.cn/55049933/s/1244622;--bug=1016490 --user=宋天阳 【测试跟踪】github#17588,之前已覆盖点进去会筛选已经关联的用例现在不行了 https://www.tapd.cn/55049933/s/1244624 Co-authored-by: song-tianyang <tianyang.song@fit2cloud.com>
This commit is contained in:
parent
aab7a50b7f
commit
5ea7ef7f2d
|
@ -1200,7 +1200,7 @@ export default {
|
|||
isRedirectFilter() {
|
||||
this.selectDataRange = "all";
|
||||
this.selectDataType = "all";
|
||||
let routeParamObj = this.$route.params.paramObj;
|
||||
let routeParamObj = this.$route.params;
|
||||
if (routeParamObj) {
|
||||
let dataRange = routeParamObj.dataSelectRange;
|
||||
let dataType = routeParamObj.dataType;
|
||||
|
|
|
@ -33,7 +33,8 @@
|
|||
class="ms-api-button"
|
||||
ref="environmentSelect"/>
|
||||
<!-- 主框架列表 -->
|
||||
<el-tabs v-model="apiDefaultTab" @edit="closeConfirm" @tab-click="addTab" @tab-remove="removeTab" ref="mainTabs">
|
||||
<el-tabs v-model="apiDefaultTab" @edit="closeConfirm" @tab-click="addTab" @tab-remove="removeTab"
|
||||
ref="mainTabs">
|
||||
<el-tab-pane
|
||||
name="trash" :closable="true"
|
||||
:label="$t('commons.trash')" v-if="trashEnable">
|
||||
|
@ -287,7 +288,7 @@ export default {
|
|||
},
|
||||
isSelectDefaultProtocol() {
|
||||
let selectDefaultProtocol = true;
|
||||
let routeParamObj = this.$route.params.paramObj;
|
||||
let routeParamObj = this.$route.params;
|
||||
if (routeParamObj) {
|
||||
let dataRange = routeParamObj.dataSelectRange;
|
||||
let dataType = routeParamObj.dataType;
|
||||
|
@ -391,7 +392,7 @@ export default {
|
|||
},
|
||||
activated() {
|
||||
this.$nextTick(() => {
|
||||
let routeParamObj = this.$route.params.paramObj;
|
||||
let routeParamObj = this.$route.params;
|
||||
if (routeParamObj) {
|
||||
let dataRange = routeParamObj.dataSelectRange;
|
||||
if (dataRange && dataRange.length > 0) {
|
||||
|
@ -466,7 +467,7 @@ export default {
|
|||
}
|
||||
},
|
||||
created() {
|
||||
let routeParamObj = this.$route.params.paramObj;
|
||||
let routeParamObj = this.$route.params;
|
||||
if (routeParamObj) {
|
||||
let workspaceId = routeParamObj.workspaceId;
|
||||
if (workspaceId) {
|
||||
|
@ -792,23 +793,6 @@ export default {
|
|||
this.handleTabsEdit(this.$t('api_test.definition.request.fast_debug'), "debug", id);
|
||||
},
|
||||
init() {
|
||||
let routeParamObj = this.$route.params.paramObj;
|
||||
if (routeParamObj) {
|
||||
let dataRange = routeParamObj.dataSelectRange;
|
||||
let dataType = routeParamObj.dataType;
|
||||
if (dataRange && typeof dataRange === 'string') {
|
||||
let selectParamArr = dataRange.split("edit:");
|
||||
if (selectParamArr.length === 2) {
|
||||
let scenarioId = selectParamArr[1];
|
||||
if (dataType === 'api') {
|
||||
this.$get('/api/definition/get/' + scenarioId, (response) => {
|
||||
this.defaultProtocol = response.data.protocol;
|
||||
this.editApi(response.data);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let dataRange = this.$route.params.dataSelectRange;
|
||||
let dataType = this.$route.params.dataType;
|
||||
if (dataRange && typeof dataRange === 'string') {
|
||||
|
@ -823,7 +807,6 @@ export default {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
editApi(row) {
|
||||
const index = this.apiTabs.find(p => p.api && p.api.id === row.id);
|
||||
|
@ -969,8 +952,8 @@ export default {
|
|||
this.nodeTree = data;
|
||||
},
|
||||
changeSelectDataRangeAll(tableType) {
|
||||
if (this.$route.params.paramObj) {
|
||||
this.$route.params.paramObj.dataSelectRange = 'all';
|
||||
if (this.$route.params) {
|
||||
this.$route.params.dataSelectRange = 'all';
|
||||
}
|
||||
},
|
||||
enableTrash(data) {
|
||||
|
|
|
@ -1200,20 +1200,11 @@ export default {
|
|||
//判断是否只显示本周的数据。 从首页跳转过来的请求会带有相关参数
|
||||
isRedirectFilter() {
|
||||
this.selectDataRange = "all";
|
||||
let routeParamObj = this.$route.params.paramObj;
|
||||
if (routeParamObj) {
|
||||
let routeParam = routeParamObj.dataSelectRange;
|
||||
let dataType = routeParamObj.dataType;
|
||||
if (dataType === 'apiTestCase') {
|
||||
this.selectDataRange = routeParam;
|
||||
}
|
||||
} else {
|
||||
let routeParam = this.$route.params.dataSelectRange;
|
||||
let dataType = this.$route.params.dataType;
|
||||
if (dataType === 'apiTestCase') {
|
||||
this.selectDataRange = routeParam;
|
||||
}
|
||||
}
|
||||
},
|
||||
changeSelectDataRangeAll() {
|
||||
this.$emit("changeSelectDataRangeAll", "testCase");
|
||||
|
|
|
@ -968,22 +968,6 @@ export default {
|
|||
},
|
||||
//判断是否只显示本周的数据。 从首页跳转过来的请求会带有相关参数
|
||||
getSelectDataRange() {
|
||||
let routeParamObj = this.$route.params.paramObj;
|
||||
if (routeParamObj) {
|
||||
let dataRange = routeParamObj.dataSelectRange;
|
||||
let dataType = routeParamObj.dataType;
|
||||
this.selectDataRange = dataType === 'api' ? dataRange : "all";
|
||||
if (this.selectDataRange &&
|
||||
Object.prototype.toString.call(this.selectDataRange).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object'
|
||||
&& this.selectDataRange.indexOf(":") !== -1) {
|
||||
let selectParamArr = this.selectDataRange.split(":");
|
||||
if (selectParamArr.length === 2) {
|
||||
if (selectParamArr[0] === "apiList") {
|
||||
this.condition.name = selectParamArr[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let dataRange = this.$route.params.dataSelectRange;
|
||||
let dataType = this.$route.params.dataType;
|
||||
this.selectDataRange = dataType === 'api' ? dataRange : "all";
|
||||
|
@ -997,7 +981,6 @@ export default {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
changeSelectDataRangeAll() {
|
||||
this.$emit("changeSelectDataRangeAll", "api");
|
||||
|
|
|
@ -187,18 +187,6 @@ export default {
|
|||
},
|
||||
isRedirect() {
|
||||
let isRedirectPage = false;
|
||||
let routeParamObj = this.$route.params.paramObj;
|
||||
if (routeParamObj) {
|
||||
if (routeParamObj.dataSelectRange) {
|
||||
let item = JSON.parse(JSON.stringify(routeParamObj.dataSelectRange)).param;
|
||||
if (item !== undefined) {
|
||||
let type = item.taskGroup.toString();
|
||||
if (type === "SWAGGER_IMPORT") {
|
||||
isRedirectPage = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this.$route.params.dataSelectRange) {
|
||||
let item = JSON.parse(JSON.stringify(this.$route.params.dataSelectRange)).param;
|
||||
if (item !== undefined) {
|
||||
|
@ -208,7 +196,6 @@ export default {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return isRedirectPage;
|
||||
},
|
||||
filter() {
|
||||
|
|
|
@ -291,8 +291,8 @@ export default {
|
|||
switch (page) {
|
||||
case "api":
|
||||
this.$router.push({
|
||||
name: 'ApiDefinition',
|
||||
params: {paramObj: redirectObj}
|
||||
name: 'ApiDefinitionWithQuery',
|
||||
params: {redirectID: uuid, dataType: dataType, dataSelectRange: selectType}
|
||||
});
|
||||
break;
|
||||
case "apiWithQuery":
|
||||
|
@ -303,8 +303,8 @@ export default {
|
|||
break;
|
||||
case "scenario":
|
||||
this.$router.push({
|
||||
name: 'ApiAutomationSingle',
|
||||
params: {paramObj: redirectObj}
|
||||
name: 'ApiAutomationWithQuery',
|
||||
params: {redirectID: uuid, dataType: dataType, dataSelectRange: selectType}
|
||||
});
|
||||
break;
|
||||
case "scenarioWithQuery":
|
||||
|
|
|
@ -47,11 +47,6 @@ export default {
|
|||
name: "ApiAutomation",
|
||||
component: () => import('@/business/components/api/automation/ApiAutomation'),
|
||||
},
|
||||
{
|
||||
path: "automation",
|
||||
name: "ApiAutomationSingle",
|
||||
component: () => import('@/business/components/api/automation/ApiAutomation'),
|
||||
},
|
||||
{
|
||||
path: 'monitor/view',
|
||||
name: 'ApiMonitor',
|
||||
|
|
|
@ -218,7 +218,6 @@ import MsTag from "@/business/components/common/components/MsTag";
|
|||
import ApiStatus from "@/business/components/api/definition/components/list/ApiStatus.vue";
|
||||
import {
|
||||
buildBatchParam,
|
||||
deepClone,
|
||||
getCustomFieldBatchEditOption,
|
||||
getCustomFieldFilter,
|
||||
getCustomFieldValue,
|
||||
|
@ -236,7 +235,8 @@ import {
|
|||
getCurrentProjectID,
|
||||
getCurrentWorkspaceId,
|
||||
getUUID,
|
||||
hasLicense, operationConfirm,
|
||||
hasLicense,
|
||||
operationConfirm,
|
||||
parseTag
|
||||
} from "@/common/js/utils";
|
||||
import {getTestTemplate} from "@/network/custom-field-template";
|
||||
|
@ -632,12 +632,9 @@ export default {
|
|||
});
|
||||
},
|
||||
getSelectDataRange() {
|
||||
let routeParamObj = this.$route.params.paramObj;
|
||||
this.selectDataRange = 'all';
|
||||
if (routeParamObj) {
|
||||
let dataRange = routeParamObj.dataSelectRange;
|
||||
let dataRange = this.$route.params.dataSelectRange;
|
||||
this.selectDataRange = dataRange;
|
||||
}
|
||||
},
|
||||
initTableData(nodeIds) {
|
||||
this.condition.planId = "";
|
||||
|
|
|
@ -172,7 +172,7 @@ export default {
|
|||
case "testCase":
|
||||
this.$router.push({
|
||||
name: 'testCaseRedirect',
|
||||
params: {paramObj: redirectObj}
|
||||
params: {redirectID: uuid, dataType: dataType, dataSelectRange: selectType}
|
||||
});
|
||||
break;
|
||||
case "testPlanEdit":
|
||||
|
@ -186,8 +186,8 @@ export default {
|
|||
break;
|
||||
case "api":
|
||||
this.$router.push({
|
||||
name: 'ApiDefinition',
|
||||
params: {paramObj: redirectObj}
|
||||
name: 'ApiDefinitionWithQuery',
|
||||
params: {redirectID: uuid, dataType: dataType, dataSelectRange: selectType}
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ export default {
|
|||
component: TestCase,
|
||||
},
|
||||
{
|
||||
path: 'case/all',
|
||||
path: 'case/all/:redirectID?/:dataType?/:dataSelectRange?/:projectId?/:workspaceId?',
|
||||
name: 'testCaseRedirect',
|
||||
component: TestCase,
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue