support to show the table struct
This commit is contained in:
parent
185fb0de7e
commit
13fe6ee1ce
|
@ -7,7 +7,7 @@ import { ElMessage } from 'element-plus'
|
||||||
import { Codemirror } from 'vue-codemirror'
|
import { Codemirror } from 'vue-codemirror'
|
||||||
import HistoryInput from '../components/HistoryInput.vue'
|
import HistoryInput from '../components/HistoryInput.vue'
|
||||||
import type { Ref } from '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 stores: Ref<Store[]> = ref([])
|
||||||
const kind = ref('')
|
const kind = ref('')
|
||||||
|
@ -58,6 +58,10 @@ const queryDataFromTable = (data: QueryData) => {
|
||||||
sqlQuery.value = `@selectTableLImit100_${data.label}`
|
sqlQuery.value = `@selectTableLImit100_${data.label}`
|
||||||
executeQuery()
|
executeQuery()
|
||||||
}
|
}
|
||||||
|
const describeTable = (data: QueryData) => {
|
||||||
|
sqlQuery.value = `@describeTable_${data.label}`
|
||||||
|
executeQuery()
|
||||||
|
}
|
||||||
const queryTables = () => {
|
const queryTables = () => {
|
||||||
sqlQuery.value = ``
|
sqlQuery.value = ``
|
||||||
executeQuery()
|
executeQuery()
|
||||||
|
@ -194,8 +198,15 @@ const executeWithQuery = async (sql: string) => {
|
||||||
<el-option v-for="item in queryDataMeta.databases" :key="item" :label="item"
|
<el-option v-for="item in queryDataMeta.databases" :key="item" :label="item"
|
||||||
:value="item"></el-option>
|
:value="item"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-tree :data="tablesTree" node-key="label" @node-click="queryDataFromTable" highlight-current
|
<el-tree :data="tablesTree" node-key="label" highlight-current
|
||||||
draggable />
|
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-scrollbar>
|
||||||
</el-aside>
|
</el-aside>
|
||||||
<el-container>
|
<el-container>
|
||||||
|
|
Loading…
Reference in New Issue