傅行帆 5 years ago
parent
commit
a04486ce9c
2 changed files with 55 additions and 22 deletions
  1. 27
    11
      src/pages/statistical/building/detail.jsx
  2. 28
    11
      src/pages/statistical/building/index.jsx

+ 27
- 11
src/pages/statistical/building/detail.jsx View File

@@ -109,6 +109,12 @@ class buildingDetailStats extends React.Component {
109 109
       })
110 110
   }
111 111
 
112
+   //重置搜索
113
+  handleReset = () => {
114
+    daterange = []
115
+    this.props.form.resetFields();
116
+  }
117
+
112 118
   render() {
113 119
     const columns = [
114 120
         {
@@ -142,26 +148,35 @@ class buildingDetailStats extends React.Component {
142 148
         },
143 149
       ];
144 150
 
151
+    const { getFieldDecorator } = this.props.form;
145 152
     return (
146 153
     <div>
154
+      <Form layout="inline">
147 155
       <Radio.Group buttonStyle="solid" defaultValue="a">
148 156
           <Radio.Button value="c" onClick={() => this.getDataOf(0)}>今日</Radio.Button>
149 157
           <Radio.Button value="a" onClick={() => this.getDataOf(7)}>最近7天</Radio.Button>
150 158
           <Radio.Button value="b" onClick={() => this.getDataOf(30)}>最近1月</Radio.Button>
151 159
         </Radio.Group>
152
-        <RangePicker
153
-          style={{ paddingLeft: '30px' }}
154
-          ranges={{
155
-            Today: [moment(), moment()],
156
-            'This Month': [moment().startOf('month'), moment().endOf('month')],
157
-          }}
158
-          onChange={(_dates, dateStrings) => this.onChangetime(_dates, dateStrings)}
159
-        />
160
+        <Form.Item>
161
+        {getFieldDecorator('time', {
162
+            initialValue: [],
163
+            rules: [{ required: true, message: '请上传封面图1' }],
164
+        })(
165
+          <RangePicker
166
+            style={{ paddingLeft: '30px' }}
167
+            ranges={{
168
+              Today: [moment(), moment()],
169
+              'This Month': [moment().startOf('month'), moment().endOf('month')],
170
+            }}
171
+            onChange={(_dates, dateStrings) => this.onChangetime(_dates, dateStrings)}
172
+          />
173
+        )}
174
+        </Form.Item>
160 175
         <Button type="primary" htmlType="submit" style={{ marginLeft: '30px' }} onClick={() => this.datalist()}>
161 176
           查询
162 177
         </Button>
163
-        <Button type="danger" onClick={() => router.go(-1)} style={{ marginBottom: '18px', marginLeft: '30px' }}>重置</Button>
164
-
178
+        <Button type="danger" onClick={this.handleReset} style={{ marginBottom: '18px', marginLeft: '30px' }}>重置</Button>
179
+        </Form>
165 180
         <StatsChartLine title={this.state.buildingName} data={this.state.barData} />
166 181
         <Row>
167 182
             <Col span={22}>
@@ -179,5 +194,6 @@ class buildingDetailStats extends React.Component {
179 194
     )
180 195
   }
181 196
 }
197
+const WrappedHeader = Form.create({ name: 'record' })(buildingDetailStats);
182 198
 
183
-export default buildingDetailStats
199
+export default WrappedHeader

+ 28
- 11
src/pages/statistical/building/index.jsx View File

@@ -125,6 +125,12 @@ class buildingStats extends React.Component {
125 125
     });
126 126
   }
127 127
 
128
+  //重置搜索
129
+  handleReset = () => {
130
+    daterange = []
131
+    this.props.form.resetFields();
132
+  }
133
+
128 134
   render() {
129 135
     const columns = [
130 136
         {
@@ -170,26 +176,35 @@ class buildingStats extends React.Component {
170 176
         },
171 177
       ];
172 178
 
179
+    const { getFieldDecorator } = this.props.form;
173 180
     return (
174 181
     <div>
182
+      <Form layout="inline">
175 183
       <Radio.Group buttonStyle="solid" defaultValue="a">
176 184
           <Radio.Button value="c" onClick={() => this.getDataOf(0)}>今日</Radio.Button>
177 185
           <Radio.Button value="a" onClick={() => this.getDataOf(7)}>最近7天</Radio.Button>
178 186
           <Radio.Button value="b" onClick={() => this.getDataOf(30)}>最近1月</Radio.Button>
179 187
         </Radio.Group>
180
-        <RangePicker
181
-          style={{ paddingLeft: '30px' }}
182
-          ranges={{
183
-            Today: [moment(), moment()],
184
-            'This Month': [moment().startOf('month'), moment().endOf('month')],
185
-          }}
186
-          onChange={(_dates, dateStrings) => this.onChangetime(_dates, dateStrings)}
187
-        />
188
+        <Form.Item>
189
+        {getFieldDecorator('time', {
190
+            initialValue: [],
191
+            rules: [{ required: true, message: '请上传封面图1' }],
192
+        })(
193
+          <RangePicker
194
+              style={{ paddingLeft: '30px' }}
195
+              ranges={{
196
+                Today: [moment(), moment()],
197
+                'This Month': [moment().startOf('month'), moment().endOf('month')],
198
+              }}
199
+              onChange={(_dates, dateStrings) => this.onChangetime(_dates, dateStrings)}
200
+            />
201
+        )}
202
+        </Form.Item>
188 203
         <Button type="primary" htmlType="submit" style={{ marginLeft: '30px' }} onClick={() => this.datalist()}>
189 204
           查询
190 205
         </Button>
191
-        <Button type="danger" onClick={() => router.go(-1)} style={{ marginBottom: '18px', marginLeft: '30px' }}>重置</Button>
192
-
206
+        <Button type="danger" onClick={this.handleReset} style={{ marginBottom: '18px', marginLeft: '30px' }}>重置</Button>
207
+        </Form>
193 208
         <Row>
194 209
             <Col span={12}>
195 210
                 <StatsChart title="项目公客排行" data={this.state.barData.gkBarMap} />
@@ -225,4 +240,6 @@ class buildingStats extends React.Component {
225 240
   }
226 241
 }
227 242
 
228
-export default buildingStats
243
+const WrappedHeader = Form.create({ name: 'record' })(buildingStats);
244
+
245
+export default WrappedHeader