Bladeren bron

修改车辆设备统计分析,修改借款打印

余思翰 6 maanden geleden
bovenliggende
commit
e3acc615bf

+ 6
- 1
oa-ui/src/views/flowable/form/components/print/borrowPrint.vue Bestand weergeven

@@ -17,6 +17,12 @@
17 17
             {{ formartUsage(form.borrowUsage) }}
18 18
           </td>
19 19
         </tr>
20
+        <tr v-if="form.borrowUsage != '0'">
21
+          <td :colspan="2" class="fontbold">借款事由</td>
22
+          <td :colspan="8">
23
+            {{ form.applyReason }}
24
+          </td>
25
+        </tr>
20 26
         <tr v-if="form.borrowUsage == '0'">
21 27
           <td :colspan="2" class="fontbold">项目名称</td>
22 28
           <td :colspan="4">{{ chooseProject.projectName }}</td>
@@ -210,7 +216,6 @@ export default {
210 216
     }
211 217
   },
212 218
   mounted() {
213
-
214 219
   },
215 220
   methods: {
216 221
     formartUsage(val) {

+ 1
- 1
oa-ui/src/views/oa/material/buy.vue Bestand weergeven

@@ -124,7 +124,7 @@
124 124
         <el-button @click="cancel">取 消</el-button>
125 125
       </div>
126 126
     </el-dialog>
127
-    <el-dialog title="选择耗材" :visible.sync="materialOpen" width="60%" append-to-body>
127
+    <el-dialog title="选择耗材" :visible.sync="materialOpen" width="60%" append-to-body :close-on-click-modal="false">
128 128
       <choose-materal @confirmChoose="confirmMaterial"></choose-materal>
129 129
     </el-dialog>
130 130
   </div>

+ 1
- 1
oa-ui/src/views/oa/material/give.vue Bestand weergeven

@@ -122,7 +122,7 @@
122 122
         <el-button @click="cancel">取 消</el-button>
123 123
       </div>
124 124
     </el-dialog>
125
-    <el-dialog title="选择耗材" :visible.sync="materialOpen" width="60%" append-to-body>
125
+    <el-dialog title="选择耗材" :visible.sync="materialOpen" width="60%" append-to-body :close-on-click-modal="false">
126 126
       <choose-materal @confirmChoose="confirmMaterial"></choose-materal>
127 127
     </el-dialog>
128 128
   </div>

+ 9
- 7
oa-ui/src/views/oa/project/invest.vue Bestand weergeven

@@ -1,8 +1,8 @@
1 1
 <!--
2 2
  * @Author: ysh
3 3
  * @Date: 2024-02-27 14:49:15
4
- * @LastEditors: wrh
5
- * @LastEditTime: 2024-09-20 17:11:35
4
+ * @LastEditors: Please set LastEditors
5
+ * @LastEditTime: 2024-10-17 11:27:44
6 6
 -->
7 7
 <template>
8 8
   <div class="project-wrapper">
@@ -134,7 +134,7 @@
134 134
         <el-form-item label="项目负责人:" prop="projectLeader">
135 135
           <el-tag effect="plain" type="warning" style="margin-right: 10px;"
136 136
             v-if="addForm.projectLeaderName != undefined">{{
137
-        addForm.projectLeaderName }}</el-tag>
137
+              addForm.projectLeaderName }}</el-tag>
138 138
           <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="choosePeople">选择</el-button>
139 139
         </el-form-item>
140 140
         <el-form-item label="项目类型:" prop="projectType">
@@ -358,10 +358,12 @@ export default {
358 358
     },
359 359
     handleView(row) {
360 360
       let id = row.projectId
361
-      this.$router.push({
362
-        path: '/project/info',
363
-        query: { projectId: id }
364
-      })
361
+      this.$router.push(
362
+        {
363
+          name: 'projectInfo',
364
+          params: { id },
365
+          query: { projectId: id, projectName: row.projectName }
366
+        });
365 367
     },
