cuiqian2004
8 天以前 30311cd24ee3b1567ffafac002494bb67feda657
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
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
<template>
    <view class="pages-teaching">
        <view class="view-content">
            <view class="map-content">
            </view>
        </view>
        <view class="bottom">
            <template v-if="mapOperationType =='public_teaching' || mapOperationType =='station_teaching'">
                <view class="bottom-content" v-if="teachingStatus =='teaching'">
                    <view class="tip">路径记录中...</view>
                    <view v-if="mapOperationType =='public_teaching'">
                        <view>正在记录搬运车行进路径,可随时切换主路/支路示教,完成后点按钮以结束示教。在示教过程中可以添加站点。</view>
                        <view class="switch-type">
                            <view class="switch-button-group">
                                <view class="switch-button"
                                    :class="teachingModeCur.main_road ==1?'switch-button-checked':''"
                                    @click="onTeachingModeMainRoad(1)">主路示教</view>
                                <view class="switch-button "
                                    :class="teachingModeCur.main_road ==0?'switch-button-checked':''"
                                    @click="onTeachingModeMainRoad(0)">支路示教</view>
                            </view>
                        </view>
                    </view>
 
                    <view v-else>
                        正在记录搬运车行进路径,完成后点按钮以结束示教
                    </view>
                    <view class="text-button-group">
                        <a-button v-if="mapOperationType =='public_teaching'" type="ghost" class="button"
                            @click="clickAddDatation">添加站点</a-button>
                        <a-button type="primary" class="button" @click="clickTeachingEnd">结束记录</a-button>
                    </view>
                </view>
                <view class="bottom-content" v-else-if="teachingStatus =='end'">
                    <view class="tip">路径记录完成</view>
                    <view>
                        要将该段路径保存为示教路径吗?
                    </view>
                    <view class="text-button-group">
                        <a-button type="primary" class="button" @click="clickTeachingSave">保存为示教路径</a-button>
                        <a-button type="ghost" class="button" @click="clickTeachingReset">重新记录</a-button>
                    </view>
                </view>
                <view class="bottom-content" v-else-if="teachingStatus =='save'">
                    <view class="tip">示教完成</view>
                    <view>
                        已将路径保存为示教路径
                    </view>
                    <view class="text-button-group">
                        <a-button type="primary" class="button" @click="clickTeachingFinish">完成</a-button>
                    </view>
                </view>
                <template v-else>
                    <view class="bottom-content" v-if=" mapOperationType =='station_teaching'">
                        <view class="tip">请选择示教路线的起点和终点</view>
                        <view class="row-group">
                            <view class="coordinate">
                                <text class="name">起点:</text>
                                <a @click="clickStartStation">
                                    {{startStationID ? stationName(startStationID) : "请选择起点"}}
                                </a>
                            </view>
                            <view class="coordinate">
                                <text class="name">终点:</text>
                                <a @click="clickEndStation">
                                    {{endStationID ? stationName(endStationID) : "请选择终点"}}
                                </a>
 
                            </view>
                        </view>
                        <view>请将搬运车移至起点,点“开始记录”后将车开到终点,此次行进路线将作为所选站点间的示教路线。</view>
                        <view class="text-button-group">
                            <a-button type="primary" :disabled="startStationID=='' || endStationID==''" class="button"
                                @click="clickTeachingStart">开始记录</a-button>
                        </view>
                    </view>
                    <view class="bottom-content" v-else>
                        <view class="tip">即将开始公共示教</view>
                        <view>
                            请选择要进行主路还是支路示教,点【开始记录】后将记录搬运车的行进路线作为公共示教路线。开始记录后可随时切换主路/支路示教。
                        </view>
                        <view class="text-button-group">
                            <view class="switch-type">
                                <view class="switch-button-group">
                                    <view class="switch-button"
                                        :class="teachingModeCur.main_road ==1?'switch-button-checked':''"
                                        @click="onTeachingModeMainRoad(1)">主路示教</view>
                                    <view class="switch-button "
                                        :class="teachingModeCur.main_road ==0?'switch-button-checked':''"
                                        @click="onTeachingModeMainRoad(0)">支路示教</view>
                                </view>
                            </view>
                            <a-button type="primary" class="button" @click="clickTeachingStart">开始记录</a-button>
                        </view>
                    </view>
                </template>
            </template>
            <view class="bottom-content" v-else>
                <view class="img-button-group">
                    <view fill="none" class="button" @click="clickStationTeaching">
                        <text class="ico conversion-path"></text>
                        <view class="text">站点示教</view>
                    </view>
                    <view type="text" class="button " @click="clickPublicTeaching">
                        <text class="ico edit-road-outline-rounded"></text>
                        <view class="text">公共示教</view>
                    </view>
                </view>
 
            </view>
        </view>
        <view>
            <uni-popup ref="refPopupPicker" background-color="transparent" maskBackgroundColor="rgba(0, 0, 0, 0.2)">
                <view class="popup-content" @click="closePopupPicker">
                    <picker-view class="popup-content-view" :style="{'margin-left':pickerView.left +'px'}"
                        :indicator-style="indicatorStyle" :value="pickerView.value" @change="bindPickerChange">
                        <picker-view-column>
                            <view class="item" @click="clickPickerViewItem(index)"
                                v-for="(item,index) in pickerView.list" :key="index">{{item.name}}</view>
                        </picker-view-column>
 
                    </picker-view>
                </view>
            </uni-popup>
            <uni-popup ref="refPopupCalibration">
                <view class="popup-dialog">
                    <view class="popup-dialog-title">
                        <text class="uni-dialog-title-text">是否要校准站点位置?</text>
                    </view>
                    <view class="popup-dialog-content">
                        检测到{{calibratioStationTypeName}}位置朝向与所选站点有偏差,是否将站点位置朝向校准到当前值?
                    </view>
                    <view class="popup-dialog-button-group">
 
                        <view class="popup-dialog-button" @click="clickCalibration">
                            校准
                        </view>
                        <view class="popup-dialog-button" @click="clickNoCalibration">
                            不校准
                        </view>
                        <view class="popup-dialog-button" @click="clickBackTeaching">
                            回到示教
                        </view>
                    </view>
                </view>
            </uni-popup>
        </view>
    </view>
