feat: 为表格优化界面,添加icon与动画
This commit is contained in:
parent
50ffd491fe
commit
44e357b887
|
@ -1,32 +1,38 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="flex flex-row justify-between items-center">
|
<div class="flex flex-row justify-between items-center">
|
||||||
<h1 class="text-3xl font-bold mb-6">FPGA 设备管理</h1>
|
<h1 class="text-3xl font-bold mb-6">FPGA 设备管理</h1>
|
||||||
|
<div>
|
||||||
<button
|
<button
|
||||||
class="btn btn-ghost text-error hover:underline"
|
class="btn btn-ghost group"
|
||||||
|
@click="tableManager.getAllBoards"
|
||||||
|
>
|
||||||
|
<RefreshCw class="w-4 h-4 mr-2 transition-transform duration-300 group-hover:rotate-180" />
|
||||||
|
刷新
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="btn btn-ghost text-error hover:underline group"
|
||||||
@click="tableManager.toggleEditMode"
|
@click="tableManager.toggleEditMode"
|
||||||
>
|
>
|
||||||
|
<Edit class="w-4 h-4 mr-2 transition-transform duration-200 group-hover:scale-110" />
|
||||||
编辑
|
编辑
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="card bg-base-100 shadow-xl">
|
<div class="card bg-base-100 shadow-xl">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="flex flex-row justify-between items-center mb-4">
|
|
||||||
<h2 class="card-title">IP 地址列表</h2>
|
|
||||||
<button class="btn btn-ghost" @click="tableManager.getAllBoards">
|
|
||||||
刷新
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 搜索和列控制 -->
|
<!-- 搜索和列控制 -->
|
||||||
<div class="flex items-center py-4 gap-4">
|
<div class="flex items-center my-2 gap-4">
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="筛选 IP 地址..."
|
placeholder="筛选 IP 地址..."
|
||||||
class="input input-bordered max-w-sm"
|
class="input input-bordered max-w-sm"
|
||||||
:value="tableManager.getColumnByKey('devAddr')?.getFilterValue() as string"
|
:value="
|
||||||
|
tableManager.getColumnByKey('devAddr')?.getFilterValue() as string
|
||||||
|
"
|
||||||
@input="
|
@input="
|
||||||
tableManager.getColumnByKey('devAddr')
|
tableManager
|
||||||
|
.getColumnByKey('devAddr')
|
||||||
?.setFilterValue(($event.target as HTMLInputElement).value)
|
?.setFilterValue(($event.target as HTMLInputElement).value)
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
|
@ -75,18 +81,20 @@
|
||||||
|
|
||||||
<div class="flex gap-2 ml-auto">
|
<div class="flex gap-2 ml-auto">
|
||||||
<button
|
<button
|
||||||
class="btn btn-primary"
|
class="btn btn-primary group"
|
||||||
:disabled="!tableManager.isEditMode.value"
|
:disabled="!tableManager.isEditMode.value"
|
||||||
@click="showAddBoardDialog = true"
|
@click="showAddBoardDialog = true"
|
||||||
>
|
>
|
||||||
|
<Plus class="w-4 h-4 mr-2 transition-transform duration-200 group-hover:scale-110" />
|
||||||
新增实验板
|
新增实验板
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
class="btn btn-error"
|
class="btn btn-error group"
|
||||||
:disabled="!tableManager.isEditMode.value"
|
:disabled="!tableManager.isEditMode.value"
|
||||||
@click="tableManager.deleteSelectedBoards"
|
@click="tableManager.deleteSelectedBoards"
|
||||||
>
|
>
|
||||||
|
<Trash2 class="w-4 h-4 mr-2 transition-transform duration-200 group-hover:scale-110 group-hover:animate-pulse" />
|
||||||
删除选中
|
删除选中
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -112,7 +120,10 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<template v-if="tableManager.getRowModel().rows?.length">
|
<template v-if="tableManager.getRowModel().rows?.length">
|
||||||
<template v-for="row in tableManager.getRowModel().rows" :key="row.id">
|
<template
|
||||||
|
v-for="row in tableManager.getRowModel().rows"
|
||||||
|
:key="row.id"
|
||||||
|
>
|
||||||
<tr
|
<tr
|
||||||
class="hover"
|
class="hover"
|
||||||
:class="{ 'bg-primary/10': row.getIsSelected() }"
|
:class="{ 'bg-primary/10': row.getIsSelected() }"
|
||||||
|
@ -190,6 +201,7 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { FlexRender } from "@tanstack/vue-table";
|
import { FlexRender } from "@tanstack/vue-table";
|
||||||
import { onMounted, ref } from "vue";
|
import { onMounted, ref } from "vue";
|
||||||
|
import { RefreshCw, Edit, Plus, Trash2 } from "lucide-vue-next";
|
||||||
import { useProvideBoardManager } from "./BoardManager";
|
import { useProvideBoardManager } from "./BoardManager";
|
||||||
import { useProvideBoardTableManager } from "./BoardTableManager";
|
import { useProvideBoardTableManager } from "./BoardTableManager";
|
||||||
import AddBoardDialog from "./AddBoardDialog.vue";
|
import AddBoardDialog from "./AddBoardDialog.vue";
|
||||||
|
|
Loading…
Reference in New Issue