fix (接口自动化): 场景增加关闭校验,修复选择所有场景生成关系错误
This commit is contained in:
parent
69b18e97c9
commit
5335609959
|
@ -38,4 +38,16 @@ public class QueryTestCaseRequest extends BaseQueryRequest {
|
|||
private long createTime = 0;
|
||||
private long relevanceCreateTime = 0;
|
||||
private List<String> testCaseContainIds;
|
||||
|
||||
|
||||
// 补充场景条件
|
||||
private String excludeId;
|
||||
private String moduleId;
|
||||
private boolean recent = false;
|
||||
private String executeStatus;
|
||||
private boolean notInTestPlan;
|
||||
//操作人
|
||||
private String operator;
|
||||
//操作时间
|
||||
private Long operationTime;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
</ms-aside-container>
|
||||
|
||||
<ms-main-container style="overflow: hidden">
|
||||
<el-tabs v-model="activeName" @tab-click="addTab" @tab-remove="removeTab">
|
||||
<el-tabs v-model="activeName" @tab-click="addTab" @tab-remove="closeConfirm">
|
||||
<el-tab-pane
|
||||
name="trash"
|
||||
:label="$t('commons.trash')" v-if="trashEnable">
|
||||
|
@ -297,9 +297,30 @@ export default {
|
|||
}
|
||||
},
|
||||
handleTabClose() {
|
||||
let message = "";
|
||||
this.tabs.forEach(t => {
|
||||
if (t && this.$store.state.scenarioMap.has(t.currentScenario.id) && this.$store.state.scenarioMap.get(t.currentScenario.id) > 1) {
|
||||
message += t.currentScenario.name + ",";
|
||||
}
|
||||
})
|
||||
if (message !== "") {
|
||||
this.$alert("场景[ " + message.substr(0, message.length - 1) + " ]未保存,是否确认关闭全部?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
cancelButtonText: this.$t('commons.cancel'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
this.$store.state.scenarioMap.clear();
|
||||
this.tabs = [];
|
||||
this.activeName = "default";
|
||||
this.refresh();
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.tabs = [];
|
||||
this.activeName = "default";
|
||||
this.refresh();
|
||||
}
|
||||
},
|
||||
handleCommand(e) {
|
||||
switch (e) {
|
||||
|
@ -323,6 +344,24 @@ export default {
|
|||
this.activeName = "default";
|
||||
}
|
||||
},
|
||||
closeConfirm(targetName) {
|
||||
let t = this.tabs.filter(tab => tab.name === targetName);
|
||||
if (t && this.$store.state.scenarioMap.has(t[0].currentScenario.id) && this.$store.state.scenarioMap.get(t[0].currentScenario.id) > 1) {
|
||||
this.$alert("场景[ " + t[0].currentScenario.name + " ]未保存,是否确认关闭?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
cancelButtonText: this.$t('commons.cancel'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
this.$store.state.scenarioMap.delete(t[0].currentScenario.id);
|
||||
this.removeTab(targetName);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$store.state.scenarioMap.delete(t[0].currentScenario.id);
|
||||
this.removeTab(targetName);
|
||||
}
|
||||
},
|
||||
removeTab(targetName) {
|
||||
this.tabs = this.tabs.filter(tab => tab.name !== targetName);
|
||||
if (this.tabs.length > 0) {
|
||||
|
@ -377,9 +416,9 @@ export default {
|
|||
}
|
||||
}
|
||||
},
|
||||
init(){
|
||||
init() {
|
||||
let scenarioData = this.$route.params.scenarioData;
|
||||
if(scenarioData){
|
||||
if (scenarioData) {
|
||||
this.editScenario(scenarioData)
|
||||
}
|
||||
},
|
||||
|
|
|
@ -462,6 +462,28 @@ export default {
|
|||
runScenario: undefined,
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
currentScenario: {
|
||||
handler(val) {
|
||||
if (val && this.$store.state.scenarioMap) {
|
||||
let change = this.$store.state.scenarioMap.get(this.currentScenario.id);
|
||||
change = change + 1;
|
||||
this.$store.state.scenarioMap.set(this.currentScenario.id, change);
|
||||
}
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
scenarioDefinition: {
|
||||
handler(newObj, oldObj) {
|
||||
if (this.$store.state.scenarioMap) {
|
||||
let change = this.$store.state.scenarioMap.get(this.currentScenario.id);
|
||||
change = change + 1;
|
||||
this.$store.state.scenarioMap.set(this.currentScenario.id, change);
|
||||
}
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
},
|
||||
created() {
|
||||
if (!this.currentScenario.apiScenarioModuleId) {
|
||||
this.currentScenario.apiScenarioModuleId = "";
|
||||
|
@ -486,6 +508,10 @@ export default {
|
|||
if (!this.currentScenario.name) {
|
||||
this.$refs.refFab.openMenu();
|
||||
}
|
||||
if (!(this.$store.state.scenarioMap instanceof Map)) {
|
||||
this.$store.state.scenarioMap = new Map();
|
||||
}
|
||||
this.$store.state.scenarioMap.set(this.currentScenario.id, 0);
|
||||
},
|
||||
directives: {OutsideClick},
|
||||
computed: {
|
||||
|
@ -494,7 +520,7 @@ export default {
|
|||
},
|
||||
},
|
||||
methods: {
|
||||
setDomain() {
|
||||
setDomain(flag) {
|
||||
if (this.projectEnvMap && this.projectEnvMap.size > 0) {
|
||||
let scenario = {
|
||||
id: this.currentScenario.id,
|
||||
|
@ -514,6 +540,9 @@ export default {
|
|||
if (res.data) {
|
||||
let data = JSON.parse(res.data);
|
||||
this.scenarioDefinition = data.hashTree;
|
||||
if (!flag) {
|
||||
this.$store.state.scenarioMap.set(this.currentScenario.id, 0);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -1186,7 +1215,7 @@ export default {
|
|||
if (scenario && scenario.environmentEnable) {
|
||||
this.debugData.environmentEnable = scenario.environmentEnable;
|
||||
this.debugLoading = false;
|
||||
}else{
|
||||
} else {
|
||||
this.debugLoading = true;
|
||||
}
|
||||
this.reportId = getUUID().substring(0, 8);
|
||||
|
@ -1276,6 +1305,7 @@ export default {
|
|||
this.setParameter();
|
||||
saveScenario(this.path, this.currentScenario, this.scenarioDefinition, this, (response) => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.$store.state.scenarioMap.delete(this.currentScenario.id);
|
||||
this.path = "/api/automation/update";
|
||||
this.$store.state.pluginFiles = [];
|
||||
if (response.data) {
|
||||
|
@ -1380,6 +1410,7 @@ export default {
|
|||
if (this.scenarioDefinition) {
|
||||
this.resetResourceId(this.scenarioDefinition);
|
||||
}
|
||||
this.$store.state.scenarioMap.set(this.currentScenario.id, 0);
|
||||
})
|
||||
}
|
||||
},
|
||||
|
@ -1475,7 +1506,7 @@ export default {
|
|||
},
|
||||
setProjectEnvMap(projectEnvMap) {
|
||||
this.projectEnvMap = projectEnvMap;
|
||||
this.setDomain();
|
||||
this.setDomain(true);
|
||||
},
|
||||
getWsProjects() {
|
||||
this.$get("/project/listAll", res => {
|
||||
|
|
|
@ -30,6 +30,7 @@ const state = {
|
|||
// 当前项目是否勾选自定义ID
|
||||
currentProjectIsCustomNum: false,
|
||||
testCaseTemplate: {},
|
||||
scenarioMap: new Map(),
|
||||
}
|
||||
|
||||
const store = new Vuex.Store({
|
||||
|
|
Loading…
Reference in New Issue