diff --git a/Cunkebao/src/pages/mobile/workspace/auto-group/form/index.tsx b/Cunkebao/src/pages/mobile/workspace/auto-group/form/index.tsx index 4b039b3a..86f0d1c2 100644 --- a/Cunkebao/src/pages/mobile/workspace/auto-group/form/index.tsx +++ b/Cunkebao/src/pages/mobile/workspace/auto-group/form/index.tsx @@ -4,7 +4,7 @@ import { Form, Toast, TextArea } from "antd-mobile"; import { Input, InputNumber, Button, Switch } from "antd"; import Layout from "@/components/Layout/Layout"; import style from "./index.module.scss"; -import { createAutoGroup, updateAutoGroup } from "./api"; +import { createAutoGroup, updateAutoGroup, getAutoGroupDetail } from "./api"; import { AutoGroupFormData } from "./types"; import DeviceSelection from "@/components/DeviceSelection/index"; import NavCommon from "@/components/NavCommon/index"; @@ -34,23 +34,27 @@ const AutoGroupForm: React.FC = () => { const [loading, setLoading] = useState(false); useEffect(() => { - if (isEdit) { - // 这里应请求详情接口,回填表单,演示用mock + // 这里应请求详情接口,回填表单,演示用mock + getAutoGroupDetail(id).then(res => { setForm({ ...defaultForm, - name: "VIP客户建群", - deveiceGroups: [], - startTime: dayjs().format("HH:mm"), - endTime: dayjs().add(1, "hour").format("HH:mm"), - groupSizeMin: 20, - groupSizeMax: 50, - maxGroupsPerDay: 20, - groupNameTemplate: "VIP客户交流群{序号}", - groupDescription: "VIP客户专属交流群,提供优质服务", - status: 1, + name: res.name, + deveiceGroups: res.config.deveiceGroups, + deveiceGroupsOptions: res.config.deveiceGroupsOptions, + startTime: res.config.startTime, + endTime: res.config.endTime, + groupSizeMin: res.config.groupSizeMin, + groupSizeMax: res.config.groupSizeMax, + maxGroupsPerDay: res.config.maxGroupsPerDay, + groupNameTemplate: res.config.groupNameTemplate, + groupDescription: res.config.groupDescription, + status: res.status, + type: res.type, + id: res.id, }); - } - }, [isEdit, id]); + console.log(form); + }); + }, [id]); const handleSubmit = async () => { setLoading(true); @@ -104,14 +108,14 @@ const AutoGroupForm: React.FC = () => { } > - + setTaskName(val.target.value)} placeholder="请输入任务名称" /> - +