|
@@ -10,8 +10,9 @@
|
10
|
10
|
<div class="pie2" id="cwSourcePie"></div>
|
11
|
11
|
</div>
|
12
|
12
|
</div>
|
13
|
|
- <div class="middle">
|
14
|
|
-
|
|
13
|
+ <div class="middle" v-loading="subLoading">
|
|
14
|
+ <!-- <div class="middle-top" id="subAmountBar"></div> -->
|
|
15
|
+ <div class="middle-top" id="subYearLine"></div>
|
15
|
16
|
</div>
|
16
|
17
|
<div class="right">
|
17
|
18
|
|
|
@@ -22,7 +23,9 @@
|
22
|
23
|
|
23
|
24
|
<script>
|
24
|
25
|
import { ehcartsInit } from '@/utils/echarts'
|
25
|
|
-let amountChart, cwAmountChart, cwSourceChart
|
|
26
|
+import { getContractStatistic } from '@/api/oa/contract/contract';
|
|
27
|
+import { getSubContractStatistic } from '@/api/oa/contract/subContract';
|
|
28
|
+let amountChart, cwAmountChart, cwSourceChart, subAmountChart, subYearChart
|
26
|
29
|
export default {
|
27
|
30
|
props: {
|
28
|
31
|
datas: {
|
|
@@ -38,35 +41,58 @@ export default {
|
38
|
41
|
contractCwAmount: {},
|
39
|
42
|
contractSource: {},
|
40
|
43
|
contractYear: {},
|
|
44
|
+ subAmount: {},
|
|
45
|
+ subYearNum: {},
|
41
|
46
|
subYear: 0,
|
42
|
|
- sumAomunt: 0
|
|
47
|
+ sumAomunt: 0,
|
|
48
|
+ sumSubAomunt: 0,
|
|
49
|
+ activeYear: '',
|
|
50
|
+ subLoading: true,
|
|
51
|
+ }
|
|
52
|
+ },
|
|
53
|
+ watch: {
|
|
54
|
+ contractCwAmount() {
|
|
55
|
+ this.initChartCwAomunt(this.activeYear);
|
|
56
|
+ },
|
|
57
|
+ contractSource() {
|
|
58
|
+ this.initChartCwSource(this.activeYear);
|
43
|
59
|
}
|
44
|
60
|
},
|
45
|
61
|
mounted() {
|
46
|
62
|
this.initDatas();
|
47
|
|
- this.initAmountBar();
|
|
63
|
+ // this.initAmountBar();
|
48
|
64
|
this.initChartCwAomunt('');
|
49
|
65
|
this.initChartCwSource('');
|
50
|
66
|
},
|
51
|
67
|
methods: {
|
52
|
68
|
async initDatas() {
|
53
|
|
- console.log(this.datas);
|
54
|
69
|
if (Object.keys(this.datas).length !== 0) {
|
55
|
70
|
this.contractAmount = this.datas.amount[0];
|
56
|
|
- this.contractCwAmount = this.datas.cwAmount[0]
|
57
|
|
- this.contractSource = this.datas.source[0]
|
58
|
|
- this.contractYear = this.datas.year[0]
|
59
|
|
- this.loading = false
|
60
|
|
- let sum = Object.values(this.contractAmount).reduce((accumulator, currentValue) => accumulator + currentValue, 0)
|
|
71
|
+ this.contractCwAmount = this.datas.cwAmount[0];
|
|
72
|
+ this.contractSource = this.datas.source[0];
|
|
73
|
+ this.contractYear = this.datas.year[0];
|
|
74
|
+ this.loading = false;
|
|
75
|
+ let sum = Object.values(this.contractAmount).reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
61
|
76
|
this.sumAomunt = (sum / 100000000).toFixed(4) + '亿元';
|
62
|
77
|
}
|
|
78
|
+ this.subLoading = true;
|
|
79
|
+ let subDatas = await getSubContractStatistic();
|
|
80
|
+ this.subAmount = subDatas.data.amount[0];
|
|
81
|
+ this.subYearNum = subDatas.data.year[0];
|
|
82
|
+ let sum = Object.values(this.subAmount).reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
|
83
|
+ this.sumSubAomunt = (sum / 100000000).toFixed(4) + '亿元';
|
|
84
|
+ this.initAmountBar();
|
|
85
|
+ this.initChartSubYear();
|
|
86
|
+ this.subLoading = false;
|
63
|
87
|
},
|
64
|
88
|
initAmountBar() {
|
65
|
89
|
let option = {
|
66
|
90
|
title: {
|
67
|
91
|
text: '各年合同额统计',
|
68
|
|
- subtext: '共计合同额:' + Object.values(this.contractAmount).reduce((accumulator, currentValue) => accumulator + currentValue, 0) + '元'
|
69
|
|
- + '(约: ' + this.sumAomunt + ')'
|
|
92
|
+ subtext: '承接合同总额:' + Object.values(this.contractAmount).reduce((accumulator, currentValue) => accumulator + currentValue, 0) + '元'
|
|
93
|
+ + '(约: ' + this.sumAomunt + ')\n' +
|
|
94
|
+ '分包合同总额:' + Object.values(this.subAmount).reduce((accumulator, currentValue) => accumulator + currentValue, 0) + '元'
|
|
95
|
+ + '(约: ' + this.sumSubAomunt + ')'
|
70
|
96
|
},
|
71
|
97
|
grid: {
|
72
|
98
|
left: '1%',
|
|
@@ -74,6 +100,9 @@ export default {
|
74
|
100
|
bottom: '0%',
|
75
|
101
|
height: '60%',
|
76
|
102
|
containLabel: true
|
|
103
|
+ },
|
|
104
|
+ legend: {
|
|
105
|
+
|
77
|
106
|
},
|
78
|
107
|
graphic: [
|
79
|
108
|
{
|
|
@@ -109,6 +138,7 @@ export default {
|
109
|
138
|
},
|
110
|
139
|
series: [
|
111
|
140
|
{
|
|
141
|
+ name: '承接合同',
|
112
|
142
|
data: Object.values(this.contractAmount),
|
113
|
143
|
type: 'bar',
|
114
|
144
|
smooth: true,
|
|
@@ -125,22 +155,50 @@ export default {
|
125
|
155
|
return (value / 10000000).toFixed(4) + '千万元';
|
126
|
156
|
}
|
127
|
157
|
}
|
128
|
|
- },
|
129
|
|
- itemStyle: {
|
130
|
|
- color: '#1C3F95'
|
131
|
158
|
}
|
132
|
159
|
},
|
133
|
160
|
{
|
134
|
|
- type: 'line',
|
135
|
|
- data: Object.values(this.contractAmount),
|
|
161
|
+ name: '分包合同',
|
|
162
|
+ data: Object.values(this.subAmount),
|
|
163
|
+ type: 'bar',
|
136
|
164
|
smooth: true,
|
|
165
|
+ label: {
|
|
166
|
+ show: true,
|
|
167
|
+ position: 'top',
|
|
168
|
+ formatter: function (params) {
|
|
169
|
+ var value = params.value;
|
|
170
|
+ if (value >= 10000) {
|
|
171
|
+ // 亿
|
|
172
|
+ return (value / 10000).toFixed(4) + '万元';
|
|
173
|
+ }
|
|
174
|
+ }
|
|
175
|
+ },
|
137
|
176
|
itemStyle: {
|
138
|
|
- color: '#F89B30'
|
|
177
|
+
|
139
|
178
|
}
|
140
|
179
|
}
|
141
|
180
|
]
|
142
|
181
|
};
|
143
|
182
|
let charts = ehcartsInit(amountChart, 'amountBar', option);
|
|
183
|
+ this.clickYear(charts)
|
|
184
|
+ },
|
|
185
|
+ clickYear(charts) {
|
|
186
|
+ let that = this;
|
|
187
|
+ charts.on('click', function (event) {
|
|
188
|
+ if (event) {
|
|
189
|
+ that.activeYear = event.name;
|
|
190
|
+ let year = event.name + '-01-01'
|
|
191
|
+ if (event.name == "") {
|
|
192
|
+ year = ''
|
|
193
|
+ }
|
|
194
|
+ that.dataLoading = true
|
|
195
|
+ getContractStatistic({ signDate: year }).then(res => {
|
|
196
|
+ that.contractCwAmount = res.data.cwAmount[0];
|
|
197
|
+ that.contractSource = res.data.source[0];
|
|
198
|
+ that.dataLoading = false
|
|
199
|
+ })
|
|
200
|
+ }
|
|
201
|
+ })
|
144
|
202
|
},
|
145
|
203
|
initChartCwAomunt(year) {
|
146
|
204
|
let option = {
|
|
@@ -234,6 +292,132 @@ export default {
|
234
|
292
|
};
|
235
|
293
|
ehcartsInit(cwSourceChart, 'cwSourcePie', option);
|
236
|
294
|
},
|
|
295
|
+ initChartSubAmount() {
|
|
296
|
+ let option = {
|
|
297
|
+ title: {
|
|
298
|
+ text: '各年分包合同额统计',
|
|
299
|
+ subtext: '共计合同额:' + Object.values(this.subAmount).reduce((accumulator, currentValue) => accumulator + currentValue, 0) + '元'
|
|
300
|
+ + '(约: ' + this.sumSubAomunt + ')'
|
|
301
|
+ },
|
|
302
|
+ grid: {
|
|
303
|
+ left: '1%',
|
|
304
|
+ right: '1%',
|
|
305
|
+ bottom: '0%',
|
|
306
|
+ height: '60%',
|
|
307
|
+ containLabel: true
|
|
308
|
+ },
|
|
309
|
+ tooltip: {
|
|
310
|
+ trigger: 'axis',
|
|
311
|
+ axisPointer: {
|
|
312
|
+ type: 'none',
|
|
313
|
+ label: {
|
|
314
|
+ backgroundColor: '#6a7985'
|
|
315
|
+ }
|
|
316
|
+ }
|
|
317
|
+ },
|
|
318
|
+ xAxis: {
|
|
319
|
+ name: '年',
|
|
320
|
+ type: 'category',
|
|
321
|
+ data: Object.keys(this.subAmount),
|
|
322
|
+ },
|
|
323
|
+ yAxis: {
|
|
324
|
+ type: 'value',
|
|
325
|
+ name: '单位:元'
|
|
326
|
+ },
|
|
327
|
+ series: [
|
|
328
|
+ {
|
|
329
|
+ data: Object.values(this.subAmount),
|
|
330
|
+ type: 'bar',
|
|
331
|
+ smooth: true,
|
|
332
|
+ label: {
|
|
333
|
+ show: true,
|
|
334
|
+ position: 'top',
|
|
335
|
+ formatter: function (params) {
|
|
336
|
+ var value = params.value;
|
|
337
|
+ if (value >= 10000) {
|
|
338
|
+ // 亿
|
|
339
|
+ return (value / 10000).toFixed(4) + '万元';
|
|
340
|
+ }
|
|
341
|
+ }
|
|
342
|
+ },
|
|
343
|
+ itemStyle: {
|
|
344
|
+
|
|
345
|
+ }
|
|
346
|
+ },
|
|
347
|
+ {
|
|
348
|
+ type: 'line',
|
|
349
|
+ data: Object.values(this.subAmount),
|
|
350
|
+ smooth: true,
|
|
351
|
+ itemStyle: {
|
|
352
|
+
|
|
353
|
+ }
|
|
354
|
+ }
|
|
355
|
+ ]
|
|
356
|
+ };
|
|
357
|
+ ehcartsInit(subAmountChart, 'subAmountBar', option);
|
|
358
|
+ },
|
|
359
|
+ initChartSubYear() {
|
|
360
|
+ let option = {
|
|
361
|
+ title: {
|
|
362
|
+ text: '各年合同数统计',
|
|
363
|
+ subtext: '承接合同总数:' + Object.values(this.contractYear).reduce((accumulator, currentValue) => accumulator + currentValue, 0) + '个' + '\n' +
|
|
364
|
+ '分包合同总数:' + Object.values(this.subYearNum).reduce((accumulator, currentValue) => accumulator + currentValue, 0) + '个'
|
|
365
|
+ },
|
|
366
|
+ legend: {
|
|
367
|
+ right: 0
|
|
368
|
+ },
|
|
369
|
+ grid: {
|
|
370
|
+ left: '1%',
|
|
371
|
+ right: '1%',
|
|
372
|
+ bottom: '0%',
|
|
373
|
+ height: '60%',
|
|
374
|
+ containLabel: true
|
|
375
|
+ },
|
|
376
|
+ tooltip: {
|
|
377
|
+ trigger: 'axis',
|
|
378
|
+ axisPointer: {
|
|
379
|
+ type: 'cross',
|
|
380
|
+ label: {
|
|
381
|
+ backgroundColor: '#6a7985'
|
|
382
|
+ }
|
|
383
|
+ }
|
|
384
|
+ },
|
|
385
|
+ xAxis: {
|
|
386
|
+ name: '年',
|
|
387
|
+ type: 'category',
|
|
388
|
+ data: Object.keys(this.subYearNum),
|
|
389
|
+ },
|
|
390
|
+ yAxis: {
|
|
391
|
+ type: 'value',
|
|
392
|
+ name: '单位:元'
|
|
393
|
+ },
|
|
394
|
+ series: [
|
|
395
|
+ {
|
|
396
|
+ name: '承接合同',
|
|
397
|
+ data: Object.values(this.contractYear),
|
|
398
|
+ type: 'line',
|
|
399
|
+ areaStyle: {},
|
|
400
|
+ smooth: true,
|
|
401
|
+ label: {
|
|
402
|
+ show: true,
|
|
403
|
+ position: 'top',
|
|
404
|
+ },
|
|
405
|
+ },
|
|
406
|
+ {
|
|
407
|
+ name: '分包合同',
|
|
408
|
+ data: Object.values(this.subYearNum),
|
|
409
|
+ type: 'line',
|
|
410
|
+ areaStyle: {},
|
|
411
|
+ smooth: true,
|
|
412
|
+ label: {
|
|
413
|
+ show: true,
|
|
414
|
+ position: 'top',
|
|
415
|
+ },
|
|
416
|
+ }
|
|
417
|
+ ]
|
|
418
|
+ };
|
|
419
|
+ ehcartsInit(subYearChart, 'subYearLine', option);
|
|
420
|
+ },
|
237
|
421
|
}
|
238
|
422
|
}
|
239
|
423
|
</script>
|
|
@@ -263,7 +447,6 @@ export default {
|
263
|
447
|
.left-bottom {
|
264
|
448
|
width: 100%;
|
265
|
449
|
height: 300px;
|
266
|
|
- padding: 10px;
|
267
|
450
|
display: flex;
|
268
|
451
|
|
269
|
452
|
.pie1 {
|
|
@@ -284,6 +467,12 @@ export default {
|
284
|
467
|
|
285
|
468
|
.middle {
|
286
|
469
|
flex: 1;
|
|
470
|
+
|
|
471
|
+ .middle-top {
|
|
472
|
+ height: 300px;
|
|
473
|
+ padding: 10px;
|
|
474
|
+ border: 1px solid #ececec;
|
|
475
|
+ }
|
287
|
476
|
}
|
288
|
477
|
|
289
|
478
|
.right {
|