fix (接口定义): 修复sql类型结果只显示一个的问题
--bug=1007307 --user=赵勇 【接口定义】-编辑SQL接口-test-添加多条SQL语句执行不生效仅执行一条 https://www.tapd.cn/55049933/s/1057511
This commit is contained in:
parent
c73e5bccf0
commit
18f3b2b082
|
@ -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();
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue