周立森 5 年之前
父節點
當前提交
0684c8469d
共有 1 個檔案被更改,包括 31 行新增29 行删除
  1. 31
    29
      src/pages/activity/drainage/Detail.jsx

+ 31
- 29
src/pages/activity/drainage/Detail.jsx 查看文件

23
   const [startDate, setStartDate] = useState('')
23
   const [startDate, setStartDate] = useState('')
24
   const [endDate, setEndDate] = useState('')
24
   const [endDate, setEndDate] = useState('')
25
   const [total, setTotal] = useState({})
25
   const [total, setTotal] = useState({})
26
-  let daterange = []
27
   // let content = {}
26
   // let content = {}
28
   useEffect(() => {
27
   useEffect(() => {
29
 
28
 
89
       return col
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
   function fromTime (str) {
96
   function fromTime (str) {
100
     return str === '' ? null : `${moment(str).format('YYYY-MM-DDT00:00:00.000')}Z`
97
     return str === '' ? null : `${moment(str).format('YYYY-MM-DDT00:00:00.000')}Z`
142
     link.click()
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
   const { RangePicker } = DatePicker;
152
   const { RangePicker } = DatePicker;
153
+  const { getFieldDecorator } = props.form
152
   return (
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
       <div>
174
       <div>
173
         <div style={{ display: 'flex', justifyContent: 'space-between' }}>
175
         <div style={{ display: 'flex', justifyContent: 'space-between' }}>
174
           <div style={{ lineHeight: '92px', width: '600px', fontWeight: 'bold', fontSize: '18px' }}>
176
           <div style={{ lineHeight: '92px', width: '600px', fontWeight: 'bold', fontSize: '18px' }}>
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