import React from 'react'; import moment from 'moment'; import { Form, Input, DatePicker, InputNumber, Select, Row, Col } from 'antd'; import { MapPosition, ErrorBoundary } from '@sensoro/sensoro-design'; import cloneDeep from 'lodash/cloneDeep'; import { UploadImageProps } from '@sensoro/sensoro-design/es/upload-image/upload-image'; import { UploadImage } from '@sensoro/library/lib/components/upload'; import { FormilyData, FormilyType } from './interface'; import { FormItemProps } from 'antd/es/form/FormItem'; interface FormilyRenderProps { list: FormilyData[]; span?: 12 | 24; formItemMap?: Partial>; uploadImage?: UploadImageProps; getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement; } const { RangePicker } = DatePicker; const { TextArea } = Input; const { Option } = Select; function range(start: number, end: number) { const result = []; for (let i = start; i < end; i++) { result.push(i); } return result; } const FormilyRender: React.FC = ({ span, list = [], formItemMap = {}, uploadImage, getPopupContainer, }) => { function disabledDate(current: moment.Moment) { return current && current > moment().endOf('day'); } function disabledTime(current: moment.Moment) { const currentDate = moment(); const hour = currentDate.hour(); const minute = currentDate.minute(); const second = currentDate.second(); // 如果上今天之前的则不限制 if (current && current.isBefore(currentDate, 'days')) { return { disabledHours: () => [], disabledMinutes: () => [], disabledSeconds: () => [], }; } return { disabledHours: () => { return range(hour + 1, 24); }, disabledMinutes: (selectedHour: number) => { if (selectedHour === hour) { return range(minute + 1, 60); } else if (selectedHour > hour) { return range(1, 60); } else { return []; } }, disabledSeconds: (selectedHour: number, selectedMinute: number) => { if (selectedHour === hour) { if (selectedMinute === minute) { return range(second + 1, 60); } if (selectedMinute > minute) { return range(1, 60); } } if (selectedHour > hour) { return range(1, 60); } return []; }, }; } const getMaterialTypeItem = (data: FormilyData) => { const { options = [], type } = data; if (type === 'inputs') { return ; } if (type === 'numberInputs') { return ; } if (type === 'locations') { return ; } if (type === 'videos') { return ( ); } if (type === 'multiInputs') { return