fix(接口测试): 修复当接口处于编辑状态时,列表点复制就会进入编辑页面的缺陷

--bug=1010559 --user=王孝刚 【接口测试】github#10887,当接口处于编辑状态时,列表点复制就会进入编辑页面
https://www.tapd.cn/55049933/s/1108640
This commit is contained in:
wxg0103 2022-02-23 14:28:58 +08:00 committed by 刘瑞斌
parent 9bf4a3f348
commit cf1caa48c0
2 changed files with 19 additions and 3 deletions

View File

@ -129,6 +129,7 @@
@refreshTree="refreshTree"
@changeSelectDataRangeAll="changeSelectDataRangeAll"
@editApi="editApi"
@copyApi="copyApi"
@handleCase="handleCase"
@showExecResult="showExecResult"
@refreshTable="refresh"
@ -699,8 +700,8 @@ export default {
if (!index) {
let name = "";
if (row.isCopy) {
name = "copy" + "-" + row.name;
row.name = "copy" + "-" + row.name;
name = "copy" + "_" + row.name;
row.name = "copy" + "_" + row.name;
} else {
if (row.name) {
name = this.$t('api_test.definition.request.edit_api') + "-" + row.name;
@ -720,6 +721,21 @@ export default {
this.apiDefaultTab = index.name;
}
},
copyApi(row) {
let name = "";
if (row.isCopy) {
name = "copy" + "_" + row.name;
row.name = "copy" + "_" + row.name;
}
this.activeTab = "api";
if (row != null && row.tags != 'null' && row.tags != '' && row.tags != undefined) {
if (Object.prototype.toString.call(row.tags).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object'
&& Object.prototype.toString.call(row.tags).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'array') {
row.tags = JSON.parse(row.tags);
}
}
this.handleTabsEdit(name, "ADD", row);
},
handleCase(api) {
this.currentApi = api;
this.showCasePage = false;

View File

@ -680,7 +680,7 @@ export default {
handleCopy(row) {
let obj = JSON.parse(JSON.stringify(row));
obj.isCopy = true;
this.$emit('editApi', obj);
this.$emit('copyApi', obj);
},
runApi(row) {
let request = row ? JSON.parse(row.request) : {};