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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<template>
  <div class="mapPopUpBox">
    <div class="header">
      <div class="headerLeft">
        <img class="header-image" src="../../assets/images/home/mapPopUpBox/titleImg.png" alt="" />
        <div class="header-title">{{ dataObj.region_name }}</div>
      </div>
      <el-icon class="header-close" @click="props.removeLabel">
        <Close />
      </el-icon>
    </div>
    <div class="loading" v-if="loading">加载中...</div>
    <div class="content" v-else>
      <div class="info">
        <div class="info-item">
          机巢数:
          <div class="num">{{ dataObj.device_num }}</div>
        </div>
        <div class="info-item">
          任务次数:
          <div class="num">{{ dataObj.jobNum }}</div>
        </div>
      </div>
      <div class="status-title">机巢状态</div>
      <div class="status-list">
        <div v-for="item in list" :key="item.name" class="status-item">
          <div class="status-value" :style="{ color: item.color }">{{ item.value }}</div>
          <div class="status-name">{{ item.name }}</div>
        </div>
      </div>
    </div>
 
  </div>
</template>
<script setup>
import { Close } from '@element-plus/icons-vue';
import { getDeviceInfoNum } from '@/api/home/machineNest';
import { getTotalJobNum } from '@/api/home';
 
const props = defineProps(['data', 'removeLabel']);
const list = ref([
  { name: '空闲中', value: 0, color: '#8EFFAC' },
  { name: '作业', value: 0, color: '#FFA768' },
  { name: '离线中', value: 0, color: '#FFFFFF' },
]);
const loading = ref(true);
 
const dataObj = ref({
  device_num: 0,
  jobNum: 0,
  region_name: '',
});
onMounted(async () => {
  loading.value = true;
  const areaCode = props.data.region_code;
  dataObj.value.region_name = props.data.region_name;
  const res = await getDeviceInfoNum({ areaCode });
 
  
  const resJob = await getTotalJobNum({ areaCode });
  dataObj.value.jobNum = resJob.data.data;
  dataObj.value.device_num = res.data.data.device_num;
  list.value[0].value = res.data.data.leisure_num;
  list.value[1].value = res.data.data.ex_num;
  list.value[2].value = res.data.data.offline_num;
  loading.value = false;
});
</script>
<style scoped lang="scss">
.mapPopUpBox {
  width: 418px;
  height: 240px;
  background: url('@/assets/images/home/mapPopUpBox/mapPopUpBg.png') no-repeat center / 100% 100%;
  padding-left: 98px;
 
  .loading{
    display: flex;
    height: calc(100% - 51px);
    justify-content: center;
    align-items: center;
    font-size: 20px;
    color: #ffffff;
    background: rgb(24,50,101,.5);
  }
 
  .header {
    padding: 0 12px;
    width: 320px;
    height: 51px;
    display: flex;
    align-items: center;
    justify-content: space-between;
 
    .headerLeft {
      display: flex;
    }
 
    img {
      width: 26px;
      height: 26px;
    }
 
    &-title {
      font-family: YouSheBiaoTiHei, YouSheBiaoTiHei, serif;
      font-weight: 400;
      font-size: 26px;
      line-height: 30px;
      letter-spacing: 2px;
      text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.25);
      background: linear-gradient(180deg, #ffffff 41%, #35d0ff 86%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      -moz-background-clip: text;
      -moz-text-fill-color: transparent;
      background-clip: text;
      text-fill-color: transparent;
      margin-left: 4px;
    }
 
    &-close {
      width: 25px;
      height: 100%;
      line-height: 100%;
      display: flex;
      align-items: center;
      color: #9cd5ff;
      pointer-events: all;
      cursor: pointer;
    }
  }
.content {
padding: 0px 23px 25px 15px;
}
  .info {
    height: 34px;
    font-family: Source Han Sans CN, Source Han Sans CN, serif;
    font-weight: 400;
    font-size: 16px;
    color: #ffffff;
    line-height: 19px;
    display: flex;
    align-items: center;
    margin: 18px 0;
    justify-content: space-between;
 
    .info-item {
      display: flex;
      align-items: center;
 
      .num {
        font-family: YouSheBiaoTiHei, YouSheBiaoTiHei, serif;
        font-weight: 400;
        font-size: 26px;
        color: #ffffff;
        line-height: 30px;
      }
    }
  }
 
  .status-title {
    font-family: YouSheBiaoTiHei, YouSheBiaoTiHei, serif;
    font-weight: 400;
    font-size: 20px;
    color: #ffffff;
    line-height: 23px;
    text-shadow: 0px 0px 12px rgba(68, 105, 255, 0.67);
 
    margin-bottom: 14px;
  }
 
  .status-list {
    display: flex;
    justify-content: space-between;
    align-items: center;
 
    .status-item {
      width: 66px;
      height: 54px;
      background: url('@/assets/images/home/mapPopUpBox/itembg.png') no-repeat center / 100% 100%;
      text-align: center;
 
      .status-value {
        font-family: YouSheBiaoTiHei, YouSheBiaoTiHei, serif;
        font-weight: 400;
        font-size: 26px;
        color: #ffa768;
        line-height: 17px;
        text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
        position: relative;
        top: -3px;
      }
 
      .status-name {
        font-family: Source Han Sans CN, Source Han Sans CN, serif;
        font-weight: 400;
        font-size: 14px;
        color: #ffffff;
        line-height: 16px;
        position: relative;
        top: -3px;
      }
    }
  }
}
</style>