refactor: 编辑api时显现当前版本

This commit is contained in:
CaptainB 2021-12-30 15:08:48 +08:00 committed by 刘瑞斌
parent 4863ed0682
commit 407b2e5484
7 changed files with 33 additions and 4 deletions

View File

@ -91,6 +91,7 @@
<api-case-simple-list <api-case-simple-list
class="api-case-simple-list" class="api-case-simple-list"
:apiDefinitionId="currentApi.id" :apiDefinitionId="currentApi.id"
:current-version="currentApi.versionId"
:trash-enable="false" :trash-enable="false"
@changeSelectDataRangeAll="changeSelectDataRangeAll" @changeSelectDataRangeAll="changeSelectDataRangeAll"
@handleCase="handleCase" @handleCase="handleCase"
@ -239,6 +240,7 @@ export default {
this.$post('/mockConfig/genMockConfig', mockParam, response => { this.$post('/mockConfig/genMockConfig', mockParam, response => {
let mockConfig = response.data; let mockConfig = response.data;
mockConfig.apiName = this.currentApi.name; mockConfig.apiName = this.currentApi.name;
mockConfig.versionName = this.currentApi.versionName;
this.baseMockConfigData = mockConfig; this.baseMockConfigData = mockConfig;
}); });
} }
@ -359,4 +361,13 @@ export default {
height: calc(100vh - 262px) !important; height: calc(100vh - 262px) !important;
} }
/deep/ .ms-opt-btn {
position: fixed;
right: 50px;
z-index: 1;
top: 128px;
float: right;
margin-right: 20px;
margin-top: 5px;
}
</style> </style>

View File

@ -1,9 +1,9 @@
<template> <template>
<span> <span>
<span> <span>
<el-link type="primary" style="float:right;margin-top: 5px" @click="open">{{ $t('commons.adv_search.title') }} <div class="ms-opt-btn" v-if="apiDefinitionId">
</el-link> {{ $t('project.version.name') }}: {{ versionName }}
</div>
<el-input :placeholder="$t('commons.search_by_id_name_tag')" @blur="search" @keyup.enter.native="search" <el-input :placeholder="$t('commons.search_by_id_name_tag')" @blur="search" @keyup.enter.native="search"
class="search-input" size="small" class="search-input" size="small"
v-model="condition.name"/> v-model="condition.name"/>
@ -404,6 +404,7 @@ export default {
response: {}, response: {},
timeoutIndex: 0, timeoutIndex: 0,
versionFilters: [], versionFilters: [],
versionName: '',
}; };
}, },
props: { props: {
@ -1165,6 +1166,7 @@ export default {
getVersionOptions() { getVersionOptions() {
if (hasLicense()) { if (hasLicense()) {
this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => { this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => {
this.versionName = response.data.filter(v => v.id === this.currentVersion)[0].name;
this.versionFilters = response.data.map(u => { this.versionFilters = response.data.map(u => {
return {text: u.name, value: u.id}; return {text: u.name, value: u.id};
}); });

View File

@ -1,6 +1,9 @@
<template> <template>
<div> <div>
<div> <div>
<div class="ms-opt-btn">
{{ $t('project.version.name') }}: {{ mockConfigData.versionName }}
</div>
<el-input :placeholder="$t('commons.search_by_name')" class="search-input" size="small" <el-input :placeholder="$t('commons.search_by_name')" class="search-input" size="small"
:clearable="true" :clearable="true"
v-model="tableSearch"/> v-model="tableSearch"/>

View File

@ -1,6 +1,9 @@
<template> <template>
<div class="card-container"> <div class="card-container">
<div class="ms-opt-btn">
{{ $t('project.version.name') }}: {{ apiData.versionName }}
</div>
<el-card class="card-content"> <el-card class="card-content">
<!-- 操作按钮 --> <!-- 操作按钮 -->
<el-dropdown split-button type="primary" class="ms-api-buttion" @click="handleCommand('add')" <el-dropdown split-button type="primary" class="ms-api-buttion" @click="handleCommand('add')"

View File

@ -1,6 +1,9 @@
<template> <template>
<div class="card-container"> <div class="card-container">
<div class="ms-opt-btn">
{{ $t('project.version.name') }}: {{ apiData.versionName }}
</div>
<el-card class="card-content"> <el-card class="card-content">
<el-form :model="api" :rules="rules" ref="apiData" :inline="true" label-position="right"> <el-form :model="api" :rules="rules" ref="apiData" :inline="true" label-position="right">
@ -116,7 +119,8 @@ export default {
runData: [], runData: [],
reportId: "", reportId: "",
envMap: new Map, envMap: new Map,
runLoading: false runLoading: false,
versionName: '',
} }
}, },
props: {apiData: {}, currentProtocol: String, syncTabs: Array, projectId: String}, props: {apiData: {}, currentProtocol: String, syncTabs: Array, projectId: String},

View File

@ -1,6 +1,9 @@
<template> <template>
<div class="card-container"> <div class="card-container">
<div class="ms-opt-btn">
{{ $t('project.version.name') }}: {{ apiData.versionName }}
</div>
<el-card class="card-content"> <el-card class="card-content">
<!-- 操作按钮 --> <!-- 操作按钮 -->
<el-dropdown split-button type="primary" class="ms-api-buttion" @click="handleCommand('add')" <el-dropdown split-button type="primary" class="ms-api-buttion" @click="handleCommand('add')"

View File

@ -1,6 +1,9 @@
<template> <template>
<div class="card-container"> <div class="card-container">
<div class="ms-opt-btn">
{{ $t('project.version.name') }}: {{ apiData.versionName }}
</div>
<el-card class="card-content"> <el-card class="card-content">
<el-form :model="api" :rules="rules" ref="apiData" :inline="true" label-position="right"> <el-form :model="api" :rules="rules" ref="apiData" :inline="true" label-position="right">