diff --git a/Cunkebao/src/pages/mobile/workspace/auto-group/form/components/BasicSettings.tsx b/Cunkebao/src/pages/mobile/workspace/auto-group/form/components/BasicSettings.tsx new file mode 100644 index 00000000..9cba69e9 --- /dev/null +++ b/Cunkebao/src/pages/mobile/workspace/auto-group/form/components/BasicSettings.tsx @@ -0,0 +1,291 @@ +import React, { useImperativeHandle, forwardRef } from "react"; +import { Input, Button, Card, Switch, Form, InputNumber } from "antd"; +import { TextArea } from "antd-mobile"; + +interface BasicSettingsProps { + defaultValues?: { + name: string; + startTime: string; + endTime: string; + groupSizeMin: number; + groupSizeMax: number; + maxGroupsPerDay: number; + groupNameTemplate: string; + groupDescription: string; + status: number; + }; +} + +export interface BasicSettingsRef { + validate: () => Promise; + getValues: () => any; +} + +const BasicSettings = forwardRef( + ({ + defaultValues = { + name: "", + startTime: "06:00", + endTime: "23:59", + groupSizeMin: 20, + groupSizeMax: 50, + maxGroupsPerDay: 10, + groupNameTemplate: "", + groupDescription: "", + status: 1, + }, + }, ref) => { + const [form] = Form.useForm(); + + // 暴露方法给父组件 + useImperativeHandle(ref, () => ({ + validate: async () => { + try { + await form.validateFields(); + return true; + } catch (error) { + console.log("BasicSettings 表单验证失败:", error); + return false; + } + }, + getValues: () => { + return form.getFieldsValue(); + }, + })); + + return ( +
+ +
{ + // 可以在这里处理表单值变化 + }} + > + {/* 任务名称 */} + + + + + {/* 允许建群的时间段 */} + +
+ + + + + + + +
+
+ + {/* 每日最大建群数 */} + +
+ + + +
+
+ + {/* 群组最小人数 */} + +
+ + + +
+
+ + {/* 群组最大人数 */} + +
+ + + +
+
+ + {/* 群名称模板 */} + + + + + {/* 群描述 */} + +