Browse Source

新增项目借款统计

余思翰 7 months ago
parent
commit
95483630a8

+ 9
- 0
oa-ui/src/api/oa/settle/settle.js View File

42
     method: 'delete'
42
     method: 'delete'
43
   })
43
   })
44
 }
44
 }
45
+
46
+// 结算统计
47
+export function getSettleStatistic(query) {
48
+  return request({
49
+    url: '/oa/settle/statistic',
50
+    method: 'get',
51
+    params: query
52
+  })
53
+}

+ 2
- 2
oa-ui/src/views/flowable/form/projectProcess/planTab.vue View File

2
  * @Author: ysh
2
  * @Author: ysh
3
  * @Date: 2024-04-19 15:32:00
3
  * @Date: 2024-04-19 15:32:00
4
  * @LastEditors: Please set LastEditors
4
  * @LastEditors: Please set LastEditors
5
- * @LastEditTime: 2024-09-19 10:27:58
5
+ * @LastEditTime: 2024-10-23 14:39:45
6
 -->
6
 -->
7
 <template>
7
 <template>
8
   <div class="app-container">
8
   <div class="app-container">
65
           </div>
65
           </div>
66
         </el-form-item>
66
         </el-form-item>
67
         <el-form-item label="方案说明" prop="designDescription">
67
         <el-form-item label="方案说明" prop="designDescription">
68
-          <el-input type="textarea" v-model="form.designDescription" placeholder="请输入方案说明" />
68
+          <el-input type="textarea" :autosize="{ minRows: 4 }" v-model="form.designDescription" placeholder="请输入方案说明" />
69
         </el-form-item>
69
         </el-form-item>
70
         <el-row>
70
         <el-row>
71
           <el-col :span="6" :xs="24" :offset="12">
71
           <el-col :span="6" :xs="24" :offset="12">

+ 221
- 28
oa-ui/src/views/statistics/components/borrowStatistics.vue View File

1
+<!--
2
+ * @Author: ysh
3
+ * @Date: 2024-10-18 11:17:48
4
+ * @LastEditors: Please set LastEditors
5
+ * @LastEditTime: 2024-10-23 17:00:10
6
+-->
1
 <template>
7
 <template>
2
   <div style="width:100%;" v-loading="loading">
8
   <div style="width:100%;" v-loading="loading">
3
-    <div class="titles">借款统计</div>
9
+    <div class="titles">借款和结算统计</div>
4
     <div class="warpper">
10
     <div class="warpper">
5
       <div class="left">
11
       <div class="left">
6
         <div class="left-top" id="borrowBar"></div>
12
         <div class="left-top" id="borrowBar"></div>
8
       </div>
14
       </div>
9
       <div class="middle">
15
       <div class="middle">
10
         <div class="middle-top" id="borrowLine"></div>
16
         <div class="middle-top" id="borrowLine"></div>
11
-        <div class="middle-top" id="borrowUsageAmountPie" v-loading="dataLoading"></div>
17
+        <div class="middle-top" id="borrowProject"></div>
18
+      </div>
19
+      <div class="right">
20
+        <div class="right-top" id="settleBar"></div>
21
+        <div class="right-top" id="settleLine"></div>
12
       </div>
22
       </div>
13
-      <div class="right"></div>
14
     </div>
23
     </div>
15
   </div>
24
   </div>
16
 </template>
25
 </template>
18
 <script>
27
 <script>
19
 import { ehcartsInit } from '@/utils/echarts'
28
 import { ehcartsInit } from '@/utils/echarts'
20
 import { getBorrowStatistic } from '@/api/oa/borrow/borrow';
29
 import { getBorrowStatistic } from '@/api/oa/borrow/borrow';
