forked from nsjcy/frontEnd/nsjcy

Mr Ke
2020-05-27 58ae2ba21efcd85df331cf996a94038a77302b51
SunshineIns/src/page/CriminalExecution.jsx
@@ -3,7 +3,7 @@
import HeadView from '../view/HeadView';
import TableBtnView from '../view/TableBtnView';
import CommonSearchForm from '../view/CommonSearchForm';
import { Input, Button, DatePicker, Divider, message, Popconfirm, Select, Badge, Modal } from 'antd';
import { Input, Button, DatePicker, Divider, message, Popconfirm, Select, Badge, Modal, Row, Col } from 'antd';
import moment from 'moment';
import Fetch from '../fetch';
import TableView from '../view/TableView';
@@ -65,17 +65,25 @@
            },
            resetKey: Date.now(),
            loading: false,
            savedate:{}
            zIndex: '-1',
            savedate: {},
            display: 'none',
            fingerCode: ''
        };
    }
    componentDidMount() {
        document.title = '社会观护管理';
        let _this = this;
        window.addEventListener('message', function (e) {
            console.log('反馈', e)
            if(e.data) {
                _this.setState({
                    ...e.data
                })
            }
        }, false);
        console.log('this', this);
        // this.iframeAddEventListener();
        this.iframeAddEventListener();
    }
    setFormData = data => {
@@ -105,7 +113,9 @@
    showModal = (id) => {
        this.setState({
            visible: true,
            zIndex: 1000
        });
        this.sendMsg()
        // Fetch.socialCompanyDetail(id)
        //   .then(res => {
        //     this.setState({ savedate: res })
@@ -159,19 +169,25 @@
    iframeAddEventListener = () => {
        let _this = this;
        this.iframeWin = this.refs.iframe.contentWindow;
        this.iframeWin = this.refs.iframe && this.refs.iframe.contentWindow;
        this.refs.iframe && this.refs.iframe.addEventListener("load", function () {
            //代码能执行到这里说明已经载入成功完毕了
            //这里是回调函数
            console.log('menu', window.localStorage.getItem('menu'));
            _this.iframeWin.postMessage({
                fgData: false
            }, '*');
        }, false);
    }
    sendMsg = () => {
        this.iframeWin = this.refs.iframe && this.refs.iframe.contentWindow;
        this.iframeWin.postMessage({
            fgData: false
        }, '*');
    }
    render() {
        const { data, resetKey, visible, loading, savedate, closeKey, formData } = this.state;
        const { data, resetKey, visible, loading, savedate, closeKey, formData, zIndex, display, fingerCode } = this.state;
        return (
            <div className="app-page">
                <HeadView history={this.props.history} />
@@ -198,33 +214,28 @@
                        ]} />
                    <TableView columns={this.renderColumns()} data={data} pageSize='10' size='default' loading={loading} />
                </div>
                {/* <div style={{ display: 'block' }}> */}
                {/* <iframe
                        style={{ width: '100%', height: '100%' }}
                        onLoad={() => { }}
                        ref="iframe"
                        src='./fingerprint/指纹登记.html'
                        width="100%"
                        scrolling="no"
                        frameBorder="0"
                    /> */}
                <Modal
                    zIndex={zIndex}
                    key={closeKey}
                    confirmLoading={loading}
                    visible={visible}
                    title="录入信息"
                    onCancel={() => { this.setState({ visible: false }) }}
                    visible={true}
                    title="指纹录入"
                    onCancel={() => { this.setState({ visible: false, zIndex: '-1', }) }}
                    bodyStyle={{ lineHeight: 4 }}
                    // footer={null}
                    width={'60%'}
                    bodyStyle={{ height: '800px',lineHeight: 4 }}
                    bodyStyle={{ lineHeight: 4 }}
                >
                    <Input addonBefore="姓名" name='name' onChange={this.saveInputChange} value={savedate.name || ''} />
                    <Input addonBefore="牢房号" name='lnumber' onChange={this.saveInputChange} value={savedate.lnumber || ''} />
                    <Input addonBefore="指纹唯一标识" name='bianshi' onChange={this.saveInputChange} value={savedate.bianshi || ''} />
                    <Divider />
                    <Input addonBefore="指纹唯一标识" name='fingerCode' onChange={this.saveInputChange} value={fingerCode || ''} addonAfter={<Row type="flex" style={{ flexWrap: 'nowrap' }}>
                        <Col style={{ cursor: 'pointer' }} onClick={() => this.setState({ display: 'block'})}>
                            录入指纹
                        </Col>
                    </Row>} />
                    <Divider style={{ margin: '2px 0' }} />
                    <iframe
                        style={{ width: '100%', height: '100%' }}
                        style={{ width: '100%', height: '550px', display: display }}
                        onLoad={() => { }}
                        ref="iframe"
                        src='./fingerprint/指纹登记.html'
@@ -233,6 +244,7 @@
                        frameBorder="0"
                    />
                </Modal>
                {/* </div> */}
            </div>
        )