fix(接口定义): 修复提示保存成功后还提示未保存的缺陷

--bug=1017790 --user=王孝刚 【接口测试】编辑接口保存后再关闭接口,提示接口没保存
https://www.tapd.cn/55049933/s/1258275
This commit is contained in:
wxg0103 2022-10-11 15:27:01 +08:00 committed by wxg0103
parent ffe8e6360e
commit 897af4dab7
6 changed files with 16 additions and 22 deletions

View File

@ -2,7 +2,8 @@
<div class="card-container">
<!-- HTTP 请求参数 -->
<ms-edit-complete-http-api @runTest="runTest" @saveApi="saveApi" @createRootModelInTree="createRootModelInTree"
<ms-edit-complete-http-api @runTest="runTest" @saveApi="saveApiValidate"
@createRootModelInTree="createRootModelInTree"
:request="request" :response="response" :project-id="projectId"
@mockConfig="mockConfig"
@changeTab="changeTab"
@ -11,20 +12,20 @@
v-if="currentProtocol === 'HTTP'" ref="httpApi"/>
<!-- TCP -->
<ms-edit-complete-tcp-api :request="request" @runTest="runTest" @createRootModelInTree="createRootModelInTree"
@saveApi="saveApi" :basisData="currentApi"
@saveApi="saveApiValidate" :basisData="currentApi"
@changeTab="changeTab"
@checkout="checkout"
:moduleOptions="moduleOptions" :syncTabs="syncTabs" v-if="currentProtocol === 'TCP'"
ref="tcpApi"/>
<!--DUBBO-->
<ms-edit-complete-dubbo-api :request="request" @runTest="runTest" @createRootModelInTree="createRootModelInTree"
@saveApi="saveApi" :basisData="currentApi"
@saveApi="saveApiValidate" :basisData="currentApi"
@checkout="checkout"
:moduleOptions="moduleOptions" :syncTabs="syncTabs" v-if="currentProtocol === 'DUBBO'"
ref="dubboApi"/>
<!--SQL-->
<ms-edit-complete-sql-api :request="request" @runTest="runTest" @createRootModelInTree="createRootModelInTree"
@saveApi="saveApi" :basisData="currentApi"
@saveApi="saveApiValidate" :basisData="currentApi"
@checkout="checkout"
:moduleOptions="moduleOptions" :syncTabs="syncTabs" v-if="currentProtocol === 'SQL'"
ref="sqlApi"/>
@ -322,6 +323,8 @@ export default {
});
this.responseCount = 0;
this.count = 0;
store.apiStatus.set("fromChange", false);
store.apiMap.set(this.currentApi.id, store.apiStatus);
store.apiStatus.set("requestChange", false);
store.apiMap.set(this.currentApi.id, store.apiStatus);
store.apiStatus.set("responseChange", false);

View File

@ -172,14 +172,14 @@ export default {
},
'basicForm.description': {
handler(v, v1) {
if (v && v1 && v !== v1) {
if (v && v1 && v !== v1) {
this.apiMapStatus();
}
}
},
'basicForm.tags': {
handler(v, v1) {
if (v && v1 && JSON.stringify(v) !== JSON.stringify(v1)) {
if (v && v1 && JSON.stringify(v) !== JSON.stringify(v1) && v1.length !== 0) {
this.apiMapStatus();
}
}

View File

@ -172,8 +172,6 @@ export default {
this.basisData.tags = JSON.stringify(this.basisData.tags);
}
this.$emit('saveApi', this.basisData);
store.apiStatus.set("fromChange", false);
store.apiMap.set(this.basisData.id, store.apiStatus);
if (this.$refs.versionHistory) {
this.$refs.versionHistory.loading = false;
}

View File

@ -204,12 +204,13 @@ import {
citedApiScenarioCount,
definitionFollow,
delDefinitionByRefId,
getDefinitionById, getDefinitionByIdAndRefId,
getDefinitionById,
getDefinitionByIdAndRefId,
getDefinitionVersions,
getMockEnvironment, updateDefinitionFollows
getMockEnvironment,
updateDefinitionFollows
} from "@/api/definition";
import {relationGet} from "@/api/xpack";
import {updateRuleRelation} from "@/api/xpack";
import {relationGet, updateRuleRelation} from "@/api/xpack";
import MsApiRequestForm from "../request/http/ApiHttpRequestForm";
import MsResponseText from "../response/ResponseText";
import {API_STATUS, REQ_METHOD} from "../../model/JsonData";
@ -230,10 +231,10 @@ import MsDialogFooter from "metersphere-frontend/src/components/MsDialogFooter";
import {getProjectMemberOption} from "@/api/project";
import {deepClone} from "metersphere-frontend/src/utils/tableUtils";
import SyncSetting from "@/business/definition/util/SyncSetting";
import {useApiStore} from "@/store";
const {Body} = require("@/business/definition/model/ApiTestModel");
const Sampler = require("@/business/definition/components/jmeter/components/sampler/sampler");
import {useApiStore} from "@/store";
const store = useApiStore();
@ -301,7 +302,6 @@ export default {
},
mockBaseUrl: "",
newMockBaseUrl: "",
count: 0,
versionData: [],
newRequest: Sampler,
newResponse: {},
@ -525,9 +525,6 @@ export default {
} else {
this.$emit('saveApi', this.httpForm);
}
this.count = 0;
store.apiStatus.set("fromChange", false);
store.apiMap.set(this.httpForm.id, store.apiStatus);
} else {
if (this.$refs.versionHistory) {
this.$refs.versionHistory.loading = false;

View File

@ -188,8 +188,6 @@ export default {
this.basisData.tags = JSON.stringify(this.basisData.tags);
}
this.$emit('saveApi', this.basisData);
store.apiStatus.set("fromChange", false);
store.apiMap.set(this.basisData.id, store.apiStatus);
if (this.$refs.versionHistory) {
this.$refs.versionHistory.loading = false;
}

View File

@ -95,7 +95,7 @@
</template>
<script>
import {createMockConfig,getTcpMockInfo} from "@/api/api-mock";
import {createMockConfig, getTcpMockInfo} from "@/api/api-mock";
import {definitionFollow, delDefinitionByRefId, getDefinitionById, getDefinitionVersions} from "@/api/definition";
import MsTcpBasicApi from "./TCPBasicApi";
import MsTcpFormatParameters from "../request/tcp/TcpFormatParameters";
@ -244,8 +244,6 @@ export default {
}
}
this.$emit('saveApi', this.basisData);
store.apiStatus.set("fromChange", false);
store.apiMap.set(this.basisData.id, store.apiStatus);
if (this.$refs.versionHistory) {
this.$refs.versionHistory.loading = false;
}