Commit 54aec989 authored by tyyin lan's avatar tyyin lan

chore(数据库): 数据表展示优化

parent 8ded08e5
...@@ -8,10 +8,11 @@ import useTableScrollY from '@/composables/useTableScrollY' ...@@ -8,10 +8,11 @@ import useTableScrollY from '@/composables/useTableScrollY'
import { createDatabaseColumn } from './columns.tsx' import { createDatabaseColumn } from './columns.tsx'
import { DBTableItemInterface } from './type' import { DBTableItemInterface } from './type'
import { fetchGetDataBaseDetail } from '@/apis/database.ts' import { fetchGetDataBaseDetail } from '@/apis/database.ts'
import { useRoute } from 'vue-router' import { useRoute, useRouter } from 'vue-router'
const { t } = useI18n() const { t } = useI18n()
const route = useRoute() const route = useRoute()
const router = useRouter()
const { pageContentWrapRef, tableContentY } = useTableScrollY(46 + 48 + 33) const { pageContentWrapRef, tableContentY } = useTableScrollY(46 + 48 + 33)
// const { paginationData, handlePageNoChange, handlePageSizeChange } = usePagination() // const { paginationData, handlePageNoChange, handlePageSizeChange } = usePagination()
...@@ -40,7 +41,7 @@ const emptyTableDataText = computed(() => { ...@@ -40,7 +41,7 @@ const emptyTableDataText = computed(() => {
function getDBTableList() { function getDBTableList() {
fetchGetDataBaseDetail<{ fetchGetDataBaseDetail<{
title: string title: string
tableInfos: { tableName: string; tableComment: string; tableRows: number; tableColumn: number }[] tableInfos: { table_NAME: string; table_COMMENT: string; table_ROWS: number; table_COLUMN: number }[]
}>(route.params.id as string) }>(route.params.id as string)
.then((res) => { .then((res) => {
if (res.code !== 0) return '' if (res.code !== 0) return ''
...@@ -49,9 +50,9 @@ function getDBTableList() { ...@@ -49,9 +50,9 @@ function getDBTableList() {
const tableData: DBTableItemInterface[] = res.data.tableInfos.map((dataItem) => { const tableData: DBTableItemInterface[] = res.data.tableInfos.map((dataItem) => {
return { return {
name: dataItem.tableName, name: dataItem.table_NAME,
docs: dataItem.tableComment, docs: dataItem.table_COMMENT,
dataSize: `${dataItem.tableRows || '-'}行, ${dataItem.tableColumn || '-'}列`, dataSize: `${dataItem.table_ROWS || '-'}行, ${dataItem.table_COLUMN || '-'}列`,
} }
}) })
...@@ -61,6 +62,12 @@ function getDBTableList() { ...@@ -61,6 +62,12 @@ function getDBTableList() {
dbTableListLoading.value = false dbTableListLoading.value = false
}) })
} }
function handleNavBack() {
router.replace({
name: 'PersonalSpaceDatabase',
})
}
</script> </script>
<template> <template>
...@@ -73,7 +80,7 @@ function getDBTableList() { ...@@ -73,7 +80,7 @@ function getDBTableList() {
</n-input> </n-input>
</div> --> </div> -->
<div class="mb-[12px]"> <div class="mb-[12px]">
<span class="cursor-pointer select-none text-[14px]"> <span class="cursor-pointer select-none text-[14px]" @click="handleNavBack">
<i class="iconfont icon-left mr-[6px] text-[12px]"></i> <i class="iconfont icon-left mr-[6px] text-[12px]"></i>
<span>{{ dbTitle || '返回数据库列表' }}</span> <span>{{ dbTitle || '返回数据库列表' }}</span>
</span> </span>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment