xujing 5 년 전
부모
커밋
467f0f3009
2개의 변경된 파일118개의 추가작업 그리고 118개의 파일을 삭제
  1. 31
    31
      src/pages/statistical/building/component/StatsChart.jsx
  2. 87
    87
      src/pages/statistical/building/index.jsx

+ 31
- 31
src/pages/statistical/building/component/StatsChart.jsx 파일 보기

13
   }
13
   }
14
 
14
 
15
   render() {
15
   render() {
16
-    const { data = {}} = this.props
16
+    const { data = {} } = this.props
17
     const options = {
17
     const options = {
18
       title: {
18
       title: {
19
         text: this.props.title,
19
         text: this.props.title,
20
         subtext: this.props.subtext,
20
         subtext: this.props.subtext,
21
-    },
22
-    xAxis: {
21
+      },
22
+      xAxis: {
23
         type: 'category',
23
         type: 'category',
24
-        axisLabel: {rotate: 45},
24
+        axisLabel: { rotate: 45 },
25
         data: data.buildingNameList || []
25
         data: data.buildingNameList || []
26
-    },
27
-    grid: {
28
-      bottom:'30%'
29
-    },  
30
-    tooltip: {},
31
-    yAxis: {
26
+      },
27
+      grid: {
28
+        bottom: '30%'
29
+      },
30
+      tooltip: {},
31
+      yAxis: {
32
         type: 'value'
32
         type: 'value'
33
-    },
34
-    series: {
35
-      type: 'bar',
36
-      name: this.props.title,
37
-      barWidth: 50,
38
-      data: data.numList || [],
39
-      itemStyle: {
40
-        normal: {
41
-          barBorderRadius: [50, 50, 0, 0],
42
-          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
43
-            offset: 0,
44
-            color: '#FD8A95'
45
-          }, {
46
-            offset: 1,
47
-            color: '#F13043'
48
-          }]),
49
-          shadowColor: 'rgba(0, 0, 0, 0.4)',
33
+      },
34
+      series: {
35
+        type: 'bar',
36
+        name: this.props.title,
37
+        barWidth: 50,
38
+        data: data.numList || [],
39
+        itemStyle: {
40
+          normal: {
41
+            barBorderRadius: [50, 50, 0, 0],
42
+            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
43
+              offset: 0,
44
+              color: '#FD8A95'
45
+            }, {
46
+              offset: 1,
47
+              color: '#F13043'
48
+            }]),
49
+            shadowColor: 'rgba(0, 0, 0, 0.4)',
50
 
50
 
51
+          }
51
         }
52
         }
52
       }
53
       }
53
     }
54
     }
54
-}
55
 
55
 
56
     return (
56
     return (
57
-    <>
58
-      <EChart options={options} style={{ width: '100%', height: '400px', }} />
59
-    </>
57
+      <>
58
+        <EChart options={options} style={{ width: '100%', height: '400px', padding: '0.09rem 0 0 0.09rem', boxShadow: '0px 0px 16px 2px rgba(0, 0, 0, 0.12)', marginBottom: '0.16rem', borderRadius: '12px' }} />
59
+      </>
60
     )
60
     )
61
   }
61
   }
62
 }
62
 }

+ 87
- 87
src/pages/statistical/building/index.jsx 파일 보기

32
   }
32
   }
33
 
33
 
34
   componentDidMount() {
34
   componentDidMount() {
35
-    this.getBarData(moment().subtract(7, 'day').toDate(),new Date())
36
-    this.getTableData(moment().subtract(7, 'day').toDate(),new Date(),this.state.buildingId)
37
-    this.setState({...this.state, endDate: new Date(), startDate: moment().subtract(7, 'day').toDate() })
38
-    
35
+    this.getBarData(moment().subtract(7, 'day').toDate(), new Date())
36
+    this.getTableData(moment().subtract(7, 'day').toDate(), new Date(), this.state.buildingId)
37
+    this.setState({ ...this.state, endDate: new Date(), startDate: moment().subtract(7, 'day').toDate() })
38
+
39
   }
39
   }
40
 
40
 
41
   // 获取图表数据
