From e29d2313a38c0278577e645b4bb110e677175e10 Mon Sep 17 00:00:00 2001
From: liuwh <liuwh@hugeinfo.com.cn>
Date: Sun, 23 Feb 2020 12:36:07 +0800
Subject: [PATCH] 提交

---
 SunshineIns/src/page/ApplyFor.jsx |  107 +++++++++++++++++++++++++++++++++++------------------
 1 files changed, 70 insertions(+), 37 deletions(-)

diff --git a/SunshineIns/src/page/ApplyFor.jsx b/SunshineIns/src/page/ApplyFor.jsx
index 43d5dc3..2eab1b3 100644
--- a/SunshineIns/src/page/ApplyFor.jsx
+++ b/SunshineIns/src/page/ApplyFor.jsx
@@ -2,10 +2,11 @@
 
 import HeadView from '../view/HeadView';
 import TableBtnView from '../view/TableBtnView';
+import CommonSearchForm from '../view/CommonSearchForm';
+import TableView from '../view/TableView';
 import { Input, Button, DatePicker, Divider, message, Popconfirm, Select, Badge, Tooltip } from 'antd';
 import moment from 'moment';
 import Fetch from '../fetch';
-import TableView from '../view/TableView';
 const Option = Select.Option;
 function typeOfName(type) {
     switch (type) {
@@ -17,15 +18,27 @@
             return "已反馈";
     }
 }
+
+const activityStatusIds = {
+    1: '待处理',
+    2: '已受理',
+    3: '已反馈',
+}
+
+const activityStatusList = [
+    1,
+    2,
+    3,
+]
 export default class ApplyFor extends React.Component {
     constructor(props) {
         super(props);
         this.state = {
             data: [],
-            formdata: {
+            formData: {
+                __key: Date.now(),
                 page: 1,
                 size: 10,
-                type:1,
             },
             resetKey: Date.now(),
             loading: false
@@ -38,10 +51,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:1 })
             .then(res => {
                 console.log(res)
                 for (var i = 0; i < res.rows.length; i++) {
@@ -49,7 +72,22 @@
                 }
                 this.setState({
                     data: res.rows,
-                    loading:false
+                    loading: false
+                });
+            });
+    }
+
+    getData = () => {
+        this.setState({ loading: true })
+        Fetch.entryQuery({ ...this.state.formData,type:1 })
+            .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
                 });
             });
     }
@@ -143,42 +181,37 @@
                 </span>
             ),
         }];
-        const { data, loading, resetKey } = this.state;
+        const { data, loading, resetKey, formData } = this.state;
         return (
             <div className="app-page">
                 <HeadView history={this.props.history} />
                 <div style={{ marginLeft: '90%', marginBottom: '20px', marginTop: '20px' }}>
                     <Button type="primary" size='large' onClick={() => this.showModal('new')}>添加申请</Button>
                 </div>
-                {/* <Breadcrumb style={{ padding: '20px' }}>
-                    <Breadcrumb.Item><a href="">后台中心</a></Breadcrumb.Item>
-                    <Breadcrumb.Item>社会关护</Breadcrumb.Item>
-                </Breadcrumb> */}
-                <TableBtnView name={''} key={resetKey}>
-                    <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: 'select', name: '状态', label: '活动状态', key: 'status', list: activityStatusList.map(key => ({
+                                    id: key,
+                                    name: activityStatusIds[key]
+                                })),
+                            },
+                            {
+                                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