diff --git a/.gitignore b/.gitignore index db2de28..a26fc80 100644 --- a/.gitignore +++ b/.gitignore @@ -145,4 +145,5 @@ Thumbs.db # Temporary folders tmp/ -temp/ \ No newline at end of file +temp/ +nul diff --git a/crop-x/package.json b/crop-x/package.json index b7bc4c5..f4ec67e 100644 --- a/crop-x/package.json +++ b/crop-x/package.json @@ -4,7 +4,6 @@ "private": true, "type": "module", "scripts": { - "dev": "vite", "next:dev": "next dev --turbopack", "build": "tsc && vite build", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", diff --git a/crop-x/src/app/(app)/central-config/system/category/components/CategoryFilters.tsx b/crop-x/src/app/(app)/central-config/system/category/components/CategoryFilters.tsx new file mode 100644 index 0000000..75d2f6b --- /dev/null +++ b/crop-x/src/app/(app)/central-config/system/category/components/CategoryFilters.tsx @@ -0,0 +1,50 @@ +'use client'; + +import React from 'react'; +import { Card } from '@/components/ui/card'; +import { Input } from '@/components/ui/input'; +import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; +import { Search } from 'lucide-react'; + +interface CategoryFiltersProps { + searchKeyword: string; + typeFilter: string; + onSearchChange: (value: string) => void; + onTypeFilterChange: (value: string) => void; +} + +export function CategoryFilters({ + searchKeyword, + typeFilter, + onSearchChange, + onTypeFilterChange, +}: CategoryFiltersProps) { + return ( + +
+
+ + onSearchChange(e.target.value)} + className="pl-10" + /> +
+ +
+
+ ); +} \ No newline at end of file diff --git a/crop-x/src/app/(app)/central-config/system/category/components/CategoryFormDialog.tsx b/crop-x/src/app/(app)/central-config/system/category/components/CategoryFormDialog.tsx new file mode 100644 index 0000000..841a667 --- /dev/null +++ b/crop-x/src/app/(app)/central-config/system/category/components/CategoryFormDialog.tsx @@ -0,0 +1,137 @@ +'use client'; + +import React from 'react'; +import { + Dialog, + DialogContent, + DialogDescription, + DialogHeader, + DialogTitle, + DialogFooter, +} from '@/components/ui/dialog'; +import { Button } from '@/components/ui/button'; +import { Input } from '@/components/ui/input'; +import { Label } from '@/components/ui/label'; +import { Textarea } from '@/components/ui/textarea'; +import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; +import { Switch } from '@/components/ui/switch'; +import { CategoryDictionary, CategoryFormData } from '../types'; + +interface CategoryFormDialogProps { + open: boolean; + editing?: CategoryDictionary; + parent?: CategoryDictionary | null; + formData: CategoryFormData; + onOpenChange: (open: boolean) => void; + onFormDataChange: (data: Partial) => void; + onSave: () => void; +} + +export function CategoryFormDialog({ + open, + editing, + parent, + formData, + onOpenChange, + onFormDataChange, + onSave, +}: CategoryFormDialogProps) { + return ( + + + + + {editing ? '编辑分类' : '新增分类'} + + + {editing ? '编辑分类信息' : '添加新分类'} + + +
+ {parent && ( +
+ +

{parent.name}

+
+ )} +
+
+ + onFormDataChange({ code: e.target.value })} + placeholder="IND001" + /> +
+
+ + onFormDataChange({ name: e.target.value })} + placeholder="请输入名称" + /> +
+
+
+ + +
+
+ +