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() {
|
isRedirectFilter() {
|
||||||
this.selectDataRange = "all";
|
this.selectDataRange = "all";
|
||||||
this.selectDataType = "all";
|
this.selectDataType = "all";
|
||||||
let routeParamObj = this.$route.params.paramObj;
|
let routeParamObj = this.$route.params;
|
||||||
if (routeParamObj) {
|
if (routeParamObj) {
|
||||||
let dataRange = routeParamObj.dataSelectRange;
|
let dataRange = routeParamObj.dataSelectRange;
|
||||||
let dataType = routeParamObj.dataType;
|
let dataType = routeParamObj.dataType;
|
||||||
|
|
|
@ -33,7 +33,8 @@
|
||||||
class="ms-api-button"
|
class="ms-api-button"
|
||||||
ref="environmentSelect"/>
|
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
|
<el-tab-pane
|
||||||
name="trash" :closable="true"
|
name="trash" :closable="true"
|
||||||
:label="$t('commons.trash')" v-if="trashEnable">
|
:label="$t('commons.trash')" v-if="trashEnable">
|
||||||
|
@ -287,7 +288,7 @@ export default {
|
||||||
},
|
},
|
||||||
isSelectDefaultProtocol() {
|
isSelectDefaultProtocol() {
|
||||||
let selectDefaultProtocol = true;
|
let selectDefaultProtocol = true;
|
||||||
let routeParamObj = this.$route.params.paramObj;
|
let routeParamObj = this.$route.params;
|
||||||
if (routeParamObj) {
|
if (routeParamObj) {
|
||||||
let dataRange = routeParamObj.dataSelectRange;
|
let dataRange = routeParamObj.dataSelectRange;
|
||||||
let dataType = routeParamObj.dataType;
|
let dataType = routeParamObj.dataType;
|
||||||
|
@ -391,7 +392,7 @@ export default {
|
||||||
},
|
},
|
||||||
activated() {
|
activated() {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
let routeParamObj = this.$route.params.paramObj;
|
let routeParamObj = this.$route.params;
|
||||||
if (routeParamObj) {
|
if (routeParamObj) {
|
||||||
let dataRange = routeParamObj.dataSelectRange;
|
let dataRange = routeParamObj.dataSelectRange;
|
||||||
if (dataRange && dataRange.length > 0) {
|
if (dataRange && dataRange.length > 0) {
|
||||||
|
@ -466,7 +467,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
let routeParamObj = this.$route.params.paramObj;
|
let routeParamObj = this.$route.params;
|
||||||
if (routeParamObj) {
|
if (routeParamObj) {
|
||||||
let workspaceId = routeParamObj.workspaceId;
|
let workspaceId = routeParamObj.workspaceId;
|
||||||
if (workspaceId) {
|
if (workspaceId) {
|
||||||
|
@ -792,23 +793,6 @@ export default {
|
||||||
this.handleTabsEdit(this.$t('api_test.definition.request.fast_debug'), "debug", id);
|
this.handleTabsEdit(this.$t('api_test.definition.request.fast_debug'), "debug", id);
|
||||||
},
|
},
|
||||||
init() {
|
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 dataRange = this.$route.params.dataSelectRange;
|
||||||
let dataType = this.$route.params.dataType;
|
let dataType = this.$route.params.dataType;
|
||||||
if (dataRange && typeof dataRange === 'string') {
|
if (dataRange && typeof dataRange === 'string') {
|
||||||
|
@ -823,7 +807,6 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
editApi(row) {
|
editApi(row) {
|
||||||
const index = this.apiTabs.find(p => p.api && p.api.id === row.id);
|
const index = this.apiTabs.find(p => p.api && p.api.id === row.id);
|
||||||
|
@ -969,8 +952,8 @@ export default {
|
||||||
this.nodeTree = data;
|
this.nodeTree = data;
|
||||||
},
|
},
|
||||||
changeSelectDataRangeAll(tableType) {
|
changeSelectDataRangeAll(tableType) {
|
||||||
if (this.$route.params.paramObj) {
|
if (this.$route.params) {
|
||||||
this.$route.params.paramObj.dataSelectRange = 'all';
|
this.$route.params.dataSelectRange = 'all';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
enableTrash(data) {
|
enableTrash(data) {
|
||||||
|
|
|
@ -1200,20 +1200,11 @@ export default {
|
||||||
//判断是否只显示本周的数据。 从首页跳转过来的请求会带有相关参数
|
//判断是否只显示本周的数据。 从首页跳转过来的请求会带有相关参数
|
||||||
isRedirectFilter() {
|
isRedirectFilter() {
|
||||||
this.selectDataRange = "all";
|
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 routeParam = this.$route.params.dataSelectRange;
|
||||||
let dataType = this.$route.params.dataType;
|
let dataType = this.$route.params.dataType;
|
||||||
if (dataType === 'apiTestCase') {
|
if (dataType === 'apiTestCase') {
|
||||||
this.selectDataRange = routeParam;
|
this.selectDataRange = routeParam;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
changeSelectDataRangeAll() {
|
changeSelectDataRangeAll() {
|
||||||
this.$emit("changeSelectDataRangeAll", "testCase");
|
this.$emit("changeSelectDataRangeAll", "testCase");
|
||||||
|
|
|
@ -968,22 +968,6 @@ export default {
|
||||||
},
|
},
|
||||||
//判断是否只显示本周的数据。 从首页跳转过来的请求会带有相关参数
|
//判断是否只显示本周的数据。 从首页跳转过来的请求会带有相关参数
|
||||||
getSelectDataRange() {
|
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 dataRange = this.$route.params.dataSelectRange;
|
||||||
let dataType = this.$route.params.dataType;
|
let dataType = this.$route.params.dataType;
|
||||||
this.selectDataRange = dataType === 'api' ? dataRange : "all";
|
this.selectDataRange = dataType === 'api' ? dataRange : "all";
|
||||||
|
@ -997,7 +981,6 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
changeSelectDataRangeAll() {
|
changeSelectDataRangeAll() {
|
||||||
this.$emit("changeSelectDataRangeAll", "api");
|
this.$emit("changeSelectDataRangeAll", "api");
|
||||||
|
|
|
@ -187,18 +187,6 @@ export default {
|
||||||
},
|
},
|
||||||
isRedirect() {
|
isRedirect() {
|
||||||
let isRedirectPage = false;
|
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) {
|
if (this.$route.params.dataSelectRange) {
|
||||||
let item = JSON.parse(JSON.stringify(this.$route.params.dataSelectRange)).param;
|
let item = JSON.parse(JSON.stringify(this.$route.params.dataSelectRange)).param;
|
||||||
if (item !== undefined) {
|
if (item !== undefined) {
|
||||||
|
@ -208,7 +196,6 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return isRedirectPage;
|
return isRedirectPage;
|
||||||
},
|
},
|
||||||
filter() {
|
filter() {
|
||||||
|
|
|
@ -291,8 +291,8 @@ export default {
|
||||||
switch (page) {
|
switch (page) {
|
||||||
case "api":
|
case "api":
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: 'ApiDefinition',
|
name: 'ApiDefinitionWithQuery',
|
||||||
params: {paramObj: redirectObj}
|
params: {redirectID: uuid, dataType: dataType, dataSelectRange: selectType}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case "apiWithQuery":
|
case "apiWithQuery":
|
||||||
|
@ -303,8 +303,8 @@ export default {
|
||||||
break;
|
break;
|
||||||
case "scenario":
|
case "scenario":
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: 'ApiAutomationSingle',
|
name: 'ApiAutomationWithQuery',
|
||||||
params: {paramObj: redirectObj}
|
params: {redirectID: uuid, dataType: dataType, dataSelectRange: selectType}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case "scenarioWithQuery":
|
case "scenarioWithQuery":
|
||||||
|
|
|
@ -47,11 +47,6 @@ export default {
|
||||||
name: "ApiAutomation",
|
name: "ApiAutomation",
|
||||||
component: () => import('@/business/components/api/automation/ApiAutomation'),
|
component: () => import('@/business/components/api/automation/ApiAutomation'),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: "automation",
|
|
||||||
name: "ApiAutomationSingle",
|
|
||||||
component: () => import('@/business/components/api/automation/ApiAutomation'),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: 'monitor/view',
|
path: 'monitor/view',
|
||||||
name: 'ApiMonitor',
|
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 ApiStatus from "@/business/components/api/definition/components/list/ApiStatus.vue";
|
||||||
import {
|
import {
|
||||||
buildBatchParam,
|
buildBatchParam,
|
||||||
deepClone,
|
|
||||||
getCustomFieldBatchEditOption,
|
getCustomFieldBatchEditOption,
|
||||||
getCustomFieldFilter,
|
getCustomFieldFilter,
|
||||||
getCustomFieldValue,
|
getCustomFieldValue,
|
||||||
|
@ -236,7 +235,8 @@ import {
|
||||||
getCurrentProjectID,
|
getCurrentProjectID,
|
||||||
getCurrentWorkspaceId,
|
getCurrentWorkspaceId,
|
||||||
getUUID,
|
getUUID,
|
||||||
hasLicense, operationConfirm,
|
hasLicense,
|
||||||
|
operationConfirm,
|
||||||
parseTag
|
parseTag
|
||||||
} from "@/common/js/utils";
|
} from "@/common/js/utils";
|
||||||
import {getTestTemplate} from "@/network/custom-field-template";
|
import {getTestTemplate} from "@/network/custom-field-template";
|
||||||
|
@ -632,12 +632,9 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getSelectDataRange() {
|
getSelectDataRange() {
|
||||||
let routeParamObj = this.$route.params.paramObj;
|
|
||||||
this.selectDataRange = 'all';
|
this.selectDataRange = 'all';
|
||||||
if (routeParamObj) {
|
let dataRange = this.$route.params.dataSelectRange;
|
||||||
let dataRange = routeParamObj.dataSelectRange;
|
|
||||||
this.selectDataRange = dataRange;
|
this.selectDataRange = dataRange;
|
||||||
}
|
|
||||||
},
|
},
|
||||||
initTableData(nodeIds) {
|
initTableData(nodeIds) {
|
||||||
this.condition.planId = "";
|
this.condition.planId = "";
|
||||||
|
|
|
@ -172,7 +172,7 @@ export default {
|
||||||
case "testCase":
|
case "testCase":
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: 'testCaseRedirect',
|
name: 'testCaseRedirect',
|
||||||
params: {paramObj: redirectObj}
|
params: {redirectID: uuid, dataType: dataType, dataSelectRange: selectType}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case "testPlanEdit":
|
case "testPlanEdit":
|
||||||
|
@ -186,8 +186,8 @@ export default {
|
||||||
break;
|
break;
|
||||||
case "api":
|
case "api":
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: 'ApiDefinition',
|
name: 'ApiDefinitionWithQuery',
|
||||||
params: {paramObj: redirectObj}
|
params: {redirectID: uuid, dataType: dataType, dataSelectRange: selectType}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ export default {
|
||||||
component: TestCase,
|
component: TestCase,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'case/all',
|
path: 'case/all/:redirectID?/:dataType?/:dataSelectRange?/:projectId?/:workspaceId?',
|
||||||
name: 'testCaseRedirect',
|
name: 'testCaseRedirect',
|
||||||
component: TestCase,
|
component: TestCase,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue