소스 검색

新增借款统计

余思翰 7 달 전
부모
커밋
d5c266982d

+ 9
- 0
oa-ui/src/api/oa/borrow/borrow.js 파일 보기

48
     method: 'delete'
48
     method: 'delete'
49
   })
49
   })
50
 }
50
 }
51
+
52
+// 查询借款统计
53
+export function getBorrowStatistic(query) {
54
+  return request({
55
+    url: '/oa/borrow/statistic',
56
+    method: 'get',
57
+    params: query
58
+  })
59
+}

+ 3
- 2
oa-ui/src/api/oa/car/car.js 파일 보기

2
  * @Author: wrh
2
  * @Author: wrh
3
  * @Date: 2024-02-27 13:47:55
3
  * @Date: 2024-02-27 13:47:55
4
  * @LastEditors: Please set LastEditors
4
  * @LastEditors: Please set LastEditors
5
- * @LastEditTime: 2024-10-16 11:30:58
5
+ * @LastEditTime: 2024-10-18 10:04:13
6
  */
6
  */
7
 import request from '@/utils/request'
7
 import request from '@/utils/request'
8
 
8
 
50
 }
50
 }
51
 
51
 
52
 // 查询cmc车辆信息列表
52
 // 查询cmc车辆信息列表
53
-export function getCarStatistic() {
53
+export function getCarStatistic(query) {
54
   return request({
54
   return request({
55
     url: '/oa/car/statistic',
55
     url: '/oa/car/statistic',
56
     method: 'get',
56
     method: 'get',
57
+    params: query
57
   })
58
   })
58
 }
59
 }

+ 339
- 0
oa-ui/src/views/statistics/components/borrowStatistics.vue 파일 보기

