|
|
@@ -332,17 +332,18 @@ const DisabilityManagement: React.FC = () => {
|
|
|
|
|
|
{/* 创建/更新模态框 */}
|
|
|
<Dialog open={isModalOpen} onOpenChange={setIsModalOpen}>
|
|
|
- <DialogContent className="max-w-2xl">
|
|
|
+ <DialogContent className="w-[95vw] max-w-4xl max-h-[80vh] flex flex-col">
|
|
|
<DialogHeader>
|
|
|
<DialogTitle>{isCreateForm ? '新增残疾人' : '编辑残疾人'}</DialogTitle>
|
|
|
<DialogDescription>
|
|
|
{isCreateForm ? '填写残疾人信息' : '修改残疾人信息'}
|
|
|
</DialogDescription>
|
|
|
</DialogHeader>
|
|
|
- {isCreateForm ? (
|
|
|
- <Form {...createForm}>
|
|
|
- <form onSubmit={handleCreateSubmit} className="space-y-4">
|
|
|
- <div className="grid grid-cols-2 gap-4">
|
|
|
+ <div className="flex-1 overflow-y-auto pr-2 overscroll-contain touch-auto">
|
|
|
+ {isCreateForm ? (
|
|
|
+ <Form {...createForm}>
|
|
|
+ <form id="create-form" onSubmit={handleCreateSubmit} className="space-y-4">
|
|
|
+ <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
|
|
<FormField
|
|
|
control={createForm.control}
|
|
|
name="name"
|
|
|
@@ -492,21 +493,79 @@ const DisabilityManagement: React.FC = () => {
|
|
|
</FormItem>
|
|
|
)}
|
|
|
/>
|
|
|
+ <FormField
|
|
|
+ control={createForm.control}
|
|
|
+ name="isMarried"
|
|
|
+ render={({ field }) => (
|
|
|
+ <FormItem>
|
|
|
+ <FormLabel>婚姻状况</FormLabel>
|
|
|
+ <FormControl>
|
|
|
+ <select
|
|
|
+ className="flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"
|
|
|
+ {...field}
|
|
|
+ data-testid="is-married-select"
|
|
|
+ value={field.value?.toString() || '0'}
|
|
|
+ onChange={(e) => field.onChange(parseInt(e.target.value))}
|
|
|
+ >
|
|
|
+ <option value="0">未婚</option>
|
|
|
+ <option value="1">已婚</option>
|
|
|
+ </select>
|
|
|
+ </FormControl>
|
|
|
+ <FormMessage />
|
|
|
+ </FormItem>
|
|
|
+ )}
|
|
|
+ />
|
|
|
+ <FormField
|
|
|
+ control={createForm.control}
|
|
|
+ name="canDirectContact"
|
|
|
+ render={({ field }) => (
|
|
|
+ <FormItem>
|
|
|
+ <FormLabel>是否可直接联系</FormLabel>
|
|
|
+ <FormControl>
|
|
|
+ <select
|
|
|
+ className="flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"
|
|
|
+ {...field}
|
|
|
+ data-testid="can-direct-contact-select"
|
|
|
+ value={field.value?.toString() || '0'}
|
|
|
+ onChange={(e) => field.onChange(parseInt(e.target.value))}
|
|
|
+ >
|
|
|
+ <option value="0">否</option>
|
|
|
+ <option value="1">是</option>
|
|
|
+ </select>
|
|
|
+ </FormControl>
|
|
|
+ <FormMessage />
|
|
|
+ </FormItem>
|
|
|
+ )}
|
|
|
+ />
|
|
|
+ <FormField
|
|
|
+ control={createForm.control}
|
|
|
+ name="jobStatus"
|
|
|
+ render={({ field }) => (
|
|
|
+ <FormItem>
|
|
|
+ <FormLabel>就业状态</FormLabel>
|
|
|
+ <FormControl>
|
|
|
+ <select
|
|
|
+ className="flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"
|
|
|
+ {...field}
|
|
|
+ data-testid="job-status-select"
|
|
|
+ value={field.value?.toString() || '0'}
|
|
|
+ onChange={(e) => field.onChange(parseInt(e.target.value))}
|
|
|
+ >
|
|
|
+ <option value="0">未就业</option>
|
|
|
+ <option value="1">已就业</option>
|
|
|
+ </select>
|
|
|
+ </FormControl>
|
|
|
+ <FormMessage />
|
|
|
+ </FormItem>
|
|
|
+ )}
|
|
|
+ />
|
|
|
</div>
|
|
|
- <DialogFooter>
|
|
|
- <Button type="button" variant="outline" onClick={() => setIsModalOpen(false)}>
|
|
|
- 取消
|
|
|
- </Button>
|
|
|
- <Button type="submit" disabled={createMutation.isPending} data-testid="create-submit-button">
|
|
|
- {createMutation.isPending ? '创建中...' : '创建'}
|
|
|
- </Button>
|
|
|
- </DialogFooter>
|
|
|
</form>
|
|
|
</Form>
|
|
|
) : (
|
|
|
<Form {...updateForm}>
|
|
|
- <form onSubmit={handleUpdateSubmit} className="space-y-4">
|
|
|
- <div className="grid grid-cols-2 gap-4">
|
|
|
+ <form id="update-form" onSubmit={handleUpdateSubmit} className="space-y-4">
|
|
|
+ <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
|
|
<FormField
|
|
|
control={updateForm.control}
|
|
|
name="name"
|
|
|
@@ -656,18 +715,91 @@ const DisabilityManagement: React.FC = () => {
|
|
|
</FormItem>
|
|
|
)}
|
|
|
/>
|
|
|
+ <FormField
|
|
|
+ control={updateForm.control}
|
|
|
+ name="isMarried"
|
|
|
+ render={({ field }) => (
|
|
|
+ <FormItem>
|
|
|
+ <FormLabel>婚姻状况</FormLabel>
|
|
|
+ <FormControl>
|
|
|
+ <select
|
|
|
+ className="flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"
|
|
|
+ {...field}
|
|
|
+ data-testid="update-is-married-select"
|
|
|
+ value={field.value?.toString() || '0'}
|
|
|
+ onChange={(e) => field.onChange(parseInt(e.target.value))}
|
|
|
+ >
|
|
|
+ <option value="0">未婚</option>
|
|
|
+ <option value="1">已婚</option>
|
|
|
+ </select>
|
|
|
+ </FormControl>
|
|
|
+ <FormMessage />
|
|
|
+ </FormItem>
|
|
|
+ )}
|
|
|
+ />
|
|
|
+ <FormField
|
|
|
+ control={updateForm.control}
|
|
|
+ name="canDirectContact"
|
|
|
+ render={({ field }) => (
|
|
|
+ <FormItem>
|
|
|
+ <FormLabel>是否可直接联系</FormLabel>
|
|
|
+ <FormControl>
|
|
|
+ <select
|
|
|
+ className="flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"
|
|
|
+ {...field}
|
|
|
+ data-testid="update-can-direct-contact-select"
|
|
|
+ value={field.value?.toString() || '0'}
|
|
|
+ onChange={(e) => field.onChange(parseInt(e.target.value))}
|
|
|
+ >
|
|
|
+ <option value="0">否</option>
|
|
|
+ <option value="1">是</option>
|
|
|
+ </select>
|
|
|
+ </FormControl>
|
|
|
+ <FormMessage />
|
|
|
+ </FormItem>
|
|
|
+ )}
|
|
|
+ />
|
|
|
+ <FormField
|
|
|
+ control={updateForm.control}
|
|
|
+ name="jobStatus"
|
|
|
+ render={({ field }) => (
|
|
|
+ <FormItem>
|
|
|
+ <FormLabel>就业状态</FormLabel>
|
|
|
+ <FormControl>
|
|
|
+ <select
|
|
|
+ className="flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"
|
|
|
+ {...field}
|
|
|
+ data-testid="update-job-status-select"
|
|
|
+ value={field.value?.toString() || '0'}
|
|
|
+ onChange={(e) => field.onChange(parseInt(e.target.value))}
|
|
|
+ >
|
|
|
+ <option value="0">未就业</option>
|
|
|
+ <option value="1">已就业</option>
|
|
|
+ </select>
|
|
|
+ </FormControl>
|
|
|
+ <FormMessage />
|
|
|
+ </FormItem>
|
|
|
+ )}
|
|
|
+ />
|
|
|
</div>
|
|
|
- <DialogFooter>
|
|
|
- <Button type="button" variant="outline" onClick={() => setIsModalOpen(false)}>
|
|
|
- 取消
|
|
|
- </Button>
|
|
|
- <Button type="submit" disabled={updateMutation.isPending} data-testid="update-submit-button">
|
|
|
- {updateMutation.isPending ? '更新中...' : '更新'}
|
|
|
- </Button>
|
|
|
- </DialogFooter>
|
|
|
</form>
|
|
|
</Form>
|
|
|
)}
|
|
|
+ </div>
|
|
|
+ <DialogFooter className="mt-4">
|
|
|
+ <Button type="button" variant="outline" onClick={() => setIsModalOpen(false)}>
|
|
|
+ 取消
|
|
|
+ </Button>
|
|
|
+ {isCreateForm ? (
|
|
|
+ <Button type="submit" form="create-form" disabled={createMutation.isPending} data-testid="create-submit-button">
|
|
|
+ {createMutation.isPending ? '创建中...' : '创建'}
|
|
|
+ </Button>
|
|
|
+ ) : (
|
|
|
+ <Button type="submit" form="update-form" disabled={updateMutation.isPending} data-testid="update-submit-button">
|
|
|
+ {updateMutation.isPending ? '更新中...' : '更新'}
|
|
|
+ </Button>
|
|
|
+ )}
|
|
|
+ </DialogFooter>
|
|
|
</DialogContent>
|
|
|
</Dialog>
|
|
|
|