gaosp
2024-03-12 6b6a9ce33453a5ec9ca8346df39a7a610042424c
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
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
<!--
 * @Date: 2024-01-05 22:26:22
 * @LastEditors: Sneed
 * @LastEditTime: 2024-03-12 21:10:54
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/mapPreviewDetail/index.vue
-->
<template>
    <div class="workshop">
        <Nav :name="name">
            <template>
                <span class="back" @click="back">
                    返回车间地图
                </span>
            </template>
        </Nav>
        <div class="workshop-box">
            <div class="left">
                <div class="left_1">
                    <div>
                        <span>{{ deviceInfo.runRate || 0 }}%</span>
                        <span>开机运行率</span>
                    </div>
                    <div>
                        <span>{{ deviceInfo.efficiency || 0 }}%</span>
                        <span>能力利用率</span>
                    </div>
                </div>
                <div class="left_2 table">
                    <el-table stripe :data="axislist" style="width: 100%;margin-top: 20px;">
                        <el-table-column prop="name" label="轴" width="180">
                        </el-table-column>
                        <el-table-column prop="position" label="坐标" width="180">
                        </el-table-column>
                        <el-table-column prop="servoLoad" label="扭矩">
                        </el-table-column>
                    </el-table>
                </div>
                <div class="left_2 table">
                    <el-table stripe :data="axislist1" style="width: 100%;margin-top: 20px;">
                        <el-table-column prop="name" label="轴" width="180">
                        </el-table-column>
                        <el-table-column prop="position" label="坐标" width="180">
                        </el-table-column>
                        <el-table-column prop="servoLoad" label="扭矩">
                        </el-table-column>
                    </el-table>
                </div>
            </div>
            <div class="center">
                <div class="center-top">
                    <!-- spindleLoad -->
                    <div>
                        <span class="zz" :style="`transform: rotate(${260/100 * (status.spindleLoad || 0) - 220}deg)`"></span>
                        <span class="name">主轴负载</span>
                    </div>
                    <!-- rate -->
                    <div>
                        <span class="zz" :style="`transform: rotate(${260/100 * (status.rate || 0) - 220}deg)`"></span>
                        <span class="name">主轴倍率</span>
                    </div>
                    <!-- feed -->
                    <div>
                        <span class="zz" :style="`transform: rotate(${260/100 * (status.feed || 100) - 220}deg)`"></span>
                        <span class="name">进给倍率</span>
                    </div>
                </div>
                <div class="center-bottom">
                    <img :src="deviceInfo.pic || png" alt="">
                </div>
            </div>
            <div class="right">
                <div class="right_1">
                    <p>工段: {{ deviceInfo.section }}</p>
                    <p>名称: {{ deviceInfo.machineName }}</p>
                    <div class="line"></div>
                    <ul>
                        <li>
                            <img src="./img/sd.png" alt="">
                            <div>
                                <p>{{ cycleTime || 0 }}秒</p>
                                <p>运行时间</p>
                            </div>
                        </li>
                        <li>
                            <img src="./img/sd.png" alt="">
                            <div>
                                <p>{{ status.utilizationDaily || 0}}%</p>
                                <p>日利用率</p>
                            </div>
                        </li>
                        <li>
                            <img src="./img/sd.png" alt="">
                            <div>
                                <p>{{ status.utilizationweeks || 0 }}%</p>
                                <p>周利用率</p>
                            </div>
                        </li>
                        <li>
                            <img src="./img/sd.png" alt="">
                            <div>
                                <p>{{ status.utilizationmonths || 0 }}%</p>
                                <p>月利用率</p>
                            </div>
                        </li>
                        <li>
                            <img src="./img/sd.png" alt="">
                            <div>
                                <p>{{ status.cycleCount || 0 }}%</p>
                                <p>完工件数</p>
                            </div>
                        </li>
                    </ul>
                    <div class="line"></div>
                    <p>机床状态:
                        <span class="img-status" v-if="deviceInfo.status === 'STOP'">停机</span>
                        <span class="img-status run" v-if="deviceInfo.status === 'RUN'">运行</span>
                        <span class="img-status standby" v-if="deviceInfo.status === 'IDLE'">待机</span>
                        <span class="img-status alerm" v-if="deviceInfo.status === 'ALARM'">报警</span>
                    </p>
                    <p>待机原因: {{status.yy}}</p>
                </div>
                <div class="right_2">
                    <p>加工数据</p>
                    <ul>
                        <li>
                            <span>程序名称:</span>
                            <span>{{ status.progName }}</span>
                        </li>
                        <li>
                            <span>零件号:</span>
                            <span>{{ status.componentId }}</span>
                        </li>
                        <li>
                            <span>控制模型:</span>
                            <span>{{ status.progContent }}</span>
                        </li>
                        <li>
                            <span>工序号:</span>
                            <span>{{ status.processId }}</span>
                        </li>
                        <li>
                            <span>主轴转速:</span>
                            <span>{{ status.speed }}</span>
                        </li>
                        <li>
                            <span>进给速度:</span>
                            <span>{{ status.feedspeed }}</span>
                        </li>
                    </ul>
                </div>
                <div class="right_3 table">
                    <el-table stripe :data="tableData" style="width: 100%;margin-top: 20px;">
                        <el-table-column prop="alarmNo" label="报警号" width="180">
                        </el-table-column>
                        <el-table-column prop="alarmMsg" label="报警内容" width="180">
                        </el-table-column>
                        <el-table-column prop="time" label="报警时间">
                        </el-table-column>
                    </el-table>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