1
+<template>
2
+  <div style="width:100%;" v-loading="loading">
3
+    <div class="titles">借款统计</div>
4
+    <div class="warpper">
5
+      <div class="left">
6
+        <div class="left-top" id="borrowBar"></div>
7
+        <div class="left-top" id="borrowUsagePie" v-loading="dataLoading"></div>
8
+      </div>
9
+      <div class="middle">
10
+        <div class="middle-top" id="borrowLine"></div>
11
+        <div class="middle-top" id="borrowUsageAmountPie" v-loading="dataLoading"></div>
12
+      </div>
13
+      <div class="right"></div>
14
+    </div>
15
+  </div>
16
+</template>
17
+
18
+<script>
19
+import { ehcartsInit } from '@/utils/echarts'
20
+import { getBorrowStatistic } from '@/api/oa/borrow/borrow';
21
+let borrowYearChart, borrowAmountChart, borrowUsageChart, borrowUsageAmountChart
22
+export default {
23
+  props: {
24
+    borrowData: {
25
+      type: Object,
26
+      require: true,
27
+    }
28
+  },
29
+  watch: {
30
+    borrowUsage() {
31
+      this.initBorrowUsagePie(this.activeYear)
32
+    },
33
+    borrowUsageAmount() {
34
+      this.initBorrowUsageAmountPie(this.activeYear)
35
+    }
36
+  },
37
+  data() {
38
+    return {
39
+      loading: false,
40
+      borrowAmount: {},
41
+      borrowUsage: {},
42
+      borrowUsageAmount: {},
43
+      borrowYear: {},
44
+      sumBorrowAmount: 0,
45
+      dataLoading: false,
46
+      activeYear: ''
47
+    }
48
+  },
49
+  created() {
50
+    this.loading = true;
51
+    this.initDatas();
52
+    this.loading = false;
53
+  },
54
+  mounted() {
55
+    this.initBorrowYearBar();
56
+    this.initBorrowAmountLine();
57
+    this.initBorrowUsagePie('');
58
+    this.initBorrowUsageAmountPie('');
59
+  },
60
+  methods: {
61
+    initDatas() {
62
+      console.log(this.borrowData);
63
+      if (Object.keys(this.borrowData).length !== 0) {
64
+        this.borrowAmount = this.borrowData.amount[0];
65
+        this.borrowUsage = this.borrowData.usage[0];
66
+        this.borrowUsageAmount = this.borrowData.usageAmount[0];
67
+        this.borrowYear = this.borrowData.year[0];
68
+        let sum = Object.values(this.borrowAmount).reduce((accumulator, currentValue) => accumulator + currentValue, 0);
69
+        this.sumBorrowAmount = (sum / 10000).toFixed(1)
70
+      }
71
+    },
72
+    clickYear(charts) {
73
+      let that = this;
74
+      charts.on('click', function (event) {
75
+        if (event) {
76
+          that.activeYear = event.name;
77
+          let year = event.name + '-01-01'
78
+          if (event.name == "") {
79
+            year = ''
80
+          }
81
+          that.dataLoading = true
82
+          getBorrowStatistic({ applyDate: year }).then(res => {
83
+            that.borrowUsage = res.data.usage[0];
84
+            that.borrowUsageAmount = res.data.usageAmount[0];
85
+            that.dataLoading = false
86
+          })
87
+        }
88
+      })
89
+    },
90
+    initBorrowYearBar() {
91
+      let option = {
92
+        title: {
93
+          text: '各年借款申请次数',
94
+          subtext: '共计借款次数:' + Object.values(this.borrowYear).reduce((accumulator, currentValue) => accumulator + currentValue, 0) + '次'
95
+        },
96
+        grid: {
97
+          left: '1%',
98
+          right: '1%',
99
+          bottom: '0%',
100
+          height: '60%',
101
+          containLabel: true
102
+        },
103
+        graphic: [
104
+          {
105
+            type: 'text',
106
+            name: '',
107
+            right: '0',
108
+            top: '20%',
109
+            style: {
110
+              text: '全部年份',
111
+              fill: '#000', // 文本颜色  
112
+              fontSize: 12, // 文本大小  
113
+              fontWeight: '' // 文本粗细  
114
+            }
115
+          }
116
+        ],
117
+        tooltip: {
118
+          trigger: 'axis',
119
+          axisPointer: {
120
+            type: 'none',
121
+            label: {
122
+              backgroundColor: '#6a7985'
123
+            }
124
+          }
125
+        },
126
+        xAxis: {
127
+          name: '年',
128
+          type: 'category',
129
+          data: Object.keys(this.borrowYear),
130
+        },
131
+        yAxis: {
132
+          type: 'value',
133
+          name: '单位:次'
134
+        },
135
+        series: [
136
+          {
137
+            data: Object.values(this.borrowYear),
138
+            type: 'bar',
139
+            smooth: true,
140
+            label: {
141
+              show: true,
142
+              position: 'top'
143
+            },
144
+            itemStyle: {
145
+              color: '#3498DB'
146
+            }
147
+          }
148
+        ]
149
+      };
150
+      let charts = ehcartsInit(borrowYearChart, 'borrowBar', option);
151
+      this.clickYear(charts)
152
+    },
153
+    initBorrowAmountLine() {
154
+      let option = {
155
+        title: {
156
+          text: '各年借款金额',
157
+          subtext: '借款总额:' + Object.values(this.borrowAmount).reduce((accumulator, currentValue) => accumulator + currentValue, 0) + '元' +
158
+            '(约' + this.sumBorrowAmount + '万元)'
159
+        },
160
+        grid: {
161
+          left: '1%',
162
+          right: '1%',
163
+          bottom: '0%',
164
+          height: '60%',
165
+          containLabel: true
166
+        },
167
+        tooltip: {
168
+          trigger: 'axis',
169
+          axisPointer: {
170
+            type: 'none',
171
+            label: {
172
+              backgroundColor: '#6a7985'
173
+            }
174
+          }
175
+        },
176
+        xAxis: {
177
+          type: 'category',
178
+          data: Object.keys(this.borrowAmount),
179
+        },
180
+        yAxis: {
181
+          type: 'value',
182
+          name: '单位:元'
183
+        },
184
+        series: [
185
+          {
186
+            min: 0,
187
+            data: Object.values(this.borrowAmount),
188
+            type: 'line',
189
+            smooth: true,
190
+            label: {
191
+              show: true,
192
+              position: 'top',
193
+              formatter: function (params) {
194
+                let value = params.value;
195
+                if (value >= 10000) {
196
+                  return '约' + (value / 10000).toFixed(1) + '万元'
197
+                }
198
+              }
199
+            }
200
+          }
201
+        ]
202
+      };
203
+      ehcartsInit(borrowAmountChart, 'borrowLine', option);
204
+    },
205
+    initBorrowUsagePie(year) {
206
+      let option = {
207
+        title: {
208
+          text: year + '借款类型',
209
+        },
210
+        tooltip: {
211
+          trigger: 'item',
212
+          formatter: '{a} <br/>{b} : {c} ({d}%)'
213
+        },
214
+        legend: {
215
+          top: 'bottom'
216
+        },
217
+        series: [
218
+          {
219
+            name: '占比',
220
+            type: 'pie',
221
+            radius: '40%',
222
+            avoidLabelOverlap: false,
223
+            data: Object.entries(this.borrowUsage).map(([key, value]) => {
224
+              return { name: key, value: value }
225
+            }),
226
+            emphasis: {
227
+              itemStyle: {
228
+                shadowBlur: 10,
229
+                shadowOffsetX: 0,
230
+                shadowColor: 'rgba(0, 0, 0, 0.5)'
231
+              }
232
+            },
233
+            label: {
234
+              alignTo: 'none',
235
+              formatter: '{name|{b}}\n{value|{c}个}',
236
+              minMargin: 5,
237
+              edgeDistance: 8,
238
+              lineHeight: 15,
239
+              rich: {
240
+                time: {
241
+                  fontSize: 10,
242
+                  color: '#999'
243
+                }
244
+              }
245
+            },
246
+          },
247
+        ]
248
+      };
249
+      ehcartsInit(borrowUsageChart, 'borrowUsagePie', option);
250
+    },
251
+    initBorrowUsageAmountPie(year) {
252
+      let option = {
253
+        title: {
254
+          text: year + '各类型借款金额',
255
+        },
256
+        tooltip: {
257
+          trigger: 'item',
258
+          formatter: '{a} <br/>{b} : {c} ({d}%)'
259
+        },
260
+        legend: {
261
+          top: 'bottom'
262
+        },
263
+        series: [
264
+          {
265
+            name: '占比',
266
+            type: 'pie',
267
+            radius: '40%',
268
+            avoidLabelOverlap: false,
269
+            data: Object.entries(this.borrowUsageAmount).map(([key, value]) => {
270
+              return { name: key, value: value }
271
+            }),
272
+            emphasis: {
273
+              itemStyle: {
274
+                shadowBlur: 10,
275
+                shadowOffsetX: 0,
276
+                shadowColor: 'rgba(0, 0, 0, 0.5)'
277
+              }
278
+            },
279
+            label: {
280
+              alignTo: 'none',
281
+              formatter: '{name|{b}}\n{value|{c}元}',
282
+              minMargin: 5,
283
+              edgeDistance: 8,
284
+              lineHeight: 15,
285
+              rich: {
286
+                time: {
287
+                  fontSize: 10,
288
+                  color: '#999'
289
+                }
290
+              }
291
+            },
292
+          },
293
+        ]
294
+      };
295
+      ehcartsInit(borrowUsageAmountChart, 'borrowUsageAmountPie', option);
296
+    }
297
+  },
298
+}
299
+</script>
300
+
301
+<style lang="scss" scoped>
302
+.titles {
303
+  font-family: 'puhuiti';
304
+  font-size: 16px;
305
+  margin-bottom: 16px;
306
+}
307
+
308
+.warpper {
309
+  width: 100%;
310
+  height: 100%;
311
+  display: flex;
312
+
313
+  .left {
314
+    flex: 1;
315
+
316
+    .left-top {
317
+      width: 100%;
318
+      height: 300px;
319
+      padding: 10px;
320
+      border: 1px solid #ececec;
321
+    }
322
+  }
323
+
324
+  .middle {
325
+    flex: 1;
326
+
327
+    .middle-top {
328
+      width: 100%;
329
+      height: 300px;
330
+      padding: 10px;
331
+      border: 1px solid #ececec;
332
+    }
333
+  }
334
+
335
+  .right {
336
+    flex: 1;
337
+  }
338
+}
339
+</style>

