import React, { Component } from "react";
import { getAllDataList, getAllDataStringList } from '@utils/tools';
import { dragBox } from '@utils/drag';
import style from "./index.less";
import PreviewBody from "../PreviewBody";
import store from '@store';
import Notify from '@commonComp/Notify';
import close from '../../common/images/icon_close.png';


class PrintPreview extends Component {
    constructor(props) {
        super(props)
    }
    componentDidMount(){
      dragBox('previewPrintWrapper','previewPrintStatic','add')
    }
    render() {
        const { onClose, visible, preInfo,save } = this.props;
        let baseList = store.getState();
        const dataJson = getAllDataList(baseList);
        const dataStr = getAllDataStringList(baseList);

        return <div className={style['container']}>
            <div className={style['shade']} onClick={onClose}></div>
            <div className={style['modal']} id="previewPrintWrapper">
                <div id="previewPrintStatic" className={`${style['close']} drag-title`}>打印</div>
                <img src={close} onClick={onClose} />
                  <PreviewBody
                      preInfo={preInfo}
                      dataJson={dataJson}
                      dataStr={dataStr}
                      show={true}
                      onClose={onClose}
                      save={save}
                  ></PreviewBody>
            </div>
        </div>
    }
}

export default PrintPreview;
