forked from drone/command-center-dashboard

罗广辉
2025-04-21 2800fa4f32f3900509cb4d6eefaf2bfaf54efdd7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<template>
  <CommonTitle title="降本增效" />
  <div :style="{ marginLeft: pxToRem(14) }">
    <div class="synergy">
      <div class="synergy-item" v-for="item in list">
        <div class="title">{{ item.name }}</div>
        <div class="value" :style="{ color: item.color }">{{ item.value }}</div>
      </div>
    </div>
  </div>
</template>
<script setup>
import CommonTitle from '@/components/CommonTitle.vue';
import { pxToRem } from '@/utils/rem';
import {  optimizeCostEfficiency } from '@/api/home'
 
const list = ref([
  { name: '替代人工(人次)', value: 0, color: '#FFFFFF' },
  { name: '替代车辆(公里)', value: 0, color: '#FFA768' },
  { name: '节约成本(万元)', value: 0, color: '#68FFC8' },
]);
 
const getStatisticalData = () => {
  optimizeCostEfficiency().then((res) => {
    if (res.data.code !== 0) return;
    let result = res.data.data
    list.value[0].value = result.replaced_manual_times;
    list.value[1].value = result.saved_vehicle_kilometers;
    list.value[2].value = result.total_cost_saved;
  });
};
onMounted(() => {
  getStatisticalData();
});
</script>
 
<style scoped lang="scss">
.synergy {
  width: 390px;
  height: 108px;
  background: linear-gradient(
    270deg,
    #1f3e7a 0%,
    rgba(31, 62, 122, 0.35) 79%,
    rgba(31, 62, 122, 0) 100%
  );
  opacity: 0.85;
  margin: 2px 0 13 0;
  display: flex;
  justify-content: space-between;
  padding: 11px 27px 0;
 
  .synergy-item {
    width: 95px;
    height: 77px;
    padding-top: 7px;
    background: url('@/assets/images/home/homeRight/synergyBg.png') no-repeat center center / 100% 100%;
 
    .title {
      font-family: Source Han Sans CN, Source Han Sans CN, serif;
      font-weight: 400;
      font-size: 14px;
      color: #ffffff;
      text-align: center;
      font-style: normal;
      text-transform: none;
      margin-bottom: 4px;
    }
 
    .value {
      font-family: YouSheBiaoTiHei, YouSheBiaoTiHei, serif;
      font-weight: 400;
      font-size: 26px;
      color: #ffffff;
      line-height: 26px;
      font-style: normal;
      text-transform: none;
      text-align: center;
    }
  }
}
</style>