From 5a887acf1924950715086633d329db045223b5c4 Mon Sep 17 00:00:00 2001
From: liuwh <hugeinfo123>
Date: Tue, 09 Jun 2020 14:47:27 +0800
Subject: [PATCH] test

---
 SunshineIns/src/page/CriminalExecution.jsx |  160 ++++++++++++++++++++++++++++++-----------------------
 1 files changed, 91 insertions(+), 69 deletions(-)

diff --git a/SunshineIns/src/page/CriminalExecution.jsx b/SunshineIns/src/page/CriminalExecution.jsx
index b8aa2e0..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,
@@ -73,7 +30,7 @@
     }
 
     componentDidMount() {
-        document.title = '社会观护管理';
+        document.title = '刑执监督管理';
         let _this = this;
         window.addEventListener('message', function (e) {
             console.log('反馈', e)
@@ -83,20 +40,35 @@
                 })
             }
         }, false);
-        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 })
@@ -115,13 +87,15 @@
             visible: true,
             zIndex: 1000,
             iframeKey: id,
-            display: 'none'
+            display: 'none',
+            loading: true,
         });
         this.sendMsg();
-        // Fetch.socialCompanyDetail(id)
-        //   .then(res => {
-        //     this.setState({ savedate: res })
-        //   })
+        Fetch.criminalFind(id)
+            .then(res => {
+                console.log(res)
+                this.setState({ savedate: res.data, fingerCode: res.data.fingerCode || '', loading: false })
+            })
     }
 
     saveInputChange = ({ target: { value, name } }) => {
@@ -138,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',
@@ -149,8 +123,9 @@
             key: 'number',
         }, {
             title: '指纹唯一识别',
-            dataIndex: 'shibie',
-            key: 'shibie',
+            dataIndex: 'fingerCode',
+            key: 'fingerCode',
+            render: text => <div className="nowrap">{text}</div>
         }, {
             title: '录入时间',
             dataIndex: 'createTime',
@@ -163,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>
             ),
         }]
@@ -188,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, fingerCode, iframeKey } = 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} />
@@ -197,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}
@@ -213,24 +234,25 @@
                             {
                                 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='fingerCode' onChange={this.saveInputChange} value={fingerCode || ''} addonAfter={<Row type="flex" style={{ flexWrap: 'nowrap' }}>
+                    <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>
@@ -242,7 +264,7 @@
                             style={{ width: '100%', height: '550px' }}
                             onLoad={() => { }}
                             ref="iframe"
-                            src='./fingerprint/指纹登记.html'
+                            src='./fingerprint/dengji.html'
                             width="100%"
                             scrolling="no"
                             frameBorder="0"

--
Gitblit v1.8.0