|
|
@@ -0,0 +1,543 @@
|
|
|
+import React, { useState } from 'react';
|
|
|
+import { useQuery } from '@tanstack/react-query';
|
|
|
+import { format } from 'date-fns';
|
|
|
+import { Plus, Search, Edit, Trash2 } from 'lucide-react';
|
|
|
+import { vocabularyClient } from '@/client/api';
|
|
|
+import type { InferRequestType, InferResponseType } from 'hono/client';
|
|
|
+import { Button } from '@/client/components/ui/button';
|
|
|
+import { Input } from '@/client/components/ui/input';
|
|
|
+import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/client/components/ui/card';
|
|
|
+import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/client/components/ui/table';
|
|
|
+import { Badge } from '@/client/components/ui/badge';
|
|
|
+import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '@/client/components/ui/dialog';
|
|
|
+import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from '@/client/components/ui/form';
|
|
|
+import { DataTablePagination } from '@/client/admin-shadcn/components/DataTablePagination';
|
|
|
+import { useForm } from 'react-hook-form';
|
|
|
+import { zodResolver } from '@hookform/resolvers/zod';
|
|
|
+import { toast } from 'sonner';
|
|
|
+import { Skeleton } from '@/client/components/ui/skeleton';
|
|
|
+import { Switch } from '@/client/components/ui/switch';
|
|
|
+import { DisabledStatus } from '@/share/types';
|
|
|
+import { CreateVocabularyDto, UpdateVocabularyDto } from '@/server/modules/vocabulary/vocabulary.schema';
|
|
|
+
|
|
|
+// 使用RPC方式提取类型
|
|
|
+type CreateVocabularyRequest = InferRequestType<typeof vocabularyClient.$post>['json'];
|
|
|
+type UpdateVocabularyRequest = InferRequestType<typeof vocabularyClient[':id']['$put']>['json'];
|
|
|
+type VocabularyResponse = InferResponseType<typeof vocabularyClient.$get, 200>['data'][0];
|
|
|
+
|
|
|
+// 直接使用后端定义的 schema
|
|
|
+const createVocabularyFormSchema = CreateVocabularyDto;
|
|
|
+const updateVocabularyFormSchema = UpdateVocabularyDto;
|
|
|
+
|
|
|
+type CreateVocabularyFormData = CreateVocabularyRequest;
|
|
|
+type UpdateVocabularyFormData = UpdateVocabularyRequest;
|
|
|
+
|
|
|
+export const VocabularyPage = () => {
|
|
|
+ const [searchParams, setSearchParams] = useState({
|
|
|
+ page: 1,
|
|
|
+ limit: 10,
|
|
|
+ search: ''
|
|
|
+ });
|
|
|
+ const [isModalOpen, setIsModalOpen] = useState(false);
|
|
|
+ const [editingVocabulary, setEditingVocabulary] = useState<any>(null);
|
|
|
+ const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
|
|
|
+ const [vocabularyToDelete, setVocabularyToDelete] = useState<number | null>(null);
|
|
|
+ const [isCreateForm, setIsCreateForm] = useState(true);
|
|
|
+
|
|
|
+ const createForm = useForm<CreateVocabularyFormData>({
|
|
|
+ resolver: zodResolver(createVocabularyFormSchema),
|
|
|
+ defaultValues: {
|
|
|
+ word: '',
|
|
|
+ pronunciation: null,
|
|
|
+ meaning: null,
|
|
|
+ example: null,
|
|
|
+ isDisabled: DisabledStatus.ENABLED,
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
+ const updateForm = useForm<UpdateVocabularyFormData>({
|
|
|
+ resolver: zodResolver(updateVocabularyFormSchema),
|
|
|
+ defaultValues: {
|
|
|
+ word: undefined,
|
|
|
+ pronunciation: null,
|
|
|
+ meaning: null,
|
|
|
+ example: null,
|
|
|
+ isDisabled: undefined,
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
+ const { data: vocabulariesData, isLoading, refetch } = useQuery({
|
|
|
+ queryKey: ['vocabularies', searchParams],
|
|
|
+ queryFn: async () => {
|
|
|
+ const res = await vocabularyClient.$get({
|
|
|
+ query: {
|
|
|
+ page: searchParams.page,
|
|
|
+ pageSize: searchParams.limit,
|
|
|
+ keyword: searchParams.search
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (res.status !== 200) {
|
|
|
+ throw new Error('获取单词列表失败');
|
|
|
+ }
|
|
|
+ return await res.json();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ const vocabularies = vocabulariesData?.data || [];
|
|
|
+ const totalCount = vocabulariesData?.pagination?.total || 0;
|
|
|
+
|
|
|
+ // 处理搜索
|
|
|
+ const handleSearch = (e: React.FormEvent) => {
|
|
|
+ e.preventDefault();
|
|
|
+ setSearchParams(prev => ({ ...prev, page: 1 }));
|
|
|
+ };
|
|
|
+
|
|
|
+ // 处理分页
|
|
|
+ const handlePageChange = (page: number, limit: number) => {
|
|
|
+ setSearchParams(prev => ({ ...prev, page, limit }));
|
|
|
+ };
|
|
|
+
|
|
|
+ // 打开创建单词对话框
|
|
|
+ const handleCreateVocabulary = () => {
|
|
|
+ setEditingVocabulary(null);
|
|
|
+ setIsCreateForm(true);
|
|
|
+ createForm.reset({
|
|
|
+ word: '',
|
|
|
+ pronunciation: null,
|
|
|
+ meaning: null,
|
|
|
+ example: null,
|
|
|
+ isDisabled: DisabledStatus.ENABLED,
|
|
|
+ });
|
|
|
+ setIsModalOpen(true);
|
|
|
+ };
|
|
|
+
|
|
|
+ // 打开编辑单词对话框
|
|
|
+ const handleEditVocabulary = (vocabulary: VocabularyResponse) => {
|
|
|
+ setEditingVocabulary(vocabulary);
|
|
|
+ setIsCreateForm(false);
|
|
|
+ updateForm.reset({
|
|
|
+ word: vocabulary.word,
|
|
|
+ pronunciation: vocabulary.pronunciation,
|
|
|
+ meaning: vocabulary.meaning,
|
|
|
+ example: vocabulary.example,
|
|
|
+ isDisabled: vocabulary.isDisabled,
|
|
|
+ });
|
|
|
+ setIsModalOpen(true);
|
|
|
+ };
|
|
|
+
|
|
|
+ // 处理创建表单提交
|
|
|
+ const handleCreateSubmit = async (data: CreateVocabularyFormData) => {
|
|
|
+ try {
|
|
|
+ const res = await vocabularyClient.$post({
|
|
|
+ json: data
|
|
|
+ });
|
|
|
+ if (res.status !== 201) {
|
|
|
+ throw new Error('创建单词失败');
|
|
|
+ }
|
|
|
+ toast.success('单词创建成功');
|
|
|
+ setIsModalOpen(false);
|
|
|
+ refetch();
|
|
|
+ } catch (error) {
|
|
|
+ console.error('创建单词失败:', error);
|
|
|
+ toast.error('创建失败,请重试');
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ // 处理更新表单提交
|
|
|
+ const handleUpdateSubmit = async (data: UpdateVocabularyFormData) => {
|
|
|
+ if (!editingVocabulary) return;
|
|
|
+
|
|
|
+ try {
|
|
|
+ const res = await vocabularyClient[':id']['$put']({
|
|
|
+ param: { id: editingVocabulary.id },
|
|
|
+ json: data
|
|
|
+ });
|
|
|
+ if (res.status !== 200) {
|
|
|
+ throw new Error('更新单词失败');
|
|
|
+ }
|
|
|
+ toast.success('单词更新成功');
|
|
|
+ setIsModalOpen(false);
|
|
|
+ refetch();
|
|
|
+ } catch (error) {
|
|
|
+ console.error('更新单词失败:', error);
|
|
|
+ toast.error('更新失败,请重试');
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ // 处理删除单词
|
|
|
+ const handleDeleteVocabulary = (id: number) => {
|
|
|
+ setVocabularyToDelete(id);
|
|
|
+ setDeleteDialogOpen(true);
|
|
|
+ };
|
|
|
+
|
|
|
+ const confirmDelete = async () => {
|
|
|
+ if (!vocabularyToDelete) return;
|
|
|
+
|
|
|
+ try {
|
|
|
+ const res = await vocabularyClient[':id']['$delete']({
|
|
|
+ param: { id: vocabularyToDelete }
|
|
|
+ });
|
|
|
+ if (res.status !== 204) {
|
|
|
+ throw new Error('删除单词失败');
|
|
|
+ }
|
|
|
+ toast.success('单词删除成功');
|
|
|
+ refetch();
|
|
|
+ } catch (error) {
|
|
|
+ console.error('删除单词失败:', error);
|
|
|
+ toast.error('删除失败,请重试');
|
|
|
+ } finally {
|
|
|
+ setDeleteDialogOpen(false);
|
|
|
+ setVocabularyToDelete(null);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ // 渲染加载骨架
|
|
|
+ if (isLoading) {
|
|
|
+ return (
|
|
|
+ <div className="space-y-4">
|
|
|
+ <div className="flex justify-between items-center">
|
|
|
+ <h1 className="text-2xl font-bold">单词管理</h1>
|
|
|
+ <Button disabled>
|
|
|
+ <Plus className="mr-2 h-4 w-4" />
|
|
|
+ 创建单词
|
|
|
+ </Button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <Card>
|
|
|
+ <CardHeader>
|
|
|
+ <Skeleton className="h-6 w-1/4" />
|
|
|
+ </CardHeader>
|
|
|
+ <CardContent>
|
|
|
+ <div className="space-y-2">
|
|
|
+ <Skeleton className="h-4 w-full" />
|
|
|
+ <Skeleton className="h-4 w-full" />
|
|
|
+ <Skeleton className="h-4 w-full" />
|
|
|
+ </div>
|
|
|
+ </CardContent>
|
|
|
+ </Card>
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ return (
|
|
|
+ <div className="space-y-4">
|
|
|
+ <div className="flex justify-between items-center">
|
|
|
+ <h1 className="text-2xl font-bold">单词管理</h1>
|
|
|
+ <Button onClick={handleCreateVocabulary}>
|
|
|
+ <Plus className="mr-2 h-4 w-4" />
|
|
|
+ 创建单词
|
|
|
+ </Button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <Card>
|
|
|
+ <CardHeader>
|
|
|
+ <CardTitle>单词列表</CardTitle>
|
|
|
+ <CardDescription>
|
|
|
+ 管理系统中的所有单词,共 {totalCount} 个单词
|
|
|
+ </CardDescription>
|
|
|
+ </CardHeader>
|
|
|
+ <CardContent>
|
|
|
+ <div className="mb-4">
|
|
|
+ <form onSubmit={handleSearch} className="flex gap-2">
|
|
|
+ <div className="relative flex-1 max-w-sm">
|
|
|
+ <Search className="absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" />
|
|
|
+ <Input
|
|
|
+ placeholder="搜索单词、发音或含义..."
|
|
|
+ value={searchParams.search}
|
|
|
+ onChange={(e) => setSearchParams(prev => ({ ...prev, search: e.target.value }))}
|
|
|
+ className="pl-8"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <Button type="submit" variant="outline">
|
|
|
+ 搜索
|
|
|
+ </Button>
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div className="rounded-md border">
|
|
|
+ <Table>
|
|
|
+ <TableHeader>
|
|
|
+ <TableRow>
|
|
|
+ <TableHead>单词</TableHead>
|
|
|
+ <TableHead>发音</TableHead>
|
|
|
+ <TableHead>含义</TableHead>
|
|
|
+ <TableHead>例句</TableHead>
|
|
|
+ <TableHead>状态</TableHead>
|
|
|
+ <TableHead>创建时间</TableHead>
|
|
|
+ <TableHead className="text-right">操作</TableHead>
|
|
|
+ </TableRow>
|
|
|
+ </TableHeader>
|
|
|
+ <TableBody>
|
|
|
+ {vocabularies.map((vocabulary) => (
|
|
|
+ <TableRow key={vocabulary.id}>
|
|
|
+ <TableCell className="font-medium">{vocabulary.word}</TableCell>
|
|
|
+ <TableCell>{vocabulary.pronunciation || '-'}</TableCell>
|
|
|
+ <TableCell>{vocabulary.meaning || '-'}</TableCell>
|
|
|
+ <TableCell>{vocabulary.example || '-'}</TableCell>
|
|
|
+ <TableCell>
|
|
|
+ <Badge
|
|
|
+ variant={vocabulary.isDisabled === 1 ? 'secondary' : 'default'}
|
|
|
+ >
|
|
|
+ {vocabulary.isDisabled === 1 ? '禁用' : '启用'}
|
|
|
+ </Badge>
|
|
|
+ </TableCell>
|
|
|
+ <TableCell>
|
|
|
+ {format(new Date(vocabulary.createdAt), 'yyyy-MM-dd HH:mm')}
|
|
|
+ </TableCell>
|
|
|
+ <TableCell className="text-right">
|
|
|
+ <div className="flex justify-end gap-2">
|
|
|
+ <Button
|
|
|
+ variant="ghost"
|
|
|
+ size="icon"
|
|
|
+ onClick={() => handleEditVocabulary(vocabulary)}
|
|
|
+ >
|
|
|
+ <Edit className="h-4 w-4" />
|
|
|
+ </Button>
|
|
|
+ <Button
|
|
|
+ variant="ghost"
|
|
|
+ size="icon"
|
|
|
+ onClick={() => handleDeleteVocabulary(vocabulary.id)}
|
|
|
+ >
|
|
|
+ <Trash2 className="h-4 w-4" />
|
|
|
+ </Button>
|
|
|
+ </div>
|
|
|
+ </TableCell>
|
|
|
+ </TableRow>
|
|
|
+ ))}
|
|
|
+ </TableBody>
|
|
|
+ </Table>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <DataTablePagination
|
|
|
+ currentPage={searchParams.page}
|
|
|
+ totalCount={totalCount}
|
|
|
+ pageSize={searchParams.limit}
|
|
|
+ onPageChange={handlePageChange}
|
|
|
+ />
|
|
|
+ </CardContent>
|
|
|
+ </Card>
|
|
|
+
|
|
|
+ {/* 创建/编辑单词对话框 */}
|
|
|
+ <Dialog open={isModalOpen} onOpenChange={setIsModalOpen}>
|
|
|
+ <DialogContent className="sm:max-w-[500px] max-h-[90vh] overflow-y-auto">
|
|
|
+ <DialogHeader>
|
|
|
+ <DialogTitle>
|
|
|
+ {editingVocabulary ? '编辑单词' : '创建单词'}
|
|
|
+ </DialogTitle>
|
|
|
+ <DialogDescription>
|
|
|
+ {editingVocabulary ? '编辑现有单词信息' : '创建一个新的单词'}
|
|
|
+ </DialogDescription>
|
|
|
+ </DialogHeader>
|
|
|
+
|
|
|
+ {isCreateForm ? (
|
|
|
+ <Form {...createForm}>
|
|
|
+ <form onSubmit={createForm.handleSubmit(handleCreateSubmit)} className="space-y-4">
|
|
|
+ <FormField
|
|
|
+ control={createForm.control}
|
|
|
+ name="word"
|
|
|
+ render={({ field }) => (
|
|
|
+ <FormItem>
|
|
|
+ <FormLabel className="flex items-center">
|
|
|
+ 单词
|
|
|
+ <span className="text-red-500 ml-1">*</span>
|
|
|
+ </FormLabel>
|
|
|
+ <FormControl>
|
|
|
+ <Input placeholder="请输入单词" {...field} />
|
|
|
+ </FormControl>
|
|
|
+ <FormMessage />
|
|
|
+ </FormItem>
|
|
|
+ )}
|
|
|
+ />
|
|
|
+
|
|
|
+ <FormField
|
|
|
+ control={createForm.control}
|
|
|
+ name="pronunciation"
|
|
|
+ render={({ field }) => (
|
|
|
+ <FormItem>
|
|
|
+ <FormLabel>发音</FormLabel>
|
|
|
+ <FormControl>
|
|
|
+ <Input placeholder="请输入发音(如:/həˈloʊ/)" {...field} />
|
|
|
+ </FormControl>
|
|
|
+ <FormMessage />
|
|
|
+ </FormItem>
|
|
|
+ )}
|
|
|
+ />
|
|
|
+
|
|
|
+ <FormField
|
|
|
+ control={createForm.control}
|
|
|
+ name="meaning"
|
|
|
+ render={({ field }) => (
|
|
|
+ <FormItem>
|
|
|
+ <FormLabel>含义</FormLabel>
|
|
|
+ <FormControl>
|
|
|
+ <Input placeholder="请输入单词含义" {...field} />
|
|
|
+ </FormControl>
|
|
|
+ <FormMessage />
|
|
|
+ </FormItem>
|
|
|
+ )}
|
|
|
+ />
|
|
|
+
|
|
|
+ <FormField
|
|
|
+ control={createForm.control}
|
|
|
+ name="example"
|
|
|
+ render={({ field }) => (
|
|
|
+ <FormItem>
|
|
|
+ <FormLabel>例句</FormLabel>
|
|
|
+ <FormControl>
|
|
|
+ <Input placeholder="请输入例句" {...field} />
|
|
|
+ </FormControl>
|
|
|
+ <FormMessage />
|
|
|
+ </FormItem>
|
|
|
+ )}
|
|
|
+ />
|
|
|
+
|
|
|
+ <FormField
|
|
|
+ control={createForm.control}
|
|
|
+ name="isDisabled"
|
|
|
+ render={({ field }) => (
|
|
|
+ <FormItem className="flex flex-row items-center justify-between rounded-lg border p-4">
|
|
|
+ <div className="space-y-0.5">
|
|
|
+ <FormLabel className="text-base">单词状态</FormLabel>
|
|
|
+ <FormDescription>
|
|
|
+ 禁用后单词将不会显示在学习列表中
|
|
|
+ </FormDescription>
|
|
|
+ </div>
|
|
|
+ <FormControl>
|
|
|
+ <Switch
|
|
|
+ checked={field.value === 1}
|
|
|
+ onCheckedChange={(checked) => field.onChange(checked ? 1 : 0)}
|
|
|
+ />
|
|
|
+ </FormControl>
|
|
|
+ </FormItem>
|
|
|
+ )}
|
|
|
+ />
|
|
|
+
|
|
|
+ <DialogFooter>
|
|
|
+ <Button type="button" variant="outline" onClick={() => setIsModalOpen(false)}>
|
|
|
+ 取消
|
|
|
+ </Button>
|
|
|
+ <Button type="submit">
|
|
|
+ 创建单词
|
|
|
+ </Button>
|
|
|
+ </DialogFooter>
|
|
|
+ </form>
|
|
|
+ </Form>
|
|
|
+ ) : (
|
|
|
+ <Form {...updateForm}>
|
|
|
+ <form onSubmit={updateForm.handleSubmit(handleUpdateSubmit)} className="space-y-4">
|
|
|
+ <FormField
|
|
|
+ control={updateForm.control}
|
|
|
+ name="word"
|
|
|
+ render={({ field }) => (
|
|
|
+ <FormItem>
|
|
|
+ <FormLabel className="flex items-center">
|
|
|
+ 单词
|
|
|
+ <span className="text-red-500 ml-1">*</span>
|
|
|
+ </FormLabel>
|
|
|
+ <FormControl>
|
|
|
+ <Input placeholder="请输入单词" {...field} />
|
|
|
+ </FormControl>
|
|
|
+ <FormMessage />
|
|
|
+ </FormItem>
|
|
|
+ )}
|
|
|
+ />
|
|
|
+
|
|
|
+ <FormField
|
|
|
+ control={updateForm.control}
|
|
|
+ name="pronunciation"
|
|
|
+ render={({ field }) => (
|
|
|
+ <FormItem>
|
|
|
+ <FormLabel>发音</FormLabel>
|
|
|
+ <FormControl>
|
|
|
+ <Input placeholder="请输入发音(如:/həˈloʊ/)" {...field} />
|
|
|
+ </FormControl>
|
|
|
+ <FormMessage />
|
|
|
+ </FormItem>
|
|
|
+ )}
|
|
|
+ />
|
|
|
+
|
|
|
+ <FormField
|
|
|
+ control={updateForm.control}
|
|
|
+ name="meaning"
|
|
|
+ render={({ field }) => (
|
|
|
+ <FormItem>
|
|
|
+ <FormLabel>含义</FormLabel>
|
|
|
+ <FormControl>
|
|
|
+ <Input placeholder="请输入单词含义" {...field} />
|
|
|
+ </FormControl>
|
|
|
+ <FormMessage />
|
|
|
+ </FormItem>
|
|
|
+ )}
|
|
|
+ />
|
|
|
+
|
|
|
+ <FormField
|
|
|
+ control={updateForm.control}
|
|
|
+ name="example"
|
|
|
+ render={({ field }) => (
|
|
|
+ <FormItem>
|
|
|
+ <FormLabel>例句</FormLabel>
|
|
|
+ <FormControl>
|
|
|
+ <Input placeholder="请输入例句" {...field} />
|
|
|
+ </FormControl>
|
|
|
+ <FormMessage />
|
|
|
+ </FormItem>
|
|
|
+ )}
|
|
|
+ />
|
|
|
+
|
|
|
+ <FormField
|
|
|
+ control={updateForm.control}
|
|
|
+ name="isDisabled"
|
|
|
+ render={({ field }) => (
|
|
|
+ <FormItem className="flex flex-row items-center justify-between rounded-lg border p-4">
|
|
|
+ <div className="space-y-0.5">
|
|
|
+ <FormLabel className="text-base">单词状态</FormLabel>
|
|
|
+ <FormDescription>
|
|
|
+ 禁用后单词将不会显示在学习列表中
|
|
|
+ </FormDescription>
|
|
|
+ </div>
|
|
|
+ <FormControl>
|
|
|
+ <Switch
|
|
|
+ checked={field.value === 1}
|
|
|
+ onCheckedChange={(checked) => field.onChange(checked ? 1 : 0)}
|
|
|
+ />
|
|
|
+ </FormControl>
|
|
|
+ </FormItem>
|
|
|
+ )}
|
|
|
+ />
|
|
|
+
|
|
|
+ <DialogFooter>
|
|
|
+ <Button type="button" variant="outline" onClick={() => setIsModalOpen(false)}>
|
|
|
+ 取消
|
|
|
+ </Button>
|
|
|
+ <Button type="submit">
|
|
|
+ 更新单词
|
|
|
+ </Button>
|
|
|
+ </DialogFooter>
|
|
|
+ </form>
|
|
|
+ </Form>
|
|
|
+ )}
|
|
|
+ </DialogContent>
|
|
|
+ </Dialog>
|
|
|
+
|
|
|
+ {/* 删除确认对话框 */}
|
|
|
+ <Dialog open={deleteDialogOpen} onOpenChange={setDeleteDialogOpen}>
|
|
|
+ <DialogContent>
|
|
|
+ <DialogHeader>
|
|
|
+ <DialogTitle>确认删除</DialogTitle>
|
|
|
+ <DialogDescription>
|
|
|
+ 确定要删除这个单词吗?此操作无法撤销。
|
|
|
+ </DialogDescription>
|
|
|
+ </DialogHeader>
|
|
|
+ <DialogFooter>
|
|
|
+ <Button variant="outline" onClick={() => setDeleteDialogOpen(false)}>
|
|
|
+ 取消
|
|
|
+ </Button>
|
|
|
+ <Button variant="destructive" onClick={confirmDelete}>
|
|
|
+ 删除
|
|
|
+ </Button>
|
|
|
+ </DialogFooter>
|
|
|
+ </DialogContent>
|
|
|
+ </Dialog>
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+};
|