魏熙美 5 年之前
父節點
當前提交
52655ac016

+ 15
- 2
src/pages/activity/ActivityList.jsx 查看文件

@@ -17,6 +17,7 @@ const header = props => {
17 17
   // eslint-disable-next-line react-hooks/rules-of-hooks
18 18
   const [data, setData] = useState({ list: [], total: 0 })
19 19
   //   const [page, changePage] = useState({})
20
+  const [time, setTime] = useState('')
20 21
 
21 22
   // 查询列表
22 23
   const getList = params => {
@@ -228,7 +229,12 @@ const header = props => {
228 229
     props.form.validateFields((err, values) => {
229 230
       if (!err) {
230 231
         console.log('提交数据: ', values)
231
-        values.time = `${moment(values.time).format('YYYY-MM-DDT00:00:00.000')}Z`
232
+        if (time) {
233
+          values.time = `${moment(time).format('YYYY-MM-DDT00:00:00.000')}Z`
234
+        } else {
235
+          values.time = null
236
+        }
237
+        
232 238
         getList({ pageNum: 1, pageSize: 10, ...values })
233 239
       }
234 240
     });
@@ -237,9 +243,16 @@ const header = props => {
237 243
   // 重置搜索
238 244
   function handleReset () {
239 245
     props.form.resetFields();
246
+    setTime('')
240 247
     getList({ pageNum: 1, pageSize: 10 })
241 248
   }
242 249
 
250
+  // 时间回调
251
+  function timeOnChange(date, dateString) {
252
+    console.log(date, dateString)
253
+    setTime(date)
254
+  }
255
+
243 256
 
244 257
   const { getFieldDecorator } = props.form
245 258
   return (
@@ -268,7 +281,7 @@ const header = props => {
268 281
         </Form.Item>
269 282
         <Form.Item>
270 283
           {getFieldDecorator('time')(
271
-            <DatePicker />,
284
+            <DatePicker onChange={timeOnChange}/>,
272 285
           )}
273 286
         </Form.Item>
274 287
         <Form.Item>

+ 14
- 9
src/pages/building/list/add/components/base.jsx 查看文件

@@ -40,14 +40,15 @@ function openNotificationWithIcon(type, message) {
40 40
 function AddBuilding(props) {
41 41
   const { getFieldDecorator } = props.form;
42 42
 
43
+  console.log('props.building: ', props.building)
43 44
   if (props.building.buildingId !== undefined) {
44 45
     const { buildingId } = props.building
45
-    if (buildingId !== '') {
46
-      // eslint-disable-next-line react-hooks/rules-of-hooks
47
-      useEffect(() => {
46
+     // eslint-disable-next-line react-hooks/rules-of-hooks
47
+     useEffect(() => {
48
+      if (buildingId !== '') {
48 49
         getById(buildingId)
49
-      }, [])
50
-    }
50
+      }
51
+    }, [])
51 52
   }
52 53
 
53 54
    // 获取详情信息
@@ -67,6 +68,7 @@ function AddBuilding(props) {
67 68
       res.avatarImage = res.buildingImg.map(item => item.url)
68 69
       res.mapCoordinate = res.coordinate
69 70
       props.form.setFieldsValue(res)
71
+      props.onSuccess(res)
70 72
     })
71 73
   }
72 74
 
@@ -89,9 +91,10 @@ function AddBuilding(props) {
89 91
     }
90 92
 
91 93
     const api = data.buildingId === undefined ? apis.building.addBuilding : apis.building.updateBuilding
92
-    request({ ...api, data: { ...data } }).then(() => {
94
+    request({ ...api, data: { ...data } }).then(res => {
93 95
       openNotificationWithIcon('success', '操作成功')
94
-      router.go(-1)
96
+      // router.go(-1)
97
+      getById(res.buildingId)
95 98
     }).catch(err => {
96 99
       openNotificationWithIcon('error', err.message)
97 100
     })
@@ -99,7 +102,7 @@ function AddBuilding(props) {
99 102
 
100 103
   return (
101 104
         <Form {...formItemLayout} onSubmit={handleSubmit}>
102
-          <Form.Item label="项目Id"  style={{ display: 'none' }}>
105
+          <Form.Item label="项目Id" style={{ display: 'none' }}>
103 106
             {getFieldDecorator('buildingId')(<Input disabled />)}
104 107
           </Form.Item>
105 108
           <Form.Item label="楼盘编号" >
@@ -190,7 +193,9 @@ function AddBuilding(props) {
190 193
             {getFieldDecorator('discount')(<Input />)}
191 194
           </Form.Item>
192 195
           <Form.Item label="首页推荐" >
193
-            {getFieldDecorator('isMain')(
196
+            {getFieldDecorator('isMain',{
197
+              initialValue: 1,
198
+            })(
194 199
             <Radio.Group>
195 200
               <Radio value={1}>是</Radio>
196 201
               <Radio value={2}>否</Radio>

+ 12
- 6
src/pages/building/list/add/index.jsx 查看文件

@@ -33,20 +33,26 @@ const formItemLayout = {
33 33
 function AddBuilding(props) {
34 34
 
35 35
   const [tab, setTab] = useState('base')
36
+  const [buildingData, setBuildingData] = useState({ buildingId: undefined })
36 37
 
37 38
   function tabsCallback(e) {
38 39
     console.log(e);
39 40
     setTab(e.target.value)
40 41
   }
41 42
 
42
-  // console.log(props.location)
43
+  // building 回调
44
+  function buildingOnSuccess(e) {
45
+    setBuildingData(e)
46
+  }
47
+
48
+  console.log('buildingData: ', buildingData)
43 49
 
44 50
   return (
45 51
     <>
46 52
       <Radio.Group value={ tab } buttonStyle="solid" onChange={e => tabsCallback(e)}>
47 53
         <Radio.Button value="base">基本信息</Radio.Button>
48 54
         {
49
-          props.location.query.id &&
55
+          buildingData.buildingId &&
50 56
           (
51 57
             <>
52 58
               <Radio.Button value="image">户型库</Radio.Button>
@@ -57,10 +63,10 @@ function AddBuilding(props) {
57 63
         }
58 64
       </Radio.Group>
59 65
       <div style={{ marginTop: '20px' }}>
60
-        { tab === 'base' && <Base building={{ buildingId: props.location.query && props.location.query.id }} /> }
61
-        { props.location.query.id && (tab === 'image' && <ImageSet building={{ buildingId: props.location.query && props.location.query.id }} />)}
62
-        { props.location.query.id && (tab === 'poster' && <Poster building={{ buildingId: props.location.query && props.location.query.id }} />)}
63
-        { props.location.query.id && (tab === 'share' && <Share building={{ buildingId: props.location.query && props.location.query.id }} />)}
66
+        { tab === 'base' && <Base building={{ buildingId: buildingData.buildingId || (props.location.query && props.location.query.id) }} onSuccess={e => buildingOnSuccess(e)}/> }
67
+        { buildingData.buildingId && (tab === 'image' && <ImageSet building={buildingData} />)}
68
+        { buildingData.buildingId && (tab === 'poster' && <Poster building={buildingData} />)}
69
+        { buildingData.buildingId && (tab === 'share' && <Share building={buildingData} />)}
64 70
       </div>
65 71
     </>
66 72
     // <Tabs defaultActiveKey="1" onChange={tabsCallback}>

+ 1
- 1
src/pages/building/list/index.jsx 查看文件

@@ -292,7 +292,7 @@ function body(props) {
292 292
           {getFieldDecorator('isMain')(
293 293
             <Select style={{ width: '180px' }} placeholder="首页推荐" onChange={handleSelectChange}>
294 294
               <Option value="1">首页推荐</Option>
295
-              <Option value="0">首页未推荐</Option>
295
+              <Option value="2">首页未推荐</Option>
296 296
             </Select>,
297 297
           )}
298 298
         </Form.Item>

+ 105
- 72
src/pages/indexEcharts/userBehavior.jsx 查看文件

@@ -1,12 +1,13 @@
1 1
 import React, { Component, useState, useEffect } from 'react';
2
-import { Radio, DatePicker, Form, Input, Button, Icon, Select, message, Table } from 'antd';
3
-import { Row, Col, Menu, Dropdown } from 'antd';
4
-import UserBehavior from './components/UserBehavior'
2
+import { Radio, DatePicker, Form, Input, Button, Icon, Select, message, Table , Row, Col, Menu, Dropdown } from 'antd';
3
+
5 4
 import moment from 'moment';
5
+import UserBehavior from './components/UserBehavior'
6 6
 import EChart from '../../components/EchartsTest/EChart';
7 7
 import request from '../../utils/request';
8 8
 import apis from '../../services/apis';
9 9
 import BuildSelect from '../../components/SelectButton/BuildSelect'
10
+import { func } from 'prop-types';
10 11
 
11 12
 // const formatDate = (start, end) => {
12 13
 //   const startDate = moment(start).format('YYYY-MM-DDT00:00:00.000') + 'Z'
@@ -16,77 +17,73 @@ import BuildSelect from '../../components/SelectButton/BuildSelect'
16 17
 const { Option } = Select;
17 18
 
18 19
 const header = props => {
19
-
20
+  // eslint-disable-next-line react-hooks/rules-of-hooks
20 21
   const [tableData, setTableData] = useState({ records: [] })
21 22
 
23
+  // eslint-disable-next-line react-hooks/rules-of-hooks
22 24
   const [endDate, setEndDate] = useState({})
25
+  // eslint-disable-next-line react-hooks/rules-of-hooks
23 26
   const [startDate, setStartDate] = useState({})
24
-  let daterange = []
27
+  const daterange = []
25 28
 
29
+  // eslint-disable-next-line react-hooks/rules-of-hooks
26 30
   useEffect(() => {
27
-
31
+    window.scrollTo(0, 0)
28 32
     setEndDate(new Date())
29 33
     setStartDate(moment().subtract(7, 'day').toDate())
30 34
     getBizEventType()
31 35
     getBizEventList()
32 36
     getProperties()
33
-  
34
-    
37
+    props.form.setFieldsValue({ radioGroup: 'a' })
35 38
   }, [])
36
- 
39
+
40
+  // eslint-disable-next-line react-hooks/rules-of-hooks
37 41
   const [eventypes, setEventTypes] = useState([])
38 42
   function getBizEventType(row) {
39
-
40 43
     request({
41 44
       ...apis.indexEcharts.bizEvent.dict,
42
-    }).then((data) => {
45
+    }).then(data => {
43 46
       const eventType = ['agent', 'main']
44 47
       setEventTypes(data.records.filter(item => !eventType.includes(item.typeId)))
45 48
     })
46 49
   }
47 50
   const [eventList, setEventList] = useState([])
48 51
   function getBizEventList(row) {
49
-
50 52
     request({
51 53
       ...apis.indexEcharts.bizEvent.list,
52
-    }).then((data) => {
54
+    }).then(data => {
53 55
       setEventList(data.records)
54
-      
55 56
     })
56 57
   }
57 58
   const [properties, setProperties] = useState([])
58 59
   function getProperties(row) {
59
-
60 60
     request({
61 61
       ...apis.indexEcharts.bizEvent.properties,
62
-    }).then((data) => {
63
-
62
+    }).then(data => {
64 63
       setProperties(data.records)
65
-
66 64
     })
67 65
   }
68 66
 
69 67
   const { RangePicker } = DatePicker;
70 68
 
71
-  function onChangetime(dates, dateStrings) {
72
-
73
-    daterange[1] = dateStrings[1]
74
-    daterange[0] = dateStrings[0]
75 69
 
70
+  function handleSubmit(e) {
71
+    e.preventDefault();
72
+    props.form.validateFields((err, values) => {
73
+      if (!err) {
74
+        const { rangePicker } = values
75
+        console.log('Received values of form: ', values.rangePicker);
76
+        setEndDate(rangePicker[1])
77
+        setStartDate(rangePicker[0])
78
+      }
79
+    });
76 80
   }
77 81
 
78
-  const getDataOf = (days) => () => {
79
-
82
+  const getDataOf = days => () => {
80 83
     setEndDate(new Date())
81 84
     setStartDate(moment().subtract(days, 'day').toDate())
82 85
   }
83 86
 
84
-  function datalist() {
85
-
86
-    setEndDate(daterange[1])
87
-    setStartDate(daterange[0])
88
-
89
-  }
90 87
 
91 88
   function redata(e) {
92 89
     console.log('行为回调数据:', e)
@@ -109,6 +106,12 @@ const header = props => {
109 106
     setBuildingId(value)
110 107
   }
111 108
 
109
+  // 重置
110
+  function resetQuery() {
111
+    props.form.resetFields()
112
+    props.form.setFieldsValue({ radioGroup: 'a' })
113
+  }
114
+
112 115
   const columns = [
113 116
     {
114 117
       title: '访问事件',
@@ -144,52 +147,80 @@ const header = props => {
144 147
 
145 148
   const dataSource = []
146 149
 
147
-  return (<>
150
+  const { getFieldDecorator, getFieldsError, getFieldError, isFieldTouched } = props.form;
151
+  return (
152
+  <>
148 153
     <div>
149 154
       <div>
150
-        <Radio.Group buttonStyle="solid" defaultValue="a">
151
-          <Radio.Button value="a" onClick={getDataOf(7)}>最近7天</Radio.Button>
152
-          <Radio.Button value="b" onClick={getDataOf(30)}>最近1月</Radio.Button>
153
-        </Radio.Group>
154
-        <RangePicker
155
-          style={{ paddingLeft: '30px', width: '400px' }}
156
-          ranges={{
157
-            Today: [moment(), moment()],
158
-            'This Month': [moment().startOf('month'), moment().endOf('month')],
159
-          }}
160
-          // 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')]}
161
-          showTime
162
-          onChange={onChangetime}
163
-        />
164
-        <Button type="primary" htmlType="submit" style={{ marginLeft: '30px', float: 'right' }} onClick={datalist}>
165
-          搜索
166
-      </Button>
167
-      </div>
168
-
169
-      <div style={{ display: 'flex', margin: '24px 0' }}>
170
-        <BuildSelect style={{ width: '14%', minWidth: '160px' }} slot='action' onChange={(e => handleBuildingChange(e))}></BuildSelect>
171
-       
172
-        <Select style={{ width: '14%', minWidth: '160px', marginLeft: '2%' }} placeholder="所有事件组" onChange={handleChangeType}>
173
-          {eventypes.map(type => (
174
-            <Option key={type.typeId}>{type.typeName}</Option>
175
-          ))}
176
-      </Select>
177
-        <Select style={{ width: '14%', minWidth: '200px', marginLeft: '2%' }} placeholder="请选择事件" onChange={handleChangeEvent}>
178
-          {eventList.map(event => (
179
-            <Option key={event.eventId}>{event.eventName}</Option>
180
-          ))}
181
-      </Select>
182
-        <Select style={{ width: '14%', minWidth: '160px', marginLeft: '2%' }} placeholder="请选择属性" onChange={handleChangeProperty}>
183
-          {properties.map(property => (
184
-            <Option key={property.propertyId}>{property.propertyName}</Option>
185
-          ))}
186
-      </Select>
187
-     
155
+        <Form layout="inline" onSubmit={handleSubmit}>
156
+          <Form.Item>
157
+            {getFieldDecorator('radioGroup')(
158
+              <Radio.Group buttonStyle="solid">
159
+                <Radio.Button value="a" onClick={getDataOf(7)}>最近7天</Radio.Button>
160
+                <Radio.Button value="b" onClick={getDataOf(30)}>最近1月</Radio.Button>
161
+              </Radio.Group>,
162
+            )}
163
+          </Form.Item>
164
+          <Form.Item>
165
+            {getFieldDecorator('rangePicker')(
166
+              <RangePicker
167
+                style={{ paddingLeft: '30px', width: '400px' }}
168
+                ranges={{
169
+                  Today: [moment(), moment()],
170
+                  'This Month': [moment().startOf('month'), moment().endOf('month')],
171
+                }}
172
+                // 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')]}
173
+                showTime
174
+              />,
175
+            )}
176
+          </Form.Item>
177
+
178
+            <Button type="primary" htmlType="submit" style={{ marginLeft: '30px', float: 'right' }}>
179
+              搜索
180
+            </Button>
181
+            <Button style={{ marginLeft: '30px', float: 'right' }} onClick={resetQuery}>
182
+              重置
183
+            </Button>
184
+
185
+          <div style={{ display: 'flex', margin: '24px 0' }}>
186
+            <Form.Item>
187
+              {getFieldDecorator('buildingId')(
188
+                <BuildSelect style={{ width: '14%', minWidth: '160px' }} slot="action" onChange={(e => handleBuildingChange(e))}></BuildSelect>,
189
+              )}
190
+            </Form.Item>
191
+            <Form.Item>
192
+              {getFieldDecorator('handleType')(
193
+                <Select style={{ width: '14%', minWidth: '160px', marginLeft: '2%' }} placeholder="所有事件组" onChange={handleChangeType}>
194
+                    {eventypes.map(type => (
195
+                      <Option key={type.typeId}>{type.typeName}</Option>
196
+                    ))}
197
+                </Select>,
198
+              )}
199
+            </Form.Item>
200
+            <Form.Item>
201
+              {getFieldDecorator('handleEvent')(
202
+                 <Select style={{ width: '14%', minWidth: '200px', marginLeft: '2%' }} placeholder="请选择事件" onChange={handleChangeEvent}>
203
+                      {eventList.map(event => (
204
+                        <Option key={event.eventId}>{event.eventName}</Option>
205
+                      ))}
206
+                  </Select>,
207
+              )}
208
+            </Form.Item>
209
+            <Form.Item>
210
+              {getFieldDecorator('handleProperty')(
211
+                 <Select style={{ width: '14%', minWidth: '160px', marginLeft: '2%' }} placeholder="请选择属性" onChange={handleChangeProperty}>
212
+                    {properties.map(property => (
213
+                      <Option key={property.propertyId}>{property.propertyName}</Option>
214
+                    ))}
215
+                </Select>,
216
+              )}
217
+            </Form.Item>
218
+          </div>
219
+        </Form>
188 220
       </div>
189 221
 
190
-
191 222
       <div style={{ margin: '24px 0' }}>
192
-        <UserBehavior tableShow={true} BuildSelectHide={true} buildingId={buildingId} endDate={endDate} startDate={startDate}  eventType={eventType} activity={activity}  event={event} dataZoom={true} onReData={(e) => redata(e)}></UserBehavior>
223
+       <UserBehavior tableShow BuildSelectHide buildingId={buildingId} endDate={endDate} startDate={startDate} eventType={eventType} activity={activity} event={event} dataZoom onReData={e => redata(e)}></UserBehavior>
193 224
       </div>
194 225
 
195 226
       {/* <Table dataSource={dataSource} columns={columns} pagination={false} scroll={{ y: 500 }} /> */}
@@ -197,4 +228,6 @@ const header = props => {
197 228
   </>
198 229
   )
199 230
 }
200
-export default header
231
+
232
+const WrappedHorizontalLoginForm = Form.create({ name: 'header' })(header);
233
+export default WrappedHorizontalLoginForm

+ 14
- 14
src/pages/integralMall/achieve.jsx 查看文件

@@ -132,25 +132,25 @@ const columns = [
132 132
             <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current}/>
133 133
           </div>
134 134
         </TabPane>
135
-        <TabPane tab="项目积分" key="project">
136
-        <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
137
-            <Form.Item>
138
-              {getFieldDecorator('buildingId')(
139
-                <BuildSelect />,
140
-              )}
141
-            </Form.Item>
142
-             
143
-            <Form.Item>
144
-              <Button type="primary" htmlType="submit" className={styles.searchBtn}>
145
-                搜索
146
-              </Button>
147
-            </Form.Item>
135
+        {/* <TabPane tab="项目积分" key="project">
136
+          <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
137
+              <Form.Item>
138
+                {getFieldDecorator('buildingId')(
139
+                  <BuildSelect />,
140
+                )}
141
+              </Form.Item>
142
+              
143
+              <Form.Item>
144
+                <Button type="primary" htmlType="submit" className={styles.searchBtn}>
145
+                  搜索
146
+                </Button>
147
+              </Form.Item>
148 148
           </Form>
149 149
           <Table rowKey="achie" style={{ marginTop: '40px' }} dataSource={data.records} columns={columns} pagination={false}/>
150 150
           <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
151 151
             <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current}/>
152 152
           </div>
153
-        </TabPane>
153
+        </TabPane> */}
154 154
       </Tabs>,
155 155
     </>
156 156
   )