huangxiaoqiang
2025-06-12 c54e0666bdd34fbe133fe521bf9d46dd6c0fe53e
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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
<template>
  <div id="index" ref="appRef">
    <div class="bg">
      <dv-loading v-if="loading">Loading...</dv-loading>
      <div v-else class="host-body">
        <div class="d-flex jc-center">
          <dv-decoration-10 class="dv-dec-10" />
          <div class="d-flex jc-center">
            <dv-decoration-8 class="dv-dec-8" :color="decorationColor" />
            <div class="title">
              <span class="title-text">飞友实业</span>
              <dv-decoration-6 class="dv-dec-6" :reverse="true" :color="['#50e3c2', '#67a1e5']" />
            </div>
            <dv-decoration-8 class="dv-dec-8" :reverse="true" :color="decorationColor" />
          </div>
          <dv-decoration-10 class="dv-dec-10-s" />
        </div>
 
        <!-- 第二行 -->
        <div class="d-flex jc-between px-2">
          <div class="d-flex aside-width">
            <div class="react-left ml-4 react-l-s">
              <span class="react-left"></span>
              <span class="text">机器人设备</span>
            </div>
            <div class="react-left bg-color-blue mr-3" style="background-color: #1a5cd7;">
              <span class="text fw-b">设备运行状态</span>
            </div>
          </div>
          <div class="d-flex aside-width">
            <div class="react-right bg-color-blue mr-3">
              <span class="text fw-b">AGV设备</span>
            </div>
            <div class="react-right mr-4 react-l-s">
              <span class="react-after"></span>
              <span class="text">{{ dateYear }} {{ dateWeek }} {{ dateDay }}</span>
            </div>
          </div>
        </div>
 
 
        <div class="body-box">
          <div style="display: flex;">
            <div style="width: 100%;">
              
              <div class="content-box">
                <div style="display: flex;">
                  <div class="abs" v-for="(list, listIndex) in titleItemList2.slice(0, 3)" :key="listIndex">
                    <dv-border-box-12>
                      <div class="up2">
                        <div class="bg-color-black item" v-for="item in list" :key="item.title + item.code">
                          <div v-if="item.code">
                            <p class="ml-3 colorBlue fw-b fs-xl titleSize">{{ item.code }}</p>
                            <p class="dv-dig-flop ml-1 mt-2 pl-3 bodyclass">{{ item.text }}</p>
                          </div>
 
                          <div v-else-if="item.img">
                            <img src="@/assets/AGV.png" width="50%" height="50%">
                          </div>
 
                          <div v-else>
                            <p class="ml-3 colorBlue fw-b fs-xl titleSize">{{ item.title }}</p>
                            <p class="dv-dig-flop ml-1 mt-2 pl-3 bodyclass">{{ item.text }}</p>
                          </div>
                        </div>
                      </div>
                    </dv-border-box-12>
                  </div>
                </div>
              </div>
 
 
              <div class="content-box">
                <div style="display: flex;">
                  <div class="abs" v-for="(list, listIndex) in titleItemList2.slice(0, 3)" :key="listIndex">
                    <dv-border-box-12>
                      <div class="up2">
                        <div class="bg-color-black item" v-for="item in list" :key="item.title + item.code">
                          <div v-if="item.code">
                            <p class="ml-3 colorBlue fw-b fs-xl titleSize">{{ item.code }}</p>
                            <p class="dv-dig-flop ml-1 mt-2 pl-3 bodyclass">{{ item.text }}</p>
                          </div>
                          <div v-else-if="item.img">
                            <img src="@/assets/AGV.png" width="50%" height="50%">
                          </div>
                          <div v-else>
                            <p class="ml-3 colorBlue fw-b fs-xl titleSize">{{ item.title }}</p>
                            <p class="dv-dig-flop ml-1 mt-2 pl-3 bodyclass">{{ item.text }}</p>
                          </div>
                        </div>
                      </div>
                    </dv-border-box-12>
                  </div>
                </div>
              </div>
            </div>
 
            <div class="content-box" style="margin-left: 350px;">
              <div class="abs" v-for="(list, listIndex) in titleItemList" :key="listIndex">
                <dv-border-box-12>
                  <div class="up">
                    <div class="bg-color-black item" v-for="item in list" :key="item.title + item.code">
                      <div v-if="item.code">
                        <p class="ml-3 colorBlue fw-b fs-xl titleSize">{{ item.code }}</p>
                        <p class="dv-dig-flop ml-1 mt-2 pl-3 bodyclass">{{ item.text }}</p>
                      </div>
 
                      <div v-else-if="item.img">
                        <img src="@/assets/AGV.png" width="50%" height="50%">
                      </div>
 
                      <div v-else>
                        <p class="ml-3 colorBlue fw-b fs-xl titleSize">{{ item.title }}</p>
                        <p class="dv-dig-flop ml-1 mt-2 pl-3 bodyclass">{{ item.text }}</p>
                      </div>
                    </div>
                  </div>
                </dv-border-box-12>
              </div>
            </div>
 
          </div>
 
 
          <!-- 第四行数据 -->
          <div class="bottom-box">
            <dv-border-box-13>
              <bottomLeft />
            </dv-border-box-13>
            <dv-border-box-12>
              <bottomRight />
            </dv-border-box-12>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
 
