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 c73e5bccf0
commit 18f3b2b082
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,7 +24,7 @@
</template>
<script>
export default {
export default {
name: "MsSqlResultTable",
data() {
return {
@ -39,49 +39,28 @@
if (!this.body) {
return;
}
let rowArry = this.body.split("\n");
let rowArray = 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);
}
} else {
this.tables.splice(this.tables.length - 1, 1);
}
} else {
let table = this.tables[0];
table.tableData.splice(table.tableData.length - 4, 4);
if (rowArray.length > 100) {
rowArray = rowArray.slice(0, 100);
}
this.getTableData(rowArray);
},
methods: {
getTableData(rowArry) {
getTableData(rowArray) {
let titles;
let result = [];
for (let i = 0; i < rowArry.length; i++) {
let colArray = rowArry[i].split("\t");
for (let i = 0; i < rowArray.length; i++) {
let colArray = rowArray[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));
this.getTableData(rowArray.slice(i + 1));
} else {
this.getTableData(rowArry.slice(i));
this.getTableData(rowArray.slice(i));
}
break;
} else {
@ -89,37 +68,39 @@
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
});
}
}
}
}
</script>
<style scoped>
.el-table {
.el-table {
margin-bottom: 20px;
}
}
.el-table >>> .cell {
.el-table >>> .cell {
white-space: nowrap;
}
}
.table-content {
.table-content {
cursor: pointer;
}
}
.el-container {
.el-container {
overflow: auto;
max-height: 500px;
}
}
</style>