import React from 'react'; import { Form, Input, Row, Col, Radio, Checkbox } from 'antd'; import { StateInfo, FenceStateConfig, FenceStateTypeEnum, FileInfo, FileTypeEnum, } from '@easytwin/core'; import { BlurInput, BlurInputNumber, ColorInput, SliderInput, RangeColor } from '@/components'; import { FileCard } from '@/pages/FileManage/components'; export interface FenceFormProp { dataSource: StateInfo['config']; onChange: (data: FenceStateConfig) => void; } type FormValuesChangeType = Omit & { videoFileId: FileInfo; }; const FenceForm: React.FC = function ({ dataSource, onChange }) { const [form] = Form.useForm(); React.useEffect(() => { form.setFieldsValue(dataSource); }, [form, dataSource]); return (
{ const { videoFileId } = changedValue; const newData: FenceStateConfig = { ...(dataSource as FenceStateConfig), ...changedValue, videoFileId: (dataSource as FenceStateConfig).videoFileId, }; if (videoFileId) { newData.videoFileId = videoFileId.id; newData.videoFileUrl = videoFileId.url; } onChange(newData); }}> {/* 围栏高度 */} {/* 自动闭合 */} {/* 样式类型 */} 基础样式 视频样式 {(dataSource as FenceStateConfig).type === FenceStateTypeEnum.BASE && ( <> {/* 围栏动画 */} {(dataSource as FenceStateConfig).useAnimation && ( <> {/* 线条颜色 */} {/* 线条高度 */} {/* 动画速度 */} )} )} {(dataSource as FenceStateConfig).type === FenceStateTypeEnum.VIDEO && ( <> {/* 基底视频 */} {/* 视频高度 */} )}
); }; export default FenceForm;