21
-let borrowYearChart, borrowAmountChart, borrowUsageChart, borrowUsageAmountChart
30
+let borrowYearChart, borrowAmountChart, borrowUsageChart, borrowProjectChart, settleYearChart, settleAmountChart
22
 export default {
31
 export default {
23
   props: {
32
   props: {
24
     borrowData: {
33
     borrowData: {
25
       type: Object,
34
       type: Object,
26
       require: true,
35
       require: true,
27
-    }
36
+    },
37
+    settleData: {
38
+      type: Object,
39
+      require: true,
40
+    },
28
   },
41
   },
29
   watch: {
42
   watch: {
30
     borrowUsage() {
43
     borrowUsage() {
31
       this.initBorrowUsagePie(this.activeYear)
44
       this.initBorrowUsagePie(this.activeYear)
32
     },
45
     },
33
     borrowUsageAmount() {
46
     borrowUsageAmount() {
34
-      this.initBorrowUsageAmountPie(this.activeYear)
47
+      // this.initBorrowUsageAmountPie(this.activeYear)
35
     }
48
     }
36
   },
49
   },
37
   data() {
50
   data() {
41
       borrowUsage: {},
54
       borrowUsage: {},
42
       borrowUsageAmount: {},
55
       borrowUsageAmount: {},
43
       borrowYear: {},
56
       borrowYear: {},
57
+      settleYear: {},
58
+      settleAmount: {},
59
+      yearProjectAmount: {},
60
+      yearProjectCount: {},
44
       sumBorrowAmount: 0,
61
       sumBorrowAmount: 0,
62
+      sumSettleAmount: 0,
45
       dataLoading: false,
63
       dataLoading: false,
46
       activeYear: ''
64
       activeYear: ''
47
     }
65
     }
55
     this.initBorrowYearBar();
73
     this.initBorrowYearBar();
56
     this.initBorrowAmountLine();
74
     this.initBorrowAmountLine();
57
     this.initBorrowUsagePie('');
75
     this.initBorrowUsagePie('');
58
-    this.initBorrowUsageAmountPie('');
76
+    // this.initBorrowUsageAmountPie('');
77
+    this.initBorrowProjectLineBar();
78
+    this.initSettleYearBar();
79
+    this.initSettleAmountLine();
59
   },
80
   },
60
   methods: {
81
   methods: {
61
     initDatas() {
82
     initDatas() {
64
         this.borrowUsage = this.borrowData.usage[0];
85
         this.borrowUsage = this.borrowData.usage[0];
65
         this.borrowUsageAmount = this.borrowData.usageAmount[0];
86
         this.borrowUsageAmount = this.borrowData.usageAmount[0];
66
         this.borrowYear = this.borrowData.year[0];
87
         this.borrowYear = this.borrowData.year[0];
88
+        this.yearProjectAmount = this.borrowData.yearProjectAmount[0];
89
+        this.yearProjectCount = this.borrowData.yearProjectCount[0];
67
         let sum = Object.values(this.borrowAmount).reduce((accumulator, currentValue) => accumulator + currentValue, 0);
90
         let sum = Object.values(this.borrowAmount).reduce((accumulator, currentValue) => accumulator + currentValue, 0);
68
         this.sumBorrowAmount = (sum / 10000).toFixed(1)
91
         this.sumBorrowAmount = (sum / 10000).toFixed(1)
69
       }
92
       }
93
+      if (Object.keys(this.settleData).length !== 0) {
94
+        this.settleYear = this.settleData.year[0];
95
+        this.settleAmount = this.settleData.amount[0];
96
+        let sum = Object.values(this.settleAmount).reduce((accumulator, currentValue) => accumulator + currentValue, 0);
97
+        this.sumSettleAmount = (sum / 10000).toFixed(1)
98
+      }
70
     },
99
     },