<script>
import drawMixin from "../utils/drawMixin";
import { formatTime } from '../utils/index.js'
import bottomLeft from './bottomLeft'
import bottomRight from './bottomRight'
import axios from 'axios';
 
export default {
  mixins: [drawMixin],
  data() {
    return {
      timing: null,
      loading: true,
      dateDay: null,
      dateYear: null,
      dateWeek: null,
      weekday: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
      decorationColor: ['#568aea', '#000000'],
      titleItem: [],
      titleItem2: [],
      titleItemList: [],
      titleItemList2: [],
      frequency: 0
    }
  },
  components: {
    bottomLeft,
    bottomRight
  },
  mounted() {
    this.timeFn()
    this.cancelLoading()
    this.changeTiming()
  },
  beforeDestroy() {
    clearInterval(this.timing)
  },
  methods: {
    timeFn() {
      this.timing = setInterval(() => {
        this.dateDay = formatTime(new Date(), 'HH: mm: ss')
        this.dateYear = formatTime(new Date(), 'yyyy-MM-dd')
        this.dateWeek = this.weekday[new Date().getDay()]
      }, 1000)
    },
    changeTiming() {
      this.GetAGVStatus()
      this.GetAGVStatus2()
    },
    GetAGVStatus() {
      axios.get("http://127.0.0.1:9291/api/Task/GetAgvStatusData")
        .then((res) => {
          if (res.data.status) {
            let agvs = res.data.data; // 获取 AGV 数据
            let sss = [];
 
            // 遍历 AGV 数据并构建 titleItem
            agvs.forEach(element => {
              let titleItem = [
                {
                  code: 'AGV编号',
                  text: element.agvCode + "  号车"
                },
                {
                  img: '图片',
                  imgs: "D:/Git/YaoNeng/项目代码/big-screen-vue-datav/src/assets/logo.png"
                },
                {
                  title: '运行状态',
                  text: element.agvStatus == 0 ? "停  止" : element.agvStatus == 1 ? "行  驶" : "暂  停"
                },
                {
                  title: '当前地标',
                  text: element.agvRfidLabel
                },
                {
                  title: '当前速度',
                  text: element.agvSpeed + "  mm/s"
                },
                {
                  title: 'AGV类型',
                  text: "举升型"
                },
                {
                  title: 'AGV上下线状态',
                  text: element.agvOnline
                },
                {
                  title: 'AGV报警代码',
                  text: element.agvAlarmCode
                }
              ];
 
              sss.push(titleItem); // 将每个 titleItem 添加到结果数组
            });
 
            // 更新 titleItemList
            this.titleItemList = sss;
          }
        })
        .catch((error) => {
          console.error("Error fetching data:", error); // 处理请求错误
        });
    },
 
    GetAGVStatus2() {
      axios.get("http://127.0.0.1:9291/api/Task/GetAgvStatusData2")
        .then((res) => {
          if (res.data.status) {
            let agvs = res.data.data; // 获取 AGV 数据
            let sss = [];
 
            // 遍历 AGV 数据并构建 titleItem
            agvs.forEach(element => {
              let titleItem2 = [
                {
                  code: '设备编号',
                  text: element.agvCode
                },
                {
                  img: '图片',
                  imgs: "D:/Git/YaoNeng/项目代码/big-screen-vue-datav/src/assets/logo.png"
                },
                {
                  title: '运行状态',
                  text: element.agvStatus == 0 ? "停  止" : element.agvStatus == 1 ? "行  驶" : "暂  停"
                },
                {
                  title: '报警信息',
                  text: element.agvRfidLabel
                },
              ];
 
              sss.push(titleItem2); // 将每个 titleItem 添加到结果数组
            });
 
            // 更新 titleItemList
            this.titleItemList2 = sss;
          }
        })
        .catch((error) => {
          console.error("Error fetching data:", error); // 处理请求错误
        });
    },
    cancelLoading() {
      setTimeout(() => {
        this.loading = false
      })
    }
  }
}
</script>
 
<style lang="scss" scoped>
@import '../assets/scss/index.scss';
 
.bg-color-black {
  border-radius: 5px;
}
 
.up {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
 
  .item {
    border-radius: 6px;
    padding-top: 8px;
    margin-top: 8px;
    width: 50%;
    height: 70px;
 
    .dv-dig-flop {
      width: 251px;
      height: 30px;
    }
  }
 
  .bodyclass {
    font-size: 26px;
    color: #ffffff;
  }
 
  .bclass {
    font-size: 26px;
    color: #e0c218;
  }
 
  .titleSize {
    font-size: 16px;
  }
 
  .bSize {
    font-size: 20px;
    color: #e0c218;
  }
}
 
.up2 {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  height: 50%;
 
  .item {
    border-radius: 6px;
    padding-top: 8px;
    margin-top: 8px;
    width: 50%;
    height: 70px;
 
    .dv-dig-flop {
      width: 251px;
      height: 30px;
    }
  }
 
  .bodyclass {
    font-size: 26px;
    color: #ffffff;
  }
 
  .bclass {
    font-size: 26px;
    color: #e0c218;
  }
 
  .titleSize {
    font-size: 16px;
  }
 
  .bSize {
    font-size: 20px;
    color: #e0c218;
  }
}
</style>