41
   // 获取图表数据
42
   getBarData = (startDate, endDate) => {
42
   getBarData = (startDate, endDate) => {
43
     request({ ...apis.stats.barList, params: { startDate, endDate } }).then((data) => {
43
     request({ ...apis.stats.barList, params: { startDate, endDate } }).then((data) => {
44
-        this.setState({...this.state, barData: data})
45
-      })
44
+      this.setState({ ...this.state, barData: data })
45
+    })
46
   }
46
   }
47
 
47
 
48
   //获取表格数据
48
   //获取表格数据
49
-  getTableData = (startDate, endDate, buildingId,pageNum,pageSize,sortField,sortOrder) => {
50
-    request({ ...apis.stats.tableList, params: { startDate, endDate, buildingId,pageNum,pageSize,sortField,sortOrder } }).then((data) => {
51
-        this.setState({...this.state, tableData: data.records, total: data.total})
52
-      })
49
+  getTableData = (startDate, endDate, buildingId, pageNum, pageSize, sortField, sortOrder) => {
50
+    request({ ...apis.stats.tableList, params: { startDate, endDate, buildingId, pageNum, pageSize, sortField, sortOrder } }).then((data) => {
51
+      this.setState({ ...this.state, tableData: data.records, total: data.total })
52
+    })
53
   }
53
   }
54
 
54
 
