|
@@ -30,7 +30,13 @@ const updateFormSchema = UpdateGoodsCategoryDto;
|
|
|
|
|
|
|
|
export const GoodsCategoryManagement = () => {
|
|
export const GoodsCategoryManagement = () => {
|
|
|
// 状态管理
|
|
// 状态管理
|
|
|
- const [searchParams, setSearchParams] = useState({ page: 1, limit: 10, search: '' });
|
|
|
|
|
|
|
+ const [searchParams, setSearchParams] = useState({
|
|
|
|
|
+ page: 1,
|
|
|
|
|
+ limit: 10,
|
|
|
|
|
+ search: '',
|
|
|
|
|
+ sortBy: 'sort',
|
|
|
|
|
+ sortOrder: 'ASC' as 'ASC' | 'DESC'
|
|
|
|
|
+ });
|
|
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
|
const [editingCategory, setEditingCategory] = useState<GoodsCategoryResponse | null>(null);
|
|
const [editingCategory, setEditingCategory] = useState<GoodsCategoryResponse | null>(null);
|
|
|
const [isCreateForm, setIsCreateForm] = useState(true);
|
|
const [isCreateForm, setIsCreateForm] = useState(true);
|
|
@@ -46,6 +52,7 @@ export const GoodsCategoryManagement = () => {
|
|
|
imageFileId: null,
|
|
imageFileId: null,
|
|
|
level: 0,
|
|
level: 0,
|
|
|
state: 1,
|
|
state: 1,
|
|
|
|
|
+ sort: 0
|
|
|
},
|
|
},
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -62,6 +69,8 @@ export const GoodsCategoryManagement = () => {
|
|
|
page: searchParams.page,
|
|
page: searchParams.page,
|
|
|
pageSize: searchParams.limit,
|
|
pageSize: searchParams.limit,
|
|
|
keyword: searchParams.search,
|
|
keyword: searchParams.search,
|
|
|
|
|
+ sortBy: searchParams.sortBy,
|
|
|
|
|
+ sortOrder: searchParams.sortOrder,
|
|
|
filters: JSON.stringify({state:[1,2]})
|
|
filters: JSON.stringify({state:[1,2]})
|
|
|
},
|
|
},
|
|
|
});
|
|
});
|
|
@@ -86,6 +95,7 @@ export const GoodsCategoryManagement = () => {
|
|
|
imageFileId: null,
|
|
imageFileId: null,
|
|
|
level: 0,
|
|
level: 0,
|
|
|
state: 1,
|
|
state: 1,
|
|
|
|
|
+ sort: 0,
|
|
|
});
|
|
});
|
|
|
setIsModalOpen(true);
|
|
setIsModalOpen(true);
|
|
|
};
|
|
};
|
|
@@ -100,6 +110,7 @@ export const GoodsCategoryManagement = () => {
|
|
|
imageFileId: category.imageFileId,
|
|
imageFileId: category.imageFileId,
|
|
|
level: category.level,
|
|
level: category.level,
|
|
|
state: category.state,
|
|
state: category.state,
|
|
|
|
|
+ sort: category.sort,
|
|
|
});
|
|
});
|
|
|
setIsModalOpen(true);
|
|
setIsModalOpen(true);
|
|
|
};
|
|
};
|
|
@@ -239,6 +250,7 @@ export const GoodsCategoryManagement = () => {
|
|
|
<TableHead>分类名称</TableHead>
|
|
<TableHead>分类名称</TableHead>
|
|
|
<TableHead>上级ID</TableHead>
|
|
<TableHead>上级ID</TableHead>
|
|
|
<TableHead>层级</TableHead>
|
|
<TableHead>层级</TableHead>
|
|
|
|
|
+ <TableHead>排序</TableHead>
|
|
|
<TableHead>状态</TableHead>
|
|
<TableHead>状态</TableHead>
|
|
|
<TableHead>图片</TableHead>
|
|
<TableHead>图片</TableHead>
|
|
|
<TableHead>创建时间</TableHead>
|
|
<TableHead>创建时间</TableHead>
|
|
@@ -374,6 +386,20 @@ export const GoodsCategoryManagement = () => {
|
|
|
</FormItem>
|
|
</FormItem>
|
|
|
)}
|
|
)}
|
|
|
/>
|
|
/>
|
|
|
|
|
+
|
|
|
|
|
+ <FormField
|
|
|
|
|
+ control={createForm.control}
|
|
|
|
|
+ name="sort"
|
|
|
|
|
+ render={({ field }) => (
|
|
|
|
|
+ <FormItem>
|
|
|
|
|
+ <FormLabel>排序</FormLabel>
|
|
|
|
|
+ <FormControl>
|
|
|
|
|
+ <Input type="number" placeholder="请输入排序" {...field} />
|
|
|
|
|
+ </FormControl>
|
|
|
|
|
+ <FormMessage />
|
|
|
|
|
+ </FormItem>
|
|
|
|
|
+ )}
|
|
|
|
|
+ />
|
|
|
|
|
|
|
|
<FormField
|
|
<FormField
|
|
|
control={createForm.control}
|
|
control={createForm.control}
|
|
@@ -485,6 +511,20 @@ export const GoodsCategoryManagement = () => {
|
|
|
)}
|
|
)}
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
|
|
|
+ <FormField
|
|
|
|
|
+ control={updateForm.control}
|
|
|
|
|
+ name="sort"
|
|
|
|
|
+ render={({ field }) => (
|
|
|
|
|
+ <FormItem>
|
|
|
|
|
+ <FormLabel>排序</FormLabel>
|
|
|
|
|
+ <FormControl>
|
|
|
|
|
+ <Input type="number" placeholder="请输入排序" {...field} />
|
|
|
|
|
+ </FormControl>
|
|
|
|
|
+ <FormMessage />
|
|
|
|
|
+ </FormItem>
|
|
|
|
|
+ )}
|
|
|
|
|
+ />
|
|
|
|
|
+
|
|
|
<FormField
|
|
<FormField
|
|
|
control={updateForm.control}
|
|
control={updateForm.control}
|
|
|
name="parentId"
|
|
name="parentId"
|