support to show the table struct

This commit is contained in:
rick 2025-03-28 10:53:51 +00:00
parent 185fb0de7e
commit 13fe6ee1ce
1 changed files with 14 additions and 3 deletions

View File

@ -7,7 +7,7 @@ import { ElMessage } from 'element-plus'
import { Codemirror } from 'vue-codemirror'
import HistoryInput from '../components/HistoryInput.vue'
import type { Ref } from 'vue'
import { Refresh } from '@element-plus/icons-vue'
import { Refresh, Document } from '@element-plus/icons-vue'
const stores: Ref<Store[]> = ref([])
const kind = ref('')
@ -58,6 +58,10 @@ const queryDataFromTable = (data: QueryData) => {
sqlQuery.value = `@selectTableLImit100_${data.label}`
executeQuery()
}
const describeTable = (data: QueryData) => {
sqlQuery.value = `@describeTable_${data.label}`
executeQuery()
}
const queryTables = () => {
sqlQuery.value = ``
executeQuery()
@ -194,8 +198,15 @@ const executeWithQuery = async (sql: string) => {
<el-option v-for="item in queryDataMeta.databases" :key="item" :label="item"
:value="item"></el-option>
</el-select>
<el-tree :data="tablesTree" node-key="label" @node-click="queryDataFromTable" highlight-current
draggable />
<el-tree :data="tablesTree" node-key="label" highlight-current
draggable>
<template #default="{node, data}">
<span @click="queryDataFromTable(data)">
{{ node.label }}
</span>
<el-icon style="margin-left: 6px;" @click="describeTable(data)" v-if="kind === 'atest-store-orm'"><Document /></el-icon>
</template>
</el-tree>
</el-scrollbar>
</el-aside>
<el-container>