</template>
<script>
    import {
        showToast,
        showModal
    } from "@/comm/utils.js"
    import {
        Button
    } from 'antd-mobile-vue-next'
 
    import {
        stations,
        updateStation,
        getAgvState,
        getTeachingMode,
        teachingModeFlag,
        delTeachingMode,
        checkAgvLocationDistanceError
 
    } from "@/api/vehicle.js"
    import {
        async
    } from "rxjs"
    export default {
        name: "PagesTeaching",
        components: {
            'a-button': Button
        },
        onBackPress() {
            const _this = this
            if (this.mapOperationType == "") {
                return false
            } else if (this.mapOperationType == "public_teaching" || this.mapOperationType == "station_teaching") {
 
                if (this.teachingStatus) {
                    showModal("已记录的路径将会被删除。", "是否要退出示教?").then((res) => {
                        if (res) {
                            this.mapOperationType = ""
                        }
                    })
                } else {
                    this.mapOperationType = ""
                }
 
            }
            return true
        },
        data() {
            return {
                indicatorStyle: `height: 75rpx;`,
                navigationBarTitle: "",
                ip: "",
                mapOperationType: "",
                teachingStatus: "",
                teachingMode: {},
                teachingModeCur: {},
 
                startStationID: "",
                endStationID: "",
                calibratioStationType: "",
                pickerView: {
                    type: "",
                    list: [],
                    value: []
                },
                stationList: [],
 
 
            }
        },
        computed: {
 
        },
        watch: {
            mapOperationType(val) {
                let name = "路径示教"
                if (val == "public_teaching") {
                    name = "公共示教"
                } else if (val == "station_teaching") {
                    name = "站点示教"
                }
                this.setData({
                    navigationBarTitle: name
                })
            },
            navigationBarTitle(val) {
                uni.setNavigationBarTitle({
                    title: val
                })
            },
            calibratioStationTypeName() {
                if (this.calibratioStationType == "start") {
                    return "起点"
                } else if (this.calibratioStationType == "end") {
                    return "终点"
                } else {
                    return "站点"
                }
            },
        },
        onLoad(option) {
            this.ip = option.ip || ""
            this.loadData()
 
        },
        methods: {
            setData(obj) {
                let that = this;
                let keys = [];
                let val, data;
 
                Object.keys(obj).forEach(function(key) {
                    keys = key.split(".");
                    val = obj[key];
                    data = that.$data;
                    keys.forEach(function(key2, index) {
                        if (index + 1 == keys.length) {
                            that.$set(data, key2, val);
                        } else {
                            if (!data[key2]) {
                                that.$set(data, key2, {});
                            }
                        }
                        data = data[key2];
                    });
                });
            },
 
            async loadData() {
                try {
 
                    const stationLst = await this.loadStations()
 
                    this.stationList = stationLst
                    this.teachingMode = await getTeachingMode(this.ip)
 
                } catch (ex) {
 
                    this.showError(ex)
                }
            },
            async loadAgvState() {
                try {
                    const info = await getAgvState(this.ip)
                    return info
                } catch (ex) {
                    this.showError(ex)
                    return {}
                }
            },
            async loadStations() {
                try {
                    const info = await stations(this.ip)
                    return info.station_list || []
                } catch (ex) {
                    this.showError(ex)
                    return []
                }
            },
            stationName(id) {
                const curIndex = this.stationList.findIndex((a) => a.stationID == id)
                if (curIndex > -1) {
                    return this.stationList[curIndex].name
                }
                return ""
 
            },
            clickPublicTeaching() {
 
                this.teachingStatus = ""
                this.teachingModeCur = {
                    mode: "Public",
                    main_road: 1,
                }
                this.mapOperationType = "public_teaching"
 
            },
            clickStationTeaching() {
 
                this.startStationID = ""
                this.endStationID = ""
                this.teachingStatus = ""
                this.mapOperationType = "station_teaching"
            },
            async teachingStart(mode) {
                try {
                    if (mode == "Stations") {
                        const res = await checkAgvLocationDistanceError(this.ip, this.startStationID)
                        if (res?.error) {
                            this.calibratioStationType = "start"
                            this.$refs.refPopupCalibration.open()
                        } else {
                            // const name =
                            //     `${ this.stationName(this.startStationID)}_${ this.stationName(this.endStationID)}`
 
                            this.teachingModeCur = {
                                mode: "Stations",
                                src_dst: `${this.startStationID}_${this.endStationID}`,
                                name: "",
                                teaching_flag: 1,
                            }
                            const res2 = await teachingModeFlag(this.ip, this.teachingModeCur)
                            if (res2?.name)
                                this.teachingModeCur.name = res2.name
                        }
                    } else {
                        //    const name = `示教_${new Date().getTime()}`
                        const main_road = this.teachingModeCur.main_road
                        this.teachingModeCur = {
                            mode: "Public",
                            src_dst: ``,
                            name: "",
                            teaching_flag: 1,
                            main_road
                        }
                        const res2 = await teachingModeFlag(this.ip, this.teachingModeCur)
                        if (res2?.name)
                            this.teachingModeCur.name = res2.name
                    }
 
                } catch (ex) {
                    this.showError(ex)
                }
 
            },
            async teachingEnd(mode) {
                try {
                    if (mode == "Stations") {
                        const res = await checkAgvLocationDistanceError(this.ip, this.endStationID)
                        if (res.error) {
                            this.calibratioStationType = "end"
                            this.$refs.refPopupCalibration.open()
                        } else {
                            this.teachingModeCur.teaching_flag = 0
                            await teachingModeFlag(this.ip, this.teachingModeCur)
                            this.teachingMode = await getTeachingMode(this.ip)
 
                            this.teachingStatus = "end"
 
                        }
                    } else {
                        this.teachingModeCur.teaching_flag = 0
                        await teachingModeFlag(this.ip, this.teachingModeCur)
                        this.teachingMode = await getTeachingMode(this.ip)
                        this.teachingStatus = "end"
                    }
                } catch (ex) {
                    this.showError(ex)
                }
 
            },
            async onTeachingModeMainRoad(val) {
                try {
                    if (this.teachingStatus) {
 
                        this.teachingModeCur.main_road = val
                        this.teachingModeCur.teaching_flag = 1
                        this.teachingModeCur.mode = "Public"
                        const res = await teachingModeFlag(this.ip, this.teachingModeCur)
                        if (res?.name)
                            this.teachingModeCur.name = res.name
                    } else {
                        this.teachingModeCur.main_road = val
                    }
 
                } catch (ex) {
                    this.showError(ex)
                }
            },
            async clickTeachingStart() {
 
                const _this = this
                try {
                    if (this.mapOperationType == "station_teaching") {
                        const stationTeaching = this.teachingMode?.stations || []
                        const srcDst = `${this.startStationID}_${this.endStationID}`
                        const name =
                            `${ this.stationName(this.startStationID)}_${ this.stationName(this.endStationID)}`
 
                        const curIndex = stationTeaching.findIndex((a) => a.src_dst == srcDst)
                        if (curIndex > -1) {
                            showModal("该站点间已有示教路径,重新记录会覆盖之前的路径。", "是否要重新记录?").then(async (res) => {
                                if (res) {
                                    try {
                                        _this.teachingStatus = "teaching"
                                        await delTeachingMode(this.ip, [{
                                            mode: "Stations",
                                            name,
                                            src_dst: srcDst
 
                                        }])
                                        stationTeaching.splice(curIndex, 1)
                                        _this.teachingStart("Stations")
                                    } catch (ex) {
                                        this.showError(ex)
                                    }
 
                                } else {
 
                                    _this.teachingStatus = ""
                                }
                            })
                        } else {
                            _this.teachingStatus = "teaching"
                            _this.teachingStart("Stations")
                        }
 
                    } else {
                        this.teachingStatus = "teaching"
                        _this.teachingStart("Public")
                    }
 
                } catch (ex) {
                    this.showError(ex)
                }
            },
            clickTeachingEnd() {
                if (this.mapOperationType == "station_teaching") {
                    this.teachingEnd("Stations")
                } else {
                    this.teachingEnd("Public")
                }
 
            },
            clickTeachingReset() {
                const _this = this
                showModal("已记录的路径将会被删除。", "是否要重新记录?").then(async (res) => {
                    if (res) {
                        try {
                            await delTeachingMode(_this.ip, [_this.teachingModeCur])
                            _this.teachingStatus = ""
                            _this.teachingMode = await getTeachingMode(_this.ip)
 
                        } catch (ex) {
                            this.showError(ex)
                        }
                    } else {
                        _this.teachingStatus = "save"
                    }
                })
 
            },
            async clickTeachingSave() {
 
                this.teachingStatus = "save"
                try {} catch (ex) {
                    this.showError(ex)
                }
 
            },
            clickTeachingFinish() {
                this.mapOperationType = ""
                const eventChannel = this.getOpenerEventChannel();
                eventChannel.emit('add');
                uni.navigateBack({
                    delta: 1, //返回层数,2则上上页
                })
            },
            clickEndStation(e) {
                const list = this.stationList.filter((a) => a.stationID != this.startStationID)
                let index = 0
 
                if (this.endStationID) {
                    index = list.findIndex((a) => a.stationID == this.endStationID)
                    if (index < 0) {
                        this.endStationID = list[0].stationID
                        index = 0
                    }
 
                } else {
                    this.endStationID = list[0].stationID
                    index = 0
                }
                this.pickerView = {
                    type: "endStation",
                    list,
                    value: [index],
                    left: e.target.offsetLeft - 150,
                }
                this.$refs.refPopupPicker.open("bottom")
            },
            clickStartStation(e) {
                const list = this.stationList.filter((a) => a.stationID != this.endStationID)
                let index = 0
 
                if (this.startStationID) {
                    index = list.findIndex((a) => a.stationID == this.startStationID)
                    if (index < 0) {
                        this.startStationID = list[0].stationID
                        index = 0
                    }
 
                } else {
                    this.startStationID = list[0].stationID
                    index = 0
                }
                this.pickerView = {
                    type: "startStation",
                    list,
                    value: [index],
                    left: e.target.offsetLeft + 50,
                }
                this.$refs.refPopupPicker.open("bottom")
            },
            clickAddDatation() {
                const _this = this
                uni.navigateTo({
                    url: `/pages/station/index?ip=${this.ip}&isAdd=1`,
                    events: {
                        // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
                        add: function(data) {
                            _this.stationList.push({
                                stationID: data.stationID,
                                name: data.name,
                                x: data.x,
                                y: data.y,
                                angle: data.angle
                            })
                        },
                    }
                })
            },
            bindPickerChange(e) {
                const val = e.detail.value
                const val2 = val[0]
                this.pickerView.value = val2
                if (this.pickerView.type == "startStation") {
                    this.startStationID = this.pickerView.list[val2].stationID
                } else if (this.pickerView.type == "endStation") {
                    this.endStationID = this.pickerView.list[val2].stationID
                }
            },
            clickPickerViewItem(index) {
                if (index == this.pickerView.value) {
                    this.$refs.refPopupPicker.close()
                }
            },
            closePopupPicker() {
                this.$refs.refPopupPicker.close()
            },
            async clickCalibration() {
                try {
                    this.$refs.refPopupCalibration.close()
                    if (this.calibratioStationType == "start") {
                        const list = this.stationList
                        const curIndex = list.findIndex((a) => a.stationID == this.startStationID)
                        if (curIndex > -1) {
                            const station = {}
                            station.stationID = list[curIndex].stationID
                            station.name = list[curIndex].name
                            const infoAgv = await getAgvState(this.ip)
                            station.angle = infoAgv.angle
                            station.x = infoAgv.x
                            station.y = infoAgv.y
                            await updateStation(this.ip, station)
                            showToast(`${station.name}位置已更新`)
                            list[curIndex].angle = infoAgv.angle
                            list[curIndex].x = infoAgv.x
                            list[curIndex].y = infoAgv.y
 
 
                        }
                        // const name =
                        //     `${ this.stationName(this.startStationID)}_${ this.stationName(this.endStationID)}`
 
                        this.teachingModeCur = {
                            mode: "Stations",
                            src_dst: `${this.startStationID}_${this.endStationID}`,
                            name: "",
                            teaching_flag: 1
                        }
                        const res2 = await teachingModeFlag(this.ip, this.teachingModeCur)
                        if (res2?.name)
                            this.teachingModeCur.name = res2.name
 
                    } else if (this.calibratioStationType == "end") {
                        const list = this.stationList
                        const curIndex = list.findIndex((a) => a.stationID == this.endStationID)
                        if (curIndex > -1) {
                            const station = {}
                            station.stationID = list[curIndex].stationID
                            station.name = list[curIndex].name
                            const infoAgv = await getAgvState(this.ip)
                            station.angle = infoAgv.angle
                            station.x = infoAgv.x
                            station.y = infoAgv.y
                            await updateStation(this.ip, station)
                            showToast(`${station.name}位置已更新`)
                            list[curIndex].angle = infoAgv.angle
                            list[curIndex].x = infoAgv.x
                            list[curIndex].y = infoAgv.y
 
                        }
                        this.teachingStatus = "end"
                        this.teachingModeCur.teaching_flag = 0
                        await teachingModeFlag(this.ip, this.teachingModeCur)
                        this.teachingMode = await getTeachingMode(this.ip)
 
                    }
                } catch (ex) {
                    this.showError(ex)
                }
            },
            async clickNoCalibration() {
                try {
                    this.$refs.refPopupCalibration.close()
                    if (this.calibratioStationType == "start") {
                        // const name =
                        //     `${ this.stationName(this.startStationID)}_${ this.stationName(this.endStationID)}`
                        this.teachingModeCur = {
                            mode: "Stations",
                            src_dst: `${this.startStationID}_${this.endStationID}`,
                            name: "",
                            teaching_flag: 1
                        }
                        const res = await teachingModeFlag(this.ip, this.teachingModeCur)
                        if (res?.name)
                            this.teachingModeCur.name = res.name
 
                    } else if (this.calibratioStationType == "end") {
 
                        this.teachingModeCur.teaching_flag = 0
                        await teachingModeFlag(this.ip, this.teachingModeCur)
                        this.teachingMode = await getTeachingMode(this.ip)
 
                    }
                } catch (ex) {
                    this.showError(ex)
                }
            },
            clickBackTeaching() {
                this.$refs.refPopupCalibration.close()
                this.teachingStatus = ""
            },
            showError(ex) {
                let exStr = JSON.stringify(ex)
                if (exStr == "{}")
                    exStr = ex
                let tip = typeof ex.msg == "string" ? ex.msg : exStr
                showModal(tip, "错误", false)
            },
 
 
        }
    }
