From 2fdc3dc444a2f8199866780205c0fa4b5ac40522 Mon Sep 17 00:00:00 2001 From: liuwh <hugeinfo123> Date: Fri, 29 May 2020 10:38:46 +0800 Subject: [PATCH] 指纹登记与对比 --- SunshineIns/src/page/CriminalExecution.jsx | 197 ++++++++++++++++++++++++++++-------------------- 1 files changed, 115 insertions(+), 82 deletions(-) diff --git a/SunshineIns/src/page/CriminalExecution.jsx b/SunshineIns/src/page/CriminalExecution.jsx index dead32e..2a4dced 100644 --- a/SunshineIns/src/page/CriminalExecution.jsx +++ b/SunshineIns/src/page/CriminalExecution.jsx @@ -3,62 +3,19 @@ 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, Row, Col } from 'antd'; +import { Input, Button, DatePicker, Divider, message, Popconfirm, Select, Tooltip, Modal, Row, Col } from 'antd'; import moment from 'moment'; import Fetch from '../fetch'; import TableView from '../view/TableView'; const Option = Select.Option; -function typeOfName(type) { - switch (type) { - case 1: - return "跟踪帮教"; - case 2: - return "合适成年人"; - case 3: - return "社会调查"; - case 4: - return "心理疏导"; - case 5: - return "法律援助"; - } -} - -const taskNodeIds = { - 1: '跟踪帮教', - 2: '合适成年人', - 3: '社会调查', - 4: '心理疏导', - 5: '法律援助', -} - -const activityTypeList = [ - 1, - 2, - 3, - 4, - 5 -] -const activityStatusIds = { - 0: '未开始', - 1: '进行中', - 2: '已结束', - 99: '暂停', -} - -const activityStatusList = [ - 0, - 1, - 2 -] - export default class CareList extends React.Component { constructor(props) { super(props); this.state = { - data: [], - formData: { + list: [], + formdata: { __key: Date.now(), page: 1, size: 10, @@ -67,30 +24,51 @@ loading: false, zIndex: '-1', savedate: {}, - display: 'none' + display: 'none', + fingerCode: '' }; } componentDidMount() { - document.title = '社会观护管理'; + 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(); + _this.getData(); + } + + getData = () => { + const { formdata } = this.state; + this.setState({ loading: true }) + console.log('formdata', formdata) + Fetch.criminalQuery({ ...formdata }) + .then(res => { + console.log("res", res) + this.setState({ + list: res.data.content, + loading: false + }); + }); } setFormData = data => { console.log('form', data); this.setState({ - formData: data, + formdata: data, }); } deleteItems = (e) => { console.log(e); this.setState({ loading: true }) - Fetch.socialDelete(e).then(res => { + Fetch.criminalDelete(e).then(res => { if (res.code == 0) { console.log(res) this.setState({ loading: false }) @@ -107,13 +85,17 @@ showModal = (id) => { this.setState({ visible: true, - zIndex: 1000 + zIndex: 1000, + iframeKey: id, + display: 'none', + loading: true, }); - this.sendMsg() - // Fetch.socialCompanyDetail(id) - // .then(res => { - // this.setState({ savedate: res }) - // }) + this.sendMsg(); + Fetch.criminalFind(id) + .then(res => { + console.log(res) + this.setState({ savedate: res.data, fingerCode: res.data.fingerCode || '', loading: false }) + }) } saveInputChange = ({ target: { value, name } }) => { @@ -130,7 +112,7 @@ title: '编号', dataIndex: 'index', key: 'index', - render: (text, item, index) => <span>{index}</span> + render: (text, item, index) => <span>{index + 1}</span> }, { title: ' 姓名', dataIndex: 'name', @@ -141,8 +123,9 @@ key: 'number', }, { title: '指纹唯一识别', - dataIndex: 'shibie', - key: 'shibie', + dataIndex: 'fingerCode', + key: 'fingerCode', + render: text => <div className="nowrap">{text}</div> }, { title: '录入时间', dataIndex: 'createTime', @@ -155,7 +138,15 @@ <span> <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> + <Popconfirm + title="确认删除吗?" + id={record.id} + onConfirm={e => this.deleteItems(record.id)} + okText="确定" + cancelText="取消" + > + <label className='theme-color' style={{ cursor: 'pointer' }}>删除</label> + </Popconfirm> </span> ), }] @@ -180,8 +171,46 @@ }, '*'); } + //确认提交按钮 + handleOk = () => { + const { savedate, fingerCode } = this.state; + if (!savedate.name) { + return message.warning("姓名不能为空"); + } + if (!savedate.number) { + return message.warning("牢房号不能为空"); + } + if (!fingerCode) { + return message.warning("请录入指纹"); + } + this.setState({ btloading: true }) + Fetch.criminalSave({ ...savedate, fingerCode }) + .then(res => { + if (res.code === 0) { + this.setState({ + zIndex: '-1', + fingerCode: "", + btloading: false, + closeKey: Date.now() + }, this.getData); + message.success("提交成功!") + } + }); + this.setState({ + + }) + } + + //取消按钮 + handleCancel = () => { + this.setState({ + fingerCode: "", + zIndex: '-1', + }); + } + render() { - const { data, resetKey, visible, loading, savedate, closeKey, formData, zIndex, display } = this.state; + const { list, resetKey, visible, loading, btloading, savedate, closeKey, formdata, zIndex, display, fingerCode, iframeKey } = this.state; return ( <div className="app-page"> <HeadView history={this.props.history} /> @@ -189,9 +218,9 @@ <Button type="primary" size='large' onClick={() => this.showModal('new')}>新增</Button> </div> <div style={{ background: '#fff', margin: 20 }}> - <CommonSearchForm + {/* <CommonSearchForm {...this.props} - formData={formData} + formData={formdata} setFormData={this.setFormData} searchonClick={this.searchonClick} pathName={this.props.location.pathname} @@ -205,38 +234,42 @@ { type: 'input', name: '联系电话', label: '联系电话', key: 'companyTel' }, - ]} /> - <TableView columns={this.renderColumns()} data={data} pageSize='10' size='default' loading={loading} /> + ]} /> */} + <TableView columns={this.renderColumns()} data={list} pageSize='10' size='default' loading={loading} /> </div> <Modal zIndex={zIndex} key={closeKey} - confirmLoading={loading} + confirmLoading={btloading} visible={true} title="指纹录入" - onCancel={() => { this.setState({ visible: false, zIndex: '-1', }) }} + onOk={this.handleOk} + onCancel={this.handleCancel} bodyStyle={{ lineHeight: 4 }} // 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='bianshi' onChange={this.saveInputChange} value={savedate.bianshi || ''} addonAfter={<Row type="flex" style={{ flexWrap: 'nowrap' }}> - <Col style={{ cursor: 'pointer' }} onClick={() => this.setState({ display: 'block'})}> + <Input addonBefore="牢房号" name='number' onChange={this.saveInputChange} value={savedate.number || ''} /> + <Input addonBefore="指纹唯一标识" name='fingerCode' value={fingerCode || ''} disabled 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: '550px', display: display }} - onLoad={() => { }} - ref="iframe" - src='./fingerprint/指纹登记.html' - width="100%" - scrolling="no" - frameBorder="0" - /> + <div style={{ display: display }}> + <Divider style={{ margin: '2px 0' }} /> + <iframe + key={iframeKey} + style={{ width: '100%', height: '550px' }} + onLoad={() => { }} + ref="iframe" + src='./fingerprint/dengji.html' + width="100%" + scrolling="no" + frameBorder="0" + /> + </div> </Modal> {/* </div> */} -- Gitblit v1.8.0