From 942cb64adf9f3f8113549ffc9f64e6861d556064 Mon Sep 17 00:00:00 2001 From: Mr Ke <kelq@hugeinfo.com.cn> Date: Wed, 27 May 2020 17:41:57 +0800 Subject: [PATCH] 加入iframeKey值 --- SunshineIns/src/page/CriminalExecution.jsx | 65 ++++++++++++++++++++------------ 1 files changed, 40 insertions(+), 25 deletions(-) diff --git a/SunshineIns/src/page/CriminalExecution.jsx b/SunshineIns/src/page/CriminalExecution.jsx index 31d038d..560de49 100644 --- a/SunshineIns/src/page/CriminalExecution.jsx +++ b/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,11 @@ showModal = (id) => { this.setState({ visible: true, + zIndex: 1000, + iframeKey: id, + display: 'none' }); + this.sendMsg(); // Fetch.socialCompanyDetail(id) // .then(res => { // this.setState({ savedate: res }) @@ -159,19 +171,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, iframeKey } = this.state; return ( <div className="app-page"> <HeadView history={this.props.history} /> @@ -198,33 +216,29 @@ ]} /> <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%' }} + key={iframeKey} + style={{ width: '100%', height: '550px', display: display }} onLoad={() => { }} ref="iframe" src='./fingerprint/指纹登记.html' @@ -233,6 +247,7 @@ frameBorder="0" /> </Modal> + {/* </div> */} </div> ) -- Gitblit v1.8.0