Skip to content

Commit ba89a47

Browse files
fix(工作台): 查询时自动展开结果区域
修复关闭结果后再次查询不展开的问题
1 parent 0c98035 commit ba89a47

2 files changed

Lines changed: 46 additions & 1 deletion

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<script>
2+
import SqlQuery from './SqlQuery';
3+
4+
const DEFAULT_EXPANDED_EDITOR_HEIGHT = 240;
5+
const originalExecute = SqlQuery.methods.execute;
6+
const originalInsertSqlAsDraft = SqlQuery.methods.insertSqlAsDraft;
7+
const originalStartNewHistory = SqlQuery.methods.startNewHistory;
8+
const originalUseHistorySql = SqlQuery.methods.useHistorySql;
9+
10+
export default {
11+
name: 'SqlQueryResultExpand',
12+
extends: SqlQuery,
13+
methods: {
14+
expandResultArea() {
15+
if (this.resultCollapsed) {
16+
this.editorHeight = DEFAULT_EXPANDED_EDITOR_HEIGHT;
17+
}
18+
this.setResultCollapsed(false);
19+
},
20+
21+
async execute() {
22+
if (!this.sql.trim()) {
23+
return;
24+
}
25+
this.expandResultArea();
26+
return originalExecute.call(this);
27+
},
28+
29+
insertSqlAsDraft(sql) {
30+
this.expandResultArea();
31+
return originalInsertSqlAsDraft.call(this, sql);
32+
},
33+
34+
startNewHistory() {
35+
this.expandResultArea();
36+
return originalStartNewHistory.call(this);
37+
},
38+
39+
useHistorySql(item, focusEditor = true) {
40+
this.expandResultArea();
41+
return originalUseHistorySql.call(this, item, focusEditor);
42+
}
43+
}
44+
};
45+
</script>

workstation/frontend/src/router/modules/workstation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Focus from '@/business/focus/Focus'
44
import Creation from '@/business/creation/Creation'
55
import Dashboard from '@/business/dashboard/Dashboard'
66
import AdvancedSearch from '@/business/advanced-search/AdvancedSearch'
7-
import SqlQuery from '@/business/sql-query/SqlQuery'
7+
import SqlQuery from '@/business/sql-query/SqlQueryResultExpand'
88

99
export default {
1010
path: "/workstation",

0 commit comments

Comments
 (0)