fix(接口测试): API多次保存数据重复问题
--bug=1028246 --user=宋昌昌 【接口测试】api列表-操作-点击复制按钮-保存点击2次-生成数据接口数据重复 https://www.tapd.cn/55049933/s/1401924
This commit is contained in:
parent
b52c642414
commit
3822c100ac
|
@ -362,7 +362,9 @@ export default {
|
|||
if (data.response) {
|
||||
this.parseResponseStructureDefaultKeyValue(data.response);
|
||||
}
|
||||
this.setProtocolBtn(true);
|
||||
updateDefinition(this.reqUrl, null, bodyFiles, data).then((response) => {
|
||||
this.setProtocolBtn(false);
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.reqUrl = '/api/definition/update';
|
||||
this.currentApi.isCopy = false;
|
||||
|
@ -379,6 +381,22 @@ export default {
|
|||
this.responseCount = 0;
|
||||
this.count = 0;
|
||||
},
|
||||
setProtocolBtn(disable) {
|
||||
switch (this.currentProtocol) {
|
||||
case Request.TYPES.SQL:
|
||||
this.$refs.sqlApi.disableSaveBtn = disable;
|
||||
break;
|
||||
case Request.TYPES.DUBBO:
|
||||
this.$refs.dubboApi.disableSaveBtn = disable;
|
||||
break;
|
||||
case Request.TYPES.TCP:
|
||||
this.$refs.tcpApi.disableSaveBtn = disable;
|
||||
break;
|
||||
default:
|
||||
this.$refs.httpApi.disableSaveBtn = disable;
|
||||
break;
|
||||
}
|
||||
},
|
||||
parseResponseStructureDefaultKeyValue(response) {
|
||||
if (response.headers && response.headers.length === 1) {
|
||||
let kv = response.headers[0];
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
@checkout="checkout"
|
||||
@create="create"
|
||||
@del="del"/>
|
||||
<el-button type="primary" size="small" @click="saveApi" v-prevent-re-click title="ctrl + s"
|
||||
<el-button type="primary" size="small" @click="saveApi" :disabled="disableSaveBtn" v-prevent-re-click title="ctrl + s"
|
||||
v-permission="[
|
||||
'PROJECT_API_DEFINITION:READ+EDIT_API',
|
||||
'PROJECT_API_DEFINITION:READ+CREATE_API',
|
||||
|
@ -184,7 +184,8 @@ export default {
|
|||
newResponse: {},
|
||||
createNewVersionVisible: false,
|
||||
latestVersionId: '',
|
||||
hasLatest: false
|
||||
hasLatest: false,
|
||||
disableSaveBtn: false
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
v-if="!isXpack || !apiSyncRuleRelation.showUpdateRule"
|
||||
type="primary"
|
||||
size="small"
|
||||
:disabled="disableSaveBtn"
|
||||
@click="saveApi"
|
||||
v-prevent-re-click
|
||||
title="ctrl + s"
|
||||
|
@ -313,6 +314,7 @@ export default {
|
|||
citedScenarioCount: 0,
|
||||
latestVersionId: '',
|
||||
hasLatest: false,
|
||||
disableSaveBtn: false,
|
||||
};
|
||||
},
|
||||
props: {
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
@create="create"
|
||||
@setLatest="setLatest"
|
||||
@del="del" />
|
||||
<el-button type="primary" size="small" @click="saveApi" title="ctrl + s" v-prevent-re-click
|
||||
<el-button type="primary" size="small" @click="saveApi" title="ctrl + s" :disabled="disableSaveBtn" v-prevent-re-click
|
||||
v-permission="[
|
||||
'PROJECT_API_DEFINITION:READ+EDIT_API',
|
||||
'PROJECT_API_DEFINITION:READ+CREATE_API',
|
||||
|
@ -173,7 +173,8 @@ export default {
|
|||
newResponse: {},
|
||||
createNewVersionVisible: false,
|
||||
latestVersionId: '',
|
||||
hasLatest: false
|
||||
hasLatest: false,
|
||||
disableSaveBtn: false
|
||||
};
|
||||
},
|
||||
created() {
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
@create="create"
|
||||
@setLatest="setLatest"
|
||||
@del="del" />
|
||||
<el-button type="primary" size="small" @click="saveApi" title="ctrl + s" v-prevent-re-click
|
||||
<el-button type="primary" size="small" @click="saveApi" title="ctrl + s" :disabled="disableSaveBtn" v-prevent-re-click
|
||||
v-permission="[
|
||||
'PROJECT_API_DEFINITION:READ+EDIT_API',
|
||||
'PROJECT_API_DEFINITION:READ+CREATE_API',
|
||||
|
@ -172,6 +172,7 @@ export default {
|
|||
createNewVersionVisible: false,
|
||||
latestVersionId: '',
|
||||
hasLatest: false,
|
||||
disableSaveBtn: false
|
||||
};
|
||||
},
|
||||
created: function () {
|
||||
|
|
Loading…
Reference in New Issue