Ver código fonte

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

魏超 5 anos atrás
pai
commit
98de4c4a7f

+ 1
- 3
src/pages/building/list/add/components/base.jsx Ver arquivo

52
 
52
 
53
    // 获取详情信息
53
    // 获取详情信息
54
    function getById(currentId) {
54
    function getById(currentId) {
55
-    const { url, method } = apis.building.buildingGetById
56
-    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(currentId)
57
 
55
 
58
-    request({ url: tempUrl, method }).then(res => {
56
+    request({ ...apis.building.buildingGetById, urlData: { id: currentId } }).then(res => {
59
       res.openingDate = moment(res.openingDate)
57
       res.openingDate = moment(res.openingDate)
60
       res.receivedDate = moment(res.receivedDate)
58
       res.receivedDate = moment(res.receivedDate)
61
       res.avatarImage = res.buildingImg.map(item => item.url)
59
       res.avatarImage = res.buildingImg.map(item => item.url)

+ 2
- 8
src/pages/building/list/add/components/imageSet.jsx Ver arquivo

51
 
51
 
52
   function getList(params) {
52
   function getList(params) {
53
     // 网路请求
53
     // 网路请求
54
-    const { url, method } = apis.building.buildingApartment
55
-    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(props.building.buildingId)
56
-
57
-    request({ url: tempUrl, method, params: { ...params } }).then(res => {
54
+    request({ ...apis.building.buildingApartment, urlData: { id: props.building.buildingId }, params: { ...params } }).then(res => {
58
       setData(res)
55
       setData(res)
59
     }).catch(err => {
56
     }).catch(err => {
60
       openNotificationWithIcon('error', err.message)
57
       openNotificationWithIcon('error', err.message)
86
    */
83
    */
87
   function deleteApartment(record) {
84
   function deleteApartment(record) {
88
     // 网路请求
85
     // 网路请求
89
-    const { url, method } = apis.building.buildingApartmentDelete
90
-    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(record.apartmentId)
91
-
92
-    request({ url: tempUrl, method }).then(res => {
86
+    request({ ...apis.building.buildingApartmentDelete, urlData: { id: record.apartmentId } }).then(res => {
93
       getList()
87
       getList()
94
       openNotificationWithIcon('error', '操作成功')
88
       openNotificationWithIcon('error', '操作成功')
95
     }).catch(err => {
89
     }).catch(err => {

+ 1
- 4
src/pages/building/list/add/components/modalImage.jsx Ver arquivo

87
     }
87
     }
88
 
88
 
89
     // 网路请求
89
     // 网路请求
90
-    const { url, method } = apis.building.buildingApartmentGetById
91
-    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(apartmentId)
92
-
93
-    request({ url: tempUrl, method, params: { ...params } }).then(res => {
90
+    request({ ...apis.building.buildingApartmentGetById, urlData: { id: apartmentId }, params: { ...params } }).then(res => {
94
       // res.img = res.buildingImgList.map((item, _) => item.url)
91
       // res.img = res.buildingImgList.map((item, _) => item.url)
95
       res.img = res.buildingImgList.map(item => item.url)
92
       res.img = res.buildingImgList.map(item => item.url)
96
       this.props.form.setFieldsValue(res)
93
       this.props.form.setFieldsValue(res)

+ 2
- 4
src/pages/building/list/add/components/poster.jsx Ver arquivo

51
 
51
 
52
   // 获取详情信息
52
   // 获取详情信息
53
   function getById(currentId) {
53
   function getById(currentId) {
54
-    const { url, method } = apis.building.buildingGetById
55
-    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(currentId)
56
-
57
-    request({ url: tempUrl, method }).then(res => {
54
+ 
55
+    request({ ...apis.building.buildingGetById, urlData: { id: currentId } }).then(res => {
58
       setBuilding(res)
56
       setBuilding(res)
59
     })
57
     })
60
   }
58
   }

+ 1
- 5
src/pages/building/list/index.jsx Ver arquivo

77
    * @param {*} record
77
    * @param {*} record
78
    */
78
    */
79
   function deleteBuilding(record) {
79
   function deleteBuilding(record) {
80
-    const { url, method } = apis.building.deleteBuilding
81
-    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(record.buildingId)
82
-
83
     const modal = Modal.confirm();
80
     const modal = Modal.confirm();
84
     modal.update({
81
     modal.update({
85
       content: '确定删除此楼盘?',
82
       content: '确定删除此楼盘?',
86
       okText: '确认',
83
       okText: '确认',
87
       cancelText: '关闭',
84
       cancelText: '关闭',
88
       onOk: () => {
85
       onOk: () => {
89
-        request({ url: tempUrl, method }).then(() => {
86
+        request({ ...apis.building.deleteBuilding, urlData: { id: record.buildingId } }).then(() => {
90
           openNotificationWithIcon('success', '操作成功')
87
           openNotificationWithIcon('success', '操作成功')
91
           props.onSuccess()
88
           props.onSuccess()
92
         }).catch(err => {
89
         }).catch(err => {
245
           {getFieldDecorator('name')(
242
           {getFieldDecorator('name')(
246
             <Input
243
             <Input
247
               prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
244
               prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
248
-              type="password"
249
               placeholder="楼盘名称"
245
               placeholder="楼盘名称"
250
             />,
246
             />,
251
           )}
247
           )}

+ 1
- 4
src/pages/building/type/edi.jsx Ver arquivo

31
 
31
 
32
   // 获取详情信息
32
   // 获取详情信息
33
   function getById(currentId) {
33
   function getById(currentId) {
34
-    const { url, method } = apis.buildingType.getById
35
-    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(currentId)
36
-
37
-    request({ url: tempUrl, method }).then(res => {
34
+    request({ ...apis.buildingType.getById, urlData: { id: currentId } }).then(res => {
38
       data = res
35
       data = res
39
       props.form.setFieldsValue(res)
36
       props.form.setFieldsValue(res)
40
     })
37
     })

+ 6
- 1
src/pages/customer/independentList/index.jsx Ver arquivo

333
   }
333
   }
334
 
334
 
335
   function exportIndependen() {
335
   function exportIndependen() {
336
+    request({ ...apis.customer.customerRecommendAgentsExport, responseType: 'blob' })
337
+    .then(response => {
338
+      download(response)
339
+    }).catch(error => {
336
 
340
 
341
+    })
337
   }
342
   }
338
 
343
 
339
   function download(data) {
344
   function download(data) {
432
             </Button>
437
             </Button>
433
         </Form.Item>
438
         </Form.Item>
434
       </Form>
439
       </Form>
435
-      <Button type="primary" onClick={() => exportIndependen()} className={Styles.SubmitButton} style={{ marginTop: '5px', marginBottom: '5px', display: 'none' }}>
440
+      <Button type="primary" onClick={() => exportIndependen()} className={Styles.SubmitButton} style={{ marginTop: '5px', marginBottom: '5px' }}>
436
         导出数据
441
         导出数据
437
       </Button>
442
       </Button>
438
       <Table dataSource={dataSource.records} columns={columns} pagination={{ total: dataSource.total, onChange }} />
443
       <Table dataSource={dataSource.records} columns={columns} pagination={{ total: dataSource.total, onChange }} />

+ 2
- 2
src/pages/customer/recommendCustomer/index.jsx Ver arquivo

86
       ...apis.customer.customerRecommendRecommenderExport, 
86
       ...apis.customer.customerRecommendRecommenderExport, 
87
       responseType: 'blob',
87
       responseType: 'blob',
88
     }).then(response => {
88
     }).then(response => {
89
-      // console.log('response: ', response)
89
+      console.log('exportRecommendCustomer: ', response)
90
       download(response)
90
       download(response)
91
     }).catch(error => {
91
     }).catch(error => {
92
 
92
 
213
             </Button>
213
             </Button>
214
         </Form.Item>
214
         </Form.Item>
215
       </Form>
215
       </Form>
216
-      <Button type="primary" onClick={() => exportRecommendCustomer()} className={Styles.SubmitButton} style={{ marginTop: '5px', marginBottom: '5px', display: 'none' }}>
216
+      <Button type="primary" onClick={() => exportRecommendCustomer()} className={Styles.SubmitButton} style={{ marginTop: '5px', marginBottom: '5px' }}>
217
         导出数据
217
         导出数据
218
       </Button>
218
       </Button>
219
       <Table dataSource={dataSource.records} columns={columns} pagination={{ total: dataSource.total, onChange }} />
219
       <Table dataSource={dataSource.records} columns={columns} pagination={{ total: dataSource.total, onChange }} />

+ 5
- 2
src/pages/customer/report/index.jsx Ver arquivo

71
   }
71
   }
72
 
72
 
73
   function exportReport() {
73
   function exportReport() {
74
-
74
+    request({ ...apis.customer.customerRecommendReportExport, responseType: 'blob' })
75
+    .then(response => {
76
+      download(response)
77
+    })
75
   }
78
   }
76
 
79
 
77
   function download(data) {
80
   function download(data) {
176
             </Button>
179
             </Button>
177
         </Form.Item>
180
         </Form.Item>
178
       </Form>
181
       </Form>
179
-      <Button type="primary" onClick={() => exportReport()} className={Styles.SubmitButton} style={{ marginTop: '5px', marginBottom: '5px', display: 'none' }}>
182
+      <Button type="primary" onClick={() => exportReport()} className={Styles.SubmitButton} style={{ marginTop: '5px' }}>
180
         导出数据
183
         导出数据
181
       </Button>
184
       </Button>
182
       <Table style={{marginTop:'40px'}} dataSource={dataSource.records} columns={columns} pagination={{ total: dataSource.total, onChange }} />
185
       <Table style={{marginTop:'40px'}} dataSource={dataSource.records} columns={columns} pagination={{ total: dataSource.total, onChange }} />

+ 8
- 2
src/pages/indexEcharts/components/UserBehavior.jsx Ver arquivo

24
   //柱图
24
   //柱图
25
 
25
 
26
   useEffect(() => {
26
   useEffect(() => {
27
-    getUserBehaviorSummary(formatDate(props.startDate, props.endDate))
27
+    const date = formatDate(props.startDate, props.endDate)
28
+    getUserBehaviorSummary({
29
+      ...date,
30
+      activity: props.activity,
31
+      event: props.event,
32
+      eventType: props.eventType
33
+    })
28
     getUserBehaviorProfile(formatDate(props.startDate, props.endDate))
34
     getUserBehaviorProfile(formatDate(props.startDate, props.endDate))
29
 
35
 
30
-  }, [props.startDate, props.endDate])
36
+  }, [props.startDate, props.endDate, props.activity, props.event, props.eventType])
31
 
37
 
32
   function getUserBehaviorSummary(params) {
38
   function getUserBehaviorSummary(params) {
33
 
39
 

+ 4
- 1
src/pages/indexEcharts/components/UserSex.jsx Ver arquivo

42
     },
42
     },
43
     legend: {},
43
     legend: {},
44
     color: ['#FF7E48', '#dcdcdc'],
44
     color: ['#FF7E48', '#dcdcdc'],
45
-    tooltip: {},
45
+    tooltip: {
46
+      trigger: 'item',
47
+      formatter: "{b}: ({d}%)"
48
+    },
46
     series: {
49
     series: {
47
       type: 'pie',
50
       type: 'pie',
48
       name: '性别比例',
51
       name: '性别比例',

+ 20
- 17
src/pages/indexEcharts/components/UserSourcepie.jsx Ver arquivo

19
 
19
 
20
   useEffect(() => {
20
   useEffect(() => {
21
     userResource(formatDate(props.startDate, props.endDate))
21
     userResource(formatDate(props.startDate, props.endDate))
22
-   }, [props.startDate, props.endDate])
23
- 
24
-   function userResource (params) {
25
-     request({
26
-       ...apis.indexEcharts.userResource,
27
-       params,
28
-     }).then((data) => {
29
-       setData(data)
30
-     })
31
-   }
32
-
33
-  function toEdit () {
22
+  }, [props.startDate, props.endDate])
23
+
24
+  function userResource(params) {
25
+    request({
26
+      ...apis.indexEcharts.userResource,
27
+      params,
28
+    }).then((data) => {
29
+      setData(data)
30
+    })
31
+  }
32
+
33
+  function toEdit() {
34
     router.push({
34
     router.push({
35
       pathname: '/indexEcharts/userSource',
35
       pathname: '/indexEcharts/userSource',
36
     });
36
     });
47
       x: 'left',
47
       x: 'left',
48
       data: ['来源置业顾问', '来源全民经纪人', '自主进入'],
48
       data: ['来源置业顾问', '来源全民经纪人', '自主进入'],
49
     },
49
     },
50
-    tooltip: {},
50
+    tooltip: {
51
+      // trigger: 'item',
52
+      // formatter: "{a} <br/>{b} : {c} ({d}%)"
53
+    },
51
     series: [
54
     series: [
52
       {
55
       {
53
         type: 'pie',
56
         type: 'pie',
55
         radius: ['34%', '52%'],
58
         radius: ['34%', '52%'],
56
       },
59
       },
57
     ],
60
     ],
61
+
58
     dataset: {
62
     dataset: {
59
       id: 'pie',
63
       id: 'pie',
60
       source: [
64
       source: [
61
-        { '用户来源': '来源置业顾问', value: person_realty_consultant,},
65
+        { '用户来源': '来源置业顾问', value: person_realty_consultant, },
62
         { '用户来源': '来源全民经纪人', value: person_estate_agent },
66
         { '用户来源': '来源全民经纪人', value: person_estate_agent },
63
         { '用户来源': '自主进入', value: person_null },
67
         { '用户来源': '自主进入', value: person_null },
64
       ]
68
       ]
65
     },
69
     },
66
   }
70
   }
67
- 
71
+
68
 
72
 
69
   const piestyles = {
73
   const piestyles = {
70
     width: '100%',
74
     width: '100%',
71
     height: '400px',
75
     height: '400px',
72
-    minWidth:'350px',
76
+    minWidth: '350px',
73
   }
77
   }
74
 
78
 
75
-
76
   return (
79
   return (
77
     <>
80
     <>
78
       <div>
81
       <div>

+ 88
- 41
src/pages/indexEcharts/userBehavior.jsx Ver arquivo

13
 //   const endDate = moment(end).format('YYYY-MM-DDT23:59:59.999') + 'Z'
13
 //   const endDate = moment(end).format('YYYY-MM-DDT23:59:59.999') + 'Z'
14
 //   return { startDate, endDate }
14
 //   return { startDate, endDate }
15
 // }
15
 // }
16
+const { Option } = Select;
16
 
17
 
17
 const header = props => {
18
 const header = props => {
18
 
19
 
26
 
27
 
27
     setEndDate(new Date())
28
     setEndDate(new Date())
28
     setStartDate(moment().subtract(7, 'day').toDate())
29
     setStartDate(moment().subtract(7, 'day').toDate())
30
+    getBizEventType()
31
+    getBizEventList()
32
+    getProperties()
29
 
33
 
30
   }, [])
34
   }, [])
35
+  const [eventypes, setEventTypes] = useState([])
36
+  function getBizEventType(row) {
37
+
38
+    request({
39
+      ...apis.indexEcharts.bizEvent.dict,
40
+    }).then((data) => {
41
+      setEventTypes(data.records)
42
+
43
+    })
44
+  }
45
+  const [eventList, setEventList] = useState([])
46
+  function getBizEventList(row) {
47
+
48
+    request({
49
+      ...apis.indexEcharts.bizEvent.list,
50
+    }).then((data) => {
51
+      setEventList(data.records)
52
+      
53
+    })
54
+  }
55
+  const [properties, setProperties] = useState([])
56
+  function getProperties(row) {
57
+
58
+    request({
59
+      ...apis.indexEcharts.bizEvent.properties,
60
+    }).then((data) => {
61
+
62
+      setProperties(data.records)
63
+
64
+    })
65
+  }
31
 
66
 
32
   const { RangePicker } = DatePicker;
67
   const { RangePicker } = DatePicker;
33
 
68
 
42
 
77
 
43
     setEndDate(new Date())
78
     setEndDate(new Date())
44
     setStartDate(moment().subtract(days, 'day').toDate())
79
     setStartDate(moment().subtract(days, 'day').toDate())
45
-
46
   }
80
   }
47
 
81
 
48
-
49
   function datalist() {
82
   function datalist() {
50
 
83
 
51
     setEndDate(daterange[1])
84
     setEndDate(daterange[1])
58
 
91
 
59
     console.log('行为回调数据:', e)
92
     console.log('行为回调数据:', e)
60
   }
93
   }
61
-  function handleChange(value) {
62
-    console.log(`selected ${value}`);
94
+  const [eventType, setEventType] = useState('')
95
+  function handleChangeType(value) {
96
+    console.log(value,"1111111111111");
97
+    setEventType(value)
98
+  }
99
+  const [event, setEvent] = useState('')
100
+  function handleChangeEvent(value) {
101
+    console.log(value,"222222222222");
102
+    setEvent(value)
103
+  }
104
+  const [activity, setActivity] = useState('')
105
+  function handleChangeProperty(value) {
106
+    console.log(value,"33333333333333");
107
+    setActivity(value)
63
   }
108
   }
64
 
109
 
65
   const columns = [
110
   const columns = [
105
       borderRadius: '12px',
150
       borderRadius: '12px',
106
       minHeight: '60vh'
151
       minHeight: '60vh'
107
     }}>
152
     }}>
108
-    <div>
109
-    <Radio.Group buttonStyle="solid" defaultValue="a">
110
-        <Radio.Button value="a" onClick={getDataOf(7)}>最近7天</Radio.Button>
111
-        <Radio.Button value="b" onClick={getDataOf(30)}>最近1月</Radio.Button>
112
-      </Radio.Group>
113
-      <RangePicker
114
-        style={{ paddingLeft: '30px' }}
115
-        ranges={{
116
-          Today: [moment(), moment()],
117
-          'This Month': [moment().startOf('month'), moment().endOf('month')],
118
-        }}
119
-        showTime
120
-        onChange={onChangetime}
121
-      />
122
-      <Button type="primary" htmlType="submit" style={{ marginLeft: '30px',float:'right' }} onClick={datalist}>
123
-        搜索
153
+      <div>
154
+        <Radio.Group buttonStyle="solid" defaultValue="a">
155
+          <Radio.Button value="a" onClick={getDataOf(7)}>最近7天</Radio.Button>
156
+          <Radio.Button value="b" onClick={getDataOf(30)}>最近1月</Radio.Button>
157
+        </Radio.Group>
158
+        <RangePicker
159
+          style={{ paddingLeft: '30px' }}
160
+          ranges={{
161
+            Today: [moment(), moment()],
162
+            'This Month': [moment().startOf('month'), moment().endOf('month')],
163
+          }}
164
+          showTime
165
+          onChange={onChangetime}
166
+        />
167
+        <Button type="primary" htmlType="submit" style={{ marginLeft: '30px', float: 'right' }} onClick={datalist}>
168
+          搜索
124
       </Button>
169
       </Button>
125
-    </div>
126
-     
170
+      </div>
171
+
127
       <div style={{ display: 'flex', margin: '24px 0' }}>
172
       <div style={{ display: 'flex', margin: '24px 0' }}>
128
-      <BuildSelect slot='action' onChange={(e => handleBuildingChange(e))}></BuildSelect>
129
-        <Select placeholder="所有事件组" style={{ width: '14%',minWidth:'160px',marginLeft:'2%' }} onChange={handleChange}>
130
-          <Option value="jack">Jack</Option>
131
-          <Option value="lucy">Lucy</Option>
132
-          <Option value="Yiminghe">yiminghe</Option>
133
-        </Select>
134
-        <Select placeholder="请选择事件" style={{ width: '14%',minWidth:'160px',marginLeft:'2%' }} onChange={handleChange}>
135
-          <Option value="jack">Jack</Option>
136
-          <Option value="lucy">Lucy</Option>
137
-          <Option value="Yiminghe">yiminghe</Option>
138
-        </Select>
139
-        <Select placeholder="请选择属性" style={{ width: '14%',minWidth:'160px',marginLeft:'2%' }} onChange={handleChange}>
140
-          <Option value="jack">Jack</Option>
141
-          <Option value="lucy">Lucy</Option>
142
-          <Option value="Yiminghe">yiminghe</Option>
143
-        </Select>
173
+        <BuildSelect style={{ width: '14%', minWidth: '160px' }} slot='action' onChange={(e => handleBuildingChange(e))}></BuildSelect>
174
+       
175
+        <Select  style={{ width: '14%', minWidth: '160px', marginLeft: '2%' }} placeholder="所有事件组" onChange={handleChangeType}>
176
+          {eventypes.map(type => (
177
+            <Option key={type.typeId}>{type.typeName}</Option>
178
+          ))}
179
+      </Select>
180
+        <Select  style={{ width: '14%', minWidth: '200px', marginLeft: '2%' }} placeholder="请选择事件" onChange={handleChangeEvent}>
181
+          {eventList.map(event => (
182
+            <Option key={event.eventId}>{event.eventName}</Option>
183
+          ))}
184
+      </Select>
185
+        <Select  style={{ width: '14%', minWidth: '160px', marginLeft: '2%' }} placeholder="请选择属性" onChange={handleChangeProperty}>
186
+          {properties.map(property => (
187
+            <Option key={property.propertyId}>{property.propertyName}</Option>
188
+          ))}
189
+      </Select>
190
+     
144
       </div>
191
       </div>
145
-      
146
-      
192
+
193
+
147
       <div style={{ margin: '24px 0' }}>
194
       <div style={{ margin: '24px 0' }}>
148
-        <UserBehavior BuildSelectHide={true} endDate={endDate} startDate={startDate} dataZoom={true} onReData={(e) => redata(e)}></UserBehavior>
195
+        <UserBehavior BuildSelectHide={true} endDate={endDate} startDate={startDate}  eventType={eventType} activity={activity}  event={event} dataZoom={true} onReData={(e) => redata(e)}></UserBehavior>
149
       </div>
196
       </div>
150
 
197
 
151
       <Table dataSource={dataSource} columns={columns} pagination={false} scroll={{ y: 500 }} />
198
       <Table dataSource={dataSource} columns={columns} pagination={false} scroll={{ y: 500 }} />

+ 136
- 123
src/pages/indexEcharts/userSource.jsx Ver arquivo

9
 import apis from '../../services/apis';
9
 import apis from '../../services/apis';
10
 
10
 
11
 
11
 
12
+
13
+const { RangePicker } = DatePicker;
14
+const { Option } = Select
15
+
16
+
12
 // const formatDate = (start, end) => {
17
 // const formatDate = (start, end) => {
13
 //   const startDate = moment(start).format('YYYY-MM-DDT00:00:00.000') + 'Z'
18
 //   const startDate = moment(start).format('YYYY-MM-DDT00:00:00.000') + 'Z'
14
 //   const endDate = moment(end).format('YYYY-MM-DDT23:59:59.999') + 'Z'
19
 //   const endDate = moment(end).format('YYYY-MM-DDT23:59:59.999') + 'Z'
15
 //   return { startDate, endDate }
20
 //   return { startDate, endDate }
16
 // }
21
 // }
17
 
22
 
23
+let daterange = []
24
+let tableTitle = ['日期']
25
+
26
+const columns = [
27
+  {
28
+    title: '日期',
29
+    dataIndex: 'label',
30
+    key: 'label',
31
+    width:'20%'
32
+  },
33
+  {
34
+    title: '名片分享',
35
+    dataIndex: '名片分享',
36
+    key: '名片分享',
37
+  },
38
+  {
39
+    title: '生成海报',
40
+    dataIndex: '生成海报',
41
+    key: '生成海报',
42
+  },
43
+  {
44
+    title: '小程序搜索',
45
+    dataIndex: '小程序搜索',
46
+    key: '小程序搜索',
47
+  },
48
+  {
49
+    title: '好友分享',
50
+    dataIndex: '好友分享',
51
+    key: '好友分享',
52
+
53
+  },
54
+
55
+
56
+]
57
+
58
+class Header extends React.Component {
59
+
60
+  constructor(props) {
61
+    super(props)
62
+    this.state = {
63
+      dataSoures: [],
64
+      tableData: [],
65
+      userType: 'all',
66
+      endDate: {},
67
+      startDate: {}
68
+    }
69
+  }
18
 
70
 
19
-const header = props => {
20
-
21
-  const [tableData, setTableData] = useState([])
22
-  const [userType, setuserType] = useState([])
23
-  const [endDate, setEndDate] = useState({})
24
-  const [startDate, setStartDate] = useState({})
25
-  let daterange = []
71
+  componentDidMount() {
72
+    this.setState({ endDate: new Date(), startDate: moment().subtract(7, 'day').toDate() })
73
+  }
26
 
74
 
27
-  useEffect(() => {
28
-    setEndDate(new Date())
29
-    setStartDate(moment().subtract(7, 'day').toDate())
30
-    setuserType('all')
31
-  }, [])
32
 
75
 
33
-  const { RangePicker } = DatePicker;
34
 
76
 
35
-  function onChangetime(dates, dateStrings) {
77
+  formatDate = (start, end) => {
78
+    const tempStartDate = `${moment(start).format('YYYY-MM-DDT00:00:00.000')}Z`
79
+    const tempEndDate = `${moment(end).format('YYYY-MM-DDT23:59:59.999')}Z`
80
+    return { startDate: tempStartDate, endDate: tempEndDate }
81
+  }
36
 
82
 
83
+  onChangetime = (_dates, dateStrings) => {
37
     daterange[1] = dateStrings[1]
84
     daterange[1] = dateStrings[1]
38
     daterange[0] = dateStrings[0]
85
     daterange[0] = dateStrings[0]
39
-
40
   }
86
   }
41
 
87
 
42
-  const handleSubmit = (e, props) => {
88
+  handleSubmit = (e, props) => {
43
 
89
 
44
     e.preventDefault();
90
     e.preventDefault();
45
 
91
 
46
   }
92
   }
47
 
93
 
48
-  const getDataOf = (days) => () => {
49
-
50
-    setEndDate(new Date())
51
-    setStartDate(moment().subtract(days, 'day').toDate())
52
-
94
+  getDataOf = (days) => {
95
+    this.setState({ endDate: new Date(), startDate: moment().subtract(days, 'day').toDate() })
53
   }
96
   }
54
 
97
 
55
-  function datalist() {
56
-
57
-    setEndDate(daterange[1])
58
-    setStartDate(daterange[0])
59
-
98
+  datalist = () => {
99
+    this.setState({ endDate: daterange[1], startDate: daterange[0] })
60
   }
100
   }
61
 
101
 
102
+  onSuccess = e => {
103
+    this.setState({ dataSoures: e }, () => {
104
+      this.onTabledatas(e)
105
+    })
106
+  }
62
 
107
 
63
-  let tableTitle = ['日期']
64
-
65
-
66
-  function onTabledatas(e) {
67
-    const data = (e.data || []).reduce((acc, item, index) => {
108
+  onTabledatas = (e) => {
109
+    console.log('this.state.userType: ', this.state.userType)
110
+    const data = (e.data || []).reduce((acc, item) => {
68
       const { date, fromName, count, registered } = item
111
       const { date, fromName, count, registered } = item
69
-      const num = userType === 'registered' ? registered : count
112
+      const num = this.state.userType === 'registered' ? registered : count
70
 
113
 
71
       tableTitle = tableTitle.indexOf(fromName) > -1 ? tableTitle : tableTitle.concat(fromName) // eslint-disable-line
114
       tableTitle = tableTitle.indexOf(fromName) > -1 ? tableTitle : tableTitle.concat(fromName) // eslint-disable-line
72
       acc[date] = { ...acc[date], [`${fromName}`]: !num ? 0 : num }
115
       acc[date] = { ...acc[date], [`${fromName}`]: !num ? 0 : num }
74
       return acc
117
       return acc
75
     }, {})
118
     }, {})
76
 
119
 
77
-    setTableData(Object.keys(data).map(x => ({ label: x, ...data[x] })))
120
+    this.setState({ tableData: Object.keys(data).map(x => ({ label: x, ...data[x] })) })
78
 
121
 
79
   }
122
   }
80
 
123
 
81
-  const columns = [
82
-    {
83
-      title: '日期',
84
-      dataIndex: 'label',
85
-      key: 'label',
86
-      width:'20%'
87
-    },
88
-    {
89
-      title: '名片分享',
90
-      dataIndex: '名片分享',
91
-      key: '名片分享',
92
-    },
93
-    {
94
-      title: '生成海报',
95
-      dataIndex: '生成海报',
96
-      key: '生成海报',
97
-    },
98
-    {
99
-      title: '小程序搜索',
100
-      dataIndex: '小程序搜索',
101
-      key: '小程序搜索',
102
-    },
103
-    {
104
-      title: '好友分享',
105
-      dataIndex: '好友分享',
106
-      key: '好友分享',
107
-
108
-    },
109
-
110
-
111
-  ]
112
-
113
-  function handleSelectChange(e) {
114
-
115
-    console.log(e)
116
-    setuserType(e)
124
+  handleSelectChange = (e) => {
125
+    this.setState({ userType: e }, () => {
126
+      this.onTabledatas(this.state.dataSoures)
127
+    })
117
   }
128
   }
118
 
129
 
119
 
130
 
120
-
121
-  return (<>
122
-    <div style={{
123
-      backgroundColor: '#fff',
124
-      padding: '32PX 28px',
125
-      boxShadow: '0px 0px 16px 2px rgba(0,0,0,0.12)',
126
-      borderRadius: '12px',
127
-      minHeight: '60vh'
128
-    }}>
129
-      <Radio.Group buttonStyle="solid" defaultValue="a">
130
-        <Radio.Button value="a" onClick={getDataOf(7)}>最近7天</Radio.Button>
131
-        <Radio.Button value="b" onClick={getDataOf(30)}>最近1月</Radio.Button>
132
-      </Radio.Group>
133
-      <RangePicker
134
-        style={{ paddingLeft: '30px' }}
135
-        ranges={{
136
-          Today: [moment(), moment()],
137
-          'This Month': [moment().startOf('month'), moment().endOf('month')],
138
-        }}
139
-        showTime
140
-        // format="YYYY/MM/DD HH:mm:ss"
141
-        onChange={onChangetime}
142
-      />
143
-      <Button type="primary" htmlType="submit" style={{ marginLeft: '30px' }} onClick={datalist}>
144
-        查询
145
-          </Button>
146
-      <div>
147
-
148
-        <div style={{ display: 'flex' }}>
149
-          <div style={{
150
-            width: '1060px',
151
-            height: '560px',
152
-            paddingTop: '40px',
153
-            marginRight: ' 40px',
154
-          }}>
155
-            <UserSource BuildSelectHide={true} endDate={endDate} startDate={startDate} onSuccess={(e) => onTabledatas(e)}></UserSource>
156
-          </div>
157
-          <div style={{
158
-            width: '509px',
159
-            height: '600px',
160
-            paddingTop: '40px',
161
-
162
-          }}>
163
-            <UserSourcepie endDate={endDate} startDate={startDate}></UserSourcepie>
131
+  render() {
132
+    return (
133
+    <>
134
+      <div style={{
135
+        backgroundColor: '#fff',
136
+        padding: '32PX 28px',
137
+        boxShadow: '0px 0px 16px 2px rgba(0,0,0,0.12)',
138
+        borderRadius: '12px',
139
+        minHeight: '60vh'
140
+      }}>
141
+        <Radio.Group buttonStyle="solid" defaultValue="a">
142
+          <Radio.Button value="a" onClick={() => this.getDataOf(7)}>最近7天</Radio.Button>
143
+          <Radio.Button value="b" onClick={() => this.getDataOf(30)}>最近1月</Radio.Button>
144
+        </Radio.Group>
145
+        <RangePicker
146
+          style={{ paddingLeft: '30px' }}
147
+          ranges={{
148
+            Today: [moment(), moment()],
149
+            'This Month': [moment().startOf('month'), moment().endOf('month')],
150
+          }}
151
+          showTime
152
+          // format="YYYY/MM/DD HH:mm:ss"
153
+          onChange={(_dates, dateStrings) => this.onChangetime(_dates, dateStrings)}
154
+        />
155
+        <Button type="primary" htmlType="submit" style={{ marginLeft: '30px' }} onClick={() => this.datalist()}>
156
+          查询
157
+        </Button>
158
+        <div>
159
+  
160
+          <div style={{ display: 'flex' }}>
161
+            <div style={{
162
+              width: '1060px',
163
+              height: '560px',
164
+              paddingTop: '40px',
165
+              marginRight: ' 40px',
166
+            }}>
167
+              <UserSource BuildSelectHide={true} endDate={this.state.endDate} startDate={this.state.startDate} onSuccess={(e) => this.onSuccess(e)}></UserSource>
168
+            </div>
169
+            <div style={{
170
+              width: '509px',
171
+              height: '600px',
172
+              paddingTop: '40px',
173
+  
174
+            }}>
175
+              <UserSourcepie endDate={this.state.endDate} startDate={this.state.startDate}></UserSourcepie>
176
+            </div>
164
           </div>
177
           </div>
178
+          <Select style={{ width: '180px' }} placeholder="所有用户" onChange={(e) => this.handleSelectChange(e)}>
179
+            <Option value='all'>所有用户</Option>
180
+            <Option value='registered'>注册用户</Option>
181
+          </Select>
182
+  
183
+          <Table style={{marginTop:'20px'}} dataSource={this.state.tableData} columns={columns} pagination={false} scroll={{ y: 500 }}></Table>
165
         </div>
184
         </div>
166
-        <Select style={{ width: '180px' }} placeholder="所有用户" onChange={handleSelectChange}>
167
-          <Option value='all'>所有用户</Option>
168
-          <Option value='registered'>注册用户</Option>
169
-        </Select>
170
-
171
-        <Table style={{marginTop:'20px'}} dataSource={tableData} columns={columns} pagination={false} scroll={{ y: 500 }}></Table>
172
       </div>
185
       </div>
173
-    </div>
174
-  </>
175
-  )
186
+    </>
187
+    )
188
+  }
176
 }
189
 }
177
 
190
 
178
-export default header
191
+export default Header

+ 2
- 1
src/pages/staff/list/addRole.jsx Ver arquivo

29
   const [dataMenuId, setDataMenuId] = useState([])
29
   const [dataMenuId, setDataMenuId] = useState([])
30
   const [dataButtonId, setDataButtonId] = useState([])
30
   const [dataButtonId, setDataButtonId] = useState([])
31
 
31
 
32
-  const [loading, setLoading] = useState(true);
32
+  const [loading, setLoading] = useState(false);
33
 
33
 
34
   useEffect(() => {
34
   useEffect(() => {
35
     // 新增和编辑用一个页面
35
     // 新增和编辑用一个页面
64
 
64
 
65
   // 根据角色id查询当前的菜单及其按钮
65
   // 根据角色id查询当前的菜单及其按钮
66
   function buttonAndMenuList(params, ids) {
66
   function buttonAndMenuList(params, ids) {
67
+    setLoading(true)
67
     request({ ...apis.role.buttonAndMenuList, urlData: { id: ids }, params: { ...params } }).then(data => {
68
     request({ ...apis.role.buttonAndMenuList, urlData: { id: ids }, params: { ...params } }).then(data => {
68
       setLoading(false)
69
       setLoading(false)
69
       props.form.setFieldsValue({ roleName: data.roleName })
70
       props.form.setFieldsValue({ roleName: data.roleName })

+ 36
- 9
src/services/apis.js Ver arquivo

55
     },
55
     },
56
     buildingGetById: {
56
     buildingGetById: {
57
       method: 'GET',
57
       method: 'GET',
58
-      url: `${prefix}/buildingSelectId/id`,
58
+      url: `${prefix}/buildingSelectId/:id`,
59
       action: 'admin.buildingSelectId.id.get',
59
       action: 'admin.buildingSelectId.id.get',
60
     },
60
     },
61
     deleteBuilding: {
61
     deleteBuilding: {
62
       method: 'DELETE',
62
       method: 'DELETE',
63
-      url: `${prefix}/building/delete/id`,
63
+      url: `${prefix}/building/delete/:id`,
64
       action: 'admin.building.delete.id.delete',
64
       action: 'admin.building.delete.id.delete',
65
     },
65
     },
66
     buildingApartment: {
66
     buildingApartment: {
67
       method: 'GET',
67
       method: 'GET',
68
-      url: `${prefix}/buildingApartment/buildingId/id`,
68
+      url: `${prefix}/buildingApartment/buildingId/:id`,
69
       action: 'admin.buildingApartment.buildingId.id.get',
69
       action: 'admin.buildingApartment.buildingId.id.get',
70
     },
70
     },
71
     buildingApartmentGetById: {
71
     buildingApartmentGetById: {
72
       method: 'GET',
72
       method: 'GET',
73
-      url: `${prefix}/buildingApartment/id`,
73
+      url: `${prefix}/buildingApartment/:id`,
74
       action: 'admin.buildingApartment.id.get',
74
       action: 'admin.buildingApartment.id.get',
75
     },
75
     },
76
     buildingApartmentUpdate: {
76
     buildingApartmentUpdate: {
85
     },
85
     },
86
     buildingApartmentDelete: {
86
     buildingApartmentDelete: {
87
       method: 'DELETE',
87
       method: 'DELETE',
88
-      url: `${prefix}/apartment/deleted/id`,
88
+      url: `${prefix}/apartment/deleted/:id`,
89
       action: 'admin.apartment.deleted.id.delete',
89
       action: 'admin.apartment.deleted.id.delete',
90
     },
90
     },
91
     buildingSelect: {
91
     buildingSelect: {
102
     },
102
     },
103
     delete: {
103
     delete: {
104
       method: 'DELETE',
104
       method: 'DELETE',
105
-      url: `${prefix}/tdBuildingType/id`,
105
+      url: `${prefix}/tdBuildingType/:id`,
106
       action: 'admin.tdBuildingType.id.delete',
106
       action: 'admin.tdBuildingType.id.delete',
107
     },
107
     },
108
     update: {
108
     update: {
109
       method: 'PUT',
109
       method: 'PUT',
110
-      url: `${prefix}/tdBuildingType/id`,
110
+      url: `${prefix}/tdBuildingType/:id`,
111
       action: 'admin.tdBuildingType.id.put',
111
       action: 'admin.tdBuildingType.id.put',
112
     },
112
     },
113
     add: {
113
     add: {
117
     },
117
     },
118
     getById: {
118
     getById: {
119
       method: 'GET',
119
       method: 'GET',
120
-      url: `${prefix}/tdBuildingType/id`,
120
+      url: `${prefix}/tdBuildingType/:id`,
121
       action: 'admin.tdBuildingType.id.get',
121
       action: 'admin.tdBuildingType.id.get',
122
     },
122
     },
123
   },
123
   },
246
       url: `${prefix}/customer/recommend/recommender/export`,
246
       url: `${prefix}/customer/recommend/recommender/export`,
247
       action: 'admin.customer.recommend.recommender.export.get',
247
       action: 'admin.customer.recommend.recommender.export.get',
248
     },
248
     },
249
+    customerRecommendReportExport: { // 导出数据(报备客户)
250
+      method: 'GET',
251
+      url: `${prefix}/customer/recommend/report/export`,
252
+      action: 'admin.customer.recommend.report.export.get',
253
+    },
254
+    customerRecommendAgentsExport: { // 导出数据(经纪人)
255
+      method: 'GET',
256
+      url: `${prefix}/customer/recommend/agents/export`,
257
+      action: 'admin.customer.recommend.agents.export.get',
258
+    },
249
   },
259
   },
250
   indexEcharts: {
260
   indexEcharts: {
251
     userResource: {
261
     userResource: {
265
         action: 'behaviorIncident',
275
         action: 'behaviorIncident',
266
       },
276
       },
267
     },
277
     },
278
+    bizEvent: {
279
+      dict: {
280
+        method:'get',
281
+        url: `${prefix}/tdBizEventType`,
282
+        action:'select',
283
+      },
284
+      list: {
285
+        method:'get',
286
+        url: `${prefix}/tdBizEvent`,
287
+        action:'select',
288
+      },
289
+      properties: {
290
+        method:'get',
291
+        url: `${prefix}/taEventProperties`,
292
+        action:'select',
293
+      },
294
+    },
268
     userActive: {
295
     userActive: {
269
       method: 'GET',
296
       method: 'GET',
270
       url: `${prefix}/selectActiveUserCount`,
297
       url: `${prefix}/selectActiveUserCount`,
571
     getListInvite: {
598
     getListInvite: {
572
       url: `${prefix}/channel/InviteClientsList`,
599
       url: `${prefix}/channel/InviteClientsList`,
573
       method: 'GET',
600
       method: 'GET',
574
-      action: 'admin.InviteClientsList.get',
601
+      action: 'admin.channel.InviteClientsList.get',
575
     },
602
     },
576
  },
603
  },
577
  role: {
604
  role: {

+ 7
- 3
src/utils/request.js Ver arquivo

58
         requestType: data instanceof FormData ? 'form' : 'json',
58
         requestType: data instanceof FormData ? 'form' : 'json',
59
         credentials: 'include', // 带 cookie
59
         credentials: 'include', // 带 cookie
60
         interceptors: true,
60
         interceptors: true,
61
-        getResponse: true
61
+        getResponse: true,
62
       },
62
       },
63
     }
63
     }
64
   );
64
   );
76
       });
76
       });
77
       throw new Error(response.statusText);
77
       throw new Error(response.statusText);
78
     } else {
78
     } else {
79
-      // console.log('response: ', response)
80
-      // console.log('response.headers: ', response.headers)
79
+      console.log('response.headers: ', response.headers)
80
+      console.log('response.headers.Content-Type: ', response.headers.get('Content-Type'))
81
+      if (response.headers.get('Content-Type') === 'application/octet-stream;charset=utf-8') {
82
+        return await response.clone().blob();
83
+      }
84
+
81
       const { code, data, message } = await response.clone().json();
85
       const { code, data, message } = await response.clone().json();
82
       if (code != 1000) {
86
       if (code != 1000) {
83
         notification.error({
87
         notification.error({