瀏覽代碼

修改整体统计中的合同统计,新增月份选择

余思翰 3 月之前
父節點
當前提交
a7137b7236
共有 2 個檔案被更改,包括 202 行新增104 行删除
  1. 188
    90
      oa-ui/src/views/statistics/components/contractStatistics.vue
  2. 14
    14
      oa-ui/src/views/statistics/components/topHead.vue

+ 188
- 90
oa-ui/src/views/statistics/components/contractStatistics.vue 查看文件

@@ -3,6 +3,11 @@
3 3
     <div class="titles">合同统计</div>
4 4
     <div class="warpper">
5 5
       <div class="left">
6
+        <div class="date-range">
7
+          <el-date-picker v-model="dateRange" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="monthrange"
8
+            range-separator="-" start-placeholder="开始月份" end-placeholder="结束月份" :default-time="['00:00:00', '23:59:59']"
9
+            @change="queryList"></el-date-picker>
10
+        </div>
6 11
         <!-- 每年合同额柱状图 -->
7 12
         <div class="left-top" id="amountBar"></div>
8 13
         <div class="left-bottom">
@@ -11,7 +16,6 @@
11 16
         </div>
12 17
       </div>
13 18
       <div class="middle" v-loading="subLoading">
14
-        <!-- <div class="middle-top" id="subAmountBar"></div> -->
15 19
         <div class="middle-top" id="subYearLine"></div>
16 20
         <div class="middle-bottom">
17 21
           <div class="bottom-left" id="subCwAmountPie"></div>
@@ -45,15 +49,22 @@ export default {
45 49
       contractCwAmount: {},
46 50
       contractSource: {},
47 51
       contractYear: {},
52
+      paidAmount: {},
53
+      paidCwAmount: {},
54
+      paidYear: {},
48 55
       subAmount: {},
49 56
       subYearNum: {},
50 57
       subCwAmount: {},
51 58
       subSource: {},
59
+      subPaidAmount: {},
60
+      subPaidCwAmount: {},
61
+      subPaidYear: {},
52 62
       subYear: 0,
53 63
       sumAomunt: 0,
54 64
       sumSubAomunt: 0,
55 65
       activeYear: '',
56 66
       subLoading: true,
67
+      dateRange: []
57 68
     }
58 69
   },
59 70
   watch: {
@@ -68,7 +79,7 @@ export default {
68 79
     },
69 80
     subSource() {
70 81
       this.initChartSubCwSource(this.activeYear);
71
-    }
82
+    },
72 83
   },