55
   formatDate = (start, end) => {
55
   formatDate = (start, end) => {
66
 
66
 
67
   //切换三个标签页
67
   //切换三个标签页
68
   getDataOf = (days) => {
68
   getDataOf = (days) => {
69
-    this.getBarData(moment().subtract(days, 'day').toDate(),new Date())
70
-    this.getTableData(moment().subtract(days, 'day').toDate(),new Date(),this.state.buildingId)
69
+    this.getBarData(moment().subtract(days, 'day').toDate(), new Date())
70
+    this.getTableData(moment().subtract(days, 'day').toDate(), new Date(), this.state.buildingId)
71
     this.setState({ ...this.state, endDate: new Date(), startDate: moment().subtract(days, 'day').toDate() })
71
     this.setState({ ...this.state, endDate: new Date(), startDate: moment().subtract(days, 'day').toDate() })
72
   }
72
   }
73
 
73
 
74
   //点击查询
74
   //点击查询
75
   datalist = () => {
75
   datalist = () => {
76
-    this.getBarData(daterange[0] === undefined ? moment().subtract(7, 'day').toDate() : daterange[0],daterange[1] === undefined ? new Date() : daterange[1])
77
-    this.getTableData(daterange[0] === undefined ? moment().subtract(7, 'day').toDate() : daterange[0],daterange[1] === undefined ? new Date() : daterange[1],this.state.buildingId)
78
-    this.setState({ 
76
+    this.getBarData(daterange[0] === undefined ? moment().subtract(7, 'day').toDate() : daterange[0], daterange[1] === undefined ? new Date() : daterange[1])
77
+    this.getTableData(daterange[0] === undefined ? moment().subtract(7, 'day').toDate() : daterange[0], daterange[1] === undefined ? new Date() : daterange[1], this.state.buildingId)
78
+    this.setState({
79
       ...this.state,
79
       ...this.state,
80
       endDate: daterange[1] === undefined ? new Date() : daterange[1],
80
       endDate: daterange[1] === undefined ? new Date() : daterange[1],
81
       startDate: daterange[0] === undefined ? moment().subtract(7, 'day').toDate() : daterange[0],
81
       startDate: daterange[0] === undefined ? moment().subtract(7, 'day').toDate() : daterange[0],
82
     })
82
     })
83
-    
83
+
84
   }
84
   }
85
-  
85
+
86
   //切换楼盘信息
86
   //切换楼盘信息
87
   handleBuildingChange = (e) => {
87
   handleBuildingChange = (e) => {
88
-    this.getTableData(this.state.startDate,this.state.endDate,e)
89
-    this.setState({...this.state, buildingId: e})
88
+    this.getTableData(this.state.startDate, this.state.endDate, e)
89
+    this.setState({ ...this.state, buildingId: e })
90
   }
90
   }
91
 
91
 
92
   //排序
92
   //排序
93
   handleTableChange = (pagination, filters, sorter) => {
93
   handleTableChange = (pagination, filters, sorter) => {
94
     console.log(pagination, filters, sorter)
94
     console.log(pagination, filters, sorter)
95
-    this.getTableData(this.state.startDate,this.state.endDate,this.state.buildingId,pagination.current,10,sorter.columnKey,sorter.order)
95
+    this.getTableData(this.state.startDate, this.state.endDate, this.state.buildingId, pagination.current, 10, sorter.columnKey, sorter.order)
96
   };
96
   };
97
 
97
 
98
   //导出
98
   //导出
127
 
127
 
128
   render() {
128
   render() {
129
     const columns = [
129
     const columns = [
130
-        {
131
-          title: '项目名称',
132
-          dataIndex: 'buildingName',
133
-          key: 'buildingName',
134
-        },
135
-        {
136
-          title: '新增客户',
137
-          dataIndex: 'khNum',
138
-          key: 'kh_num',
139
-          sorter: true,
140
-        },
141
-        {
142
-          title: '公客',
143
-          dataIndex: 'gkNum',
144
-          key: 'gk_num',
145
-          sorter: true,
146
-        },
147
-        {
148
-          title: '私客',
149
-          dataIndex: 'skNum',
150
-          key: 'sk_num',
151
-          sorter: true,
152
-        },
153
-        {
154
-            title: '访问人数',
155
-            dataIndex: 'uvNum',
156
-            key: 'uv_num',
157
-            sorter: true,
158
-        },
159
-        {
160
-            title: '访问次数',
161
-            dataIndex: 'pvNum',
162
-            key: 'pv_num',
163
-            sorter: true,
164
-        },
165
-        {
166
-            title: '详情',
167
-            render: (_, record) => (
168
-                    <Button type="link" style={{ color: 'red' }} onClick={() => this.toDetailPage(record)}>查看详情</Button>
169
-                ),
170
-        },
171
-      ];
130
+      {
131
+        title: '项目名称',
132
+        dataIndex: 'buildingName',
133
+        key: 'buildingName',
134
+      },
135
+      {
136
+        title: '新增客户',
137
+        dataIndex: 'khNum',
138
+        key: 'kh_num',
139
+        sorter: true,
140
+      },
141
+      {
142
+        title: '公客',
143
+        dataIndex: 'gkNum',
144
+        key: 'gk_num',
145
+        sorter: true,
146
+      },
147
+      {
148
+        title: '私客',
149
+        dataIndex: 'skNum',
150
+        key: 'sk_num',
151
+        sorter: true,
152
+      },
153
+      {
154
+        title: '访问人数',
155
+        dataIndex: 'uvNum',
156
+        key: 'uv_num',
157
+        sorter: true,
158
+      },
159
+      {
160
+        title: '访问次数',
161
+        dataIndex: 'pvNum',
162
+        key: 'pv_num',
163
+        sorter: true,
164
+      },
165
+      {
166
+        title: '详情',
167
+        render: (_, record) => (
168
+          <Button type="link" style={{ color: 'red' }} onClick={() => this.toDetailPage(record)}>查看详情</Button>
169
+        ),
170
+      },
171
+    ];
172
 
172
 
173
     return (
173
     return (
174
-    <div>
175
-      <Radio.Group buttonStyle="solid" defaultValue="a">
174
+      <div>
175
+        <Radio.Group buttonStyle="solid" defaultValue="a">
176
           <Radio.Button value="c" onClick={() => this.getDataOf(0)}>今日</Radio.Button>
176
           <Radio.Button value="c" onClick={() => this.getDataOf(0)}>今日</Radio.Button>
177
           <Radio.Button value="a" onClick={() => this.getDataOf(7)}>最近7天</Radio.Button>
177
           <Radio.Button value="a" onClick={() => this.getDataOf(7)}>最近7天</Radio.Button>
178
           <Radio.Button value="b" onClick={() => this.getDataOf(30)}>最近1月</Radio.Button>
178
           <Radio.Button value="b" onClick={() => this.getDataOf(30)}>最近1月</Radio.Button>
189
           查询
189
           查询
190
         </Button>
190
         </Button>
191
         <Button type="danger" onClick={() => router.go(-1)} style={{ marginBottom: '18px', marginLeft: '30px' }}>重置</Button>
191
         <Button type="danger" onClick={() => router.go(-1)} style={{ marginBottom: '18px', marginLeft: '30px' }}>重置</Button>
192
-
192
+        <div style={{fontSize:'0.09rem',color:'#999',marginBottom:'0.16rem'}}>最多显示6个项目,其他项目请在下方详细数据中搜索</div>
193
         <Row>
193
         <Row>
194
-            <Col span={12}>
195
-                <StatsChart title="项目公客排行" data={this.state.barData.gkBarMap} />
196
-            </Col>
197
-            <Col span={12}>
198
-                <StatsChart title="项目私客排行" data={this.state.barData.skBarMap} />
199
-            </Col>
194
+          <Col span={12} style={{paddingRight:'0.08rem'}}>
195
+            <StatsChart title="项目公客排行" data={this.state.barData.gkBarMap} />
196
+          </Col>
197
+          <Col span={12}style={{paddingLeft:'0.08rem'}}>
198
+            <StatsChart title="项目私客排行" data={this.state.barData.skBarMap} />
199
+          </Col>
200
         </Row>
200
         </Row>
201
         <Row>
201
         <Row>
202
-            <Col span={12}>
203
-                <StatsChart title="项目访问人数排行" subtext="项目详情访问情况" data={this.state.barData.wgBarMap} />
204
-            </Col>
205
-            <Col span={12}>
206
-                <StatsChart title="项目访问次数排行" subtext="项目详情访问情况,与上方时间筛选无关" data={this.state.barData.fwBarMap} />
207
-            </Col>
202
+          <Col span={12} style={{paddingRight:'0.08rem'}}>
203
+            <StatsChart title="项目访问人数排行" subtext="项目详情访问情况" data={this.state.barData.wgBarMap} />
204
+          </Col>
205
+          <Col span={12} style={{paddingLeft:'0.08rem'}}>
206
+            <StatsChart title="项目访问次数排行" subtext="项目详情访问情况,与上方时间筛选无关" data={this.state.barData.fwBarMap} />
207
+          </Col>
208
         </Row>
208
         </Row>
209
         <Row>
209
         <Row>
210
-            <Col span={22}>
211
-              <span style={{marginRight: '10px'}} >详细数据</span>
212
-              <BuildSelect slot='action' onChange={(e => this.handleBuildingChange(e))} value={this.state.buildingId}></BuildSelect>
213
-            </Col>
214
-            <Col span={2}>
210
+          <Col span={22}>
211
+            <span style={{ marginRight: '10px' }} >详细数据</span>
212
+            <BuildSelect slot='action' onChange={(e => this.handleBuildingChange(e))} value={this.state.buildingId}></BuildSelect>
213
+          </Col>
214
+          <Col span={2}>
215
             <AuthButton name="admin.statistical.building.export" noRight={null}>
215
             <AuthButton name="admin.statistical.building.export" noRight={null}>
216
               <Button type="primary" onClick={this.exportBuildingStats}>导出</Button>
216
               <Button type="primary" onClick={this.exportBuildingStats}>导出</Button>
217
             </AuthButton>
217
             </AuthButton>
218
-            </Col>
218
+          </Col>
219
         </Row>
219
         </Row>
220
-        
221
-        
222
-        <Table style={{marginTop:'20px'}} dataSource={this.state.tableData} columns={columns} pagination={{ total: this.state.total}} onChange={this.handleTableChange} scroll={{ y: 500 }}></Table>
223
-    </div>
220
+
221
+
222
+        <Table style={{ marginTop: '20px' }} dataSource={this.state.tableData} columns={columns} pagination={{ total: this.state.total }} onChange={this.handleTableChange} scroll={{ y: 500 }}></Table>
223
+      </div>
224
     )
224
     )
225
   }
225
   }
226
 }
226
 }