From 5b3120953bbde7a6f9e0897c4a0784e9f5e99757 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Wed, 20 Jul 2022 18:43:06 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=B6=88=E6=81=AF=E9=80=9A=E7=9F=A5):?= =?UTF-8?q?=20=E9=A1=B5=E9=9D=A2=E7=BC=93=E5=AD=98=E5=80=BC=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --user=郭雨琦 --story=1008912 https://www.tapd.cn/55049933/prong/stories/view/1155049933001008912 --- .../complete/EditCompleteHTTPApi.vue | 54 +++++++++++++++++-- 1 file changed, 50 insertions(+), 4 deletions(-) diff --git a/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue b/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue index cac9ba05fe..20a0c5339d 100644 --- a/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue +++ b/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue @@ -282,6 +282,7 @@ export default { status: [{required: true, message: this.$t('commons.please_select'), trigger: 'change'}], }, httpForm: {environmentId: "", path: "", tags: []}, + beforeHttpForm: {environmentId: "", path: "", tags: []}, newData: {environmentId: "", path: "", tags: []}, dialogVisible: false, isShowEnable: true, @@ -502,6 +503,9 @@ export default { if (this.httpForm.tags instanceof Array) { this.httpForm.tags = JSON.stringify(this.httpForm.tags); } + if (this.beforeHttpForm.tags instanceof Array) { + this.beforeHttpForm.tags = JSON.stringify(this.beforeHttpForm.tags); + } }, saveApi() { this.$refs['httpForm'].validate((valid) => { @@ -514,7 +518,40 @@ export default { } } if (hasLicense() && this.httpForm.caseTotal > 0) { - this.batchSyncApiVisible = true; + if (this.httpForm.name !== this.beforeHttpForm.name) { + this.batchSyncApiVisible = true; + } + if (this.httpForm.method !== this.beforeHttpForm.method) { + this.batchSyncApiVisible = true; + } + if (this.httpForm.path !== this.beforeHttpForm.path) { + this.batchSyncApiVisible = true; + } + if (this.httpForm.userId !== this.beforeHttpForm.userId) { + this.batchSyncApiVisible = true; + } + if (this.httpForm.moduleId !== this.beforeHttpForm.moduleId) { + this.batchSyncApiVisible = true; + } + if (this.httpForm.status !== this.beforeHttpForm.status) { + this.batchSyncApiVisible = true; + } + if (this.httpForm.tags !== this.beforeHttpForm.tags) { + this.batchSyncApiVisible = true; + } + let submitRequest = JSON.stringify(this.httpForm.request); + let beforeRequest = JSON.stringify(this.beforeHttpForm.request); + if (submitRequest !== beforeRequest) { + this.batchSyncApiVisible = true; + } + let submitResponse = JSON.stringify(this.httpForm.response); + let beforeResponse = JSON.stringify(this.beforeHttpForm.response); + if (submitResponse !== beforeResponse) { + this.batchSyncApiVisible = true; + } + if (this.batchSyncApiVisible !== true) { + this.$emit('saveApi', this.httpForm); + } } else { this.$emit('saveApi', this.httpForm); } @@ -535,14 +572,21 @@ export default { let fromData = this.$refs.synSetting.fromData; this.httpForm.triggerUpdate = JSON.stringify(fromData); } - if (this.specialReceivers) { + if (this.specialReceivers && this.specialReceivers === true) { this.httpForm.sendSpecialMessage = this.specialReceivers; + } else { + this.httpForm.sendSpecialMessage = false } - if (this.caseCreator) { + + if (this.caseCreator && this.caseCreator === true) { this.httpForm.caseCreator = this.caseCreator; + } else { + this.httpForm.caseCreator = false } - if (this.scenarioCreator) { + if (this.scenarioCreator && this.scenarioCreator === true) { this.httpForm.scenarioCreator = this.scenarioCreator; + } else { + this.httpForm.scenarioCreator = false } this.$emit('saveApi', this.httpForm); } @@ -811,8 +855,10 @@ export default { this.basisData.moduleId = this.moduleOptions[0].id; } this.httpForm = JSON.parse(JSON.stringify(this.basisData)); + this.beforeHttpForm = JSON.parse(JSON.stringify(this.basisData)); this.$get('/api/definition/follow/' + this.basisData.id, response => { this.httpForm.follows = response.data; + this.beforeHttpForm.follows = response.data; for (let i = 0; i < response.data.length; i++) { if (response.data[i] === this.currentUser().id) { this.showFollow = true;