From f2730dc27f232483d9151cb32486dbb27774f3ff Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Fri, 31 Dec 2021 10:32:10 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=AF=A6=E6=83=85=E5=8F=98=E6=9B=B4=E5=8E=86?= =?UTF-8?q?=E5=8F=B2=E6=97=A0=E5=8F=98=E6=9B=B4=E8=AF=A6=E6=83=85=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1009209 --user=王孝刚 [ github#8776]接口详情-变更历史无变更详情日志 https://www.tapd.cn/55049933/s/1088966 --- .../api/definition/components/case/ApiCaseItem.vue | 11 +++++++++-- .../src/business/components/history/HistoryDetail.vue | 6 +++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue index 7719612253..b78c6a2485 100644 --- a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue +++ b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue @@ -8,7 +8,7 @@ + @blur="saveTestCase(apiCase , true)" :placeholder="$t('commons.input_name')" ref="nameEdit"/> {{ apiCase.id ? apiCase.name : '' | ellipsis }} @@ -220,6 +220,7 @@ export default { showFollow: false, beforeRequest: {}, compare: [], + isSave: false } }, props: { @@ -404,6 +405,7 @@ export default { } }, saveCase(row, hideAlert) { + this.isSave = true; let tmp = JSON.parse(JSON.stringify(row)); this.isShowInput = false; tmp.request.body = row.request.body; @@ -451,6 +453,7 @@ export default { if (!row.message) { this.$success(this.$t('commons.save_success')); this.reload(); + this.isSave = false; // 刷新编辑后用例列表 if (this.api.source === "editCase") { this.$emit('reLoadCase'); @@ -459,6 +462,8 @@ export default { this.$emit('refresh'); } } + }, (error) => { + this.isSave = false; }); }, saveTestCase(row, hideAlert) { @@ -472,7 +477,9 @@ export default { this.addModule(row); } else { this.api.source = "editCase"; - this.saveCase(row, hideAlert); + if (!this.isSave){ + this.saveCase(row, hideAlert); + } } } }, diff --git a/frontend/src/business/components/history/HistoryDetail.vue b/frontend/src/business/components/history/HistoryDetail.vue index 22462ed472..d9301a0f0e 100644 --- a/frontend/src/business/components/history/HistoryDetail.vue +++ b/frontend/src/business/components/history/HistoryDetail.vue @@ -38,7 +38,11 @@ }, methods: { getDiff(v1, v2) { - let delta = jsondiffpatch.diff(v1, v2); + if (this.detail.columnName==='request' && v1 && v2){ + let delta = jsondiffpatch.diff(JSON.parse(v1) , JSON.parse(v2)); + return formattersHtml.format(delta, JSON.parse(v1)); + } + let delta = jsondiffpatch.diff(v1 , v2); return formattersHtml.format(delta, v1); }, handleClose() {