73 84
   mounted() {
74 85
     this.initDatas();
@@ -83,6 +94,9 @@ export default {
83 94
         this.contractCwAmount = this.datas.cwAmount[0];
84 95
         this.contractSource = this.datas.source[0];
85 96
         this.contractYear = this.datas.year[0];
97
+        this.paidAmount = this.datas.paidAmount[0];
98
+        this.paidCwAmount = this.datas.paidCwAmount[0];
99
+        this.paidYear = this.datas.paidYear[0];
86 100
         this.loading = false;
87 101
         let sum = Object.values(this.contractAmount).reduce((accumulator, currentValue) => accumulator + currentValue, 0);
88 102
         this.sumAomunt = (sum / 100000000).toFixed(4) + '亿元';
@@ -93,6 +107,9 @@ export default {
93 107
       this.subYearNum = subDatas.data.year[0];
94 108
       this.subCwAmount = subDatas.data.cwAmount[0];
95 109
       this.subSource = subDatas.data.source[0];
110
+      this.subPaidAmount = subDatas.data.paidAmount[0];
111
+      this.subPaidCwAmount = subDatas.data.paidCwAmount[0];
112
+      this.subPaidYear = subDatas.data.paidYear[0];
96 113
       let sum = Object.values(this.subAmount).reduce((accumulator, currentValue) => accumulator + currentValue, 0);
97 114
       this.sumSubAomunt = (sum / 100000000).toFixed(4) + '亿元';
98 115
       this.initAmountBar();
@@ -101,15 +118,44 @@ export default {
101 118
       this.initChartSubCwSource('');
102 119
       this.subLoading = false;
103 120
     },
121
+    queryList() {
122
+      getContractStatistic(this.addDateRange({}, this.dateRange)).then(res => {
123
+        let datas = res.data;
124
+        this.contractAmount = datas.amount[0];
125
+        this.contractCwAmount = datas.cwAmount[0];
126
+        this.contractSource = datas.source[0];
127
+        this.contractYear = datas.year[0];
128
+        this.paidAmount = datas.paidAmount[0];
129
+        this.paidCwAmount = datas.paidCwAmount[0];
130
+        this.paidYear = datas.paidYear[0];
131
+        getSubContractStatistic(this.addDateRange({}, this.dateRange)).then(res => {
132
+          console.log(res)
133
+          let datas = res.data;
134
+          this.subAmount = datas.amount[0];
135
+          this.subYearNum = datas.year[0];
136
+          this.subCwAmount = datas.cwAmount[0];
137
+          this.subSource = datas.source[0];
138
+          this.subPaidAmount = datas.paidAmount[0];
139
+          this.subPaidCwAmount = datas.paidCwAmount[0];
140
+          this.subPaidYear = datas.paidYear[0];
141
+          this.initAmountBar();
142
+          this.initChartSubYear();
143
+        })
144
+      })
145
+    },
104 146
     initAmountBar() {
105 147
       let option = {
106 148
         title: {
107 149
           text: '各年合同额统计',
108
-          subtext: '承接合同总额:' + Object.values(this.contractAmount).reduce((accumulator, currentValue) => accumulator + currentValue, 0) + '元'
150
+          
151
+          subtext: '承接合同总额:' + (Object.values(this.contractAmount).reduce((accumulator, currentValue) => accumulator + currentValue, 0)).toFixed(2) + '元'
109 152
             + '(约: ' + this.sumAomunt + ')\n' +
110
-            '分包合同总额:' + Object.values(this.subAmount).reduce((accumulator, currentValue) => accumulator + currentValue, 0) + '元'
153
+            '分包合同总额:' + (Object.values(this.subAmount).reduce((accumulator, currentValue) => accumulator + currentValue, 0)).toFixed(2) + '元'
111 154
             + '(约: ' + this.sumSubAomunt + ')'
112 155
         },
156
+        legend: {
157
+          right: 0
158
+        },
113 159
         grid: {
114 160
           left: '1%',
115 161
           right: '1%',
@@ -117,25 +163,10 @@ export default {
117 163
           height: '60%',
118 164
           containLabel: true
119 165
         },
120
-        legend: {},
121
-        graphic: [
122
-          {
123
-            type: 'text',
124
-            name: '',
125
-            right: '0',
126
-            top: '20%',
127
-            style: {
128
-              text: '全部年份',
129
-              fill: '#000', // 文本颜色  
130
-              fontSize: 12, // 文本大小  
131
-              fontWeight: '' // 文本粗细  
132
-            }
133
-          }
134
-        ],
135 166
         tooltip: {
136 167
           trigger: 'axis',
137 168
           axisPointer: {
138
-            type: 'none',
169
+            type: 'cross',
139 170
             label: {
140 171
               backgroundColor: '#6a7985'
141 172
             }
@@ -154,7 +185,8 @@ export default {
154 185
           {
155 186
             name: '承接合同',
156 187
             data: Object.values(this.contractAmount),
157
-            type: 'bar',
188
+            type: 'line',
189
+            areaStyle: {},
158 190
             smooth: true,
159 191
             label: {
160 192
               show: true,
@@ -166,31 +198,150 @@ export default {
166 198
                   return (value / 100000000).toFixed(4) + '亿';
167 199
                 } else {
168 200
                   // 千万元  
169
-                  return (value / 10000000).toFixed(4) + '千万';
201
+                  return (value / 10000000).toFixed(4) + '千万';
170 202
                 }
171 203
               }
172
-            }
204
+            },
173 205
           },
174 206
           {
175 207
             name: '分包合同',
176 208
             data: Object.values(this.subAmount),
177
-            type: 'bar',
209
+            type: 'line',
210
+            areaStyle: {},
178 211
             smooth: true,
179 212
             label: {
180 213
               show: true,
181 214
               position: 'top',
182 215
               formatter: function (params) {
183 216
                 var value = params.value;
184
-                if (value >= 10000) {
217
+                if (value >= 100000000) {
185 218
                   // 亿  
186
-                  return (value / 10000000).toFixed(4) + '千万元';
219
+                  return (value / 100000000).toFixed(4) + '亿';
220
+                } else {
221
+                  // 千万元  
222
+                  return (value / 10000000).toFixed(4) + '千万';
187 223
                 }
188 224
               }
189 225
             },
190
-            itemStyle: {
191
-
226
+          },
227
+          {
228
+            name: '已回款',
229
+            data: Object.values(this.paidAmount),
230
+            type: 'line',
231
+            areaStyle: {},
232
+            smooth: true,
233
+            label: {
234
+              show: true,
235
+              position: 'top',
236
+            },
237
+          },
238
+          {
239
+            name: '已付款',
240
+            data: Object.values(this.subPaidAmount),
241
+            type: 'line',
242
+            areaStyle: {},
243
+            smooth: true,
244
+            label: {
245
+              show: true,
246
+              position: 'top',
247
+            },
248
+          },
249
+        ]
250
+      };
251
+      ehcartsInit(subYearChart, 'subYearLine', option);
252
+    },
253
+    initChartSubYear() {
254
+      let option = {
255
+        title: {
256
+          text: '各年合同数统计',
257
+          subtext: '承接合同总数:' + Object.values(this.contractYear).reduce((accumulator, currentValue) => accumulator + currentValue, 0) + '个' + '\n' +
258
+            '分包合同总数:' + Object.values(this.subYearNum).reduce((accumulator, currentValue) => accumulator + currentValue, 0) + '个'
259
+        },
260
+        grid: {
261
+          left: '1%',
262
+          right: '1%',
263
+          bottom: '0%',
264
+          height: '60%',
265
+          containLabel: true
266
+        },
267
+        legend: {},
268
+        graphic: [
269
+          {
270
+            type: 'text',
271
+            name: '',
272
+            right: '0',
273
+            top: '20%',
274
+            style: {
275
+              text: '全部年份',
276
+              fill: '#000', // 文本颜色  
277
+              fontSize: 12, // 文本大小  
278
+              fontWeight: '' // 文本粗细  
279
+            }
280
+          }
281
+        ],
282
+        tooltip: {
283
+          trigger: 'axis',
284
+          axisPointer: {
285
+            type: 'none',
286
+            label: {
287
+              backgroundColor: '#6a7985'
192 288
             }
193 289
           }
290
+        },
291
+        xAxis: {
292
+          name: '年',
293
+          type: 'category',
294
+          data: Object.keys(this.subYearNum),
295
+        },
296
+        yAxis: {
297
+          type: 'value',
298
+          name: '单位:元'
299
+        },
300
+        series: [
301
+          {
302
+            name: '承接合同',
303
+            data: Object.values(this.contractYear),
304
+            type: 'bar',
305
+            // stack: 'one',
306
+            smooth: true,
307
+            label: {
308
+              show: true,
309
+              position: 'top',
310
+            }
311
+          },
312
+          {
313
+            name: '分包合同',
314
+            data: Object.values(this.subYearNum),
315
+            type: 'bar',
316
+            // stack: 'two',
317
+            smooth: true,
318
+            label: {
319
+              show: true,
320
+              position: 'top',
321
+            }
322
+          },
323
+          {
324
+            name: '已回款',
325
+            data: Object.values(this.paidYear),
326
+            type: 'bar',
327
+            // stack: 'one',
328
+            smooth: true,
329
+            label: {
330
+              show: true,
331
+              position: 'top',
332
+            }
333
+          },
334
+          {
335
+            name: '已付款',
336
+            data: Object.values(this.subPaidYear),
337
+            type: 'bar',
338
+            // stack: 'two',
339
+            smooth: true,
340
+            label: {
341
+              show: true,
342
+              position: 'top',
343
+            }
344
+          },
194 345
         ]
195 346
       };
196 347
       let charts = ehcartsInit(amountChart, 'amountBar', option);
@@ -385,68 +536,7 @@ export default {
385 536
       };
386 537
       ehcartsInit(subAmountChart, 'subAmountBar', option);
387 538
     },
388
-    initChartSubYear() {
389
-      let option = {
390
-        title: {
391
-          text: '各年合同数统计',
392
-          subtext: '承接合同总数:' + Object.values(this.contractYear).reduce((accumulator, currentValue) => accumulator + currentValue, 0) + '个' + '\n' +
393
-            '分包合同总数:' + Object.values(this.subYearNum).reduce((accumulator, currentValue) => accumulator + currentValue, 0) + '个'
394
-        },
395
-        legend: {
396
-          right: 0
397
-        },
398
-        grid: {
399
-          left: '1%',
400
-          right: '1%',
401
-          bottom: '0%',
402
-          height: '60%',
403
-          containLabel: true
404
-        },
405
-        tooltip: {
406
-          trigger: 'axis',
407
-          axisPointer: {
408
-            type: 'cross',
409
-            label: {
410
-              backgroundColor: '#6a7985'
411
-            }
412
-          }
413
-        },
414
-        xAxis: {
415
-          name: '年',
416
-          type: 'category',
417
-          data: Object.keys(this.subYearNum),
418
-        },
419
-        yAxis: {
420
-          type: 'value',
421
-          name: '单位:元'
422
-        },
423
-        series: [
424
-          {
425
-            name: '承接合同',
426
-            data: Object.values(this.contractYear),
427
-            type: 'line',
428
-            areaStyle: {},
429
-            smooth: true,
430
-            label: {
431
-              show: true,
432
-              position: 'top',
433
-            },
434
-          },
435
-          {
436
-            name: '分包合同',
437
-            data: Object.values(this.subYearNum),
438
-            type: 'line',
439
-            areaStyle: {},
440
-            smooth: true,
441
-            label: {
442
-              show: true,
443
-              position: 'top',
444
-            },
445
-          }
446
-        ]
447
-      };
448
-      ehcartsInit(subYearChart, 'subYearLine', option);
449
-    },
539
+    
450 540
     initChartSubCwAomunt(year) {
451 541
       let option = {
452 542
         title: {
@@ -568,7 +658,15 @@ export default {
568 658
 
569 659
   .left {
570 660
     flex: 1.5;
661
+    position: relative;
662
+
571 663
 
664
+    .date-range {
665
+      position: absolute;
666
+      right: 66px;
667
+      top: 54px;
668
+      z-index: 9999;
669
+    }
572 670
     .left-top {
573 671
       width: 100%;
574 672
       height: 300px;

+ 14
- 14
oa-ui/src/views/statistics/components/topHead.vue 查看文件

@@ -31,20 +31,6 @@
31 31
           <div id="thisContract"></div>
32 32
         </div>
33 33
       </div>
34
-      <div class="three item-box" @click="$emit('handleClick', 'device')">
35
-        <div class="data-left">
36
-          <div class="data-title">{{ thisYear }}年设备申领</div>
37
-          <div class="number">{{ deviceNum.toLocaleString('en-US') }}</div>
38
-          <div>
39
-            <span class="text-1">较去年</span>
40
-            <span class="text-2" :class="{ upColor: isDeviceUp, dowColor: !isDeviceUp }">{{ deviceSubYear }}</span>
41
-            <img :src="isDeviceUp ? upImg : downImg" alt="">
42
-          </div>
43
-        </div>
44
-        <div class="chart-box">
45
-          <div id="thisDevice"></div>
46
-        </div>
47
-      </div>
48 34
       <div class="four item-box" @click="$emit('handleClick', 'borrow')">
49 35
         <div class="data-left">
50 36
           <div class="data-title">{{ thisYear }}借款次数</div>
@@ -74,6 +60,20 @@
74 60
           <div id="thisSettle"></div>
75 61
         </div>
76 62
       </div>
63
+      <div class="three item-box" @click="$emit('handleClick', 'device')">
64
+        <div class="data-left">
65
+          <div class="data-title">{{ thisYear }}年设备申领</div>
66
+          <div class="number">{{ deviceNum.toLocaleString('en-US') }}</div>
67
+          <div>
68
+            <span class="text-1">较去年</span>
69
+            <span class="text-2" :class="{ upColor: isDeviceUp, dowColor: !isDeviceUp }">{{ deviceSubYear }}</span>
70
+            <img :src="isDeviceUp ? upImg : downImg" alt="">
71
+          </div>
72
+        </div>
73
+        <div class="chart-box">
74
+          <div id="thisDevice"></div>
75
+        </div>
76
+      </div>
77 77
     </div>
78 78
   </div>
79 79
 </template>

Loading…
取消
儲存