fix(接口定义): 修复复制场景多次点击保存按钮可以生成多个重复场景的缺陷
--bug=1019718 --user=王孝刚 [接口测试]github#19292复制场景后出现了多个重名和重复ID的场景 https://www.tapd.cn/55049933/s/1297592
This commit is contained in:
parent
48b12b0501
commit
1e2b445f9a
|
@ -105,6 +105,7 @@ export function saveScenario(url, scenario, scenarioDefinition, _this, success)
|
||||||
success(response.data);
|
success(response.data);
|
||||||
}
|
}
|
||||||
}, error => {
|
}, error => {
|
||||||
|
_this.isPreventReClick = false;
|
||||||
_this.errorRefresh();
|
_this.errorRefresh();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1114,7 +1114,7 @@ export default {
|
||||||
alertMsg = this.$t('api_definition.scenario_is_referenced', [checkResult.refCount]) + ', ' + this.$t('api_test.is_continue') + " ?";
|
alertMsg = this.$t('api_definition.scenario_is_referenced', [checkResult.refCount]) + ', ' + this.$t('api_test.is_continue') + " ?";
|
||||||
this.showScenario = true;
|
this.showScenario = true;
|
||||||
}
|
}
|
||||||
this.$refs.apiDeleteConfirm.open(alertMsg, this.$t('permission.project_api_definition.delete_case'), param, checkResult.checkMsg);
|
this.$refs.apiDeleteConfirm.open(alertMsg, this.$t('permission.project_api_scenario.delete'), param, checkResult.checkMsg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -381,12 +381,14 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {getPluginList} from "@/api/plugin";
|
import {getPluginList} from "@/api/plugin";
|
||||||
import {getMaintainer} from "@/api/project";
|
import {getMaintainer, getOwnerProjects} from "@/api/project";
|
||||||
import {
|
import {
|
||||||
delByScenarioIdAndRefId,
|
delByScenarioIdAndRefId,
|
||||||
|
execStop,
|
||||||
getApiScenarioEnv,
|
getApiScenarioEnv,
|
||||||
getFollowByScenarioId,
|
getFollowByScenarioId,
|
||||||
getScenarioVersions,
|
getScenarioVersions,
|
||||||
|
getScenarioWithBLOBsById,
|
||||||
setScenarioDomain,
|
setScenarioDomain,
|
||||||
updateScenarioFollows
|
updateScenarioFollows
|
||||||
} from "@/api/scenario";
|
} from "@/api/scenario";
|
||||||
|
@ -396,32 +398,20 @@ import {parseEnvironment} from "@/business/environment/model/EnvironmentModel";
|
||||||
import {ELEMENT_TYPE, STEP, TYPE_TO_C} from "./Setting";
|
import {ELEMENT_TYPE, STEP, TYPE_TO_C} from "./Setting";
|
||||||
import {KeyValue} from "@/business/definition/model/ApiTestModel";
|
import {KeyValue} from "@/business/definition/model/ApiTestModel";
|
||||||
|
|
||||||
import {
|
import {getCurrentProjectID, getCurrentUser} from "metersphere-frontend/src/utils/token";
|
||||||
getCurrentProjectID,
|
import {getUUID, objToStrMap, strMapToObj} from "metersphere-frontend/src/utils";
|
||||||
getCurrentUser
|
import {hasLicense, hasPermission} from "metersphere-frontend/src/utils/permission";
|
||||||
} from "metersphere-frontend/src/utils/token";
|
|
||||||
import {
|
|
||||||
getUUID,
|
|
||||||
objToStrMap,
|
|
||||||
strMapToObj
|
|
||||||
} from "metersphere-frontend/src/utils";
|
|
||||||
import {
|
|
||||||
hasPermission,
|
|
||||||
hasLicense
|
|
||||||
} from "metersphere-frontend/src/utils/permission";
|
|
||||||
import OutsideClick from "./common/outside-click";
|
import OutsideClick from "./common/outside-click";
|
||||||
import {
|
import {
|
||||||
getReportMessageSocket,
|
getReportMessageSocket,
|
||||||
savePreciseEnvProjectIds,
|
|
||||||
saveScenario,
|
|
||||||
handleCtrlREvent,
|
handleCtrlREvent,
|
||||||
handleCtrlSEvent,
|
handleCtrlSEvent,
|
||||||
|
savePreciseEnvProjectIds,
|
||||||
|
saveScenario,
|
||||||
} from "@/business/automation/api-automation";
|
} from "@/business/automation/api-automation";
|
||||||
import MsComponentConfig from "./component/ComponentConfig";
|
import MsComponentConfig from "./component/ComponentConfig";
|
||||||
import {ENV_TYPE} from "metersphere-frontend/src/utils/constants";
|
import {ENV_TYPE} from "metersphere-frontend/src/utils/constants";
|
||||||
import {mergeRequestDocumentData} from "@/business/definition/api-definition";
|
import {mergeRequestDocumentData} from "@/business/definition/api-definition";
|
||||||
import {execStop, getScenarioWithBLOBsById} from "@/api/scenario";
|
|
||||||
import {getOwnerProjects} from "@/api/project";
|
|
||||||
import {getEnvironmentByProjectId} from "metersphere-frontend/src/api/environment";
|
import {getEnvironmentByProjectId} from "metersphere-frontend/src/api/environment";
|
||||||
import {useApiStore} from "@/store";
|
import {useApiStore} from "@/store";
|
||||||
|
|
||||||
|
@ -587,7 +577,8 @@ export default {
|
||||||
newCreateTime: 0,
|
newCreateTime: 0,
|
||||||
oldCreateTime: 0,
|
oldCreateTime: 0,
|
||||||
oldUserName: '',
|
oldUserName: '',
|
||||||
debugReportId: ""
|
debugReportId: "",
|
||||||
|
isPreventReClick: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
@ -1603,6 +1594,9 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
editScenario() {
|
editScenario() {
|
||||||
|
if (this.isPreventReClick) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.mergeScenario(this.scenarioDefinition);
|
this.mergeScenario(this.scenarioDefinition);
|
||||||
if (!document.getElementById("inputDelay")) {
|
if (!document.getElementById("inputDelay")) {
|
||||||
return;
|
return;
|
||||||
|
@ -1623,8 +1617,10 @@ export default {
|
||||||
this.currentScenario.versionId = this.$refs.versionHistory.currentVersion.id;
|
this.currentScenario.versionId = this.$refs.versionHistory.currentVersion.id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.isPreventReClick = true;
|
||||||
saveScenario(this.path, this.currentScenario, this.scenarioDefinition, this, (response) => {
|
saveScenario(this.path, this.currentScenario, this.scenarioDefinition, this, (response) => {
|
||||||
this.$success(this.$t('commons.save_success'));
|
this.$success(this.$t('commons.save_success'));
|
||||||
|
this.isPreventReClick = false;
|
||||||
this.path = "/api/automation/update";
|
this.path = "/api/automation/update";
|
||||||
store.pluginFiles = [];
|
store.pluginFiles = [];
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
|
|
Loading…
Reference in New Issue