/*
 * @Author: sunjun
 * @Date: 2020-08-07 15:01:37
 * @LastEditTime: 2020-11-18 09:00:06
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /hrmAttendance/components/groupSetting/info/LocationEdit.js
 */
import React, {Component} from 'react';
import {observer} from 'mobx-react';
import {WeaDialog} from 'ecCom';
import {Button} from 'antd';
import {i18n} from '../../../public/i18n';
import Map from '../Map';

@observer
export default class WifiEdit extends Component{
    onScale = (evt, state) => {
    }

    onChangeHeight = height => {
        // 高度变化回调
    };

    render(){
        const {
            store
        } = this.props;
        const {locationDialogParams, formTarget} = store;
        const {
            locationForm: form,
            locationFormFields: fields
        } = formTarget;
        const generateDialogParams = () =>{
            const props = {...locationDialogParams};
            let buttons = [<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@f6u856`} type='primary' op='create' onClick={() => store.saveLocation()}>{i18n.label.save()}</Button>];
            Object.assign(props, {
                buttons,
                moreBtn: {datas: store.convertToMenus(buttons)},
                scalable: true,
                onScale: this.onScale,
                onChangeHeight: this.onChangeHeight
                // key: new Date().getTime()
            })
            return props;
        }

        return (
            <WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@586mgu`} {...generateDialogParams()}>
                {
                    locationDialogParams.visible && 
                    <Map ecId={`${this && this.props && this.props.ecId || ''}_Map@lkdufc`} placeSearch store={store}/>
                }
            </WeaDialog>
        )
    }
}