fix(接口测试): 接口详情变更历史无变更详情日志

--bug=1009209 --user=王孝刚 [ github#8776]接口详情-变更历史无变更详情日志
https://www.tapd.cn/55049933/s/1088966
This commit is contained in:
wxg0103 2021-12-31 10:32:10 +08:00 committed by 刘瑞斌
parent 5d0367895f
commit f2730dc27f
2 changed files with 14 additions and 3 deletions

View File

@ -8,7 +8,7 @@
<el-input v-if="!apiCase.id || isShowInput" size="small" v-model="apiCase.name" :name="index" :key="index" <el-input v-if="!apiCase.id || isShowInput" size="small" v-model="apiCase.name" :name="index" :key="index"
class="ms-api-header-select" style="width: 180px" class="ms-api-header-select" style="width: 180px"
:readonly="!hasPermission('PROJECT_API_DEFINITION:READ+EDIT_CASE')" :readonly="!hasPermission('PROJECT_API_DEFINITION:READ+EDIT_CASE')"
@blur="saveTestCase(apiCase,true)" :placeholder="$t('commons.input_name')" ref="nameEdit"/> @blur="saveTestCase(apiCase , true)" :placeholder="$t('commons.input_name')" ref="nameEdit"/>
<span v-else> <span v-else>
<el-tooltip :content="apiCase.id ? apiCase.name : ''" placement="top"> <el-tooltip :content="apiCase.id ? apiCase.name : ''" placement="top">
<span>{{ apiCase.id ? apiCase.name : '' | ellipsis }}</span> <span>{{ apiCase.id ? apiCase.name : '' | ellipsis }}</span>
@ -220,6 +220,7 @@ export default {
showFollow: false, showFollow: false,
beforeRequest: {}, beforeRequest: {},
compare: [], compare: [],
isSave: false
} }
}, },
props: { props: {
@ -404,6 +405,7 @@ export default {
} }
}, },
saveCase(row, hideAlert) { saveCase(row, hideAlert) {
this.isSave = true;
let tmp = JSON.parse(JSON.stringify(row)); let tmp = JSON.parse(JSON.stringify(row));
this.isShowInput = false; this.isShowInput = false;
tmp.request.body = row.request.body; tmp.request.body = row.request.body;
@ -451,6 +453,7 @@ export default {
if (!row.message) { if (!row.message) {
this.$success(this.$t('commons.save_success')); this.$success(this.$t('commons.save_success'));
this.reload(); this.reload();
this.isSave = false;
// //
if (this.api.source === "editCase") { if (this.api.source === "editCase") {
this.$emit('reLoadCase'); this.$emit('reLoadCase');
@ -459,6 +462,8 @@ export default {
this.$emit('refresh'); this.$emit('refresh');
} }
} }
}, (error) => {
this.isSave = false;
}); });
}, },
saveTestCase(row, hideAlert) { saveTestCase(row, hideAlert) {
@ -472,7 +477,9 @@ export default {
this.addModule(row); this.addModule(row);
} else { } else {
this.api.source = "editCase"; this.api.source = "editCase";
this.saveCase(row, hideAlert); if (!this.isSave){
this.saveCase(row, hideAlert);
}
} }
} }
}, },

View File

@ -38,7 +38,11 @@
}, },
methods: { methods: {
getDiff(v1, v2) { 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); return formattersHtml.format(delta, v1);
}, },
handleClose() { handleClose() {