+ 40
- 21
oa-ui/src/views/statistics/components/carDeviceStatistics.vue 파일 보기

2
  * @Author: ysh
2
  * @Author: ysh
3
  * @Date: 2024-10-17 10:40:13
3
  * @Date: 2024-10-17 10:40:13
4
  * @LastEditors: Please set LastEditors
4
  * @LastEditors: Please set LastEditors
5
- * @LastEditTime: 2024-10-17 17:21:13
5
+ * @LastEditTime: 2024-10-18 14:55:46
6
 -->
6
 -->
7
 <template>
7
 <template>
8
   <div style="width:100%;" v-loading="loading">
8
   <div style="width:100%;" v-loading="loading">
17
       </div>
17
       </div>
18
       <div class="right">
18
       <div class="right">
19
         <div class="right-top" id="carYearBar"></div>
19
         <div class="right-top" id="carYearBar"></div>
20
-        <div class="right-top" id="carStatusPie"></div>
20
+        <div class="right-top" id="carStatusPie" v-loading="dataLoading"></div>
21
       </div>
21
       </div>
22
-      <div class="right">
22
+      <div class="right" v-loading="dataLoading">
23
         <div class="right-top" id="carApprovalBar"></div>
23
         <div class="right-top" id="carApprovalBar"></div>
