import React, { useEffect, useState } from 'react'; import LabelTitleLine from '../../Unit/titleLine/index'; import LabelInput from '../../Unit/textInput/index'; import LabelColorPick from '../../Unit/colorPick/index'; import LabelUploadLinkButton from '../../Unit/labelUploadLinkButton/index'; import LabelControl from '../../Unit/labelControl/index'; import LabelSelect from '../../Unit/LabelSelect/index'; import LabelSwitch from '../../Unit/lableSwitch/index'; import LabelScreenshot from '../../Unit/LabelScreenshot/index'; import LabelPositionButton from '../../Unit/PositionButton/index'; import AddLine from '../../Unit/AddLine/index'; import LabelInputAndDelect from '../../Unit/labelInputAndDel/index'; import LabelselectAndNumberInput from '../../Unit/LabelSelectAndNumberInput/index'; import LabelControlScope from '../../Unit/LabelControlScope/index'; import UploadWrap from '../../Unit/UploadWrap/index'; import LabelTextarea from '../../Unit/HeaderTextarea/index'; import LabelIcon from '../../Unit/LabelIcon/index'; import LabelTwoInput from '../../Unit/LabelTwoInput/index'; import LabelClick from '../../Unit/LabelClick/index'; import LabelNumberStyle from '../../Unit/LabelNumberStyle/index'; import LabelLine from '../../Unit/LabelLine/index'; import LabelTowCheckbox from '../../Unit/LabelTwoCheck/index'; import BorderImg from '../../Unit/BorderImg/index'; import TwoSelect from '../../Unit/TwoSelect/index'; import LabelIcontUploadSelect from '../../Unit/LabelIcontUploadSelect/index'; import LabelCheckbox from '../../Unit/LabelCheckbox/index'; import LabelLabel from '../../Unit/LabelLabel/index'; import LabelSearchSelect from '../../Unit/LabelSearchSelect/index'; import LabelCode from '../../Unit/LabelCode/index'; import LabelInputNumber from '../../Unit/LabelInputNumber/index'; import LabelTabs from '../../Unit/LabelTabs/index'; import LabelControlAndNumberInput from '../../Unit/LabelControlAndNumberInput/index'; import LabelTitle from '../../Unit/LabelTitle/index'; import ClickButton from '../../Unit/ClickButton/index'; import ClickButtons from '../../Unit/ClickButtons/index'; import Icons from '../../Unit/Icons/index'; import LabelNumberInputSelect from '../../Unit/LabelNumberInputSelect/index'; import LabelAlign from '../../Unit/LabelAlign/index'; import ChartColorPick from '../../Unit/chartColorPick/index'; import SelectBtn from '../../Unit/SelectBtn/index'; import ClickButtonUpload from '../../Unit/ClickButtonUpload/index'; import ClickTextButton from '../../Unit/clickTextButton/index'; import LabelRadioGroup from '../../Unit/labelRadioGroup/index'; import Line from '../../Unit/Line/index'; import RadioGroup from '../../Unit/RadioGroup/index'; import CheckboxGroup from '../../Unit/CheckboxGroup/index'; import LabelSwitch2 from '../../Unit/LabelSwitch2/index'; import EventList from '../../Unit/EventList/index'; import RadioTree from '../../Unit/RadioTree/index'; import FooterBtn from '../../Unit/FooterBtn/index'; import Text from '../../Unit/Text/index'; import LabelTexts from '../../Unit/LabelTexts/index'; import ListBy2 from '../../Unit/ListBy2/index'; import LabelCascader from '../../Unit/LabelCascader/index'; import LabelUpload from '../../Unit/LabelUpload/index'; import LabelPopoverTab from '../../Unit/LabelPopoverTab/index'; import Icon from 'src/components/Icon/index'; import CheckTree from '../../Unit/CheckTree/index'; import CockpitList from '../../Unit/CockpitList/index'; import UrlInput from '../../Unit/UrlInput/index'; import SelectIcon from '../../Unit/SelectIcon/index'; import LabelTwoNumberInput from '../../Unit/LabelTwoInputNumber/index'; import { Collapse, Switch, Popconfirm } from 'antd'; import { ILargeScreenSettingProps } from '../../../type/LargeScreenSetting'; import '../style.scss'; import undeveloped_black from '../../image/undeveloped_black.png'; import undeveloped_white from '../../image/undeveloped_white.png'; const { Panel } = Collapse; function LargeScreenSettingMain(props: ILargeScreenSettingProps) { const { settingList, changeSettingData, changeCollapse, collapseDefaultActiveKey, theme, scenes, sceneSelectId, cockpitList, style, settingData } = props; const [dragInfo, setDragInfo] = useState({ draggable: false, oldY: 0, midHeight: 0, endHeight: 0 }); useEffect(() => { document.addEventListener('mousemove', moveEvent); document.addEventListener('mouseup', upEvent); return () => { document.removeEventListener('mousemove', moveEvent); document.removeEventListener('mouseup', upEvent); }; }, [dragInfo]); const moveEvent = (event) => { if (dragInfo?.draggable && dragInfo?.midHeight !== 0) { let y = dragInfo.oldY - event.pageY + dragInfo.midHeight; if (y > 210) { setDragInfo({ ...dragInfo, endHeight: y }); } else { setDragInfo({ ...dragInfo, endHeight: 210 }); } //y = null; } }; const upEvent = () => { if (dragInfo.draggable) { setDragInfo({ ...dragInfo, midHeight: dragInfo.endHeight, oldY: 0, draggable: false }); } else { setDragInfo({ ...dragInfo, oldY: 0, draggable: false }); } }; //样式配置事件 const _changeData = ( value: any, key: string | number, item: any, itemInfoKey: string | number, itemInfo: any ) => { changeSettingData?.({ value, key, item, itemInfoKey, itemInfo }); }; const _changeData1 = ( value: any, type: string, key: string | number, item: any, itemInfoKey: string | number, itemInfo: any ) => { changeSettingData?.({ value, key, type, item, itemInfoKey, itemInfo }); }; //折叠面板的事件 const _changeCollapse = (value: string | object, type: string) => { changeCollapse?.(value, type); }; const renderComponent = (item, itemInfo): any => { if (item?.hidden) { return <>; } switch (item?.component) { case 'labelInput': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'labelColorPick': return ( _changeData(value, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'labelUploadLinkButton': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'labelStep': return ( _changeData(rest, item.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'labelSelect': return ( _changeData(value, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'labelSwitch': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'LabelScreenshot': return ( _changeData(value, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'labelPositionButton': return ( _changeData(value, item.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'addLine': return ( _changeData(value, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'labelInputAndDelect': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'labelselectAndNumberInput': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'labelControlScope': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'uploadWrap': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'labelTextarea': return ( _changeData(value, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'labelIcon': return ( _changeData(value, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'labelLine': return ( _changeData(value, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'labelTowCheckbox': return ( _changeData1( value, type, item?.key, item, itemInfo?.key, itemInfo ) } {...item} /> ); case 'labelTitleLine': return ( _changeData(value, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'labelTwoInput': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'labelClick': return ( _changeData(value, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'labelNumberStyle': return ( _changeData(value, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'borderImg': return ( _changeData(value, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'twoSelect': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'labelIcontUploadSelect': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'labelCheckbox': return ( _changeData(value, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'labelLabel': return ; case 'labelSearchSelect': return ( _changeData(value, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'labelCode': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'labelInputNumber': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'labelTabs': return ( _changeData(value, item?.key, item, itemInfo?.key, itemInfo) } {...item} tabsRender={renderComponent} /> ); case 'labelControlAndNumberInput': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'labelTitle': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'clickButton': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'clickButtons': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'icons': return ( _changeData(value, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'labelNumberInputSelect': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'align': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'chartColorPick': return ( { _changeData(arg, item?.key, item, itemInfo?.key, itemInfo); }} {...item} /> ); case 'selectBtn': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'clickButtonUpload': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'clickTextButton': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'labelRadioGroup': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'line': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'radioGroup': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'interaction': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'radioTree': return (

{item?.title}

_changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} />
); case 'footerBtn': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'text': return ( _changeData(value, item?.key, item, itemInfo?.key, itemInfo) } /> ); case 'labelTexts': return ( _changeData(value, item?.key, item, itemInfo?.key, itemInfo) } /> ); case 'labelPlaceholder': return <>; case 'listBy2': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'labelCascader': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'labelUpload': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'labelPopoverTab': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'checkboxGroup': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'labelSwitch2': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'checkTree': return (

{item?.title}

_changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} />
); case 'cockpitList': return (

{item?.title}

_changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} />
); case 'urlInput': return (

{item?.title}

_changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} />
); case 'labelSelectIcon': return ( _changeData(rest, item?.key, item, itemInfo?.key, itemInfo) } {...item} /> ); case 'labelTwoNumberInput': return ( { _changeData(rest, item?.key, item, itemInfo?.key, itemInfo); }} {...item} /> ); default: break; } }; const renderElement = (list, index = 1): any => { if (list?.length > 0) { return ( _changeCollapse(e, 'collapseChange')} > {Array.isArray(list) && list?.length > 0 && list?.map((item) => { if (item?.hidden) { return <>; } else if (item?.collapse) { return ( {item?.blockTitle} {item?.hasSwitch ? ( { e.stopPropagation(); _changeCollapse( { checked, key: item?.key }, 'collapseIcon' ); }} /> ) : ( <> )} } > {item?.compoentList?.map((item2) => { if (item2?.hidden) { return <>; } else { if (item2?.collapse) { return renderElement(item?.compoentList, item2.key); } else { return renderComponent(item2, item); } } })} ); } else if (item?.collapseType === 'titleSwitch') { return (
{item?.blockTitle}
同步组件 } placement="topRight" overlayClassName="zl-large-screen-synchronous-popconfirm" visible={item?.open} onConfirm={() => { _changeCollapse(null, 'confirm'); }} onCancel={() => _changeCollapse(null, 'cancel')} okText="确定" cancelText="取消" > { e.stopPropagation(); _changeCollapse(checked, 'isSynchronizingStyle'); }} />
); } else { return (
{item?.blockTitle || item?.blockTitles ? ( ) : ( <> )} {item?.compoentList?.map((item2) => { if (item2?.hidden) { return <>; } else { return renderComponent(item2, item); } })}
); } })}
); } else { return (
暂未开发 暂未开发 正在开发敬请期待~
); } }; return (
{settingData?.title === '自定义地图' ? (
{ setDragInfo({ ...dragInfo, draggable: true, oldY: e.pageY, midHeight: document.getElementById('zl-ls-block-setting') .clientHeight }); }} >
) : ( <> )} {renderElement(settingList)}
); } export default LargeScreenSettingMain;