refactor: 优化代码
This commit is contained in:
parent
5353d7a04a
commit
7714805698
|
@ -17,7 +17,7 @@
|
|||
|
||||
<el-table border :data="tableData" class="adjust-table table-content" @sort-change="sort"
|
||||
@row-click="handleView"
|
||||
@filter-change="filter" @select-all="handleSelectAll" @select="selectionChange">
|
||||
@filter-change="filter" @select-all="select" @select="select">
|
||||
<el-table-column
|
||||
type="selection"></el-table-column>
|
||||
<el-table-column prop="name" :label="$t('commons.name')" width="250" show-overflow-tooltip>
|
||||
|
@ -127,18 +127,7 @@
|
|||
create() {
|
||||
this.$router.push('/api/test/create');
|
||||
},
|
||||
|
||||
handleSelectAll(selection) {
|
||||
this.selectIds.clear()
|
||||
this.selectProjectNames.clear()
|
||||
this.selectProjectId.clear()
|
||||
selection.forEach(s => {
|
||||
this.selectIds.add(s.id)
|
||||
this.selectProjectNames.add(s.projectName)
|
||||
this.selectProjectId.add(s.projectId)
|
||||
})
|
||||
},
|
||||
selectionChange(selection) {
|
||||
select(selection) {
|
||||
this.selectIds.clear()
|
||||
this.selectProjectNames.clear()
|
||||
this.selectProjectId.clear()
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
import MsApiScenarioConfig from "./components/ApiScenarioConfig";
|
||||
import MsApiReportStatus from "../report/ApiReportStatus";
|
||||
import MsApiReportDialog from "./ApiReportDialog";
|
||||
import {getUUID} from "../../../../common/js/utils";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
|
||||
|
||||
export default {
|
||||
|
@ -95,13 +95,12 @@
|
|||
},
|
||||
checkName(callback) {
|
||||
for (let i of this.selectProjectId) {
|
||||
this.result = this.$post('/api/checkName', {name: this.ruleForm.testName, projectId: i}, response => {
|
||||
this.result = this.$post('/api/checkName', {name: this.ruleForm.testName, projectId: i}, () => {
|
||||
if (callback) callback();
|
||||
})
|
||||
}
|
||||
},
|
||||
_getEnvironmentAndRunTest: function (item) {
|
||||
let count = 0;
|
||||
this.result = this.$get('/api/environment/list/' + item.projectId, response => {
|
||||
let environments = response.data;
|
||||
let environmentMap = new Map();
|
||||
|
@ -131,7 +130,6 @@
|
|||
scenarioDefinition: JSON.parse(item.scenarioDefinition),
|
||||
schedule: {},
|
||||
});
|
||||
console.log(test)
|
||||
this.test = this.test || test;
|
||||
if (this.tests.length > 1) {
|
||||
this.test.scenarioDefinition = this.test.scenarioDefinition.concat(test.scenarioDefinition);
|
||||
|
|
Loading…
Reference in New Issue