24
         <div class="right-top" id="carDayBar"></div>
24
         <div class="right-top" id="carDayBar"></div>
25
       </div>
25
       </div>
29
 
29
 
30
 <script>
30
 <script>
31
 import { ehcartsInit } from '@/utils/echarts'
31
 import { ehcartsInit } from '@/utils/echarts'
32
+import { getCarStatistic } from '@/api/oa/car/car';
33
+import { getDeviceStatistic } from '@/api/oa/device/device';
32
 let deviceYearChart, deviceStatusChart, deviceApprovalChart, carYearChart, carStatusChart, carApprovalChart, carDayChart
34
 let deviceYearChart, deviceStatusChart, deviceApprovalChart, carYearChart, carStatusChart, carApprovalChart, carDayChart
33
 export default {
35
 export default {
34
   props: {
36
   props: {
41
       require: true,
43
       require: true,
42
     }
44
     }
43
   },
45
   },
46
+  watch: {
47
+    carUsage(){
48
+      this.initCarUsagePie()
49
+    },
50
+    carApproval(){
51
+      this.initCarApprovalBar()
52
+    },
53
+    carDay(){
54
+      this.initCarDayBar()
55
+    }
56
+  },
44
   data() {
57
   data() {
45
     return {
58
     return {
46
       loading: true,
59
       loading: true,
52
       carYear: {},
65
       carYear: {},
53
       carUsage: {},
66
       carUsage: {},
54
       carDay: {},
67
       carDay: {},
68
+      dataLoading:false,
55
     }
69
     }
56
   },
70
   },
57
   created() {
71
   created() {
65
     this.initDeviceStatusPie();
79
     this.initDeviceStatusPie();
66
     this.initDeviceApprovalBar();
80
     this.initDeviceApprovalBar();
67
     this.initCarYearBar();
81
     this.initCarYearBar();
68
-    this.initCarStatusPie();
82
+    this.initCarUsagePie();
69
     this.initCarApprovalBar();
83
     this.initCarApprovalBar();
70
     this.initCarDayBar();
84
     this.initCarDayBar();
71
   },
85
   },
86
         this.carDay = this.carData.day;
100
         this.carDay = this.carData.day;
87
       }
101
       }
88
     },
102
     },
