Browse Source

🐛 fix(admin): 修复供应商和商户管理页面的表单问题

- 修复商户状态选择器在值为null时的空指针错误,添加可选链操作符
- 移除供应商编辑表单中的默认空密码字段,避免覆盖原有密码
yourname 4 tháng trước cách đây
mục cha
commit
a117228f96

+ 1 - 1
src/client/admin-shadcn/pages/Merchants.tsx

@@ -440,7 +440,7 @@ export const MerchantsPage = () => {
                   render={({ field }) => (
                     <FormItem>
                       <FormLabel>状态</FormLabel>
-                      <Select onValueChange={(value) => field.onChange(parseInt(value))} defaultValue={field.value.toString()}>
+                      <Select onValueChange={(value) => field.onChange(parseInt(value))} defaultValue={field.value?.toString()}>
                         <FormControl>
                           <SelectTrigger>
                             <SelectValue placeholder="请选择状态" />

+ 0 - 1
src/client/admin-shadcn/pages/Suppliers.tsx

@@ -117,7 +117,6 @@ export const SuppliersPage = () => {
     updateForm.reset({
       name: supplier.name,
       username: supplier.username,
-      password: '',
       phone: supplier.phone,
       realname: supplier.realname,
       state: supplier.state,