</script>
 
<style lang="scss">
    .pages-teaching {
        display: flex;
        width: 750rpx;
        height: 100vh;
        background-color: #fff;
        position: relative;
 
 
        .view-content {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #ddd;
            display: flex;
            flex-direction: column;
        }
 
        .map-content {
            width: 100%;
            display: flex;
            flex: 1;
            position: relative;
 
            .content {
                overflow: auto;
                position: absolute;
                left: 0;
                right: 0;
                bottom: 0;
                top: 0;
 
                .fabric {
                    width: 100%;
                    height: 100%;
                }
            }
        }
 
        .no-content {
            margin-top: 50px;
            padding: 20rpx 40rpx;
            align-items: center;
            text-align: center;
            display: flex;
            flex-direction: column;
            font-size: 30rpx;
            font-weight: 400;
            background-color: #000fff;
 
            .title {
                font-size: 40rpx;
                margin-bottom: 10rpx;
            }
 
 
        }
 
        .bottom {
            position: fixed;
            left: 50rpx;
            right: 50rpx;
            bottom: 20rpx;
            display: flex;
 
            .bottom-content {
                display: flex;
                flex-direction: column;
                width: 100%;
                // justify-content: center;
                // align-items: center;
                padding: 0 10rpx;
                padding-bottom: 10rpx;
                background-color: #fff;
                border-radius: 10rpx;
                //background-color: #eee;
 
                .title {
                    font-size: 40rpx;
                    margin-bottom: 10rpx;
                }
 
                .tip {
                    color: #888;
                    margin: 10rpx;
                    text-align: left;
                }
 
                .row-group {
                    display: flex;
                    flex-direction: row;
                    margin: 10rpx 0;
 
                }
 
                .disabled {
                    color: #ccc !important;
                }
 
                .coordinate {
                    flex: 1;
                    display: flex;
                    flex-direction: row;
                    align-items: center;
                    // .name{
                    //     padding: 10rpx 0;
 
                    // }
                }
 
                .number-input {
                    flex: 1;
                    background-color: #fff;
                    padding: 10rpx;
                    border-radius: 8rpx;
                    color: #1890FF;
                }
 
 
                .name-input {
                    width: calc(100% - 20rpx);
                    margin-bottom: 10rpx;
                    background-color: #fff;
                    padding: 10rpx;
                    border-radius: 8rpx;
                    display: flex;
                    flex-direction: row;
                    color: #1890FF;
 
                    input {
                        flex: 1;
                    }
                }
            }
 
            .img-button-group {
                display: flex;
                //width: 100%;
                flex-direction: row;
                border-radius: 10px;
                border: 1px solid #fff;
                font-size: 30rpx !important;
                justify-content: space-around;
 
                .button {
                    margin: 10rpx 20rpx;
                    height: 144rpx !important;
                    border: 0;
                    display: flex;
                    flex-direction: column;
                    background-color: #00000000;
 
                    .img {
                        margin: auto;
                        width: 72rpx;
                        height: 72rpx;
 
                    }
 
                    .ico {
                        margin: auto;
                        font-size: 72rpx;
                        color: #1890FF;
                    }
 
                    .text {
                        margin: auto;
 
                    }
 
                }
 
            }
 
 
            .text-button-group {
                display: flex;
                width: 100%;
                justify-content: center;
                align-items: center;
                flex-direction: column;
                font-size: 30rpx !important;
 
                .button {
                    margin: auto;
                    margin-top: 20rpx;
                    width: calc(100% - 10rpx);
                    border-radius: 30rpx;
                }
 
                .am-button {
                    border-radius: 30px;
                }
 
                .am-button-ghost {
                    border: 1px solid #1677ff !important;
                }
            }
 
            .switch-type {
                width: 100%;
                align-items: center;
                vertical-align: middle;
 
                .switch-button-group {
                    width: 96%;
                    height: 32px;
                    border: 1px solid #dfdfdf;
                    border-radius: 16px;
                    background-color: #dfdfdf;
                    display: flex;
                    flex: row;
 
                    .switch-button {
                        flex: 1;
                        border-radius: 16px;
                        color: #000000A5;
                        height: 32px;
                        line-height: 32px;
                        text-align: center;
                    }
 
                    .switch-button-checked {
                        box-shadow: 0px 2px 8px 0px #0000000C;
                        background-color: #fff;
                        color: #262626;
                    }
 
                }
 
 
 
 
            }
        }
 
 
 
        .popup-content {
            display: flex;
            justify-content: center;
            flex-direction: column;
            background-color: transparent;
        }
 
        .popup-dialog {
            width: 300px;
            border-radius: 11px;
            background-color: #fff;
 
            .popup-dialog-title {
                display: flex;
                flex-direction: row;
                justify-content: center;
                padding-top: 15px;
                font-size: 18px;
                font-weight: 500;
            }
 
            .popup-dialog-content {
                display: flex;
                flex-direction: row;
                justify-content: center;
                align-items: center;
                padding: 10px;
            }
 
            .popup-dialog-button-group {
                display: flex;
                flex-direction: column;
 
                .popup-dialog-button {
                    display: flex;
                    flex-direction: row;
                    justify-content: center;
                    align-items: center;
                    height: 45px;
                    border-top: 1px solid #f5f5f5;
                    color: #1890FF;
                }
            }
 
        }
 
        .popup-content-view {
            width: 150px;
            height: 150px;
            border-radius: 10rpx;
            padding: 10rpx 20rpx;
            background-color: #fff;
 
            .item {
                line-height: 75rpx;
                text-align: center;
                border: 0;
 
            }
        }
    }
</style>