103
+    clickYear(charts) {
104
+      let that = this;
105
+      charts.on('click', function (event) {
106
+        if (event) {
107
+          that.activeYear = event.name;
108
+          let year = event.name + '-01-01'
109
+          if (event.name == "") {
110
+            year = ''
111
+          }
112
+          that.dataLoading = true
113
+          getCarStatistic({ applyDate: year }).then(res => {
114
+            that.carApproval = res.data.approval;
115
+            that.carUsage = res.data.usage[0];
116
+            that.carDay = res.data.day;
117
+            that.dataLoading = false
118
+          })
119
+        }
120
+      })
121
+    },
89
     initDeviceYearBar() {
122
     initDeviceYearBar() {
90
       let option = {
123
       let option = {
91
         title: {
124
         title: {
99
           height: '60%',
132
           height: '60%',
100
           containLabel: true
133
           containLabel: true
101
         },
134
         },
102
-        // legend: {},
103
-        graphic: [
104
-          {
105
-            type: 'text',
106
-            name: '',
107
-            right: '0',
108
-            top: '20%',
109
-            style: {
110
-              text: '全部年份',
111
-              fill: '#000', // 文本颜色  
112
-              fontSize: 12, // 文本大小  
113
-              fontWeight: '' // 文本粗细  
114
-            }
115
-          }
116
-        ],
117
         tooltip: {
135
         tooltip: {
118
           trigger: 'axis',
136
           trigger: 'axis',
119
           axisPointer: {
137
           axisPointer: {
359
         ]
377
         ]
360
       };
378
       };
361
       let charts = ehcartsInit(carYearChart, 'carYearBar', option);
379
       let charts = ehcartsInit(carYearChart, 'carYearBar', option);
380
+      this.clickYear(charts)
362
     },
381
     },
363
-    initCarStatusPie(){
382
+    initCarUsagePie(){
364
       let option = {
383
       let option = {
365
         title: {
384
         title: {
366
-          text: '车辆状态和申请类型情况',
385
+          text: '车辆申请类型',
367
         },
386
         },
368
         tooltip: {
387
         tooltip: {
369
           trigger: 'item',
388
           trigger: 'item',

+ 108
- 15
oa-ui/src/views/statistics/components/topHead.vue 파일 보기

45
           <div id="thisDevice"></div>
45
           <div id="thisDevice"></div>
46
         </div>
46
         </div>
47
       </div>
47
       </div>
48
-      <div class="four item-box">
48
+      <div class="four item-box" @click="$emit('handleClick', 'borrow')">
49
         <div class="data-left">
49
         <div class="data-left">
50
-          <div class="data-title">2024项目总数</div>
51
-          <div class="number">{{ projectNum.toLocaleString('en-US') }}</div>
50
+          <div class="data-title">{{ thisYear }}借款申请次数</div>
51
+          <div class="number">{{ borrowNum.toLocaleString('en-US') }}</div>
52
           <div>
52
           <div>
53
             <span class="text-1">较去年</span>
53
             <span class="text-1">较去年</span>
54
-            <span class="text-2" :class="{ upColor: isProjectUp, dowColor: !isProjectUp }">206</span>
55
-            <img :src="isProjectUp ? upImg : downImg" alt="">
54
+            <span class="text-2" :class="{ upColor: isBorrowUp, dowColor: !isBorrowUp }">{{ borrowSubYear }}</span>
55
+            <img :src="isBorrowUp ? upImg : downImg" alt="">
56
           </div>
56
           </div>
57
         </div>
57
         </div>
58
         <div class="chart-box">
58
         <div class="chart-box">
59
-          <div id=""></div>
59
+          <div id="thisBorrow"></div>
60
         </div>
60
         </div>
61
       </div>
61
       </div>
62
     </div>
62
     </div>
68
 import downSrc from '@/assets/icons/down.png'
68
 import downSrc from '@/assets/icons/down.png'
69
 import * as echarts from 'echarts'
69
 import * as echarts from 'echarts'
70
 import { ehcartsInit } from '@/utils/echarts'
70
 import { ehcartsInit } from '@/utils/echarts'
71
-let thisYearChart, contractYearChart, deviceYearChart
71
+let thisYearChart, contractYearChart, deviceYearChart,borrowYearChart
72
 export default {
72
 export default {
73
   props: {
73
   props: {
74
     pDatas: {
74
     pDatas: {
82
     dDatas: {
82
     dDatas: {
83
       type: Object,
83
       type: Object,
84
       require: true,
84
       require: true,
85
+    },
86
+    bDatas: {
87
+      type: Object,
88
+      require: true,
85
     }
89
     }
86
   },
90
   },
87
   data() {
91
   data() {
89
       projectNum: 0,
93
       projectNum: 0,
90
       contractNum: 0,
94
       contractNum: 0,
91
       deviceNum: 0,
95
       deviceNum: 0,
96
+      borrowNum: 0,
92
       upImg: upSrc,
97
       upImg: upSrc,
93
       downImg: downSrc,
98
       downImg: downSrc,
94
       isProjectUp: false,
99
       isProjectUp: false,
95
       isContractUp: false,
100
       isContractUp: false,
96
       isDeviceUp: false,
101
       isDeviceUp: false,
102
+      isBorrowUp: false,
97
       thisYear: new Date().getFullYear(),
103
       thisYear: new Date().getFullYear(),
98
       year: {},
104
       year: {},
99
       type: {},
105
       type: {},
106
       deviceApproval: {},
112
       deviceApproval: {},
107
       deviceStatus: {},
113
       deviceStatus: {},
108
       deviceYear: {},
114
       deviceYear: {},
115
+      borrowAmount: {},
116
+      borrowUsage: {},
117
+      borrowUsageAmount: {},
118
+      borrowYear: {},
109
       subYear: 0,
119
       subYear: 0,
110
       contractSubYear: 0,
120
       contractSubYear: 0,
111
-      deviceSubYear:0,
121
+      deviceSubYear: 0,
122
+      borrowSubYear: 0,
112
       loading: true
123
       loading: true
113
     }
124
     }
114
   },
125
   },
119
     contractYear() {
130
     contractYear() {
120
       this.initChartTwo();
131
       this.initChartTwo();
121
     },
132
     },
122
-    deviceYear(){
133
+    deviceYear() {
123
       this.initChartThree();
134
       this.initChartThree();
124
     },
135
     },
136
+    borrowYear(){
137
+      this.initChartFour();
138
+    },
125
     pDatas: {
139
     pDatas: {
126
       handler(newVal) {
140
       handler(newVal) {
127
         if (newVal) {
141
         if (newVal) {
139
       },
153
       },
140
       immediate: true,  // 在绑定时立即执行一次  
154
       immediate: true,  // 在绑定时立即执行一次  
141
       deep: true       // 深度监听对象的变化  
155
       deep: true       // 深度监听对象的变化  
142
-    }
156
+    },
157
+    dDatas: {
158
+      handler(newVal) {
159
+        if (newVal) {
160
+          this.initDatas();
161
+        }
162
+      },
163
+      immediate: true,  // 在绑定时立即执行一次  
164
+      deep: true       // 深度监听对象的变化  
165
+    },
166
+    bDatas: {
167
+      handler(newVal) {
168
+        if (newVal) {
169
+          this.initDatas();
170
+        }
171
+      },
172
+      immediate: true,  // 在绑定时立即执行一次  
173
+      deep: true       // 深度监听对象的变化  
174
+    },
143
   },
175
   },
144
   created() {
176
   created() {
145
   },
177
   },
157
       }
189
       }
158
       if (Object.keys(this.cDatas).length !== 0) {
190
       if (Object.keys(this.cDatas).length !== 0) {
159
         this.contractAmount = this.cDatas.amount[0];
191
         this.contractAmount = this.cDatas.amount[0];
160
-        this.contractCwAmount = this.cDatas.cwAmount[0]
161
-        this.contractSource = this.cDatas.source[0]
162
-        this.contractYear = this.cDatas.year[0]
163
-        this.getContractYearSub(this.contractYear)
192
+        this.contractCwAmount = this.cDatas.cwAmount[0];
193
+        this.contractSource = this.cDatas.source[0];
194
+        this.contractYear = this.cDatas.year[0];
195
+        this.getContractYearSub(this.contractYear);
164
       }
196
       }
165
       if (Object.keys(this.dDatas).length !== 0) {
197
       if (Object.keys(this.dDatas).length !== 0) {
166
         this.deviceApproval = this.dDatas.approval[0];
198
         this.deviceApproval = this.dDatas.approval[0];
167
         this.deviceStatus = this.dDatas.status[0];
199
         this.deviceStatus = this.dDatas.status[0];
168
         this.deviceYear = this.dDatas.year[0];
200
         this.deviceYear = this.dDatas.year[0];
169
-        this.getDeviceYearSub(this.deviceYear)
201
+        this.getDeviceYearSub(this.deviceYear);
202
+      }
203
+      if (Object.keys(this.bDatas).length !== 0) {
204
+        this.borrowAmount = this.bDatas.amount[0];
205
+        this.borrowUsage = this.bDatas.usage[0];
206
+        this.borrowUsageAmount = this.bDatas.usageAmount[0];
207
+        this.borrowYear = this.bDatas.year[0];
208
+        this.getBorrowYearSub(this.borrowYear);
170
       }
209
       }
210
+
171
       this.loading = false
211
       this.loading = false
172
     },
212
     },
173
     initChartOne() {
213
     initChartOne() {
293
       };
333
       };
294
       ehcartsInit(deviceYearChart, 'thisDevice', option);
334
       ehcartsInit(deviceYearChart, 'thisDevice', option);
295
     },
335
     },
336
+    initChartFour() {
337
+      let option = {
338
+        grid: {
339
+          left: '1%',
340
+          right: '1%',
341
+          bottom: '0%',
342
+          height: '60%',
343
+          containLabel: true
344
+        },
345
+        tooltip: {
346
+          trigger: 'axis',
347
+          axisPointer: {
348
+            type: 'none',
349
+            label: {
350
+              backgroundColor: '#6a7985'
351
+            }
352
+          }
353
+        },
354
+        xAxis: {
355
+          type: 'category',
356
+          data: Object.keys(this.borrowYear).slice(-6),
357
+          show: false
358
+        },
359
+        yAxis: {
360
+          type: 'value',
361
+          axisLabel: { show: false },
362
+          splitLine: { show: false }
363
+        },
364
+        series: [
365
+          {
366
+            min: 0,
367
+            data: Object.values(this.borrowYear).slice(-6),
368
+            type: 'line',
369
+            smooth: true,
370
+            itemStyle: {
371
+              color: '#7B68EE'
372
+            }
373
+          }
374
+        ]
375
+      };
376
+      ehcartsInit(borrowYearChart, 'thisBorrow', option);
377
+    },
296
     getProjectYearSub(year) {
378
     getProjectYearSub(year) {
297
       let arr = Object.values(year).slice(-2);
379
       let arr = Object.values(year).slice(-2);
298
       this.subYear = Number(arr[1]) - Number(arr[0]);
380
       this.subYear = Number(arr[1]) - Number(arr[0]);
326
         this.isDeviceUp = true
408
         this.isDeviceUp = true
327
       }
409
       }
328
     },
410
     },
411
+    getBorrowYearSub(year) {
412
+      let arr = Object.values(year).slice(-2);
413
+      this.borrowSubYear = Number(arr[1]) - Number(arr[0]);
414
+      this.borrowNum = Number(arr[1])
415
+      if (this.borrowSubYear < 0) {
416
+        this.borrowSubYear = - this.borrowSubYear;
417
+        this.isBorrowUp = false
418
+      } else {
419
+        this.isBorrowUp = true
420
+      }
421
+    }
329
   },
422
   },
