周立森 5 years ago
parent
commit
0684c8469d
1 changed files with 31 additions and 29 deletions
  1. 31
    29
      src/pages/activity/drainage/Detail.jsx

+ 31
- 29
src/pages/activity/drainage/Detail.jsx View File

@@ -23,7 +23,6 @@ const header = (props) => {
23 23
   const [startDate, setStartDate] = useState('')
24 24
   const [endDate, setEndDate] = useState('')
25 25
   const [total, setTotal] = useState({})
26
-  let daterange = []
27 26
   // let content = {}
28 27
   useEffect(() => {
29 28
 
@@ -89,12 +88,10 @@ const header = (props) => {
89 88
       return col
90 89
     }))
91 90
   }
91
+  // function datalist () {
92 92
 
93
-
94
-  function datalist () {
95
-
96
-    gettaDrainageRecord({ pageNum: 1, pageSize: 10, drainageId: drainageId, startTime: Time(startDate), endTime: Time(endDate) })
97
-  }
93
+  //   gettaDrainageRecord({ pageNum: 1, pageSize: 10, drainageId: drainageId, startTime: Time(startDate), endTime: Time(endDate) })
94
+  // }
98 95
 
99 96
   function fromTime (str) {
100 97
     return str === '' ? null : `${moment(str).format('YYYY-MM-DDT00:00:00.000')}Z`
@@ -142,33 +139,38 @@ const header = (props) => {
142 139
     link.click()
143 140
   }
144 141
 
145
-  function handleReset () {
146
-
147
-    onChangetime()
142
+  function handleReset (e) {
143
+    console.log(e)
144
+    props.form.resetFields();
145
+  }
148 146
 
147
+  const handleSubmit = (e, props) => {
148
+    e.preventDefault();
149
+    gettaDrainageRecord({ pageNum: 1, pageSize: 10, drainageId: drainageId, startTime: Time(startDate), endTime: Time(endDate) })
149 150
   }
150 151
 
151 152
   const { RangePicker } = DatePicker;
153
+  const { getFieldDecorator } = props.form
152 154
   return (
153 155
     <>
154
-
155
-      <RangePicker
156
-        style={{ width: '400px' }}
157
-        // ranges={{
158
-        //   Today: [moment(), moment()],
159
-        //   'This Month': [moment().startOf('month'), moment().endOf('month')],
160
-        // }}
161
-        // defaultValue={[moment(new Date(new Date().setDate((new Date().getDate() - 6))), 'YYYY-MM-DD HH:MM:SS'), moment(new Date(), 'YYYY-MM-DD HH:MM:SS')]}
162
-        showTime
163
-        onChange={onChangetime}
164
-
165
-      />
166
-      <Button type="primary" htmlType="submit" style={{ marginLeft: '30px', float: 'right' }} onClick={datalist}>
167
-        搜索
168
-      </Button>
169
-      {/* <Button style={{ marginLeft: '30px', float: 'right' }} onClick={handleReset}>
170
-              重置
171
-            </Button> */}
156
+      <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
157
+        <Form.Item>
158
+        {getFieldDecorator('time')(
159
+            <RangePicker showTime format="YYYY-MM-DD" 
160
+            showTime
161
+            onChange={onChangetime}
162
+            />,
163
+          )}
164
+        </Form.Item>
165
+        <Form.Item>
166
+          <Button type="primary" htmlType="submit" >
167
+            搜索
168
+          </Button>
169
+          <Button style={{ marginLeft: 8 }} onClick={handleReset}>
170
+            重置
171
+            </Button>
172
+        </Form.Item>
173
+      </Form>
172 174
       <div>
173 175
         <div style={{ display: 'flex', justifyContent: 'space-between' }}>
174 176
           <div style={{ lineHeight: '92px', width: '600px', fontWeight: 'bold', fontSize: '18px' }}>
@@ -191,6 +193,6 @@ const header = (props) => {
191 193
     </>
192 194
   )
193 195
 }
196
+const WrappedHeader = Form.create({ name: 'header' })(header);
194 197
 
195
-
196
-export default header
198
+export default WrappedHeader