71
     clickYear(charts) {
100
     clickYear(charts) {
72
       let that = this;
101
       let that = this;
204
     initBorrowUsagePie(year) {
233
     initBorrowUsagePie(year) {
205
       let option = {
234
       let option = {
206
         title: {
235
         title: {
207
-          text: year + '借款类型',
236
+          text: year + '借款类型占比',
208
         },
237
         },
209
         tooltip: {
238
         tooltip: {
210
           trigger: 'item',
239
           trigger: 'item',
217
           {
246
           {
218
             name: '占比',
247
             name: '占比',
219
             type: 'pie',
248
             type: 'pie',
220
-            radius: '40%',
249
+            radius: '30%',
250
+            center: ['25%', '50%'],
221
             avoidLabelOverlap: false,
251
             avoidLabelOverlap: false,
222
             data: Object.entries(this.borrowUsage).map(([key, value]) => {
252
             data: Object.entries(this.borrowUsage).map(([key, value]) => {
223
               return { name: key, value: value }
253
               return { name: key, value: value }
243
               }
273
               }
244
             },
274
             },
245
           },
275
           },
246
-        ]
247
-      };
248
-      ehcartsInit(borrowUsageChart, 'borrowUsagePie', option);
249
-    },
250
-    initBorrowUsageAmountPie(year) {
251
-      let option = {
252
-        title: {
253
-          text: year + '各类型借款金额',
254
-        },
255
-        tooltip: {
256
-          trigger: 'item',
257
-          formatter: '{a} <br/>{b} : {c} ({d}%)'
258
-        },
259
-        legend: {
260
-          top: 'bottom'
261
-        },
262
-        series: [
263
           {
276
           {
264
             name: '占比',
277
             name: '占比',
265
             type: 'pie',
278
             type: 'pie',
266
-            radius: '40%',
279
+            radius: '30%',
280
+            center: ['65%', '50%'],
267
             avoidLabelOverlap: false,
281
             avoidLabelOverlap: false,
268
             data: Object.entries(this.borrowUsageAmount).map(([key, value]) => {
282
             data: Object.entries(this.borrowUsageAmount).map(([key, value]) => {
269
               return { name: key, value: value }
283
               return { name: key, value: value }
291
           },
305
           },
292
         ]
306
         ]
293
       };
307
       };
294
-      ehcartsInit(borrowUsageAmountChart, 'borrowUsageAmountPie', option);
308
+      ehcartsInit(borrowUsageChart, 'borrowUsagePie', option);
309
+    },
310
+    initBorrowProjectLineBar(year) {
311
+      let option = {
312
+        title: {
313
+          text: '项目借款金额',
314
+        },
315
+        tooltip: {
316
+          trigger: 'axis',
317
+        },
318
+        grid: {
319
+          left: '1%',
320
+          right: '1%',
321
+          bottom: '0%',
322
+          containLabel: true
323
+        },
324
+        legend: {
325
+          right: '0%',
326
+          orient: 'vertical'
327
+        },
328
+        xAxis: [
329
+          {
330
+            type: 'category',
331
+            data: Object.keys(this.yearProjectAmount).map(item => item + '项目'),
332
+            axisPointer: {
333
+              type: 'shadow'
334
+            }
335
+          }
336
+        ],
337
+        yAxis: [
338
+          {
339
+            type: 'value',
340
+            name: '金额',
341
+          }
342
+        ],
343
+        series: [
344
+          {
345
+            type: 'line',
346
+            tooltip: {
347
+              valueFormatter: function (value) {
348
+                return value + ' 元';
349
+              }
350
+            },
351
+            smooth: true,
352
+            data: Object.values(this.yearProjectAmount),
353
+            label: {
354
+              show: true,
355
+              position: 'top',
356
+              formatter: function (params) {
357
+                let value = params.value;
358
+                if (value >= 10000) {
359
+                  return '约' + (value / 10000).toFixed(1) + '万元'
360
+                }
361
+              }
362
+            }
363
+          },
364
+        ]
365
+      };
366
+      ehcartsInit(borrowProjectChart, 'borrowProject', option);
367
+    },
368
+    initSettleYearBar() {
369
+      let option = {
370
+        title: {
371
+          text: '各年结算申请次数',
372
+          subtext: '共计结算次数:' + Object.values(this.settleYear).reduce((accumulator, currentValue) => accumulator + currentValue, 0) + '次'
373
+        },
374
+        grid: {
375
+          left: '1%',
376
+          right: '1%',
377
+          bottom: '0%',
378
+          height: '60%',
379
+          containLabel: true
380
+        },
381
+        graphic: [
382
+          {
383
+            type: 'text',
384
+            name: '',
385
+            right: '0',
386
+            top: '20%',
387
+            style: {
388
+              text: '全部年份',
389
+              fill: '#000', // 文本颜色  
390
+              fontSize: 12, // 文本大小  
391
+              fontWeight: '' // 文本粗细  
392
+            }
393
+          }
394
+        ],
395
+        tooltip: {
396
+          trigger: 'axis',
397
+          axisPointer: {
398
+            type: 'none',
399
+            label: {
400
+              backgroundColor: '#6a7985'
401
+            }
402
+          }
403
+        },
404
+        xAxis: {
405
+          name: '年',
406
+          type: 'category',
407
+          data: Object.keys(this.settleYear),
408
+        },
409
+        yAxis: {
410
+          type: 'value',
411
+          name: '单位:次'
412
+        },
413
+        series: [
414
+          {
415
+            data: Object.values(this.settleYear),
416
+            type: 'bar',
417
+            smooth: true,
418
+            label: {
419
+              show: true,
420
+              position: 'top'
421
+            },
422
+            itemStyle: {
423
+              color: '#00788C'
424
+            }
425
+          }
426
+        ]
427
+      };
428
+      let charts = ehcartsInit(settleYearChart, 'settleBar', option);
429
+    },
430
+    initSettleAmountLine() {
431
+      let option = {
432
+        title: {
433
+          text: '各年结算金额',
434
+          subtext: '结算总额:' + Object.values(this.settleAmount).reduce((accumulator, currentValue) => accumulator + currentValue, 0) + '元' +
435
+            '(约' + this.sumSettleAmount + '万元)'
436
+        },
437
+        grid: {
438
+          left: '1%',
439
+          right: '1%',
440
+          bottom: '0%',
441
+          height: '60%',
442
+          containLabel: true
443
+        },
444
+        tooltip: {
445
+          trigger: 'axis',
446
+          axisPointer: {
447
+            type: 'none',
448
+            label: {
449
+              backgroundColor: '#6a7985'
450
+            }
451
+          }
452
+        },
453
+        xAxis: {
454
+          type: 'category',
455
+          data: Object.keys(this.settleAmount),
456
+        },
457
+        yAxis: {
458
+          type: 'value',
459
+          name: '单位:元'
460
+        },
461
+        series: [
462
+          {
463
+            min: 0,
464
+            data: Object.values(this.settleAmount),
465
+            type: 'line',
466
+            smooth: true,
467
+            label: {
468
+              show: true,
469
+              position: 'top',
470
+              formatter: function (params) {
471
+                let value = params.value;
472
+                if (value >= 10000) {
473
+                  return '约' + (value / 10000).toFixed(1) + '万元'
474
+                }
475
+              }
476
+            }
477
+          }
478
+        ]
479
+      };
480
+      ehcartsInit(settleAmountChart, 'settleLine', option);
295
     }
481
     }
296
   },
482
   },
297
 }
483
 }
333
 
519
 
334
   .right {
520
   .right {
335
     flex: 1;
521
     flex: 1;
522
+
523
+    .right-top {
524
+      width: 100%;
525
+      height: 300px;
526
+      padding: 10px;
527
+      border: 1px solid #ececec;
528
+    }
336
   }
529
   }
337
 }
530
 }