330
 }
423
 }
331
 </script>
424
 </script>

+ 20
- 8
oa-ui/src/views/statistics/index.vue 파일 보기

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-17 16:59:56
5
+ * @LastEditTime: 2024-10-18 11:35:36
6
 -->
6
 -->
7
 <template>
7
 <template>
8
   <div class="app-container bg">
8
   <div class="app-container bg">
9
-    <div class="head">
10
-      <top-head @handleClick="changeClick" :pDatas="projectInfo" :cDatas="contractInfo" :dDatas="deviceInfo"></top-head>
9
+    <div class="head" v-loading="dataLoading">
10
+      <top-head @handleClick="changeClick" :pDatas="projectInfo" :cDatas="contractInfo" :dDatas="deviceInfo"
11
+        :bDatas="borrowInfo"></top-head>
11
     </div>
12
     </div>
12
     <div class="content">
13
     <div class="content">
13
       <project-statistics v-if="isActive == 'project'" :datas="projectInfo"></project-statistics>
14
       <project-statistics v-if="isActive == 'project'" :datas="projectInfo"></project-statistics>
14
       <contract-statistics v-else-if="isActive == 'contract'" :datas="contractInfo"></contract-statistics>
15
       <contract-statistics v-else-if="isActive == 'contract'" :datas="contractInfo"></contract-statistics>
