Pārlūkot izejas kodu

Merge branch 'dev' of http://git.ycjcjy.com/zhiyuxing/estateagents-admin-manager into dev

xujing 5 gadus atpakaļ
vecāks
revīzija
c66c154bdd

+ 27
- 11
src/pages/statistical/building/detail.jsx Parādīt failu

@@ -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

+ 31
- 12
src/pages/statistical/building/index.jsx Parādīt failu

@@ -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,25 +176,36 @@ class buildingStats extends React.Component {
170 176
       },
171 177
     ];
172 178
 
179
+    const { getFieldDecorator } = this.props.form;
173 180
     return (
174
-      <div>
175
-        <Radio.Group buttonStyle="solid" defaultValue="a">
181
+
182
+    <div>
183
+      <Form layout="inline">
184
+      <Radio.Group buttonStyle="solid" defaultValue="a">
176 185
           <Radio.Button value="c" onClick={() => this.getDataOf(0)}>今日</Radio.Button>
177 186
           <Radio.Button value="a" onClick={() => this.getDataOf(7)}>最近7天</Radio.Button>
178 187
           <Radio.Button value="b" onClick={() => this.getDataOf(30)}>最近1月</Radio.Button>
179 188
         </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
-        />
189
+        <Form.Item>
190
+        {getFieldDecorator('time', {
191
+            initialValue: [],
192
+            rules: [{ required: true, message: '请上传封面图1' }],
193
+        })(
194
+          <RangePicker
195
+              style={{ paddingLeft: '30px' }}
196
+              ranges={{
197
+                Today: [moment(), moment()],
198
+                'This Month': [moment().startOf('month'), moment().endOf('month')],
199
+              }}
200
+              onChange={(_dates, dateStrings) => this.onChangetime(_dates, dateStrings)}
201
+            />
202
+        )}
203
+        </Form.Item>
188 204
         <Button type="primary" htmlType="submit" style={{ marginLeft: '30px' }} onClick={() => this.datalist()}>
189 205
           查询
190 206
         </Button>
191
-        <Button type="danger" onClick={() => router.go(-1)} style={{ marginBottom: '18px', marginLeft: '30px' }}>重置</Button>
207
+        <Button type="danger" onClick={this.handleReset} style={{ marginBottom: '18px', marginLeft: '30px' }}>重置</Button>
208
+        </Form>
192 209
         <div style={{fontSize:'0.09rem',color:'#999',marginBottom:'0.16rem'}}>最多显示6个项目,其他项目请在下方详细数据中搜索</div>
193 210
         <Row>
194 211
           <Col span={12} style={{paddingRight:'0.08rem'}}>
@@ -225,4 +242,6 @@ class buildingStats extends React.Component {
225 242
   }
226 243
 }
227 244
 
228
-export default buildingStats
245
+const WrappedHeader = Form.create({ name: 'record' })(buildingStats);
246
+
247
+export default WrappedHeader