import Nav from '@/components/nav'
import png from './img/jq.png'
import { getRequest, getFormRequest } from '@/api/Api'
export default {
    components: {
        Nav
    },
    data() {
        return {
            png,
            cycleTime: '',
            name: '',
            deviceInfo: {
                section: '', // 工段
            },
            status: {
                progName: '',
                componentId: '',
                progContent: '',
                processId: '',
                speed: '',
                feedspeed: '',
                spindleLoad: '',
                rate: '',
                feed: '',
                utilizationDaily: '',
                utilizationweeks: '',
                utilizationmonths: '',
                cycleCount: '',
            },
            tableData: [],
            axislist: [
                {
                    name: '',
                    position: '',
                    servoLoad: ''
                },
                {
                    name: '',
                    position: '',
                    servoLoad: ''
                },
                {
                    name: '',
                    position: '',
                    servoLoad: ''
                }
            ],
            axislist1: [
                {
                    name: '',
                    position: '',
                    servoLoad: ''
                },
                {
                    name: '',
                    position: '',
                    servoLoad: ''
                },
                {
                    name: '',
                    position: '',
                    servoLoad: ''
                }
            ],
        }
    },
    methods: {
        back() {
            this.$router.go(-1)
        },
        init() {
            getFormRequest('getbyid', {
                machineId: this.$route.query.id
            }).then(res => {
                var axisNames
                if (res.data.status.var4 != null) {
                    axisNames = res.status.var4.split(':')
                }
                var positions
                if (res.data.status.var5 != null) {
                    positions = res.status.var5.split(':')
                }
                var servoLoads
                if (res.data.status.var6 != null) {
                    servoLoads = res.status.var6.split(':')
                }
                for (let i = 0; i < 3; i++) {
                    if ((axisNames == null) || (axisNames[i] == null) || (axisNames[i] === '')) {
                        this.axislist[i].name = ''
                    } else {
                        this.axislist[i].name = axisNames[i]
                    }
                    if (positions == null) {
                        this.axislist[i].position = ''
                    } else {
                        this.axislist[i].position = positions[i]
                    }
                    if (servoLoads == null) {
                        this.axislist[i].servoLoad = ''
                    } else {
                        this.axislist[i].servoLoad = servoLoads[i]
                    }
                }
                for (let i = 3; i < 6; i++) {
                    if ((axisNames == null) || (axisNames[i] == null) || (axisNames[i] === '')) {
                        this.axislist1[i - 3].name = ''
                    } else {
                        this.axislist1[i - 3].name = axisNames[i]
                    }
                    if (positions == null) {
                        this.axislist1[i - 3].position = ''
                    } else {
                        this.axislist1[i - 3].position = positions[i]
                    }
                    if (servoLoads == null) {
                        this.axislist1[i - 3].servoLoad = ''
                    } else {
                        this.axislist1[i - 3].servoLoad = servoLoads[i]
                    }
                }
                this.status = res.data.status
                this.tableData = res.data.list
                this.cycleTime = this.formatSeconds(res.data.msg.cycleTime)// 运行时间
                console.log(res)
            })
            try {
                this.deviceInfo = JSON.parse(window.localStorage.getItem('deviceInfo'))
            } catch (error) {
                this.deviceInfo = {}
            }
            this.name = `车间列表 / ${this.$route.query.name ? this.$route.query.name + '/'  : ''} ${this.deviceInfo.machineName}`
        },
        formatSeconds(value) {
            var secondTime = parseInt(value)// 秒
            var minuteTime = 0// 分
            var hourTime = 0// 小时
            if (secondTime > 60) { // 如果秒数大于60,将秒数转换成整数
                // 获取分钟,除以60取整数,得到整数分钟
                minuteTime = parseInt(secondTime / 60)
                // 获取秒数,秒数取佘,得到整数秒数
                secondTime = parseInt(secondTime % 60)
                // 如果分钟大于60,将分钟转换成小时
                if (minuteTime > 60) {
                    // 获取小时,获取分钟除以60,得到整数小时
                    hourTime = parseInt(minuteTime / 60)
                    // 获取小时后取佘的分,获取分钟除以60取佘的分
                    minuteTime = parseInt(minuteTime % 60)
                }
            }
            var result = '' + parseInt(secondTime) + '秒'
 
            if (minuteTime > 0) {
                result = '' + parseInt(minuteTime) + '分' + result
            }
            if (hourTime > 0) {
                result = '' + parseInt(hourTime) + '小时' + result
            }
            return result
        }
    },
    mounted() {
        this.init()
    }
}
</script>
<style lang="scss">
.table {
    .el-table::before {
        background-color: transparent;
    }
 
    .el-table th {
        color: #E6E5E5;
        background-color: #182D54;
        border-bottom: none;
    }
 
    .el-table {
        color: #E6E5E5;
        background: transparent;
        background-color: transparent;
        border-bottom: none;
        padding: 0;
    }
 
    .el-table__fixed-right::before,
    .el-table__fixed::before {
        background: transparent;
    }
 
    .el-table td,
    .el-table--striped .el-table__body tr.el-table__row--striped td,
    .el-table--enable-row-hover .el-table__body tr:hover>td {
        color: #E6E5E5;
        border-bottom: none;
        background: transparent;
        background-color: transparent;
        // padding: 0;
    }
 
    .el-table tr {
        color: #E6E5E5;
        border-bottom: none;
        background: transparent;
        background-color: transparent;
        border-bottom: none;
        padding: 0;
    }
 
    .el-table tr.el-table__row--striped {
        background-color: #182D54 !important;
 
    }
 
    // .el-table__header {
    //     color: #E6E5E5;
    //     background: transparent;
    //     background-color: transparent;
    //     border-bottom: none;
    //     padding: 0;
    // }
    // .el-table__body-wrapper {
    //     color: #E6E5E5;
    //     background: transparent;
    //     background-color: transparent;
    //     border-bottom: none;
    //     padding: 0;
    // }
    .el-table__header-wrapper {
        border: none;
        border-bottom: none;
        padding: 0;
    }
}
</style>
<style lang="scss" scoped>
.workshop {
    width: 100%;
    height: 100%;
    color: #FFF;
 
    .back {
        margin-left: auto;
        text-align: center;
        width: 92px;
        height: 28px;
        background: rgba(23, 38, 67, 0.6);
        border-radius: 50px;
        border: 1px solid #ddd;
        border-image: linear-gradient(130deg, rgba(255, 51, 51, 1), rgba(242, 191, 36, 1)) 1 1;
        ;
        font-size: 12px;
        font-family: PingFangSC, PingFang SC;
        font-weight: 500;
        color: #F7F8FA;
        line-height: 22px;
        background: linear-gradient(130deg, #FF3333 0%, #F2BF24 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        cursor: pointer;
 
    }
 
    .workshop-box {
        width: 100%;
        height: 100%;
        padding: 0 20px;
        display: flex;
 
        .left {
            width: 462px;
 
            .left_1 {
                width: 100%;
                height: 251px;
                background: url('./img/left_1.png');
                display: flex;
                justify-content: space-around;
                align-items: center;
 
                &>div {
                    width: 189px;
                    height: 197px;
                    background: url('./img/circle.png');
                    position: relative;
                    background-size: contain;
 
                    span:first-child {
                        position: absolute;
                        left: 50%;
                        top: 50%;
                        transform: translate(-50%, -50%);
                        font-size: 26px;
                        font-weight: bold;
                        color: #C3E1E1;
                    }
 
                    span:last-child {
                        position: absolute;
                        left: 50%;
                        bottom: 20%;
                        transform: translate(-50%, -50%);
                        font-size: 18px;
                        color: #C3E1E1;
                    }
                }
            }
 
            .left_2 {
                margin-top: 16px;
                width: 100%;
                height: 324px;
                background: url('./img/left_2.png');
            }
        }
 
        .center {
            flex: 1 1 auto;
            display: flex;
            flex-direction: column;
            .center-top {
                display: flex;
                justify-content: space-around;
 
                &>div {
                    position: relative;
                    width: 180px;
                    height: 180px;
                    background: url('./img/yq.png');
                    background-size: contain;
 
                    span.zz {
                        position: absolute;
                        left: 50%;
                        top: 50%;
                        width: 40%;
                        height: 2px;
                        margin-top: -2px;
                        transform: rotate(-220deg);
                        transform-origin: left center;
                        color: #fff;
                        background: #FFF;
                    }
 
                    span.name {
                        font-size: 18px;
                        font-family: PingFangSC, PingFang SC;
                        font-weight: 400;
                        color: #C3E1E1;
                        position: absolute;
                        bottom: 0;
                        width: 100%;
                        text-align: center;
                    }
                }
 
                &>div:last-child {
                    span.zz {
                        transform: rotate(40deg);
                    }
                }
            }
 
            .center-bottom {
                flex: 1 1 auto;
                margin-bottom: 50px;
                margin-top: 50px;
                display: flex;
                justify-content: center;
 
                img {
                    max-width: 100%;
                    max-height: 100%;
                }
            }
        }
 
        .right {
            width: 463px;
 
            .right_1 {
                width: 100%;
                height: 418px;
                background: url('./img/right_1.png');
                padding: 0 14px;
                overflow: hidden;
                background-size: contain;
                &>p {
                    font-size: 21px;
                    font-family: PingFangSC, PingFang SC;
                    color: #C3E1E1;
                    line-height: 32px;
                    padding-left: 34px;
                    padding-right: 14px;
                    position: relative;
                }
 
                &>p:first-child {
                    margin-top: 32px;
                    margin-bottom: 12px;
 
                }
 
                &>p:last-child {
                    margin-top: 14px;
                    margin-bottom: 12px;
 
                }
 
                &>p:before {
                    content: '';
                    position: absolute;
                    top: 50%;
                    left: 14px;
                    transform: translateY(-50%);
                    width: 7px;
                    height: 7px;
                    border-radius: 7px;
                    background: linear-gradient(180deg, #9AFEFE 0%, #4B78CD 100%);
                }
 
                div.line {
                    margin-top: 14px;
                    height: 0;
                    border-bottom: 1px dashed #C3E1E1;
                    margin-bottom: 14px;
                }
 
                ul {
                    list-style: none;
                    display: flex;
                    flex-wrap: wrap;
 
                    li {
                        display: flex;
                        align-items: center;
                        padding: 4px 12px;
                        font-size: 12px;
 
                        img {
                            width: 46px;
                            height: 46px;
                            margin-right: 12px;
                        }
                    }
 
                    li~li {
                        // margin: 0 12px;
                    }
                }
            }
 
            .right_2 {
 
                margin-top: 16px;
                width: 100%;
                height: 208px;
                background: url('./img/right_2.png');
                background-size: contain;
                p {
                    font-size: 16px;
                    color: #F7F8FA;
                    line-height: 22px;
                    padding: 8px 14px;
                }
 
                ul {
                    list-style: none;
                    display: flex;
                    flex-wrap: wrap;
 
                    li {
                        flex: 0 0 auto;
                        width: 50%;
                        padding: 14px;
                    }
                }
            }
 
            .right_2 {
                margin-top: 16px;
                width: 100%;
                height: 208px;
                background: url('./img/right_2.png');
                background-size: contain;
            }
 
            .right_3 {
                margin-top: 16px;
                width: 100%;
                height: 265px;
                background: url('./img/right_3.png');
            }
        }
    }
}
 
.img-status {
    position: absolute;
    width: 68px;
    height: 30px;
    margin-left: 14px;
    color: #000;
    font-size: 12px;
    background: rgba(216, 216, 216, 0.09);
    border-radius: 15px;
    text-align: center;
}
 
.img-status.standby {
    background: linear-gradient(130deg, #FF3333 0%, #F2BF24 100%);
}
 
.img-status.run {
    background: linear-gradient(130deg, #EAF224 0%, #3DF297 100%);
}
 
.img-status.alerm {
    background: #FF3333;
    color: #fff;
}
</style>