15
-      <car-device-statistics v-else-if="isActive == 'device'" :deviceData="deviceInfo" :carData="carInfo"></car-device-statistics>
16
+      <car-device-statistics v-else-if="isActive == 'device'" :deviceData="deviceInfo"
17
+        :carData="carInfo"></car-device-statistics>
18
+      <borrow-statistics v-else-if="isActive == 'borrow'" :borrowData="borrowInfo"></borrow-statistics>
16
     </div>
19
     </div>
17
   </div>
20
   </div>
18
 </template>
21
 </template>
19
 
22
 
20
 <script>
23
 <script>
21
-import { getProjectStatistic } from '@/api/oa/project/project'
24
+import { getProjectStatistic } from '@/api/oa/project/project';
22
 import { getContractStatistic } from '@/api/oa/contract/contract';
25
 import { getContractStatistic } from '@/api/oa/contract/contract';
23
 import { getCarStatistic } from '@/api/oa/car/car';
26
 import { getCarStatistic } from '@/api/oa/car/car';
24
 import { getDeviceStatistic } from '@/api/oa/device/device';
27
 import { getDeviceStatistic } from '@/api/oa/device/device';
28
+import { getBorrowStatistic } from '@/api/oa/borrow/borrow';
25
 import ProjectStatistics from './components/projectStatistics.vue';
