diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3c3629e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+node_modules
diff --git a/src/components/MainContent.tsx b/src/components/MainContent.tsx
index 8f1ca7a..6d0d2b1 100644
--- a/src/components/MainContent.tsx
+++ b/src/components/MainContent.tsx
@@ -383,6 +383,10 @@ function TableViewer({ tab, onLoadPage }: {
({tab.total} 行)
+
+ 点击列头图钉可固定列
+
+
{/* 分页控制 */}
- {/* 数据表格 - 使用绝对定位确保滚动 */}
+ {/* 数据表格 - 使用 DataTable 组件支持列固定 */}
-
-
-
-
- {tab.columns.map((col, i) => (
- |
-
- {col.key === 'PRI' && }
- {col.name}
- ({col.type})
- {col.comment && (
-
-
-
- )}
-
- {col.comment && (
-
- {col.comment}
-
- )}
- |
- ))}
-
-
-
- {tab.data.map((row, i) => (
-
- {tab.columns.map((col, j) => (
- |
- {row[col.name] === null ? (
- NULL
- ) : typeof row[col.name] === 'object' ? (
- {JSON.stringify(row[col.name])}
- ) : (
- String(row[col.name])
- )}
- |
- ))}
-
- ))}
-
-
-
- {tab.data.length === 0 && (
-
- 暂无数据
-
- )}
+
+
@@ -569,4 +518,147 @@ function QueryEditor({ tab, databases, tables, columns, onRun, onUpdateSql, onUp
sqlContent += `INSERT INTO \`${tableName}\` (\`${columns.join('`, `')}\`) VALUES (${values});\n`
})
- const blob = n
\ No newline at end of file
+ const blob = new Blob([sqlContent], { type: 'text/plain;charset=utf-8' })
+ saveAs(blob, `query_results_${Date.now()}.sql`)
+ }
+
+ // 导出下拉菜单状态
+ const [showExportMenu, setShowExportMenu] = useState(false)
+
+ return (
+
+ {/* SQL 编辑区 */}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {/* 导出按钮 */}
+
+
+ {showExportMenu && (
+
+
+
+
+ )}
+
+
+
+ {filePath && {filePath.split(/[/\\]/).pop()}}
+ Ctrl+Enter 执行 | Ctrl+S 保存 | Ctrl+Shift+F 格式化
+
+
+
+
+
+
+
+ {/* 结果区 - 使用 DataTable 组件支持列固定 */}
+
+
+
+ 结果
+ {tab.results && ({tab.results.rows.length} 行)}
+
+ {tab.results && tab.results.rows.length > 0 && (
+
+ 点击列头图钉可固定列
+
+ )}
+
+
+
+
+ {tab.results ? (
+
{
+ const colInfo = findColumnInfo(col)
+ return {
+ name: col,
+ type: colInfo?.type,
+ key: colInfo?.key,
+ comment: colInfo?.comment,
+ }
+ })}
+ data={tab.results.rows}
+ showColumnInfo={true}
+ />
+ ) : (
+
+ 执行查询以查看结果
+
+ )}
+
+
+
+
+ )
+}