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 fe37c8f16e..2ee70e0bff 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 }} @@ -223,6 +223,7 @@ export default { showFollow: false, beforeRequest: {}, compare: [], + isSave: false } }, props: { @@ -407,6 +408,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; @@ -453,6 +455,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'); @@ -461,6 +464,8 @@ export default { this.$emit('refresh'); } } + }, (error) => { + this.isSave = false; }); }, saveTestCase(row, hideAlert) { @@ -474,7 +479,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() {