From a92f3c4d10bebbdc55270e72ccd97cd1ba7d4e28 Mon Sep 17 00:00:00 2001
From: LAPTOP-RI7D261L\Mr Ke <545800322@qq.com>
Date: Wed, 26 Feb 2020 16:40:55 +0800
Subject: [PATCH] Merge branch 'master' of http://120.79.193.119:9090/r/nsjcy/frontEnd/nsjcy

---
 SunshineIns/src/page/PoliceSecurity.jsx |   96 +++++++++++++++++++++++++++++-------------------
 1 files changed, 58 insertions(+), 38 deletions(-)

diff --git a/SunshineIns/src/page/PoliceSecurity.jsx b/SunshineIns/src/page/PoliceSecurity.jsx
index dbb8f47..91dffde 100644
--- a/SunshineIns/src/page/PoliceSecurity.jsx
+++ b/SunshineIns/src/page/PoliceSecurity.jsx
@@ -2,6 +2,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, Tooltip } from 'antd';
 import moment from 'moment';
 import Fetch from '../fetch';
@@ -22,10 +23,10 @@
         super(props);
         this.state = {
             data: [],
-            formdata: {
+            formData: {
+                __key: Date.now(),
                 page: 1,
                 size: 10,
-                type:3,
             },
             resetKey: Date.now(),
             loading: false
@@ -37,10 +38,20 @@
         this.getData();
     }
 
-    getData = () => {
-        const { formdata } = this.state;
+    setFormData = data => {
+        console.log('form', data);
+        this.setState({
+            formData: data,
+        });
+    }
+
+    searchonClick = data => {
+        console.log('form', data);
+        this.setState({
+            formData: data,
+        });
         this.setState({ loading: true })
-        Fetch.entryQuery({ ...formdata })
+        Fetch.entryQuery({ ...data, type: 3 })
             .then(res => {
                 console.log(res)
                 for (var i = 0; i < res.rows.length; i++) {
@@ -48,14 +59,29 @@
                 }
                 this.setState({
                     data: res.rows,
-                    loading: false 
+                    loading: false
+                });
+            });
+    }
+
+    getData = () => {
+        this.setState({ loading: true })
+        Fetch.entryQuery({ ...this.state.formData, type: 3 })
+            .then(res => {
+                console.log(res)
+                for (var i = 0; i < res.rows.length; i++) {
+                    res.rows[i]['index'] = i + 1;
+                }
+                this.setState({
+                    data: res.rows,
+                    loading: false
                 });
             });
     }
     onInputChange = ({ target: { value, name } }) => {
-        this.setState(({ formdata }) => ({
-            formdata: {
-                ...formdata,
+        this.setState(({ formData }) => ({
+            formData: {
+                ...formData,
                 [name]: value
             }
         }))
@@ -65,8 +91,8 @@
     }
 
     Seaech = () => {
-        const { formdata } = this.state;
-        Fetch.getSweeping(formdata)
+        const { formData } = this.state;
+        Fetch.getSweeping(formData)
             .then(res => {
                 for (var i = 0; i < res.length; i++) {
                     res[i]['index'] = i + 1;
@@ -79,7 +105,7 @@
     Reset = () => {
         this.setState({
             resetKey: Date.now(),
-            formdata: {}
+            formData: {}
         }, this.getData);
     }
 
@@ -132,35 +158,29 @@
                 </span>
             ),
         }];
-        const { data, loading, resetKey } = this.state;
+        const { data, loading, resetKey, formData } = this.state;
         return (
             <div className="app-page">
                 <HeadView history={this.props.history} />
-                <TableBtnView  key={resetKey} style={{marginTop:"20px"}}>
-                    <Select
-                        style={{ width: 200 }}
-                        placeholder="根据举报性质查询"
-                        onChange={(value) => this.onInputChange({ target: { name: 'nature', value } })}
-                    >
-                        <Option value="1">涉黑涉恶违法犯罪行为</Option>
-                        <Option value="2">涉黑涉恶违法犯罪保护伞</Option>
-                        <Option value="3">其他</Option>
-                    </Select>
-                    <Input placeholder="根据内容模糊查询" style={{ width: "200px" }} name='content' onChange={this.onInputChange} />
-                    <Select
-                        style={{ width: 200 }}
-                        placeholder="根据状态查询"
-                        onChange={(value) => this.onInputChange({ target: { name: 'status', value } })}
-                    >
-                        <Option value="2">已回复</Option>
-                        <Option value="1">待回复</Option>
-                    </Select>
-
-                    <DatePicker onChange={(_, value) => this.onInputChange({ target: { name: 'createTime', value } })} placeholder="根据创建时间查询" />
-                    <Button type="primary" onClick={this.Seaech}>查询</Button>
-                    <Button onClick={this.Reset}>重置</Button>
-                </TableBtnView>
-                <TableView columns={columns} data={data} pageSize='10' size='default' loading={loading} />
+                <div style={{ background: '#fff', margin: 20 }}>
+                    <CommonSearchForm
+                        {...this.props}
+                        formData={formData}
+                        setFormData={this.setFormData}
+                        searchonClick={this.searchonClick}
+                        pathName={this.props.location.pathname}
+                        data={[
+                            { type: 'input', name: '申请人', label: '申请人', key: 'createrName' },
+                            {
+                                type: 'rangePicker',
+                                label: '申请时间',
+                                name: JSON.stringify(['开始时间', '结束时间']),
+                                key: JSON.stringify(['startTime', 'endTime']),
+                                keylistName: 'rangeTimelist',
+                            },
+                        ]} />
+                    <TableView columns={columns} data={data} pageSize='10' size='default' loading={loading} />
+                </div>
             </div>
         );
     }

--
Gitblit v1.8.0