执行器展示和交互优化

This commit is contained in:
暮光:城中城
2021-07-11 18:57:35 +08:00
parent 77ff6722ab
commit e509431340
4 changed files with 19 additions and 6 deletions

View File

@@ -76,6 +76,10 @@ public class DbSqlExecutorController {
List<String> resultList = new LinkedList<>(); List<String> resultList = new LinkedList<>();
// 支持;分割的多个sql执行 // 支持;分割的多个sql执行
String[] sqlArr = sql.split(";"); String[] sqlArr = sql.split(";");
// 执行条数太多,反应慢,展示结果栏太多,也不应该在这一次执行很多条语句,应该使用导入
if (sqlArr.length > 20) {
return DocDbResponseJson.warn("单次执行最多支持20条语句同时执行当前语句条数" + sqlArr.length);
}
for (String sqlItem : sqlArr) { for (String sqlItem : sqlArr) {
if (StringUtils.isBlank(sqlItem)) { if (StringUtils.isBlank(sqlItem)) {
continue; continue;

View File

@@ -33,7 +33,7 @@ public class SqlLogUtil {
} }
public static String parseLogSql(String sql, List<ParameterMapping> parameterMappings, List<Object> paramList) { public static String parseLogSql(String sql, List<ParameterMapping> parameterMappings, List<Object> paramList) {
StringBuilder sqlSb = new StringBuilder(sql.replaceAll("[\\s]+", " ")); StringBuilder sqlSb = new StringBuilder(sql.replaceAll(" {2,}", " "));
int fromIndex = 0; int fromIndex = 0;
if (parameterMappings.size() > 0) { if (parameterMappings.size() > 0) {
for (int i = 0; i < parameterMappings.size(); i++) { for (int i = 0; i < parameterMappings.size(); i++) {

View File

@@ -105,7 +105,7 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="exportConditionVisible = false"> </el-button> <el-button @click="downloadDataVisible = false"> </el-button>
<el-button type="primary" @click="doDownloadTableData"> </el-button> <el-button type="primary" @click="doDownloadTableData"> </el-button>
</span> </span>
</el-dialog> </el-dialog>

View File

@@ -46,7 +46,7 @@
<el-table-column prop="createTime" label="执行时间" width="160px"></el-table-column> <el-table-column prop="createTime" label="执行时间" width="160px"></el-table-column>
<el-table-column prop="content" label="SQL"> <el-table-column prop="content" label="SQL">
<template slot-scope="scope"> <template slot-scope="scope">
<pre style="margin: 0;" @dblclick="inputFavoriteSql(scope.row.content)">{{scope.row.content}}</pre> <pre class="sql-content-line" @dblclick="inputFavoriteSql(scope.row.content)" :title="scope.row.content">{{scope.row.content}}</pre>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="160px"> <el-table-column label="操作" width="160px">
@@ -62,7 +62,7 @@
<el-table-column prop="createTime" label="执行时间" width="160px"></el-table-column> <el-table-column prop="createTime" label="执行时间" width="160px"></el-table-column>
<el-table-column prop="content" label="SQL"> <el-table-column prop="content" label="SQL">
<template slot-scope="scope"> <template slot-scope="scope">
<pre style="margin: 0;" @dblclick="inputFavoriteSql(scope.row.content)">{{scope.row.content}}</pre> <pre class="sql-content-line" @dblclick="inputFavoriteSql(scope.row.content)" :title="scope.row.content">{{scope.row.content}}</pre>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="160px"> <el-table-column label="操作" width="160px">
@@ -74,7 +74,7 @@
</el-table> </el-table>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="信息" name="tabInfo" v-if="!!executeResultInfo"> <el-tab-pane label="信息" name="tabInfo" v-if="!!executeResultInfo">
<pre>{{executeResultInfo}}</pre> <pre style="white-space: pre-wrap;">{{executeResultInfo}}</pre>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="错误" name="tabError" v-if="!!executeError"> <el-tab-pane label="错误" name="tabError" v-if="!!executeError">
<div style="color: #f00;">{{executeError}}</div> <div style="color: #f00;">{{executeError}}</div>
@@ -204,7 +204,7 @@
this.sqlParams.push({key: item, value: this.sqlParamHistory[item] || ''}); this.sqlParams.push({key: item, value: this.sqlParamHistory[item] || ''});
}); });
this.sqlParamWaiting = false; this.sqlParamWaiting = false;
}, 1000); }, 300);
} }
}); });
}, },
@@ -293,6 +293,7 @@
}).then(json => { }).then(json => {
this.sqlExecuting = false; this.sqlExecuting = false;
if (json.errCode != 200) { if (json.errCode != 200) {
this.executeShowTable = 'tabError';
this.executeError = json.errMsg; this.executeError = json.errMsg;
return; return;
} }
@@ -478,6 +479,14 @@
padding: 0 5px; padding: 0 5px;
resize: none; resize: none;
} }
.data-executor-vue .sql-content-line{
margin: 0;
overflow:hidden;
text-overflow:ellipsis;
display:-webkit-box;
-webkit-line-clamp:2;
-webkit-box-orient:vertical;
}
.data-executor-vue .execute-use-time{ .data-executor-vue .execute-use-time{
font-size: 12px;margin-right: 10px; font-size: 12px;margin-right: 10px;
} }