fix: 一键运行同一项目报错提示

This commit is contained in:
wenyann 2020-08-27 15:51:44 +08:00
parent d8094b3907
commit 98b0391234
2 changed files with 22 additions and 20 deletions

View File

@ -128,23 +128,25 @@ export default {
}, },
handleSelectAll(selection) { handleSelectAll(selection) {
this.selectIds.clear()
this.selectProjectNames.clear()
this.selectNames.clear()
if (selection.length > 0) { if (selection.length > 0) {
this.tableData.forEach(item => { selection.forEach(s => {
this.selectIds.add(item.id); this.selectIds.add(s.id)
this.selectProjectNames.add(item.projectName) this.selectProjectNames.add(s.projectName)
}); })
} else {
this.selectIds.clear()
this.selectProjectNames.clear()
} }
}, },
selectionChange(selection, row) { selectionChange(selection) {
if (this.selectIds.has(row.id)) { this.selectIds.clear()
this.selectIds.delete(row.id); this.selectProjectNames.clear()
this.selectProjectNames.delete(row.projectName) this.selectNames.clear()
} else { if (selection.length > 0) {
this.selectIds.add(row.id); selection.forEach(s => {
this.selectProjectNames.add(row.projectName) this.selectIds.add(s.id)
this.selectProjectNames.add(s.projectName)
})
} }
}, },
runTest() { runTest() {
@ -200,6 +202,9 @@ export default {
this.$refs.apiCopy.open(test); this.$refs.apiCopy.open(test);
}, },
init() { init() {
this.selectIds.clear()
this.selectProjectNames.clear()
this.selectNames.clear()
this.projectId = this.$route.params.projectId; this.projectId = this.$route.params.projectId;
if (this.projectId && this.projectId !== "all") { if (this.projectId && this.projectId !== "all") {
this.$store.commit('setProjectId', this.projectId); this.$store.commit('setProjectId', this.projectId);

View File

@ -74,17 +74,14 @@
}, },
checkedSaveAndRunTest() { checkedSaveAndRunTest() {
if (this.selectNames.has(this.ruleForm.testName)) { if (this.selectNames.has(this.ruleForm.testName)) {
this.selectIds.clear()
this.selectProjectNames.clear()
this.selectNames.clear()
this.$warning(this.$t('load_test.already_exists')); this.$warning(this.$t('load_test.already_exists'));
this.oneClickOperationVisible = false; this.oneClickOperationVisible = false;
this.$emit('refresh') this.$emit('refresh')
} else { } else {
if (this.selectProjectNames.size > 1) { if (this.selectProjectNames.size > 1) {
this.selectIds.clear()
this.selectProjectNames.clear() /* console.log(this.selectIds)
this.selectNames.clear() console.log(this.selectNames)*/
this.$warning(this.$t('load_test.same_project_test')); this.$warning(this.$t('load_test.same_project_test'));
this.oneClickOperationVisible = false; this.oneClickOperationVisible = false;
this.$emit('refresh') this.$emit('refresh')