fix (接口定义): 修复sql类型结果只显示一个的问题

--bug=1007307 --user=赵勇 【接口定义】-编辑SQL接口-test-添加多条SQL语句执行不生效仅执行一条 https://www.tapd.cn/55049933/s/1057511
This commit is contained in:
fit2-zhao 2021-10-21 18:51:41 +08:00 committed by fit2-zhao
parent d5fd36b35e
commit bc55fbd285
2 changed files with 62 additions and 85 deletions

View File

@ -55,7 +55,6 @@ public class TestResultService {
try {
ApiTestReport report = null;
ApiTestReportVariable reportTask = null;
String reportUrl = null;
String planScenarioId = null;
// 这部分后续优化只留 DEFINITION SCENARIO 两部分
if (StringUtils.equals(runMode, ApiRunMode.DEBUG.name())) {
@ -129,9 +128,6 @@ public class TestResultService {
reportTask.setExecutionEnvironment(name);
SystemParameterService systemParameterService = CommonBeanFactory.getBean(SystemParameterService.class);
assert systemParameterService != null;
BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo();
reportUrl = baseSystemConfigDTO.getUrl() + "/#/api/automation/report";
}
testResult.setTestId(scenarioReport.getScenarioId());
planScenarioId = scenarioReport.getTestPlanScenarioId();

View File

@ -24,102 +24,83 @@
</template>
<script>
export default {
name: "MsSqlResultTable",
data() {
return {
tables: [],
titles: []
}
},
props: {
body: String
},
created() {
if (!this.body) {
return;
}
let rowArry = this.body.split("\n");
//
if (rowArry.length > 100) {
rowArry = rowArry.slice(0, 100);
}
this.getTableData(rowArry);
if (this.tables.length > 1) {
for (let i = 0; i < this.tables.length; i++) {
if (this.tables[i].titles.length === 1 && i < this.tables.length - 1) {
this.tables[i].tableData.splice(this.tables[i].tableData.length - 1, 1);
}
}
let lastTable = this.tables[this.tables.length - 1];
if (lastTable.titles.length === 1) {
if (lastTable.tableData.length > 4) {
lastTable.tableData.splice(lastTable.tableData.length - 4, 4);
} else {
this.tables.splice(this.tables.length - 1, 1);
}
export default {
name: "MsSqlResultTable",
data() {
return {
tables: [],
titles: []
}
},
props: {
body: String
},
created() {
if (!this.body) {
return;
}
let rowArray = this.body.split("\n");
//
if (rowArray.length > 100) {
rowArray = rowArray.slice(0, 100);
}
this.getTableData(rowArray);
},
methods: {
getTableData(rowArray) {
let titles;
let result = [];
for (let i = 0; i < rowArray.length; i++) {
let colArray = rowArray[i].split("\t");
if (i === 0) {
titles = colArray;
} else {
this.tables.splice(this.tables.length - 1, 1);
}
} else {
let table = this.tables[0];
table.tableData.splice(table.tableData.length - 4, 4);
}
},
methods: {
getTableData(rowArry) {
let titles;
let result = [];
for (let i = 0; i < rowArry.length; i++) {
let colArray = rowArry[i].split("\t");
if (i === 0) {
titles = colArray;
} else {
if (colArray.length != titles.length) {
//
if (colArray.length === 1 && colArray[0] === '') {
this.getTableData(rowArry.slice(i + 1));
} else {
this.getTableData(rowArry.slice(i));
}
break;
if (colArray.length != titles.length) {
//
if (colArray.length === 1 && colArray[0] === '') {
this.getTableData(rowArray.slice(i + 1));
} else {
let item = {};
for (let j = 0; j < colArray.length; j++) {
item[titles[j]] = (colArray[j] ? colArray[j] : "");
}
this.getTableData(rowArray.slice(i));
}
break;
} else {
let item = {};
for (let j = 0; j < colArray.length; j++) {
item[titles[j]] = (colArray[j] ? colArray[j] : "");
}
//
if (result.length < 100) {
result.push(item);
}
}
}
this.tables.splice(0, 0, {
titles: titles,
tableData: result
});
}
this.tables.splice(0, 0, {
titles: titles,
tableData: result
});
}
}
}
</script>
<style scoped>
.el-table {
margin-bottom: 20px;
}
.el-table {
margin-bottom: 20px;
}
.el-table >>> .cell {
white-space: nowrap;
}
.el-table >>> .cell {
white-space: nowrap;
}
.table-content {
cursor: pointer;
}
.table-content {
cursor: pointer;
}
.el-container {
overflow: auto;
max-height: 500px;
}
.el-container {
overflow: auto;
max-height: 500px;
}
</style>