2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 12:40:25 +08:00

feat: 数据库管理优化2

This commit is contained in:
耗子
2024-11-27 01:45:58 +08:00
parent cd8a10d799
commit 3677d0317c
12 changed files with 90 additions and 6 deletions

View File

@@ -7,6 +7,9 @@ export default {
create: (data: any) => http.Post(`/database`, data),
// 删除数据库
delete: (server_id: number, name: string) => http.Delete(`/database`, { server_id, name }),
// 更新评论
comment: (server_id: number, name: string, comment: string) =>
http.Post(`/database/comment`, { server_id, name, comment }),
// 获取数据库服务器列表
serverList: (page: number, limit: number) =>
http.Get('/databaseServer', { params: { page, limit } }),

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
import { renderIcon } from '@/utils'
import { NButton, NPopconfirm, NTag } from 'naive-ui'
import { NButton, NInput, NPopconfirm, NTag } from 'naive-ui'
import database from '@/api/panel/database'
@@ -50,6 +50,23 @@ const columns: any = [
})
}
},
{
title: '备注',
key: 'comment',
minWidth: 250,
resizable: true,
ellipsis: { tooltip: true },
render(row: any) {
return h(NInput, {
size: 'small',
value: row.comment,
onBlur: () => handleComment(row),
onUpdateValue(v) {
row.comment = v
}
})
}
},
{
title: '操作',
key: 'actions',
@@ -104,6 +121,12 @@ const handleDelete = async (serverID: number, name: string) => {
})
}
const handleComment = (row: any) => {
database.comment(row.server_id, row.name, row.comment).then(() => {
window.$message.success('修改成功')
})
}
onMounted(() => {
window.$bus.on('database:refresh', () => {
refresh()
@@ -119,7 +142,7 @@ onUnmounted(() => {
<n-data-table
striped
remote
:scroll-x="800"
:scroll-x="1000"
:loading="loading"
:columns="columns"
:data="data"

View File

@@ -215,7 +215,7 @@ onUnmounted(() => {
<n-data-table
striped
remote
:scroll-x="1200"
:scroll-x="1500"
:loading="loading"
:columns="columns"
:data="data"

View File

@@ -188,7 +188,7 @@ onUnmounted(() => {
<n-data-table
striped
remote
:scroll-x="1400"
:scroll-x="1500"
:loading="loading"
:columns="columns"
:data="data"