From 8d68b6a1dcdf5008fba6bdac5858d1085a0e63e7 Mon Sep 17 00:00:00 2001
From: liuwh <hugeinfo123>
Date: Mon, 30 Mar 2020 23:14:04 +0800
Subject: [PATCH] 提交

---
 SunshineIns/src/page/Examine.jsx |  123 ++++++++++++++++++++++-------------------
 1 files changed, 66 insertions(+), 57 deletions(-)

diff --git a/SunshineIns/src/page/Examine.jsx b/SunshineIns/src/page/Examine.jsx
index ce5607f..6404369 100644
--- a/SunshineIns/src/page/Examine.jsx
+++ b/SunshineIns/src/page/Examine.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:2,
             },
             resetKey: Date.now(),
             loading: false
@@ -38,48 +39,57 @@
         this.getData();
     }
 
-    getData = () => {
-        const { formdata } = this.state;
-        Fetch.entryQuery({ ...formdata })
+    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({ ...data, type: 2 })
             .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
+                    data: res.rows,
+                    loading: false
+                });
+            });
+    }
+
+    getData = () => {
+        this.setState({ loading: true })
+        console.log(this.state.formData)
+        Fetch.entryQuery({ ...this.state.formData, type: 2 })
+            .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
             }
         }))
     }
     showModal = (id) => {
         this.props.history.push("/entry/ExamineEdit/" + id);
-    }
-
-    Seaech = () => {
-        const { formdata } = this.state;
-        Fetch.getSweeping(formdata)
-            .then(res => {
-                for (var i = 0; i < res.length; i++) {
-                    res[i]['index'] = i + 1;
-                }
-                this.setState({
-                    data: res
-                });
-            });
-    }
-    Reset = () => {
-        this.setState({
-            resetKey: Date.now(),
-            formdata: {}
-        }, this.getData);
     }
 
     confirm = (e) => {
@@ -126,40 +136,39 @@
             title: '操作',
             key: 'action',
             render: (text, record) => (
-                <span>
-                    <a onClick={() => this.showModal(record.id)}>审核</a>
-                </span>
+                record.status == 1 ?
+                    <span>
+                        <a onClick={() => this.showModal(record.id)}>审核</a>
+                    </span>
+                    : <span>
+                        <a onClick={() => this.showModal(record.id)}>详情</a>
+                    </span>
             ),
         }];
-        const { data, loading, resetKey } = this.state;
+        const { data, loading, resetKey, formData } = this.state;
+        console.log(formData)
         return (
             <div className="app-page">
                 <HeadView history={this.props.history} />
-                <TableBtnView name={''} 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