From e0619eb9a340484b516f2cf56f5a43f440a036a1 Mon Sep 17 00:00:00 2001 From: SikongJueluo Date: Fri, 11 Jul 2025 21:50:35 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=AE=8C=E6=95=B4?= =?UTF-8?q?=E5=AE=9E=E9=AA=8C=E6=9D=BF=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/User/BoardControl.vue | 46 ++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/src/views/User/BoardControl.vue b/src/views/User/BoardControl.vue index abc6c9f..eb76249 100644 --- a/src/views/User/BoardControl.vue +++ b/src/views/User/BoardControl.vue @@ -239,6 +239,44 @@ const columns: ColumnDef[] = [ : h("span", { class: "font-medium" }, device.ipAddr); }, }, + { + accessorKey: "port", + header: "端口", + cell: ({ row }) => { + const device = row.original; + return isEditMode.value + ? h("input", { + type: "number", + class: "input input-sm w-full", + value: device.port, + onInput: (e: Event) => { + device.port = parseInt((e.target as HTMLInputElement).value); + }, + }) + : h("span", { class: "font-mono" }, device.port.toString()); + }, + enableHiding: true, + }, + { + accessorKey: "id", + header: "设备ID", + cell: ({ row }) => + h("span", { class: "font-mono text-xs" }, row.original.id), + enableHiding: true, + }, + { + accessorKey: "status", + header: "状态", + cell: ({ row }) => { + const device = row.original; + const statusText = device.status === 0 ? "忙碌" : "可用"; + const statusClass = device.status === 0 ? "badge-warning" : "badge-success"; + return h("span", { + class: `badge ${statusClass} min-w-15` + }, statusText); + }, + enableHiding: true, + }, { accessorKey: "version", header: "版本号", @@ -362,7 +400,12 @@ const columns: ColumnDef[] = [ // TanStack Table 状态 const sorting = ref([]); const columnFilters = ref([]); -const columnVisibility = ref({}); +const columnVisibility = ref({ + // 默认隐藏端口、ID和状态列 + port: false, + id: false, + status: false, +}); const rowSelection = ref({}); const expanded = ref({}); @@ -430,6 +473,7 @@ const table = useVueTable({ }, }, }); + onMounted(() => { // 初始化数据 boardManager.fetchBoardsData();