mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-30 04:50:26 +08:00
fix: 前端树形按钮变更为右击显示,后端修复协程panic导致进程退出
This commit is contained in:
@@ -96,7 +96,6 @@
|
||||
import { toRefs, reactive, computed, defineComponent, ref } from 'vue';
|
||||
import { dbApi } from './api';
|
||||
|
||||
import 'codemirror/theme/ambiance.css';
|
||||
import 'codemirror/addon/hint/show-hint.css';
|
||||
// import base style
|
||||
import 'codemirror/lib/codemirror.css';
|
||||
@@ -210,7 +209,13 @@ export default defineComponent({
|
||||
// 没有选中的文本,则为全部文本
|
||||
let sql = getSql();
|
||||
notNull(sql, '内容不能为空');
|
||||
runSqlStr(sql);
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行sql str
|
||||
*/
|
||||
const runSqlStr = async (sql: string) => {
|
||||
state.execRes.tableColumn = [];
|
||||
state.execRes.data = [];
|
||||
state.execRes.emptyResText = '查询中...';
|
||||
@@ -336,7 +341,7 @@ export default defineComponent({
|
||||
// 赋值第一个表信息
|
||||
if (state.tableMetadata.length > 0) {
|
||||
state.tableName = state.tableMetadata[0]['tableName'];
|
||||
changeTable(state.tableName);
|
||||
changeTable(state.tableName, false);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -367,14 +372,22 @@ export default defineComponent({
|
||||
};
|
||||
|
||||
// 选择表事件
|
||||
const changeTable = async (tableName: string) => {
|
||||
const changeTable = (tableName: string, execSelectSql: boolean = true) => {
|
||||
if (tableName == '') {
|
||||
return;
|
||||
}
|
||||
state.columnMetadata = await dbApi.columnMetadata.request({
|
||||
id: state.dbId,
|
||||
tableName: tableName,
|
||||
});
|
||||
dbApi.columnMetadata
|
||||
.request({
|
||||
id: state.dbId,
|
||||
tableName: tableName,
|
||||
})
|
||||
.then((res) => {
|
||||
state.columnMetadata = res;
|
||||
});
|
||||
|
||||
if (execSelectSql) {
|
||||
runSqlStr(`SELECT * FROM ${tableName} ORDER BY create_time DESC LIMIT 25`);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user