From 1768fd22d33baec141ca76dfc9230196e19f3b72 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Fri, 23 Dec 2022 15:46:36 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=87=E6=8D=A2tab=E5=90=8E=E5=86=8D?= =?UTF-8?q?=E5=9B=9E=E7=BC=96=E8=BE=91=E9=A1=B5=E9=9D=A2=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=EF=BC=8C=E6=B2=A1=E5=BC=B9=E5=90=8C=E6=AD=A5=E7=AA=97=E5=8F=A3?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1016100--user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001016100 --- .../complete/EditCompleteHTTPApi.vue | 64 +++++++++++++------ 1 file changed, 44 insertions(+), 20 deletions(-) diff --git a/api-test/frontend/src/business/definition/components/complete/EditCompleteHTTPApi.vue b/api-test/frontend/src/business/definition/components/complete/EditCompleteHTTPApi.vue index 45ab7cc218..1d8caf2e35 100644 --- a/api-test/frontend/src/business/definition/components/complete/EditCompleteHTTPApi.vue +++ b/api-test/frontend/src/business/definition/components/complete/EditCompleteHTTPApi.vue @@ -566,43 +566,69 @@ export default { if (this.httpForm.path !== this.beforeHttpForm.path && !this.noShowSyncRuleRelation) { this.batchSyncApiVisible = true; } - if (this.request.headers && this.beforeRequest.headers) { - let submitRequestHeaders = JSON.stringify(this.request.headers); + if (this.httpForm.request.headers && this.beforeRequest.headers) { + for (let i = 0; i < this.httpForm.request.headers.length; i++) { + if (this.httpForm.request.headers[i].isEdit !== undefined) { + this.beforeRequest.headers[i].isEdit = this.httpForm.request.headers[i].isEdit + } + } + let submitRequestHeaders = JSON.stringify(this.httpForm.request.headers); let beforeRequestHeaders = JSON.stringify(this.beforeRequest.headers); if (submitRequestHeaders !== beforeRequestHeaders && !this.noShowSyncRuleRelation) { this.batchSyncApiVisible = true; } } - if (this.request.arguments && this.beforeRequest.arguments) { - let submitRequestQuery = JSON.stringify(this.request.arguments); + if (this.httpForm.request.arguments && this.beforeRequest.arguments) { + for (let i = 0; i < this.httpForm.request.arguments.length; i++) { + if (this.httpForm.request.arguments[i].isEdit !== undefined) { + this.beforeRequest.arguments[i].isEdit = this.httpForm.request.arguments[i].isEdit + } + } + let submitRequestQuery = JSON.stringify(this.httpForm.request.arguments); let beforeRequestQuery = JSON.stringify(this.beforeRequest.arguments); if (submitRequestQuery !== beforeRequestQuery && !this.noShowSyncRuleRelation) { this.batchSyncApiVisible = true; } } - if (this.request.rest && this.beforeRequest.rest) { - let submitRequestRest = JSON.stringify(this.request.rest); + if (this.httpForm.request.rest && this.beforeRequest.rest) { + for (let i = 0; i < this.httpForm.request.rest.length; i++) { + if (this.httpForm.request.rest[i].isEdit !== undefined) { + this.beforeRequest.rest[i].isEdit = this.httpForm.request.rest[i].isEdit + } + } + let submitRequestRest = JSON.stringify(this.httpForm.request.rest); let beforeRequestRest = JSON.stringify(this.beforeRequest.rest); if (submitRequestRest !== beforeRequestRest && !this.noShowSyncRuleRelation) { this.batchSyncApiVisible = true; } } - if (this.request.body && this.beforeRequest.body) { - let submitRequestBody = JSON.stringify(this.request.body); + if (this.httpForm.request.body && this.beforeRequest.body) { + let submitRequestBody = JSON.stringify(this.httpForm.request.body); let beforeRequestBody = JSON.stringify(this.beforeRequest.body); + for (let i = 0; i < this.httpForm.request.body.kvs.length; i++) { + if (this.httpForm.request.body.kvs[i].isEdit !== undefined) { + this.beforeRequest.body.kvs[i].isEdit = this.httpForm.request.body.kvs[i].isEdit + } + if (this.httpForm.request.body.kvs[i].files !== null && this.httpForm.request.body.kvs[i].files.length === 0) { + this.beforeRequest.body.kvs[i].files = this.httpForm.request.body.kvs[i].files + } + if (this.httpForm.request.body.kvs[i].uuid) { + this.beforeRequest.body.kvs[i].uuid = this.httpForm.request.body.kvs[i].uuid + } + } if (submitRequestBody !== beforeRequestBody && !this.noShowSyncRuleRelation) { this.batchSyncApiVisible = true; } } - if (this.request.authManager && this.beforeRequest.authManager) { - let submitRequestAuthManager = JSON.stringify(this.request.authManager); + if (this.httpForm.request.authManager && this.beforeRequest.authManager) { + let submitRequestAuthManager = JSON.stringify(this.httpForm.request.authManager); let beforeRequestAuthManager = JSON.stringify(this.beforeRequest.authManager); if (submitRequestAuthManager !== beforeRequestAuthManager && !this.noShowSyncRuleRelation) { this.batchSyncApiVisible = true; } } - if (this.request.hashTree && this.beforeRequest.hashTree) { - let submitRequestHashTree = JSON.stringify(this.request.hashTree); + if (this.httpForm.request.hashTree && this.beforeRequest.hashTree) { + let submitRequestHashTree = JSON.stringify(this.httpForm.request.hashTree); let beforeRequestHashTree = JSON.stringify(this.beforeRequest.hashTree); if (submitRequestHashTree !== beforeRequestHashTree && !this.noShowSyncRuleRelation) { this.batchSyncApiVisible = true; @@ -782,6 +808,11 @@ export default { } else { this.versionData = response.data; } + + this.beforeHttpForm = this.versionData[0]; + this.beforeRequest = JSON.parse(this.versionData[0].request); + this.beforeResponse = JSON.parse(this.versionData[0].response); + let latestVersionData = response.data.filter((v) => v.versionId === this.latestVersionId); if (latestVersionData.length > 0) { this.hasLatest = false @@ -1078,14 +1109,7 @@ export default { this.getCitedScenarioCount(); this.getCaseCount(); } - }, - mounted() { - if (hasLicense()) { - this.beforeHttpForm = deepClone(this.basisData); - this.beforeRequest = deepClone(this.request); - this.beforeResponse = deepClone(this.response); - } - }, + } };