From 58ae2ba21efcd85df331cf996a94038a77302b51 Mon Sep 17 00:00:00 2001 From: Mr Ke <kelq@hugeinfo.com.cn> Date: Wed, 27 May 2020 17:07:48 +0800 Subject: [PATCH] 修改报错问题 --- SunshineIns/src/page/CriminalExecution.jsx | 154 +++++++++++++++++++++++--------------------------- 1 files changed, 71 insertions(+), 83 deletions(-) diff --git a/SunshineIns/src/page/CriminalExecution.jsx b/SunshineIns/src/page/CriminalExecution.jsx index fae5615..d6a946e 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'; @@ -64,17 +64,26 @@ size: 10, }, resetKey: Date.now(), - loading: false + loading: false, + 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 => { @@ -84,7 +93,7 @@ }); } - confirm = (e) => { + deleteItems = (e) => { console.log(e); this.setState({ loading: true }) Fetch.socialDelete(e).then(res => { @@ -104,82 +113,55 @@ showModal = (id) => { this.setState({ visible: true, + zIndex: 1000 }); + this.sendMsg() // Fetch.socialCompanyDetail(id) // .then(res => { // this.setState({ savedate: res }) // }) } + saveInputChange = ({ target: { value, name } }) => { + this.setState(({ savedate }) => ({ + savedate: { + ...savedate, + [name]: value + } + })) + } + renderColumns = () => { return [{ - title: '任务标题', - dataIndex: 'taskTitle', - key: 'taskTitle' + title: '编号', + dataIndex: 'index', + key: 'index', + render: (text, item, index) => <span>{index}</span> }, { - title: '任务类型', - dataIndex: 'taskType', - key: 'taskType', - render: text => <span>{typeOfName(text)}</span> + title: ' 姓名', + dataIndex: 'name', + key: 'name', }, { - title: '状态', - dataIndex: 'status', - key: 'status', - render: text => ( - text == 0 ? - <Badge style={{ backgroundColor: '#6C757C' }} count={'未开始'} /> : text == 1 ? <Badge count={'进行中'} style={{ backgroundColor: '#F1C40F' }} /> : text == 2 ? <Badge count={'已结束'} style={{ backgroundColor: '#2ECC71' }} /> : <Badge count={'暂停'} style={{ backgroundColor: '#2ECC71' }} /> - ) + title: '牢房号', + dataIndex: 'number', + key: 'number', }, { - title: '创建时间', + title: '指纹唯一识别', + dataIndex: 'shibie', + key: 'shibie', + }, { + title: '录入时间', dataIndex: 'createTime', key: 'createTime', - render: text => <span>{moment(text).format("YYYY-MM-DD HH:mm")}</span> - }, { - title: '开始时间', - dataIndex: 'startTime', - key: 'startTime', - render: text => <span>{moment(text).format("YYYY-MM-DD HH:mm")}</span> - }, { - title: '结束时间', - dataIndex: 'endTime', - key: 'endTime', - render: text => <span>{moment(text).format("YYYY-MM-DD HH:mm")}</span> + render: text => <span>{moment(text).format("YYYY-MM-DD")}</span> }, { title: '操作', key: 'action', render: (text, record) => ( <span> - { - record.status == 0 ? - <React.Fragment> - <a onClick={() => this.showModal(record.id)}>编辑</a> - <Divider type="vertical" /> - <Popconfirm - title="确认删除任务吗?" - id={record.id} - onConfirm={e => this.confirm(record.id)} - okText="确定" - cancelText="取消" - > - <a href="#">删除</a> - <Divider type="vertical" /> - </Popconfirm> - <a onClick={() => this.reboot(record.id, 99)}>暂停</a> - </React.Fragment> : - record.status == 1 ? - <React.Fragment> - <a onClick={() => this.showModal(record.id)}>查看</a> - <Divider type="vertical" /> - <a onClick={() => this.showModal(record.id)}>结束任务</a> - <Divider type="vertical" /> - <a onClick={() => this.reboot(record.id, 99)}>暂停</a> - </React.Fragment> : - <React.Fragment> - <a onClick={() => this.showModal(record.id)}>查看</a> - <Divider type="vertical" /> - <a onClick={() => this.reboot(record.id, 0)}>重启</a> - </React.Fragment> - } + <label onClick={() => this.showModal(record.id)} className='theme-color' style={{ cursor: 'pointer' }}>编辑</label> + <Divider type="vertical" /> + <label onClick={() => this.deleteItems(record.id)} className='theme-color' style={{ cursor: 'pointer' }}>删除</label> </span> ), }] @@ -187,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} /> @@ -226,29 +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={'80%'} - bodyStyle={{ height: '600px' }} + // footer={null} + width={'60%'} + 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='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' @@ -257,6 +244,7 @@ frameBorder="0" /> </Modal> + {/* </div> */} </div> ) -- Gitblit v1.8.0