From fe58b23cd4ed46abac0bb9d84929bc8f12505159 Mon Sep 17 00:00:00 2001 From: jweboy Date: Mon, 8 Apr 2024 01:10:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0table=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 +- app/dashboard/platform/columns.tsx | 55 ------- app/dashboard/platform/components/DtoForm.tsx | 155 ------------------ .../platform/components/FormDialog.tsx | 32 ---- app/dashboard/platform/page.tsx | 32 ---- app/dashboard/product/form/page.tsx | 2 +- app/dashboard/product/page.tsx | 2 +- app/page.tsx | 2 +- .../components => components}/DataTable.tsx | 0 9 files changed, 4 insertions(+), 278 deletions(-) delete mode 100644 app/dashboard/platform/columns.tsx delete mode 100644 app/dashboard/platform/components/DtoForm.tsx delete mode 100644 app/dashboard/platform/components/FormDialog.tsx delete mode 100644 app/dashboard/platform/page.tsx rename {app/dashboard/platform/components => components}/DataTable.tsx (100%) diff --git a/.env.development b/.env.development index c361a93..b7fe60a 100644 --- a/.env.development +++ b/.env.development @@ -1 +1 @@ - NEXT_PUBLIC_API_URL=https://nest-api-service.vercel.app \ No newline at end of file + NEXT_PUBLIC_API_URL=http://127.0.0.1:4000 \ No newline at end of file diff --git a/app/dashboard/platform/columns.tsx b/app/dashboard/platform/columns.tsx deleted file mode 100644 index a3653ac..0000000 --- a/app/dashboard/platform/columns.tsx +++ /dev/null @@ -1,55 +0,0 @@ -"use client"; - -import { Badge } from "@/components/ui/badge"; -import { Button } from "@/components/ui/button"; -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuLabel, - DropdownMenuTrigger, -} from "@/components/ui/dropdown-menu"; -import { ColumnDef } from "@tanstack/react-table"; -import { MoreHorizontal } from "lucide-react"; - -export const columns: ColumnDef[] = [ - { - accessorKey: "name", - header: "名称", - cell({ row }) { - return ( -
- - {row.original.name} - -
- ); - }, - }, - { - accessorKey: "description", - header: "描述信息", - cell({ row: { original } }) { - return ( -
- {original.description} -
- ); - }, - }, - { - accessorKey: "type", - header: "类型", - }, - { - accessorKey: "tag", - header: "标签", - cell({ row: { original } }) { - return ( -
- {original.tag} -
- ); - }, - }, -]; diff --git a/app/dashboard/platform/components/DtoForm.tsx b/app/dashboard/platform/components/DtoForm.tsx deleted file mode 100644 index 4993b59..0000000 --- a/app/dashboard/platform/components/DtoForm.tsx +++ /dev/null @@ -1,155 +0,0 @@ -"use client"; - -import { Button } from "@/components/ui/button"; -import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; -import { - Form, - FormControl, - FormField, - FormItem, - FormLabel, - FormMessage, -} from "@/components/ui/form"; -import { Input } from "@/components/ui/input"; -import { - Select, - SelectContent, - SelectItem, - SelectValue, - SelectTrigger, -} from "@/components/ui/select"; -import { Textarea } from "@/components/ui/textarea"; -import { request } from "@/lib/request"; -import { zodResolver } from "@hookform/resolvers/zod"; -import React from "react"; -import { useForm } from "react-hook-form"; -import { object, string, z } from "zod"; - -const PlatformDtoForm = () => { - const formSchema = object({ - name: string().min(1, "请输入名称"), - url: string().min(1, "请输入地址"), - description: string().min(1, "请输入描述信息"), - type: string(), - tag: string(), - }); - - const form = useForm>({ - resolver: zodResolver(formSchema), - defaultValues: { - name: "", - url: "", - description: "", - type: "database", - tag: "mongodb", - }, - }); - - const handleSubmit = (values: z.infer) => { - request("/platform", { data: values, method: "POST" }); - }; - - return ( -
- - ( - - 平台名称 - - - - - - )} - /> - ( - - 平台地址 - - - - - - )} - /> - ( - - 优势描述 - -