Commit 8ded08e5 authored by tyyin lan's avatar tyyin lan

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

parent 77caa441
......@@ -47,7 +47,7 @@ export function handleUpdateDataBase<T>(payload: object) {
* @returns 获取数据库详情
*/
export function fetchGetDataBaseDetail<T>(id: string) {
return request.post<T>(`/databaseRest/getDetail.json?id=${id}`)
return request.post<T>(`/databaseRest/get.json?id=${id}`)
}
/**
......
......@@ -7,19 +7,20 @@ import useTableScrollY from '@/composables/useTableScrollY'
// import CustomPagination from '@/components/custom-pagination/custom-pagination.vue'
import { createDatabaseColumn } from './columns.tsx'
import { DBTableItemInterface } from './type'
import { fetchGetDBTableList } from '@/apis/database.ts'
import { fetchGetDataBaseDetail } from '@/apis/database.ts'
import { useRoute } from 'vue-router'
const { t } = useI18n()
const route = useRoute()
const { pageContentWrapRef, tableContentY } = useTableScrollY(46 + 48)
const { pageContentWrapRef, tableContentY } = useTableScrollY(46 + 48 + 33)
// const { paginationData, handlePageNoChange, handlePageSizeChange } = usePagination()
// const searchDBTableInputValue = ref('')
const isSearchEmptyList = ref(false)
const dbTableList = ref<DBTableItemInterface[]>([])
const dbTableListLoading = ref(true)
const dbTitle = ref('')
const dbTableColumns = createDatabaseColumn({ t })
......@@ -37,13 +38,16 @@ const emptyTableDataText = computed(() => {
})()
function getDBTableList() {
fetchGetDBTableList<{ tableName: string; tableComment: string; tableRows: number; tableColumn: number }[]>(
route.params.id as string,
)
fetchGetDataBaseDetail<{
title: string
tableInfos: { tableName: string; tableComment: string; tableRows: number; tableColumn: number }[]
}>(route.params.id as string)
.then((res) => {
if (res.code !== 0) return ''
const tableData: DBTableItemInterface[] = res.data.map((dataItem) => {
dbTitle.value = res.data.title
const tableData: DBTableItemInterface[] = res.data.tableInfos.map((dataItem) => {
return {
name: dataItem.tableName,
docs: dataItem.tableComment,
......@@ -68,6 +72,12 @@ function getDBTableList() {
</template>
</n-input>
</div> -->
<div class="mb-[12px]">
<span class="cursor-pointer select-none text-[14px]">
<i class="iconfont icon-left mr-[6px] text-[12px]"></i>
<span>{{ dbTitle || '返回数据库列表' }}</span>
</span>
</div>
<div class="rounded-[10px] bg-white p-[23px]">
<n-data-table
......
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