366 368
     handleUpdate(row) {
367 369
       this.addForm = row;

+ 602
- 0
oa-ui/src/views/statistics/components/carDeviceStatistics.vue Bestand weergeven

@@ -0,0 +1,602 @@
1
+<!--
2
+ * @Author: ysh
3
+ * @Date: 2024-10-17 10:40:13
4
+ * @LastEditors: Please set LastEditors
5
+ * @LastEditTime: 2024-10-17 17:21:13
6
+-->
7
+<template>
8
+  <div style="width:100%;" v-loading="loading">
9
+    <div class="titles">设备和车辆统计</div>
10
+    <div class="warpper">
11
+      <div class="left">
12
+        <div class="left-top" id="deviceYearBar"></div>
13
+        <div class="left-top" id="deviceStatusPie"></div>
14
+      </div>
15
+      <div class="middle">
16
+        <div class="middle-chart" id="deviceApprovalBar"></div>
17
+      </div>
18
+      <div class="right">
19
+        <div class="right-top" id="carYearBar"></div>
20
+        <div class="right-top" id="carStatusPie"></div>
21
+      </div>
22
+      <div class="right">
23
+        <div class="right-top" id="carApprovalBar"></div>
24
+        <div class="right-top" id="carDayBar"></div>
25
+      </div>
26
+    </div>
27
+  </div>
28
+</template>
29
+
30
+<script>
31
+import { ehcartsInit } from '@/utils/echarts'
32
+let deviceYearChart, deviceStatusChart, deviceApprovalChart, carYearChart, carStatusChart, carApprovalChart, carDayChart
33
+export default {
34
+  props: {
35
+    deviceData: {
36
+      type: Object,
37
+      require: true,
38
+    },
39
+    carData: {
40
+      type: Object,
41
+      require: true,
42
+    }
43
+  },
44
+  data() {
45
+    return {
46
+      loading: true,
47
+      deviceApproval: {},
48
+      deviceStatus: {},
49
+      deviceYear: {},
50
+      carApproval: {},
51
+      carStatus: {},
52
+      carYear: {},
53
+      carUsage: {},
54
+      carDay: {},
55
+    }
56
+  },
57
+  created() {
58
+    this.loading = true;
59
+    this.initDeviceDatas();
60
+    this.initCarDatas();
61
+    this.loading = false;
62
+  },
63
+  mounted() {
64
+    this.initDeviceYearBar();
65
+    this.initDeviceStatusPie();
66
+    this.initDeviceApprovalBar();
67
+    this.initCarYearBar();
68
+    this.initCarStatusPie();
69
+    this.initCarApprovalBar();
70
+    this.initCarDayBar();
71
+  },
72
+  methods: {
73
+    async initDeviceDatas() {
74
+      if (Object.keys(this.deviceData).length !== 0) {
75
+        this.deviceApproval = this.deviceData.approval;
76
+        this.deviceStatus = this.deviceData.status[0];
77
+        this.deviceYear = this.deviceData.year[0];
78
+      }
79
+    },
80
+    async initCarDatas() {
81
+      if (Object.keys(this.carData).length !== 0) {
82
+        this.carApproval = this.carData.approval;
83
+        this.carStatus = this.carData.status[0];
84
+        this.carYear = this.carData.year[0];
85
+        this.carUsage = this.carData.usage[0];
86
+        this.carDay = this.carData.day;
87
+      }
88
+    },
89
+    initDeviceYearBar() {
90
+      let option = {
91
+        title: {
92
+          text: '各年设备申领次数',
93
+          subtext: ''
94
+        },
95
+        grid: {
96
+          left: '1%',
97
+          right: '1%',
98
+          bottom: '0%',
99
+          height: '60%',
100
+          containLabel: true
101
+        },
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: {
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.deviceYear),
130
+        },
131
+        yAxis: {
132
+          type: 'value',
133
+          name: '单位:次'
134
+        },
135
+        series: [
136
+          {
137
+            data: Object.values(this.deviceYear),
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(deviceYearChart, 'deviceYearBar', option);
151
+    },
152
+    initDeviceStatusPie() {
153
+      let option = {
154
+        title: {
155
+          text: '设备和车辆状态',
156
+        },
157
+        tooltip: {
158
+          trigger: 'item',
159
+          formatter: '{a} <br/>{b} : {c} ({d}%)'
160
+        },
161
+        legend: {
162
+          top: 'bottom'
163
+        },
164
+        series: [
165
+          {
166
+            name: '占比',
167
+            type: 'pie',
168
+            radius: '25%',
169
+            center:['25%', '50%'],
170
+            avoidLabelOverlap: false,
171
+            data: Object.entries(this.deviceStatus).map(([key, value]) => {
172
+              return { name: key, value: value }
173
+            }),
174
+            emphasis: {
175
+              itemStyle: {
176
+                shadowBlur: 10,
177
+                shadowOffsetX: 0,
178
+                shadowColor: 'rgba(0, 0, 0, 0.5)'
179
+              }
180
+            },
181
+            label: {
182
+              alignTo: 'none',
183
+              minMargin: 5,
184
+              edgeDistance: 8,
185
+              lineHeight: 15,
186
+              rich: {
187
+                time: {
188
+                  fontSize: 10,
189
+                  color: '#999'
190
+                }
191
+              }
192
+            },
193
+          },
194
+          
195
+          {
196
+            name: '占比',
197
+            type: 'pie',
198
+            radius: '25%',
199
+            center:['75%', '50%'],
200
+            avoidLabelOverlap: false,
201
+            data: Object.entries(this.carStatus).map(([key, value]) => {
202
+              return { name: key, value: value }
203
+            }),
204
+            emphasis: {
205
+              itemStyle: {
206
+                shadowBlur: 10,
207
+                shadowOffsetX: 0,
208
+                shadowColor: 'rgba(0, 0, 0, 0.5)'
209
+              }
210
+            },
211
+            label: {
212
+              alignTo: 'none',
213
+              minMargin: 5,
214
+              edgeDistance: 8,
215
+              lineHeight: 15,
216
+              rich: {
217
+                time: {
218
+                  fontSize: 10,
219
+                  color: '#999'
220
+                }
221
+              }
222
+            },
223
+          },
224
+        ]
225
+      };
226
+      ehcartsInit(deviceStatusChart, 'deviceStatusPie', option);
227
+    },
228
+    initDeviceApprovalBar() {
229
+      let xData = this.deviceApproval.map(item => item.count)
230
+      let yData = this.deviceApproval.map(item => item.name)
231
+      let option = {
232
+        title: {
233
+          text: '各类设备申请次数榜'
234
+        },
235
+        tooltip: {
236
+          trigger: 'axis',
237
+          axisPointer: {
238
+            type: 'shadow'
239
+          }
240
+        },
241
+        toolbox: {
242
+          feature: {
243
+            dataView: {
244
+              show: true,
245
+              optionToContent: function (opt) {
246
+                var axisData = opt.yAxis[0].data;
247
+                var series = opt.series;
248
+                var table = '<table border="1" style="width:100%;text-align:center;border-collapse: collapse;"><tbody><tr>'
249
+                  + '<td>设备名称</td>'
250
+                  + '<td>数量</td>'
251
+                  + '</tr>';
252
+                for (var i = 0, l = axisData.length; i < l; i++) {
253
+                  table += '<tr>'
254
+                    + '<td>' + axisData[i] + '</td>'
255
+                    + '<td>' + series[0].data[i] + '</td>'
256
+                    + '</tr>';
257
+                }
258
+                table += '</tbody></table>';
259
+                return table;
260
+              }
261
+            }
262
+          }
263
+        },
264
+        dataZoom: [
265
+          {
266
+            type: 'inside',
267
+            start: 0,
268
+            end: 100,
269
+            show: true,
270
+            yAxisIndex: 0,
271
+          }
272
+        ],
273
+        grid: {
274
+          left: '3%',
275
+          right: '8%',
276
+          bottom: '3%',
277
+          containLabel: true
278
+        },
279
+        xAxis: {
280
+          type: 'value',
281
+        },
282
+        yAxis: {
283
+          type: 'category',
284
+          data: yData.reverse(),
285
+          axisLabel: {
286
+            fontSize: 12,
287
+            width: 120,
288
+            overflow: 'truncate',
289
+          }
290
+        },
291
+        series: [
292
+          {
293
+            type: 'bar',
294
+            data: xData.reverse(),
295
+          }
296
+        ]
297
+      };
298
+      ehcartsInit(deviceApprovalChart, 'deviceApprovalBar', option);
299
+    },
300
+    initCarYearBar(){
301
+      let option = {
302
+        title: {
303
+          text: '各年用车申请次数',
304
+          subtext: ''
305
+        },
306
+        grid: {
307
+          left: '1%',
308
+          right: '1%',
309
+          bottom: '0%',
310
+          height: '60%',
311
+          containLabel: true
312
+        },
313
+        // legend: {},
314
+        graphic: [
315
+          {
316
+            type: 'text',
317
+            name: '',
318
+            right: '0',
319
+            top: '20%',
320
+            style: {
321
+              text: '全部年份',
322
+              fill: '#000', // 文本颜色  
323
+              fontSize: 12, // 文本大小  
324
+              fontWeight: '' // 文本粗细  
325
+            }
326
+          }
327
+        ],
328
+        tooltip: {
329
+          trigger: 'axis',
330
+          axisPointer: {
331
+            type: 'none',
332
+            label: {
333
+              backgroundColor: '#6a7985'
334
+            }
335
+          }
336
+        },
337
+        xAxis: {
338
+          name: '年',
339
+          type: 'category',
340
+          data: Object.keys(this.carYear),
341
+        },
342
+        yAxis: {
343
+          type: 'value',
344
+          name: '单位:次'
345
+        },
346
+        series: [
347
+          {
348
+            data: Object.values(this.carYear),
349
+            type: 'bar',
350
+            smooth: true,
351
+            label: {
352
+              show: true,
353
+              position: 'top'
354
+            },
355
+            itemStyle:{
356
+              color:'#1ABC9C'
357
+            }
358
+          }
359
+        ]
360
+      };
361
+      let charts = ehcartsInit(carYearChart, 'carYearBar', option);
362
+    },
363
+    initCarStatusPie(){
364
+      let option = {
365
+        title: {
366
+          text: '车辆状态和申请类型情况',
367
+        },
368
+        tooltip: {
369
+          trigger: 'item',
370
+          formatter: '{a} <br/>{b} : {c} ({d}%)'
371
+        },
372
+        legend: {
373
+          top: 'bottom'
374
+        },
375
+        series: [
376
+          {
377
+            name: '占比',
378
+            type: 'pie',
379
+            radius: '40%',
380
+            // center:['75%', '50%'],
381
+            avoidLabelOverlap: false,
382
+            data: Object.entries(this.carUsage).map(([key, value]) => {
383
+              return { name: key, value: value }
384
+            }),
385
+            emphasis: {
386
+              itemStyle: {
387
+                shadowBlur: 10,
388
+                shadowOffsetX: 0,
389
+                shadowColor: 'rgba(0, 0, 0, 0.5)'
390
+              }
391
+            },
392
+            label: {
393
+              alignTo: 'none',
394
+              minMargin: 5,
395
+              edgeDistance: 8,
396
+              lineHeight: 15,
397
+              rich: {
398
+                time: {
399
+                  fontSize: 10,
400
+                  color: '#999'
401
+                }
402
+              }
403
+            },
404
+          },
405
+        ]
406
+      };
407
+      ehcartsInit(carStatusChart, 'carStatusPie', option);
408
+    },
409
+    initCarApprovalBar(){
410
+      let xData = this.carApproval.map(item => item.count)
411
+      let yData = this.carApproval.map(item => item.name)
412
+      let option = {
413
+        title: {
414
+          text: '车辆使用次数榜'
415
+        },
416
+        tooltip: {
417
+          trigger: 'axis',
418
+          axisPointer: {
419
+            type: 'shadow'
420
+          }
421
+        },
422
+        toolbox: {
423
+          feature: {
424
+            dataView: {
425
+              show: true,
426
+              optionToContent: function (opt) {
427
+                var axisData = opt.yAxis[0].data;
428
+                var series = opt.series;
429
+                var table = '<table border="1" style="width:100%;text-align:center;border-collapse: collapse;"><tbody><tr>'
430
+                  + '<td>车辆名称</td>'
431
+                  + '<td>数量</td>'
432
+                  + '</tr>';
433
+                for (var i = 0, l = axisData.length; i < l; i++) {
434
+                  table += '<tr>'
435
+                    + '<td>' + axisData[i] + '</td>'
436
+                    + '<td>' + series[0].data[i] + '</td>'
437
+                    + '</tr>';
438
+                }
439
+                table += '</tbody></table>';
440
+                return table;
441
+              }
442
+            }
443
+          }
444
+        },
445
+        dataZoom: [
446
+          {
447
+            type: 'inside',
448
+            start: 0,
449
+            end: 100,
450
+            show: true,
451
+            yAxisIndex: 0,
452
+          }
453
+        ],
454
+        grid: {
455
+          left: '3%',
456
+          right: '8%',
457
+          bottom: '3%',
458
+          containLabel: true
459
+        },
460
+        xAxis: {
461
+          type: 'value',
462
+        },
463
+        yAxis: {
464
+          type: 'category',
465
+          data: yData.reverse(),
466
+          axisLabel: {
467
+            fontSize: 12,
468
+            width: 120,
469
+            overflow: 'truncate',
470
+          }
471
+        },
472
+        series: [
473
+          {
474
+            type: 'bar',
475
+            data: xData.reverse(),
476
+          }
477
+        ]
478
+      };
479
+      ehcartsInit(carApprovalChart, 'carApprovalBar', option);
480
+    },
481
+    initCarDayBar(){
482
+      let xData = this.carDay.map(item => item.count)
483
+      let yData = this.carDay.map(item => item.name)
484
+      let option = {
485
+        title: {
486
+          text: '车辆使用天数榜'
487
+        },
488
+        tooltip: {
489
+          trigger: 'axis',
490
+          axisPointer: {
491
+            type: 'shadow'
492
+          }
493
+        },
494
+        toolbox: {
495
+          feature: {
496
+            dataView: {
497
+              show: true,
498
+              optionToContent: function (opt) {
499
+                var axisData = opt.yAxis[0].data;
500
+                var series = opt.series;
501
+                var table = '<table border="1" style="width:100%;text-align:center;border-collapse: collapse;"><tbody><tr>'
502
+                  + '<td>车辆名称</td>'
503
+                  + '<td>数量</td>'
504
+                  + '</tr>';
505
+                for (var i = 0, l = axisData.length; i < l; i++) {
506
+                  table += '<tr>'
507
+                    + '<td>' + axisData[i] + '</td>'
508
+                    + '<td>' + series[0].data[i] + '</td>'
509
+                    + '</tr>';
510
+                }
511
+                table += '</tbody></table>';
512
+                return table;
513
+              }
514
+            }
515
+          }
516
+        },
517
+        dataZoom: [
518
+          {
519
+            type: 'inside',
520
+            start: 0,
521
+            end: 100,
522
+            show: true,
523
+            yAxisIndex: 0,
524
+          }
525
+        ],
526
+        grid: {
527
+          left: '3%',
528
+          right: '8%',
529
+          bottom: '3%',
530
+          containLabel: true
531
+        },
532
+        xAxis: {
533
+          type: 'value',
534
+        },
535
+        yAxis: {
536
+          type: 'category',
537
+          data: yData.reverse(),
538
+          axisLabel: {
539
+            fontSize: 12,
540
+            width: 120,
541
+            overflow: 'truncate',
542
+          }
543
+        },
544
+        series: [
545
+          {
546
+            type: 'bar',
547
+            data: xData.reverse(),
548
+          }
549
+        ]
550
+      };
551
+      ehcartsInit(carDayChart, 'carDayBar', option);
552
+    }
553
+  },
554
+}
555
+</script>
556
+
557
+<style lang="scss" scoped>
558
+.titles {
559
+  font-family: 'puhuiti';
560
+  font-size: 16px;
561
+  margin-bottom: 16px;
562
+}
563
+
564
+.warpper {
565
+  width: 100%;
566
+  height: 100%;
567
+  display: flex;
568
+
569
+  .left {
570
+    flex: 1;
571
+
572
+    .left-top {
573
+      width: 100%;
574
+      height: 300px;
575
+      padding: 10px;
576
+      border: 1px solid #ececec;
577
+    }
578
+  }
579
+
580
+  .middle {
581
+    flex: 1;
582
+
583
+    .middle-chart {
584
+      width: 100%;
585
+      height: 600px;
586
+      padding: 10px;
587
+      border: 1px solid #ececec;
588
+    }
589
+  }
590
+
591
+  .right {
592
+    flex: 1;
593
+
594
+    .right-top {
595
+      width: 100%;
596
+      height: 300px;
597
+      padding: 10px;
598
+      border: 1px solid #ececec;
599
+    }
600
+  }
601
+}
602
+</style>

+ 24
- 3
oa-ui/src/views/statistics/components/contractStatistics.vue Bestand weergeven

@@ -89,7 +89,6 @@ export default {
89 89
       }
90 90
       this.subLoading = true;
91 91
       let subDatas = await getSubContractStatistic();
92
-      console.log(subDatas.data);
93 92
       this.subAmount = subDatas.data.amount[0];
94 93
       this.subYearNum = subDatas.data.year[0];
95 94
       this.subCwAmount = subDatas.data.cwAmount[0];
@@ -249,7 +248,18 @@ export default {
249 248
             },
250 249
             label: {
251 250
               alignTo: 'none',
252
-              formatter: '{name|{b}}\n{value|{c}元}',
251
+              formatter: function (params) {
252
+                let value = params.value;
253
+                if (value >= 100000000) {
254
+                  // 亿  
255
+                  let v = (value / 100000000).toFixed(4) + '亿'
256
+                  return params.name + '\n' + v + '元';
257
+                } else {
258
+                  // 千万元 
259
+                  let v = (value / 10000000).toFixed(4) + '千万元';
260
+                  return params.name + '\n' + v + '元';
261
+                }
262
+              },
253 263
               minMargin: 5,
254 264
               edgeDistance: 8,
255 265
               lineHeight: 15,
@@ -467,7 +477,18 @@ export default {
467 477
             },
468 478
             label: {
469 479
               alignTo: 'none',
470
-              formatter: '{name|{b}}\n{value|{c}元}',
480
+              formatter: function (params) {
481
+                let value = params.value;
482
+                if (value >= 100000000) {
483
+                  // 亿  
484
+                  let v = (value / 100000000).toFixed(4) + '亿'
485
+                  return params.name + '\n' + v + '元';
486
+                } else {
487
+                  // 千万元 
488
+                  let v = (value / 10000000).toFixed(4) + '千万';
489
+                  return params.name + '\n' + v + '元';
490
+                }
491
+              },
471 492
               minMargin: 5,
472 493
               edgeDistance: 8,
473 494
               lineHeight: 15,

+ 80
- 9
oa-ui/src/views/statistics/components/topHead.vue Bestand weergeven

@@ -31,18 +31,18 @@
31 31
           <div id="thisContract"></div>
32 32
         </div>
33 33
       </div>
34
-      <div class="three item-box">
34
+      <div class="three item-box" @click="$emit('handleClick', 'device')">
35 35
         <div class="data-left">
36
-          <div class="data-title">2024项目总数</div>
37
-          <div class="number">{{ projectNum.toLocaleString('en-US') }}</div>
36
+          <div class="data-title">{{ thisYear }}年设备申领记录</div>
37
+          <div class="number">{{ deviceNum.toLocaleString('en-US') }}</div>
38 38
           <div>
39 39
             <span class="text-1">较去年</span>
40
-            <span class="text-2" :class="{ upColor: isProjectUp, dowColor: !isProjectUp }">206</span>
41
-            <img :src="isProjectUp ? upImg : downImg" alt="">
40
+            <span class="text-2" :class="{ upColor: isDeviceUp, dowColor: !isDeviceUp }">{{ deviceSubYear }}</span>
41
+            <img :src="isDeviceUp ? upImg : downImg" alt="">
42 42
           </div>
43 43
         </div>
44 44
         <div class="chart-box">
45
-          <div id=""></div>
45
+          <div id="thisDevice"></div>
46 46
         </div>
47 47
       </div>
48 48
       <div class="four item-box">
@@ -67,8 +67,8 @@
67 67
 import upSrc from '@/assets/icons/up.png'
68 68
 import downSrc from '@/assets/icons/down.png'
69 69
 import * as echarts from 'echarts'
70
-import { disposeCharts, echartsSetoption, ehcartsInit } from '@/utils/echarts'
71
-let thisYearChart, contractYearChart
70
+import { ehcartsInit } from '@/utils/echarts'
71
+let thisYearChart, contractYearChart, deviceYearChart
72 72
 export default {
73 73
   props: {
74 74
     pDatas: {
@@ -78,16 +78,22 @@ export default {
78 78
     cDatas: {
79 79
       type: Object,
80 80
       require: true,
81
+    },
82
+    dDatas: {
83
+      type: Object,
84
+      require: true,
81 85
     }
82 86
   },
83 87
   data() {
84 88
     return {
85 89
       projectNum: 0,
86 90
       contractNum: 0,
91
+      deviceNum: 0,
87 92
       upImg: upSrc,
88 93
       downImg: downSrc,
89 94
       isProjectUp: false,
90 95
       isContractUp: false,
96
+      isDeviceUp: false,
91 97
       thisYear: new Date().getFullYear(),
92 98
       year: {},
93 99
       type: {},
@@ -97,8 +103,12 @@ export default {
97 103
       contractCwAmount: {},
98 104
       contractSource: {},
99 105
       contractYear: {},
106
+      deviceApproval: {},
107
+      deviceStatus: {},
108
+      deviceYear: {},
100 109
       subYear: 0,
101 110
       contractSubYear: 0,
111
+      deviceSubYear:0,
102 112
       loading: true
103 113
     }
104 114
   },
@@ -109,6 +119,9 @@ export default {
109 119
     contractYear() {
110 120
       this.initChartTwo();
111 121
     },
122
+    deviceYear(){
123
+      this.initChartThree();
124
+    },
112 125
     pDatas: {
113 126
       handler(newVal) {
114 127
         if (newVal) {
@@ -149,7 +162,12 @@ export default {
149 162
         this.contractYear = this.cDatas.year[0]
150 163
         this.getContractYearSub(this.contractYear)
151 164
       }
152
-
165
+      if (Object.keys(this.dDatas).length !== 0) {
166
+        this.deviceApproval = this.dDatas.approval[0];
167
+        this.deviceStatus = this.dDatas.status[0];
168
+        this.deviceYear = this.dDatas.year[0];
169
+        this.getDeviceYearSub(this.deviceYear)
170
+      }
153 171
       this.loading = false
154 172
     },
155 173
     initChartOne() {
@@ -233,6 +251,48 @@ export default {
233 251
       };
234 252
       ehcartsInit(contractYearChart, 'thisContract', option);
235 253
     },
254
+    initChartThree() {
255
+      let option = {
256
+        grid: {
257
+          left: '1%',
258
+          right: '1%',
259
+          bottom: '0%',
260
+          height: '60%',
261
+          containLabel: true
262
+        },
263
+        tooltip: {
264
+          trigger: 'axis',
265
+          axisPointer: {
266
+            type: 'none',
267
+            label: {
268
+              backgroundColor: '#6a7985'
269
+            }
270
+          }
271
+        },
272
+        xAxis: {
273
+          type: 'category',
274
+          data: Object.keys(this.deviceYear).slice(-6),
275
+          show: false
276
+        },
277
+        yAxis: {
278
+          type: 'value',
279
+          axisLabel: { show: false },
280
+          splitLine: { show: false }
281
+        },
282
+        series: [
283
+          {
284
+            min: 0,
285
+            data: Object.values(this.deviceYear).slice(-6),
286
+            type: 'line',
287
+            smooth: true,
288
+            itemStyle: {
289
+              color: '#3498DB'
290
+            }
291
+          }
292
+        ]
293
+      };
294
+      ehcartsInit(deviceYearChart, 'thisDevice', option);
295
+    },
236 296
     getProjectYearSub(year) {
237 297
       let arr = Object.values(year).slice(-2);
238 298
       this.subYear = Number(arr[1]) - Number(arr[0]);
@@ -255,6 +315,17 @@ export default {
255 315
         this.isContractUp = true
256 316
       }
257 317
     },
318
+    getDeviceYearSub(year) {
319
+      let arr = Object.values(year).slice(-2);
320
+      this.deviceSubYear = Number(arr[1]) - Number(arr[0]);
321
+      this.deviceNum = Number(arr[1])
322
+      if (this.deviceSubYear < 0) {
323
+        this.deviceSubYear = - this.deviceSubYear;
324
+        this.isDeviceUp = false
325
+      } else {
326
+        this.isDeviceUp = true
327
+      }
328
+    },
258 329
   },
259 330
 }
260 331
 </script>

+ 7
- 5
oa-ui/src/views/statistics/index.vue Bestand weergeven

@@ -2,16 +2,17 @@
2 2
  * @Author: ysh
3 3
  * @Date: 2024-10-11 09:23:15
4 4
  * @LastEditors: Please set LastEditors
5
- * @LastEditTime: 2024-10-16 15:30:12
5
+ * @LastEditTime: 2024-10-17 16:59:56
6 6
 -->
7 7
 <template>
8 8
   <div class="app-container bg">
9 9
     <div class="head">
10
-      <top-head @handleClick="changeClick" :pDatas="projectInfo" :cDatas="contractInfo"></top-head>
10
+      <top-head @handleClick="changeClick" :pDatas="projectInfo" :cDatas="contractInfo" :dDatas="deviceInfo"></top-head>
11 11
     </div>
12 12
     <div class="content">
13 13
       <project-statistics v-if="isActive == 'project'" :datas="projectInfo"></project-statistics>
14 14
       <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>
15 16
     </div>
16 17
   </div>
17 18
 </template>
@@ -24,8 +25,9 @@ import { getDeviceStatistic } from '@/api/oa/device/device';
24 25
 import ProjectStatistics from './components/projectStatistics.vue';
25 26
 import contractStatistics from './components/contractStatistics.vue';
26 27
 import topHead from './components/topHead.vue';
28
+import CarDeviceStatistics from './components/carDeviceStatistics.vue';
27 29
 export default {
28
-  components: { topHead, ProjectStatistics, contractStatistics },
30
+  components: { topHead, ProjectStatistics, contractStatistics, CarDeviceStatistics },
29 31
   data() {
30 32
     return {
31 33
       isActive: 'project',
@@ -60,12 +62,12 @@ export default {
60 62
     async getCarInfo() {
61 63
       let res = await getCarStatistic();
62 64
       this.carInfo = res.data;
63
-      
65
+      console.log(res.data);
64 66
     },
65 67
     async getDeviceInfo() {
66 68
       let res = await getDeviceStatistic();
67 69
       this.deviceInfo = res.data;
68
-      
70
+      console.log(res.data);
69 71
     },
70 72
     changeClick(val) {
71 73
       this.isActive = val

Laden…
Annuleren
Opslaan