29
 import ProjectStatistics from './components/projectStatistics.vue';
26
 import contractStatistics from './components/contractStatistics.vue';
30
 import contractStatistics from './components/contractStatistics.vue';
27
 import topHead from './components/topHead.vue';
31
 import topHead from './components/topHead.vue';
28
 import CarDeviceStatistics from './components/carDeviceStatistics.vue';
32
 import CarDeviceStatistics from './components/carDeviceStatistics.vue';
33
+import BorrowStatistics from './components/borrowStatistics.vue';
29
 export default {
34
 export default {
30
-  components: { topHead, ProjectStatistics, contractStatistics, CarDeviceStatistics },
35
+  components: { topHead, ProjectStatistics, contractStatistics, CarDeviceStatistics, BorrowStatistics },
31
   data() {
36
   data() {
32
     return {
37
     return {
33
       isActive: 'project',
38
       isActive: 'project',
35
       projectInfo: {},
40
       projectInfo: {},
36
       carInfo: {},
41
       carInfo: {},
37
       deviceInfo: {},
42
       deviceInfo: {},
43
+      borrowInfo: {},
44
+      dataLoading: true,
38
     }
45
     }
39
   },
46
   },
40
   created() {
47
   created() {
48
+    this.dataLoading = true;
41
     this.getProjectInfo();
49
     this.getProjectInfo();
42
     this.getContractInfo();
50
     this.getContractInfo();
43
     this.getCarInfo();
51
     this.getCarInfo();
44
     this.getDeviceInfo();
52
     this.getDeviceInfo();
53
+    this.getBorrowInfo();
45
   },
54
   },
46
   mounted() {
55
   mounted() {
47
 
56
 
62
     async getCarInfo() {
71
     async getCarInfo() {
63
       let res = await getCarStatistic();
72
       let res = await getCarStatistic();
64
       this.carInfo = res.data;
73
       this.carInfo = res.data;
65
-      console.log(res.data);
66
     },
74
     },
67
     async getDeviceInfo() {
75
     async getDeviceInfo() {
68
       let res = await getDeviceStatistic();
76
       let res = await getDeviceStatistic();
69
       this.deviceInfo = res.data;
77
       this.deviceInfo = res.data;
70
-      console.log(res.data);
78
+      this.dataLoading = false;
79
+    },
80
+    async getBorrowInfo() {
81
+      let res = await getBorrowStatistic();
82
+      this.borrowInfo = res.data;
71
     },
83
     },
72
     changeClick(val) {
84
     changeClick(val) {
73
       this.isActive = val
85
       this.isActive = val

Loading…
취소
저장