338
 </style>
531
 </style>

+ 12
- 2
oa-ui/src/views/statistics/index.vue View File

2
  * @Author: ysh
2
  * @Author: ysh
3
  * @Date: 2024-10-11 09:23:15
3
  * @Date: 2024-10-11 09:23:15
4
  * @LastEditors: Please set LastEditors
4
  * @LastEditors: Please set LastEditors
5
- * @LastEditTime: 2024-10-18 11:35:36
5
+ * @LastEditTime: 2024-10-23 15:12:55
6
 -->
6
 -->
7
 <template>
7
 <template>
8
   <div class="app-container bg">
8
   <div class="app-container bg">
15
       <contract-statistics v-else-if="isActive == 'contract'" :datas="contractInfo"></contract-statistics>
15
       <contract-statistics v-else-if="isActive == 'contract'" :datas="contractInfo"></contract-statistics>
16
       <car-device-statistics v-else-if="isActive == 'device'" :deviceData="deviceInfo"
16
       <car-device-statistics v-else-if="isActive == 'device'" :deviceData="deviceInfo"
17
         :carData="carInfo"></car-device-statistics>
17
         :carData="carInfo"></car-device-statistics>
18
-      <borrow-statistics v-else-if="isActive == 'borrow'" :borrowData="borrowInfo"></borrow-statistics>
18
+      <borrow-statistics v-else-if="isActive == 'borrow'" :borrowData="borrowInfo" :settleData="settleInfo"></borrow-statistics>
19
     </div>
19
     </div>
20
   </div>
20
   </div>
21
 </template>
21
 </template>
26
 import { getCarStatistic } from '@/api/oa/car/car';
26
 import { getCarStatistic } from '@/api/oa/car/car';
27
 import { getDeviceStatistic } from '@/api/oa/device/device';
27
 import { getDeviceStatistic } from '@/api/oa/device/device';
28
 import { getBorrowStatistic } from '@/api/oa/borrow/borrow';
28
 import { getBorrowStatistic } from '@/api/oa/borrow/borrow';
29
+import { getSettleStatistic } from '@/api/oa/settle/settle';
29
 import ProjectStatistics from './components/projectStatistics.vue';
30
 import ProjectStatistics from './components/projectStatistics.vue';
30
 import contractStatistics from './components/contractStatistics.vue';
31
 import contractStatistics from './components/contractStatistics.vue';
31
 import topHead from './components/topHead.vue';
32
 import topHead from './components/topHead.vue';
41
       carInfo: {},
42
       carInfo: {},
42
       deviceInfo: {},
43
       deviceInfo: {},
43
       borrowInfo: {},
44
       borrowInfo: {},
45
+      settleInfo:{},
44
       dataLoading: true,
46
       dataLoading: true,
45
     }
47
     }
46
   },
48
   },
51
     this.getCarInfo();
53
     this.getCarInfo();
52
     this.getDeviceInfo();
54
     this.getDeviceInfo();
53
     this.getBorrowInfo();
55
     this.getBorrowInfo();
56
+    this.getSettleInfo();
54
   },
57
   },
55
   mounted() {
58
   mounted() {
56
 
59
 
80
     async getBorrowInfo() {
83
     async getBorrowInfo() {
81
       let res = await getBorrowStatistic();
84
       let res = await getBorrowStatistic();
82
       this.borrowInfo = res.data;
85
       this.borrowInfo = res.data;
86
+      console.log(res.data);
83
     },
87
     },
88
+    async getSettleInfo(){
89
+      let res = await getSettleStatistic();
90
+      this.settleInfo = res.data;
91
+      
92
+    },
93
+    
84
     changeClick(val) {
94
     changeClick(val) {
85
       this.isActive = val
95
       this.isActive = val
86
     }
96
     }

Loading…
Cancel
Save