Blame view

admin-web-master/src/views/scheme/statistics.vue 13.8 KB
3ea048fb   杨鑫   最新修改
1
2
3
4
5
6
7
8
9
  <template>
  	<div style="background-color:#f7f7f7;padding:10px 10px;">
  		<div class="zhuti">
  			<div style="height:58px;line-height:58px;">
  				<div style="color:#0006"> <span>招商方案管理</span> <span style="padding:0 5px;">></span> <span
  						style="color:#000000e6">招商方案统计</span></div>
  			</div>
  			<div class="toolbar">
  			  <el-form  :inline="true" :model="pageindex"> 
e22d7ad7   杨鑫   最新
10
  			    <!-- <el-form-item label="资源类型">
3ea048fb   杨鑫   最新修改
11
12
13
14
15
16
  			    <el-select  placeholder="全部"   v-model="pageindex.leaseType"
  			      style="width: 120px;margin-right: 15px">
  			     <el-option label="商铺" value="商铺" />
  				 <el-option label="场地" value="场地" />
  				 <el-option label="广告位" value="广告位" />
  			    </el-select>
e22d7ad7   杨鑫   最新
17
  			    </el-form-item> -->
3ea048fb   杨鑫   最新修改
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
  			    <el-form-item label="日期">
  			      <el-date-picker
  			        v-model="pageindex.list"
  			        type="daterange"
  			        range-separator="至"
  			        start-placeholder="开始时间"
  			        end-placeholder="结束时间"
  			        value-format="yyyy-MM-dd"
  			      />
  			    </el-form-item>
  			
  			    <el-form-item label-width="0">
  			      <el-button   @click="search" style="background-color: #3F9B6A;color: #fff">查询</el-button>
  			      <el-button  @click="clear" class="buttonHover"
  			     style="color: #606266;border: 1px solid #dddfe5;background-color: #fff;">重置</el-button>
  			    </el-form-item>
  			  </el-form>
  			</div>
  			<div style="width: 100%;margin-bottom:30px;">
  				<div style="display:flex;margin-top:10px;">
  					<div style="width:50%;height: 400px;marigin-right:20px;">
  						<div style="display: flex;justify-content: space-between;">
  							<div style="line-height:35px;">月度签约趋势</div>
  						</div>
  						<div ref="shop1TJ" style="width:100%;height: 400px;"></div>
  					</div>
  					<div style="width:50%;height: 400px;marigin-right:20px;">
  						<div style="display: flex;justify-content: space-between;">
  							<div style="line-height:35px;">资源使用占比</div>
  						</div>
  						<div ref="shop1ZX" style="width:100%;height: 400px;"></div>
  
  					</div>
  
  				</div>
  			</div>
  			<div style="width: 100%;margin-bottom;20px;">
  				<div style="display:flex;margin-top:10px;">
  
  					<div style="width:50%;height: 400px;marigin-right:20px;">
  						<div style="display: flex;justify-content: space-between;">
  							<div style="line-height:35px;">商铺经营类型占比</div>
  						</div>
  						<div ref="shop2TJ" style="width:100%;height: 400px;"></div>
  					</div>
  					<div style="width:50%;height: 400px;marigin-right:20px;">
  						<div style="display: flex;justify-content: space-between;">
  							<div style="line-height:35px;">租金价格趋势</div>
  						</div>
  						<div ref="shop3QS" style="width:100%;height: 400px;"></div>
  					</div>
  				</div>
  			</div>
  		</div>
  
  	</div>
  </template>
  
  <script>
    import {
e22d7ad7   杨鑫   最新
78
     getInvestmentPlanStatistics
3ea048fb   杨鑫   最新修改
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
    } from '@/api/cereBusinessInfo'
  	import * as echarts from 'echarts'
  	export default {
  		name: 'atmosphereGl',
  		data() {
  			return {
  				currentPage: 1,
  				radio1: 0,
  				total: 100,
  				flag: false,
  				pageSize: 10,
  				tableData: [],
  				pageindex: {
  				leaseType:'',
  				startTime:'',
  				endTime:'',
  				list:[]
  				},
  				listType:[]
  
  			}
  		},
  		computed: {},
  		mounted() {
  			this.getAll()
  			
  		},
  
  		methods: {
  			search(){
  				if(this.pageindex.list.length!=0){
  					this.pageindex.startTime = this.pageindex.list[0]+' 00:00:00'
  					this.pageindex.endTime = this.pageindex.list[1]+' 23:59:59'	
  				}
  				
  				this.getAll()
  			},
  			clear(){
  				this.pageindex={
  				leaseType:'',
  				startTime:'',
  				endTime:'',
  				list:[]
  				}
  				this.getAll()
  			},
  			charDam(val) {
  		
  
  				// 获取图表容器的 DOM 元素
  				const chartDom = this.$refs.shop2TJ
  				// 初始化 ECharts 实例
  				const myChart = echarts.init(chartDom);
e22d7ad7   杨鑫   最新
132
  
3ea048fb   杨鑫   最新修改
133
134
135
136
  				
  		     const option = {
  		       tooltip: {
  		         trigger: 'item',
e22d7ad7   杨鑫   最新
137
138
139
140
  		         formatter: function (params) {
  		           const dataItem = val.find(item => item.businessPurpose === params.name);
  		           return `${params.name}<br/>数量: ${dataItem.num}<br/>占比: ${dataItem.proportion}%`;
  		         }
3ea048fb   杨鑫   最新修改
141
142
143
144
  		       },
  		       legend: {
  		          orient: 'horizontal', // 横向展示
  		                 left: 'center', // 居中显示
e22d7ad7   杨鑫   最新
145
  		         data: val.map(item => item.businessPurpose)
3ea048fb   杨鑫   最新修改
146
147
148
  		       },
  		       series: [
  		         {
e22d7ad7   杨鑫   最新
149
  					 color: ['#4A90E2', '#37c954','#ff94e8', '#7a69d8','#aaffe7', '#8cd89b','#feff89', '#d8d6d5'],
3ea048fb   杨鑫   最新修改
150
151
  		           name: '资源分布',
  		           type: 'pie',
e22d7ad7   杨鑫   最新
152
  				   radius: ['0%', '60%'],
3ea048fb   杨鑫   最新修改
153
154
155
156
  		           avoidLabelOverlap: false,
  		           label: {
  		             show: true,
  		             position: 'outside',
e22d7ad7   杨鑫   最新
157
  		             formatter: '{b}: {c}%'
3ea048fb   杨鑫   最新修改
158
159
160
161
  		           },
  		           labelLine: {
  		             show: true
  		           },
e22d7ad7   杨鑫   最新
162
163
164
165
  		          data: val.map(item => ({
  		            value: item.proportion,
  		            name: item.businessPurpose
  		          }))
3ea048fb   杨鑫   最新修改
166
  		         },
e22d7ad7   杨鑫   最新
167
  		         
3ea048fb   杨鑫   最新修改
168
169
170
171
172
173
174
175
176
177
178
179
  		       ]
  		     };
  				// 使用刚指定的配置项和数据显示图表
  				option && myChart.setOption(option)
  				window.addEventListener('resize', function() {
  					myChart.resize();
  				})
  			},
  			charDam1(val) {
  
  				const chartDom = this.$refs.shop1ZX;
  				const myChart = echarts.init(chartDom)
e22d7ad7   杨鑫   最新
180
181
182
183
184
185
186
187
188
189
190
191
192
193
  				 let shopCount = 0;
  				      let adCount = 0;
  				      let venueCount = 0;
  				      let totalCount = 0;
  		 val.forEach(item => {
  		        totalCount += item.num;
  		        if (item.businessPurpose === '商铺合同') {
  		          shopCount = item.proportion;
  		        } else if (item.businessPurpose === '场地合同') {
  		          venueCount = item.proportion;
  		        } else if (item.businessPurpose === '广告位合同') {
  		          adCount = item.proportion;
  		        }
  		      });
3ea048fb   杨鑫   最新修改
194
195
196
197
  		
  		      const option = {
  		        tooltip: {
  		          trigger: 'item',
e22d7ad7   杨鑫   最新
198
199
200
201
  		          formatter: function (params) {
  		            const dataItem = val.find(item => item.businessPurpose === params.name);
  		            return `${params.name}<br/>数量: ${dataItem.num}<br/>占比: ${dataItem.proportion}%`;
  		          }
3ea048fb   杨鑫   最新修改
202
203
  		        },
  		        legend: {
e22d7ad7   杨鑫   最新
204
205
206
  		          orient: 'horizontal',
  		          left: 'center',
  		          data: val.map(item => item.businessPurpose)
3ea048fb   杨鑫   最新修改
207
208
  		        },
  		        series: [
e22d7ad7   杨鑫   最新
209
  					
3ea048fb   杨鑫   最新修改
210
  		          {
e22d7ad7   杨鑫   最新
211
  					  color: ['#4A90E2', '#37c954','#ff94e8', '#7a69d8','#aaffe7', '#8cd89b','#feff89', '#d8d6d5'],
3ea048fb   杨鑫   最新修改
212
213
214
215
216
217
218
  		            name: '资源分布',
  		            type: 'pie',
  		            radius: ['50%', '70%'],
  		            avoidLabelOverlap: false,
  		            label: {
  		              show: true,
  		              position: 'outside',
e22d7ad7   杨鑫   最新
219
  		              formatter: '{b}: {c}%'
3ea048fb   杨鑫   最新修改
220
221
222
223
  		            },
  		            labelLine: {
  		              show: true
  		            },
e22d7ad7   杨鑫   最新
224
225
226
227
  		            data: val.map(item => ({
  		              value: item.proportion,
  		              name: item.businessPurpose
  		            }))
3ea048fb   杨鑫   最新修改
228
229
  		          },
  		          {
e22d7ad7   杨鑫   最新
230
231
232
233
234
235
236
237
238
239
  		            name: '总数',
  		            type: 'pie',
  		            radius: ['0%', '0%'],
  		            label: {
  		              show: true,
  		              position: 'center',
  		              formatter: `总数: ${totalCount}`,
  		              fontSize: 20
  		            },
  		            data: [{ value: totalCount, name: '总数' }]
3ea048fb   杨鑫   最新修改
240
241
242
243
244
245
246
247
248
249
  		          }
  		        ]
  		      };
  
  				    option && myChart.setOption(option,true);
  				    window.addEventListener('resize', () => myChart.resize());
  			},
  			charDam3(val) {
  				let Dom = this.$refs.shop1TJ
  				let myChart = echarts.init(Dom)
e22d7ad7   杨鑫   最新
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
  			  // 处理数据
  			      const months = Object.keys(val).reverse(); // 反转月份顺序,最新月份在前
  			      const shopData = [];
  			      const venueData = [];
  			      const adData = [];
  			
  			      months.forEach(month => {
  			        const monthData = val[month];
  			        const shop = monthData.find(item => item.contractType === '商铺合同')?.contractCount || 0;
  			        const venue = monthData.find(item => item.contractType === '场地合同')?.contractCount || 0;
  			        const ad = monthData.find(item => item.contractType === '广告位合同')?.contractCount || 0;
  			        shopData.push(shop);
  			        venueData.push(venue);
  			        adData.push(ad);
  			      });
3ea048fb   杨鑫   最新修改
265
266
267
268
269
270
271
272
273
274
275
276
  			
  			      const option = {
  			        tooltip: {
  			          trigger: 'axis'
  			        },
  			        xAxis: {
  			          type: 'category',
  			          data: months,
  			          boundaryGap: false
  			        },
  			        yAxis: {
  			          type: 'value',
e22d7ad7   杨鑫   最新
277
  			          name: '合同数量'
3ea048fb   杨鑫   最新修改
278
279
280
  			        },
  			        series: [
  			          {
e22d7ad7   杨鑫   最新
281
  			            name: '商铺合同',
3ea048fb   杨鑫   最新修改
282
  			            type: 'line',
e22d7ad7   杨鑫   最新
283
  			            data: shopData,
3ea048fb   杨鑫   最新修改
284
  			            symbol: 'circle',
e22d7ad7   杨鑫   最新
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
  			            lineStyle: { color: '#4A90E2' },
  			            itemStyle: { color: '#4A90E2' }
  			          },
  			          {
  			            name: '场地合同',
  			            type: 'line',
  			            data: venueData,
  			            symbol: 'square',
  			            lineStyle: { color: '#52C41A' },
  			            itemStyle: { color: '#52C41A' }
  			          },
  			          {
  			            name: '广告位合同',
  			            type: 'line',
  			            data: adData,
  			            symbol: 'triangle',
  			            lineStyle: { color: '#FF7800' },
  			            itemStyle: { color: '#FF7800' }
3ea048fb   杨鑫   最新修改
303
304
305
306
  			          }
  			        ]
  			      };
  
e22d7ad7   杨鑫   最新
307
  
3ea048fb   杨鑫   最新修改
308
309
310
311
312
313
314
315
316
317
318
319
320
321
  				option && myChart.setOption(option);
  				window.addEventListener('resize', function() {
  					myChart.resize();
  				})
  			},
  
  			charDam5(val) {
  			
  				// 获取图表容器的 DOM 元素
  				const chartDom = this.$refs.shop3QS
  				// 初始化 ECharts 实例
  				const myChart = echarts.init(chartDom);
  				 
  		
e22d7ad7   杨鑫   最新
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
  		        const allDates = [];
  		             const leaseTerms = ['季', '年', '日', '月'];
  		             const seriesData = {
  		               '季': [],
  		               '年': [],
  		               '日': [],
  		               '月': []
  		             };
  		       
  		             // 收集所有日期
  		             leaseTerms.forEach(term => {
  		               val[term].forEach(item => {
  		                 if (!allDates.includes(item.createDay)) {
  		                   allDates.push(item.createDay);
  		                 }
  		               });
  		             });
  		       
  		             // 按日期排序
  		             allDates.sort();
  		       
  		             // 填充各租赁期限的数据
  		             leaseTerms.forEach(term => {
  		               allDates.forEach(date => {
  		                 const found = val[term].find(item => item.createDay === date);
  		                 seriesData[term].push(found ? found.rentalPrice : null);
  		               });
  		             });
  		       
  		             const option = {
  		               tooltip: {
  		                 trigger: 'axis',
  		                 axisPointer: {
  		                   type: 'cross',
  		                   crossStyle: {
  		                     color: '#999'
  		                   }
  		                 }
  		               },
  		               legend: {
  		                 data: leaseTerms
  		               },
  		               xAxis: {
  		                 type: 'category',
  		                 data: allDates
  		               },
  		               yAxis: {
  		                 type: 'value',
3ea048fb   杨鑫   最新修改
370
  		                 name: '租金价格',
e22d7ad7   杨鑫   最新
371
372
373
374
375
376
  		                 axisLabel: {
  		                   formatter: '{value}'
  		                 }
  		               },
  		               series: leaseTerms.map(term => ({
  		                 name: term,
3ea048fb   杨鑫   最新修改
377
  		                 type: 'line',
e22d7ad7   杨鑫   最新
378
  		                 data: seriesData[term],
3ea048fb   杨鑫   最新修改
379
  		                 symbol: 'circle',
e22d7ad7   杨鑫   最新
380
381
  		                 label: {
  		                   show: false
3ea048fb   杨鑫   最新修改
382
  		                 },
e22d7ad7   杨鑫   最新
383
384
  		                 lineStyle: {
  		                   width: 2
3ea048fb   杨鑫   最新修改
385
  		                 }
e22d7ad7   杨鑫   最新
386
387
  		               }))
  		             };
3ea048fb   杨鑫   最新修改
388
389
390
391
392
393
394
395
396
  				// 使用刚指定的配置项和数据显示图表
  				option && myChart.setOption(option)
  				window.addEventListener('resize', function() {
  					myChart.resize();
  				})
  			
  			},
  
  			async getAll() {
e22d7ad7   杨鑫   最新
397
398
399
400
401
  				const res = await getInvestmentPlanStatistics(this.pageindex)
  			this.charDam3(res.data.monthlyContractVOList)
  				this.charDam1(res.data.resourceUsageRatioVOList)
  				this.charDam(res.data.businessTypeProportionList)
  				this.charDam5(res.data.rentTrendMap)
3ea048fb   杨鑫   最新修改
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
  				
  			},
  	
  		}
  	}
  </script>
  
  <style scoped>
  	.zhuti {
  		padding: 0 20px 20px 20px;
  		min-height: calc(100vh - 50px - 20px);
  		background-color: #Fff;
  
  	}
  
  	/deep/ .el-form-item__content {
  		line-height: 0;
  	}
  
  	.tableBtn {
  		display: inline-block;
  		margin-right: 10px;
  	}
  
  	.formSearch {
  		position: relative;
  		margin-top: 30px;
  		display: flex;
  		width: 100%;
  		height: 30px;
  		font-size: 14px;
  		margin-bottom: 10px;
  	}
  
  	.greens {
  		color: #3F9B6A;
  	}
  
  
  	.fenye {
  		margin-top: 20px;
  		display: flex;
  		justify-content: flex-start;
  		position: relative;
  	}
  
  	/deep/ .el-pagination.is-background .el-pager li:not(.disabled).active {
  		background-color: #3F9B6A;
  	}
  
  	.el-row {
  		margin-bottom: 20px;
  	}
  
  	:last-child {
  		margin-bottom: 0;
  	}
  
  	.el-col {
  		border-radius: 4px;
  	}
  
  	.bg-purple-dark {
  		background: #99a9bf;
  	}
  
  	.bg-purple {
  		background: #d3dce6;
  	}
  
  	.bg-purple-light {
  		background: #e5e9f2;
  	}
  
  	.grid-content {
  		border-radius: 4px;
  		min-height: 36px;
  	}
  
  	.row-bg {
  		padding: 10px 0;
  		background-color: #f9fafc;
  	}
  
  	/deep/ .bg-purple[data-v-0e3fe4ec] {
  		background: #fff;
  		height: 50px;
  	}
  
  	/deep/ .el-form--label-top .el-form-item__label {
  		padding: 0;
  	}
  
  	.demo-input-suffix {
  		display: flex;
  		margin-right: 20px;
  	}
  
  	.pagination {
  		text-align: right;
  		line-height: 20px;
  	}
  
  	/deep/ .el-pagination__total {
  		margin-top: 4px;
  	}
  
  	::v-deep .el-select .el-input.is-focus .el-input__inner {
  		border-color: #3F9B6A
  	}
  
  	/deep/ .el-dialog__header {
  		background-color: #fff;
  		padding: 0
  	}
  
  	/deep/ .el-radio__input.is-checked .el-radio__inner {
  		border-color: #3F9B6A;
  		background: #3F9B6A;
  	}
  
  	::v-deep .buttonHover:hover {
  		color: #3f9b6a !important;
  		border-color: #c5e1d2 !important;
  		background-color: #ecf5f0 !important;
  		outline: none;
  	}
  </style>