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();