refactor(接口测试): 完善接口测试首页的跳转

--story=1007743 --user=宋天阳 接口测试首页数据统计优化
https://www.tapd.cn/55049933/s/1194610
This commit is contained in:
song-tianyang 2022-07-05 14:09:44 +08:00 committed by TIanyang
parent d6587265cf
commit fefd3017a3
10 changed files with 288 additions and 189 deletions

View File

@ -3,45 +3,45 @@
<ms-container v-if="renderComponent"> <ms-container v-if="renderComponent">
<ms-aside-container> <ms-aside-container>
<ms-api-module <ms-api-module
:show-operator="true" :show-operator="true"
@nodeSelectEvent="nodeChange" @nodeSelectEvent="nodeChange"
@protocolChange="handleProtocolChange" @protocolChange="handleProtocolChange"
@refreshTable="refresh" @refreshTable="refresh"
@exportAPI="exportAPI" @exportAPI="exportAPI"
@debug="debug" @debug="debug"
@saveAsEdit="editApi" @saveAsEdit="editApi"
@setModuleOptions="setModuleOptions" @setModuleOptions="setModuleOptions"
@setNodeTree="setNodeTree" @setNodeTree="setNodeTree"
@enableTrash="enableTrash" @enableTrash="enableTrash"
@schedule="handleTabsEdit($t('api_test.api_import.timing_synchronization'), 'SCHEDULE')" @schedule="handleTabsEdit($t('api_test.api_import.timing_synchronization'), 'SCHEDULE')"
:type="'edit'" :type="'edit'"
page-source="definition" page-source="definition"
:total='total' :total='total'
:current-version="currentVersion" :current-version="currentVersion"
ref="nodeTree"/> ref="nodeTree"/>
</ms-aside-container> </ms-aside-container>
<ms-main-container> <ms-main-container>
<ms-environment-select <ms-environment-select
:project-id="projectId" :project-id="projectId"
:is-read-only="false" :is-read-only="false"
:useEnvironment='useEnvironment' :useEnvironment='useEnvironment'
@setEnvironment="setEnvironment" @setEnvironment="setEnvironment"
class="ms-api-button" class="ms-api-button"
ref="environmentSelect"/> ref="environmentSelect"/>
<!-- 主框架列表 --> <!-- 主框架列表 -->
<el-tabs v-model="apiDefaultTab" @edit="closeConfirm" @tab-click="addTab"> <el-tabs v-model="apiDefaultTab" @edit="closeConfirm" @tab-click="addTab">
<el-tab-pane <el-tab-pane
name="trash" name="trash"
:label="$t('commons.trash')" v-if="trashEnable"> :label="$t('commons.trash')" v-if="trashEnable">
<ms-tab-button <ms-tab-button
v-if="this.trashTabInfo.type === 'list'" v-if="this.trashTabInfo.type === 'list'"
:active-dom.sync="trashActiveDom" :active-dom.sync="trashActiveDom"
:left-tip="$t('api_test.definition.api_title')" :left-tip="$t('api_test.definition.api_title')"
:right-tip="$t('api_test.definition.case_title')" :right-tip="$t('api_test.definition.case_title')"
:middle-button-enable="false" :middle-button-enable="false"
left-content="API" left-content="API"
right-content="CASE" right-content="CASE"
> >
<template v-slot:version> <template v-slot:version>
<version-select v-xpack :project-id="projectId" :version-id="trashVersion" <version-select v-xpack :project-id="projectId" :version-id="trashVersion"
@ -49,43 +49,43 @@
</template> </template>
<!-- 列表集合 --> <!-- 列表集合 -->
<ms-api-list <ms-api-list
v-if="trashActiveDom==='left'" v-if="trashActiveDom==='left'"
@runTest="runTest" @runTest="runTest"
@refreshTree="refreshTree" @refreshTree="refreshTree"
@getTrashApi="getTrashApi" @getTrashApi="getTrashApi"
:module-tree="nodeTree" :module-tree="nodeTree"
:module-options="moduleOptions" :module-options="moduleOptions"
:current-protocol="currentProtocol" :current-protocol="currentProtocol"
:current-version="currentVersion" :current-version="currentVersion"
:visible="visible" :visible="visible"
:currentRow="currentRow" :currentRow="currentRow"
:select-node-ids="selectNodeIds" :select-node-ids="selectNodeIds"
:trash-enable="true" :trash-enable="true"
:selectDataRange="selectDataRange" :selectDataRange="selectDataRange"
:is-read-only="isReadOnly" :is-read-only="isReadOnly"
@changeSelectDataRangeAll="changeSelectDataRangeAll" @changeSelectDataRangeAll="changeSelectDataRangeAll"
@editApi="editApi" @editApi="editApi"
@handleCase="handleCase" @handleCase="handleCase"
@showExecResult="showExecResult" @showExecResult="showExecResult"
@refreshTable="refresh" @refreshTable="refresh"
:init-api-table-opretion="initApiTableOpretion" :init-api-table-opretion="initApiTableOpretion"
@updateInitApiTableOpretion="updateInitApiTableOpretion" @updateInitApiTableOpretion="updateInitApiTableOpretion"
ref="trashApiList"/> ref="trashApiList"/>
<!--测试用例列表--> <!--测试用例列表-->
<api-case-simple-list <api-case-simple-list
v-if="trashActiveDom==='right'" v-if="trashActiveDom==='right'"
:current-protocol="currentProtocol" :current-protocol="currentProtocol"
:current-version="currentVersion" :current-version="currentVersion"
:visible="visible" :visible="visible"
:currentRow="currentRow" :currentRow="currentRow"
:select-node-ids="selectNodeIds" :select-node-ids="selectNodeIds"
:trash-enable="true" :trash-enable="true"
:is-read-only="isReadOnly" :is-read-only="isReadOnly"
@changeSelectDataRangeAll="changeSelectDataRangeAll" @changeSelectDataRangeAll="changeSelectDataRangeAll"
@handleCase="handleCase" @handleCase="handleCase"
@refreshTable="refresh" @refreshTable="refresh"
@showExecResult="showExecResult" @showExecResult="showExecResult"
ref="trashCaseList"/> ref="trashCaseList"/>
</ms-tab-button> </ms-tab-button>
</el-tab-pane> </el-tab-pane>
@ -95,117 +95,117 @@
:closable="item.closable" :closable="item.closable"
:name="item.name"> :name="item.name">
<ms-tab-button <ms-tab-button
v-if="item.type === 'list'" v-if="item.type === 'list'"
:active-dom.sync="activeDom" :active-dom.sync="activeDom"
:left-tip="$t('api_test.definition.api_title')" :left-tip="$t('api_test.definition.api_title')"
:right-tip="$t('api_test.definition.doc_title')" :right-tip="$t('api_test.definition.doc_title')"
:middle-tip="$t('api_test.definition.case_title')" :middle-tip="$t('api_test.definition.case_title')"
left-content="API" left-content="API"
middle-content="CASE" middle-content="CASE"
:right-content="$t('api_test.definition.doc_title')" :right-content="$t('api_test.definition.doc_title')"
:right-button-enable="currentProtocol === 'HTTP' " :right-button-enable="currentProtocol === 'HTTP' "
> >
<template v-slot:version> <template v-slot:version>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion"/> <version-select v-xpack :project-id="projectId" @changeVersion="changeVersion"/>
</template> </template>
<!-- 列表集合 --> <!-- 列表集合 -->
<ms-api-list <ms-api-list
v-if="activeDom==='left'" v-if="activeDom==='left'"
@getTrashApi="getTrashApi" @getTrashApi="getTrashApi"
:module-tree="nodeTree" :module-tree="nodeTree"
:module-options="moduleOptions" :module-options="moduleOptions"
:current-protocol="currentProtocol" :current-protocol="currentProtocol"
:current-version="currentVersion" :current-version="currentVersion"
:visible="visible" :visible="visible"
:currentRow="currentRow" :currentRow="currentRow"
:select-node-ids="selectNodeIds" :select-node-ids="selectNodeIds"
:trash-enable="false" :trash-enable="false"
:selectDataRange="selectDataRange" :selectDataRange="selectDataRange"
:is-read-only="isReadOnly" :is-read-only="isReadOnly"
@runTest="runTest" @runTest="runTest"
@handleTestCase="handleTestCase" @handleTestCase="handleTestCase"
@refreshTree="refreshTree" @refreshTree="refreshTree"
@changeSelectDataRangeAll="changeSelectDataRangeAll" @changeSelectDataRangeAll="changeSelectDataRangeAll"
@editApi="editApi" @editApi="editApi"
@copyApi="copyApi" @copyApi="copyApi"
@handleCase="handleCase" @handleCase="handleCase"
@showExecResult="showExecResult" @showExecResult="showExecResult"
@refreshTable="refresh" @refreshTable="refresh"
:init-api-table-opretion="initApiTableOpretion" :init-api-table-opretion="initApiTableOpretion"
@updateInitApiTableOpretion="updateInitApiTableOpretion" @updateInitApiTableOpretion="updateInitApiTableOpretion"
ref="apiDefList"/> ref="apiDefList"/>
<!--测试用例列表--> <!--测试用例列表-->
<api-case-simple-list <api-case-simple-list
v-if="activeDom==='middle'" v-if="activeDom==='middle'"
:current-protocol="currentProtocol" :current-protocol="currentProtocol"
:current-version="currentVersion" :current-version="currentVersion"
:visible="visible" :visible="visible"
:currentRow="currentRow" :currentRow="currentRow"
:select-node-ids="selectNodeIds" :select-node-ids="selectNodeIds"
:trash-enable="false" :trash-enable="false"
:is-read-only="isReadOnly" :is-read-only="isReadOnly"
@changeSelectDataRangeAll="changeSelectDataRangeAll" @changeSelectDataRangeAll="changeSelectDataRangeAll"
@handleCase="handleCase" @handleCase="handleCase"
@refreshTable="refresh" @refreshTable="refresh"
@showExecResult="showExecResult" @showExecResult="showExecResult"
ref="caseList"/> ref="caseList"/>
<api-documents-page <api-documents-page
class="api-doc-page" class="api-doc-page"
v-if="activeDom==='right' && currentProtocol==='HTTP'" v-if="activeDom==='right' && currentProtocol==='HTTP'"
:project-id="projectId" :project-id="projectId"
:trash-enable="trashEnable" :trash-enable="trashEnable"
:version-id="currentVersion" :version-id="currentVersion"
:module-ids="selectNodeIds" :module-ids="selectNodeIds"
ref="documentsPage"/> ref="documentsPage"/>
</ms-tab-button> </ms-tab-button>
<!-- 添加/编辑测试窗口--> <!-- 添加/编辑测试窗口-->
<div v-if="item.type=== 'ADD' ||item.type === 'TEST'" class="ms-api-div"> <div v-if="item.type=== 'ADD' ||item.type === 'TEST'" class="ms-api-div">
<ms-edit-complete-container <ms-edit-complete-container
:syncTabs="syncTabs" :syncTabs="syncTabs"
@runTest="runTest" @runTest="runTest"
@saveApi="saveApi" @saveApi="saveApi"
@createRootModel="createRootModel" @createRootModel="createRootModel"
@editApi="editApi" @editApi="editApi"
@refresh="refresh" @refresh="refresh"
:current-api="item.api" :current-api="item.api"
:project-id="projectId" :project-id="projectId"
:currentProtocol="currentProtocol" :currentProtocol="currentProtocol"
:moduleOptions="moduleOptions" :moduleOptions="moduleOptions"
:activeDom="activeTab" :activeDom="activeTab"
@changeSelectDataRangeAll="changeSelectDataRangeAll" @changeSelectDataRangeAll="changeSelectDataRangeAll"
@handleCase="handleCase" @handleCase="handleCase"
@showExecResult="showExecResult" @showExecResult="showExecResult"
ref="apiConfig" ref="apiConfig"
/> />
</div> </div>
<!-- 快捷调试 --> <!-- 快捷调试 -->
<div v-else-if="item.type=== 'debug'" class="ms-api-div"> <div v-else-if="item.type=== 'debug'" class="ms-api-div">
<ms-debug-http-page <ms-debug-http-page
:currentProtocol="currentProtocol" :currentProtocol="currentProtocol"
:testCase="item.api" :testCase="item.api"
@saveAs="editApi" @saveAs="editApi"
@refreshModule="refreshModule" @refreshModule="refreshModule"
v-if="currentProtocol==='HTTP'"/> v-if="currentProtocol==='HTTP'"/>
<ms-debug-jdbc-page <ms-debug-jdbc-page
:currentProtocol="currentProtocol" :currentProtocol="currentProtocol"
:testCase="item.api" :testCase="item.api"
@saveAs="editApi" @saveAs="editApi"
@refreshModule="refreshModule" @refreshModule="refreshModule"
v-if="currentProtocol==='SQL'"/> v-if="currentProtocol==='SQL'"/>
<ms-debug-tcp-page <ms-debug-tcp-page
:currentProtocol="currentProtocol" :currentProtocol="currentProtocol"
:testCase="item.api" :testCase="item.api"
:scenario="false" :scenario="false"
@saveAs="editApi" @saveAs="editApi"
@refreshModule="refreshModule" @refreshModule="refreshModule"
v-if="currentProtocol==='TCP'"/> v-if="currentProtocol==='TCP'"/>
<ms-debug-dubbo-page <ms-debug-dubbo-page
:currentProtocol="currentProtocol" :currentProtocol="currentProtocol"
:testCase="item.api" :testCase="item.api"
@saveAs="editApi" @saveAs="editApi"
@refreshModule="refreshModule" @refreshModule="refreshModule"
v-if="currentProtocol==='DUBBO'"/> v-if="currentProtocol==='DUBBO'"/>
</div> </div>
<!-- 定时任务 --> <!-- 定时任务 -->
@ -378,7 +378,25 @@ export default {
this.param = item; this.param = item;
} }
} }
}
} else {
let dataType = this.$route.params.dataType;
if (dataType) {
if (dataType === "api") {
this.activeDom = 'left';
} else {
this.activeDom = 'middle';
}
}
if (this.$route.params.dataSelectRange) {
let item = JSON.parse(JSON.stringify(this.$route.params.dataSelectRange)).param;
if (item !== undefined) {
let type = item.taskGroup.toString();
if (type === "SWAGGER_IMPORT") {
this.handleTabsEdit(this.$t('api_test.api_import.timing_synchronization'), 'SCHEDULE');
this.param = item;
}
}
} }
} }
}, },
@ -577,7 +595,7 @@ export default {
let tab = this.apiTabs; let tab = this.apiTabs;
tab.forEach(t => { tab.forEach(t => {
if (t.type === 'ADD' && t.api && this.$store.state.apiMap.has(t.api.id) && (this.$store.state.apiMap.get(t.api.id).get("responseChange") === true || this.$store.state.apiMap.get(t.api.id).get("requestChange") === true || if (t.type === 'ADD' && t.api && this.$store.state.apiMap.has(t.api.id) && (this.$store.state.apiMap.get(t.api.id).get("responseChange") === true || this.$store.state.apiMap.get(t.api.id).get("requestChange") === true ||
this.$store.state.apiMap.get(t.api.id).get("fromChange") === true)) { this.$store.state.apiMap.get(t.api.id).get("fromChange") === true)) {
message += t.api.name + ""; message += t.api.name + "";
} else if (t.type === 'ADD' && t.title === this.$t('api_test.definition.request.title')) { } else if (t.type === 'ADD' && t.title === this.$t('api_test.definition.request.title')) {
message += this.$t('api_test.definition.request.title') + ""; message += this.$t('api_test.definition.request.title') + "";
@ -614,7 +632,7 @@ export default {
if (t.api && this.$store.state.apiMap.size > 0 && this.$store.state.apiMap.has(t.api.id)) { if (t.api && this.$store.state.apiMap.size > 0 && this.$store.state.apiMap.has(t.api.id)) {
id = t.api.id; id = t.api.id;
if (this.$store.state.apiMap.get(t.api.id).get("responseChange") === true || this.$store.state.apiMap.get(t.api.id).get("requestChange") === true || if (this.$store.state.apiMap.get(t.api.id).get("responseChange") === true || this.$store.state.apiMap.get(t.api.id).get("requestChange") === true ||
this.$store.state.apiMap.get(t.api.id).get("fromChange") === true) { this.$store.state.apiMap.get(t.api.id).get("fromChange") === true) {
message += t.api.name + ""; message += t.api.name + "";
id = t.api.id; id = t.api.id;
} }
@ -726,6 +744,20 @@ export default {
} }
} }
} }
} else {
let dataRange = this.$route.params.dataSelectRange;
let dataType = this.$route.params.dataType;
if (dataRange) {
let selectParamArr = dataRange.split("edit:");
if (selectParamArr.length === 2) {
let scenarioId = selectParamArr[1];
if (dataType === 'api') {
this.$get('/api/definition/get/' + scenarioId, (response) => {
this.editApi(response.data);
});
}
}
}
} }
}, },
editApi(row) { editApi(row) {
@ -745,7 +777,7 @@ export default {
this.activeTab = "api"; this.activeTab = "api";
if (row != null && row.tags != 'null' && row.tags != '' && row.tags != undefined) { if (row != null && row.tags != 'null' && row.tags != '' && row.tags != undefined) {
if (Object.prototype.toString.call(row.tags).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object' if (Object.prototype.toString.call(row.tags).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object'
&& Object.prototype.toString.call(row.tags).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'array') { && Object.prototype.toString.call(row.tags).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'array') {
row.tags = JSON.parse(row.tags); row.tags = JSON.parse(row.tags);
} }
} }
@ -763,7 +795,7 @@ export default {
this.activeTab = "api"; this.activeTab = "api";
if (row != null && row.tags != 'null' && row.tags != '' && row.tags != undefined) { if (row != null && row.tags != 'null' && row.tags != '' && row.tags != undefined) {
if (Object.prototype.toString.call(row.tags).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object' if (Object.prototype.toString.call(row.tags).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object'
&& Object.prototype.toString.call(row.tags).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'array') { && Object.prototype.toString.call(row.tags).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'array') {
row.tags = JSON.parse(row.tags); row.tags = JSON.parse(row.tags);
} }
} }
@ -834,7 +866,7 @@ export default {
} }
if (row != null && row.tags != 'null' && row.tags != '' && row.tags != undefined) { if (row != null && row.tags != 'null' && row.tags != '' && row.tags != undefined) {
if (Object.prototype.toString.call(row.tags).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object' if (Object.prototype.toString.call(row.tags).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object'
&& Object.prototype.toString.call(row.tags).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'array') { && Object.prototype.toString.call(row.tags).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'array') {
row.tags = JSON.parse(row.tags); row.tags = JSON.parse(row.tags);
} }
} }

View File

@ -513,7 +513,7 @@ export default {
// //
if (this.$route.query.caseId) { if (this.$route.query.caseId) {
this.$get('/api/testcase/findById/' + this.$route.query.caseId, (response) => { this.$get('/api/testcase/findById/' + this.$route.query.caseId, (response) => {
if(!response.data){ if (!response.data) {
this.$error(this.$t('api_test.case_jump_message')); this.$error(this.$t('api_test.case_jump_message'));
return; return;
} }
@ -1136,6 +1136,12 @@ export default {
if (dataType === 'apiTestCase') { if (dataType === 'apiTestCase') {
this.selectDataRange = routeParam; this.selectDataRange = routeParam;
} }
} else {
let routeParam = this.$route.params.dataSelectRange;
let dataType = this.$route.params.dataType;
if (dataType === 'apiTestCase') {
this.selectDataRange = routeParam;
}
} }
}, },
changeSelectDataRangeAll() { changeSelectDataRangeAll() {

View File

@ -914,6 +914,20 @@ export default {
} }
} }
} }
} else {
let dataRange = this.$route.params.dataSelectRange;
let dataType = this.$route.params.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];
}
}
}
} }
}, },
changeSelectDataRangeAll() { changeSelectDataRangeAll() {

View File

@ -283,7 +283,6 @@ export default {
}); });
}, },
redirectPage(page, dataType, selectType, title) { redirectPage(page, dataType, selectType, title) {
//api
//UUID //UUID
let uuid = getUUID(); let uuid = getUUID();
let redirectObj = { let redirectObj = {
@ -296,12 +295,24 @@ export default {
params: {paramObj: redirectObj} params: {paramObj: redirectObj}
}); });
break; break;
case "apiWithQuery":
this.$router.push({
name: 'ApiDefinitionWithQuery',
params: {redirectID: uuid, dataType: dataType, dataSelectRange: selectType}
});
break;
case "scenario": case "scenario":
this.$router.push({ this.$router.push({
name: 'ApiAutomation', name: 'ApiAutomation',
params: {paramObj: redirectObj} params: {paramObj: redirectObj}
}); });
break; break;
case "scenarioWithQuery":
this.$router.push({
name: 'ApiAutomationWithQuery',
params: {redirectID: uuid, dataType: dataType, dataSelectRange: selectType}
});
break;
case "testPlanEdit": case "testPlanEdit":
this.$router.push('/track/plan/view/' + selectType) this.$router.push('/track/plan/view/' + selectType)
break; break;

View File

@ -94,8 +94,16 @@ export default {
if (param.protocol === 'dubbo://') { if (param.protocol === 'dubbo://') {
param.protocol = 'DUBBO' param.protocol = 'DUBBO'
} }
let paramObj = {
redirectID: getUUID(),
dataType: "apiTestCase",
dataSelectRange: 'single:' + param.id,
projectId: getCurrentProjectID(),
type: api.protocol,
workspaceId: getCurrentWorkspaceId(),
};
definitionData = this.$router.resolve({ definitionData = this.$router.resolve({
name: 'ApiDefinition', name: 'ApiDefinitionWithQuery',
params: { params: {
redirectID: getUUID(), redirectID: getUUID(),
dataType: "apiTestCase", dataType: "apiTestCase",
@ -112,7 +120,7 @@ export default {
}); });
break; break;
case "scenario": case "scenario":
this.$emit('redirectPage', 'scenario', 'scenario', 'edit:' + param.id); this.$emit('redirectPage', 'scenarioWithQuery', 'scenario', 'edit:' + param.id);
break; break;
} }
} }

View File

@ -204,7 +204,7 @@ export default {
switch (pageType) { switch (pageType) {
case "api": case "api":
resolve = this.$router.resolve({ resolve = this.$router.resolve({
name: 'ApiDefinition', name: 'ApiDefinitionWithQuery',
params: { params: {
redirectID: getUUID(), redirectID: getUUID(),
dataType: "api", dataType: "api",

View File

@ -7,8 +7,9 @@
:data="tableData" :data="tableData"
@refresh="search" @refresh="search"
screen-height="300px"> screen-height="300px">
<el-table-column prop="index" :label="$t('api_test.home_page.running_task_list.table_coloum.index')" width="80" show-overflow-tooltip/> <el-table-column prop="index" :label="$t('api_test.home_page.running_task_list.table_coloum.index')" width="80"
<el-table-column prop="name" :label="$t('commons.name')" width="200" > show-overflow-tooltip/>
<el-table-column prop="name" :label="$t('commons.name')" width="200">
<template v-slot:default="{row}"> <template v-slot:default="{row}">
<!-- 若为只读用户不可点击之后跳转--> <!-- 若为只读用户不可点击之后跳转-->
<span v-if="isReadOnly"> <span v-if="isReadOnly">
@ -24,12 +25,16 @@
:filters="typeFilters" :filters="typeFilters"
:label="$t('api_test.home_page.running_task_list.table_coloum.task_type')" width="120"> :label="$t('api_test.home_page.running_task_list.table_coloum.task_type')" width="120">
<template v-slot:default="scope"> <template v-slot:default="scope">
<ms-tag v-if="scope.row.taskGroup == 'API_SCENARIO_TEST'" type="success" effect="plain" :content="$t('api_test.home_page.running_task_list.scenario_schedule')"/> <ms-tag v-if="scope.row.taskGroup == 'API_SCENARIO_TEST'" type="success" effect="plain"
<ms-tag v-if="scope.row.taskGroup == 'TEST_PLAN_TEST'" type="warning" effect="plain" :content="$t('api_test.home_page.running_task_list.test_plan_schedule')"/> :content="$t('api_test.home_page.running_task_list.scenario_schedule')"/>
<ms-tag v-if="scope.row.taskGroup == 'SWAGGER_IMPORT'" type="danger" effect="plain" :content="$t('api_test.home_page.running_task_list.swagger_schedule')"/> <ms-tag v-if="scope.row.taskGroup == 'TEST_PLAN_TEST'" type="warning" effect="plain"
:content="$t('api_test.home_page.running_task_list.test_plan_schedule')"/>
<ms-tag v-if="scope.row.taskGroup == 'SWAGGER_IMPORT'" type="danger" effect="plain"
:content="$t('api_test.home_page.running_task_list.swagger_schedule')"/>
</template> </template>
</ms-table-column> </ms-table-column>
<el-table-column prop="rule" :label="$t('api_test.home_page.running_task_list.table_coloum.run_rule')" width="120" show-overflow-tooltip/> <el-table-column prop="rule" :label="$t('api_test.home_page.running_task_list.table_coloum.run_rule')" width="120"
show-overflow-tooltip/>
<el-table-column width="100" :label="$t('api_test.home_page.running_task_list.table_coloum.task_status')"> <el-table-column width="100" :label="$t('api_test.home_page.running_task_list.table_coloum.task_status')">
<template v-slot:default="scope"> <template v-slot:default="scope">
<div> <div>
@ -49,7 +54,8 @@
<span>{{ scope.row.nextExecutionTime | timestampFormatDate }}</span> <span>{{ scope.row.nextExecutionTime | timestampFormatDate }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="creator" :label="$t('api_test.home_page.running_task_list.table_coloum.create_user')" width="100" show-overflow-tooltip/> <el-table-column prop="creator" :label="$t('api_test.home_page.running_task_list.table_coloum.create_user')"
width="100" show-overflow-tooltip/>
<el-table-column width="170" :label="$t('api_test.home_page.running_task_list.table_coloum.update_time')"> <el-table-column width="170" :label="$t('api_test.home_page.running_task_list.table_coloum.update_time')">
<template v-slot:default="scope"> <template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span> <span>{{ scope.row.updateTime | timestampFormatDate }}</span>
@ -65,6 +71,7 @@ import MsTag from "@/business/components/common/components/MsTag";
import {getCurrentProjectID} from "@/common/js/utils"; import {getCurrentProjectID} from "@/common/js/utils";
import MsTable from "@/business/components/common/components/table/MsTable"; import MsTable from "@/business/components/common/components/table/MsTable";
import MsTableColumn from "@/business/components/common/components/table/MsTableColumn"; import MsTableColumn from "@/business/components/common/components/table/MsTableColumn";
export default { export default {
name: "MsApiRunningTaskList", name: "MsApiRunningTaskList",
components: { components: {
@ -84,15 +91,13 @@ export default {
loading: false, loading: false,
typeFilters: [], typeFilters: [],
condition: { condition: {
filters: { filters: {}
}
} }
} }
}, },
computed:{ computed: {
isReadOnly(){ isReadOnly() {
return false; return false;
}, },
projectId() { projectId() {
@ -127,7 +132,7 @@ export default {
} }
}, },
closeTaskConfirm(row){ closeTaskConfirm(row) {
let flag = row.taskStatus; let flag = row.taskStatus;
row.taskStatus = !flag; //switch row.taskStatus = !flag; //switch
this.$confirm(this.$t('api_test.home_page.running_task_list.confirm.close_title'), this.$t('commons.prompt'), { this.$confirm(this.$t('api_test.home_page.running_task_list.confirm.close_title'), this.$t('commons.prompt'), {
@ -140,19 +145,19 @@ export default {
}); });
}, },
updateTask(taskRow){ updateTask(taskRow) {
this.result = this.$post('/api/schedule/updateEnableByPrimyKey/disable', taskRow, response => { this.result = this.$post('/api/schedule/updateEnableByPrimyKey/disable', taskRow, response => {
this.search(); this.search();
}); });
}, },
redirect(param){ redirect(param) {
if(param.taskGroup === 'TEST_PLAN_TEST'){ if (param.taskGroup === 'TEST_PLAN_TEST') {
this.$emit('redirectPage','testPlanEdit','', param.scenarioId); this.$emit('redirectPage', 'testPlanEdit', '', param.scenarioId);
}else if (param.taskGroup === 'API_SCENARIO_TEST') { } else if (param.taskGroup === 'API_SCENARIO_TEST') {
this.$emit('redirectPage', 'scenario', 'scenario', 'edit:' + param.scenarioId); this.$emit('redirectPage', 'scenarioWithQuery', 'scenario', 'edit:' + param.scenarioId);
} else if (param.taskGroup === 'SWAGGER_IMPORT') { } else if (param.taskGroup === 'SWAGGER_IMPORT') {
this.$emit('redirectPage', 'api', 'api', {param}); this.$emit('redirectPage', 'apiWithQuery', 'api', {param});
} }
} }
}, },
@ -163,14 +168,15 @@ export default {
activated() { activated() {
this.search(); this.search();
}, },
} }
</script> </script>
<style scoped> <style scoped>
.el-table { .el-table {
cursor:pointer; cursor: pointer;
} }
.el-card /deep/ .el-card__header { .el-card /deep/ .el-card__header {
border-bottom: 0px solid #EBEEF5; border-bottom: 0px solid #EBEEF5;
} }

View File

@ -92,7 +92,7 @@ export default {
this.$emit('redirectPage', 'api', 'apiTestCase', 'single:' + param); this.$emit('redirectPage', 'api', 'apiTestCase', 'single:' + param);
break; break;
case "scenario": case "scenario":
this.$emit('redirectPage', 'scenario', 'scenario', 'edit:' + param); this.$emit('redirectPage', 'scenarioWithQuery', 'scenario', 'edit:' + param);
break; break;
} }
} }

View File

@ -32,6 +32,16 @@ export default {
name: "ApiDefinition", name: "ApiDefinition",
component: () => import('@/business/components/api/definition/ApiDefinition'), component: () => import('@/business/components/api/definition/ApiDefinition'),
}, },
{
path: "definition/:redirectID?/:dataType?/:dataSelectRange?/:projectId?/:type?/:workspaceId?",
name: "ApiDefinitionWithQuery",
component: () => import('@/business/components/api/definition/ApiDefinition'),
},
{
path: "automation/:redirectID?/:dataType?/:dataSelectRange?/:projectId?/:workspaceId?",
name: "ApiAutomationWithQuery",
component: () => import('@/business/components/api/automation/ApiAutomation'),
},
{ {
path: "automation", path: "automation",
name: "ApiAutomation", name: "ApiAutomation",

View File

@ -178,6 +178,18 @@ export default {
case "testPlanEdit": case "testPlanEdit":
this.$router.push('/track/plan/view/' + selectType) this.$router.push('/track/plan/view/' + selectType)
break; break;
case "scenarioWithQuery":
this.$router.push({
name: 'ApiAutomationWithQuery',
params: {redirectID: uuid, dataType: dataType, dataSelectRange: selectType}
});
break;
case "api":
this.$router.push({
name: 'ApiDefinition',
params: {paramObj: redirectObj}
});
break;
} }
} }
} }