FEAT => 本次更新项目为:
This commit is contained in:
@@ -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 = () => {
|
||||
</Button>
|
||||
}
|
||||
>
|
||||
<Form.Item label="任务名称" name="name" required>
|
||||
<Form.Item label="任务名称" required>
|
||||
<Input
|
||||
value={form.name}
|
||||
onChange={val => setTaskName(val.target.value)}
|
||||
placeholder="请输入任务名称"
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item label="设备组" name="deveiceGroups" required>
|
||||
<Form.Item label="设备组" required>
|
||||
<DeviceSelection
|
||||
selectedOptions={form.deveiceGroupsOptions}
|
||||
onSelect={setDeviceGroups}
|
||||
|
||||
@@ -14,6 +14,7 @@ export interface AutoGroupFormData {
|
||||
groupNameTemplate: string; // 群名称模板
|
||||
groupDescription: string; // 群描述
|
||||
status: number; // 是否启用 (1: 启用, 0: 禁用)
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
// 表单验证规则
|
||||
|
||||
Reference in New Issue
Block a user