whychdw
2019-12-03 e494970eb80d7fd9fe6e8e0aceecbb9a82cf39c7
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
'use strict';
 
/**
 * 模板模块
 * 默认模块名: monitor-data
 * @return {[object]}  [ 返回一个对象 ]
 */
loader.define({
    data: {
        vm: ''
    },
    loaded: function loaded(require, exports, module) {
        // 引入vue
        this.vm = new Vue({
            el: getPageRoot(module),
            data: {
                shows: {
                    monList: false,
                    total: false,
                    monVol: false,
                    monRes: false,
                    monTmp: false,
                    monResLine: false
                },
                loading: bui.loading(),
                open: true,
                uiDialog: '',
                num: -1,
                BattGroupId: -1,
                title: '??',
                battInfo: {
                    sysstate: 0,
                    sysversion: 1.2,
                    battstate: 0,
                    isOutTime: 1,
                    groupcurr: 0,
                    groupvol: 0,
                    monCount: 0,
                    testTimelong: 0
                },
                battList: [{
                    num: 1,
                    BattGroupId: 1,
                    text: '电池组1'
                }, {
                    num: 2,
                    BattGroupId: 2,
                    text: '电池组2'
                }],
                tabs: {
                    active: 0
                },
                timer: new Timeout(),
                tbls: {
                    monInfo: {
                        height: '300px',
                        data: []
                    },
                    total: {
                        data: [{
                            type: '电压',
                            high: '',
                            low: '',
                            avg: ''
                        }, {
                            type: '内阻',
                            high: '',
                            low: '',
                            avg: ''
                        }, {
                            type: '温度',
                            high: '',
                            low: '',
                            avg: ''
                        }]
                    }
                },
                options: {
                    page: {
                        curr: 1, // 当前页
                        size: 25, // 每页的数据量
                        pageTotal: 1, // 总页数
                        total: 0 // 数据总量
                    },
                    monVol: { // 单体电压
                        title: new Title(),
                        height: "300px",
                        option: {
                            categories: [],
                            data: []
                        }
                    },
                    monRes: { // 单体内阻
                        title: new Title(),
                        height: "300px",
                        option: {
                            categories: [],
                            data: []
                        }
                    },
                    monResLine: { // 单体内阻折线图
                        title: '',
                        option: {
                            categories: [],
                            data: []
                        }
                    },
                    monTmp: { // 单体温度
                        title: new Title(),
                        height: "300px",
                        option: {
                            categories: [],
                            data: []
                        }
                    }
                },
                allData: []
            },
            filters: {
                stateFilter: function stateFilter(state, isOutTime) {
                    var rs = '';
                    if (isOutTime == 1) {
                        rs = "未连接";
                    } else {
                        switch (state) {
                            case -1:
                                rs = '未知';
                                break;
                            case 0:
                                rs = '浮充';
                                break;
                            case 1:
                                rs = '放电';
                                break;
                            case 2:
                                rs = '充电';
                                break;
                        }
                    }
                    return rs;
                },
                sysstateFilter: function sysstateFilter(sysstate) {
                    var rs = '常规模式';
                    switch (sysstate) {
                        case 1:
                            rs = '内阻测试';
                            break;
                        case 2:
                            rs = '编址模式';
                            break;
                    }
                    return rs;
                },
                formatSeconds: function (_formatSeconds) {
                    function formatSeconds(_x) {
                        return _formatSeconds.apply(this, arguments);
                    }
 
                    formatSeconds.toString = function () {
                        return _formatSeconds.toString();
                    };
 
                    return formatSeconds;
                }(function (num) {
                    return formatSeconds(num);
                })
            },
            methods: {
                setAllData: function setAllData(data) {
                    this.allData = data;
                },
                tabsChange: function tabsChange() {
                    var self = this;
                    this.$nextTick(function () {
                        self.updateGrahp();
                    });
                },
                openDrawer: function openDrawer() {
                    this.open = true;
                },
                closeDrawer: function closeDrawer() {
                    this.open = false;
                },
                listClick: function listClick(item) {
                    // 设置标题
                    this.title = item.text;
                    // 关闭Drawer
                    this.open = false;
                    // 初始化分页信息
                    this.initPage();
                    // 根据点电池组编号查询电池组信息
                    this.num = item.num;
                    // 设置电池组id
                    this.BattGroupId = item.BattGroupId;
 
                    this.startReadBattMonInfo();
                },
                searchAll: function searchAll() {
                    // 查询电池组的所有信息
                    if (typeof BattinfService != 'undefined') {
                        BattinfService.searchAll();
                    }
                },
                startReadBattMonInfo: function startReadBattMonInfo() {
                    // 开始获取电池组信息
                    var self = this;
                    this.timer.start(function () {
                        self.readBattMonInfo();
                    }, 4000);
                },
                readBattMonInfo: function readBattMonInfo() {
                    // 读取电池组信息
                    var num = this.num;
                    if (num == -1) {
                        return;
                    }
                    if (typeof DeviceService != 'undefined') {
                        DeviceService.readBattMonInfo(num);
                    } else {
                        this.setPageContent({
                            code: 1,
                            data: {
                                sysstate: 0,
                                sysversion: 1.2,
                                battstate: 0,
                                isOutTime: 0,
                                groupcurr: 2.11111,
                                groupvol: 30.444444,
                                monCount: 4,
                                testTimelong: 0,
                                mon_ress: [0.2, 0.3, 1, 2],
                                mon_tmps: [10, 11, 12, 13],
                                mon_vols: [14, 16, 18, 20]
                            }
                        });
                        this.timer.open();
                    }
                },
                setList: function setList(data) {
                    var list = [];
                    // 遍历data
                    for (var i = 0; i < data.length; i++) {
                        var _data = data[i];
                        _data.text = _data.BattGroupName;
                        if (_data.station_install) {
                            list.push(_data);
                        }
                    }
                    // 设置battList的值
                    this.battList = list;
                },
                setPageContent: function setPageContent(res) {
                    // 设置所有的数据
                    this.setAllData(res.data);
 
                    // 设置电池组的总体信息
                    this.setBattInfo(res.data);
 
                    // 设置图标配置项
                    this.setOption();
                },
                setMonInfoTbl: function setMonInfoTbl(data) {
                    var monCount = data.monCount;
                    var list = [];
                    var k = -1;
                    // 遍历单体
                    for (var i = 0; i < monCount; i++) {
                        var num = i % 3;
                        if (num == 0) {
                            k++;
                            list[k] = {};
                        }
                        num++;
                        var num_k = 'num' + num;
                        var vol_k = 'vol' + num;
                        var tmp_k = 'tmp' + num;
                        var res_k = 'res' + num;
                        list[k][num_k] = '#' + (i + 1);
                        list[k][vol_k] = data.mon_vols[i];
                        list[k][res_k] = data.mon_ress[i];
                        list[k][tmp_k] = data.mon_tmps[i];
                    }
                    this.tbls.monInfo.data = list;
                },
                setTotal: function setTotal(data) {
                    // 单体电压
                    var vol = this.getMaxMinAvg(data.monCount, data.mon_vols);
                    this.setTotalItem(0, vol, 'V', 2);
                    // 单体内阻
                    var res = this.getMaxMinAvg(data.monCount, data.mon_ress);
                    this.setTotalItem(1, res, 'mΩ', 2);
                    // 单体温度
                    var tmp = this.getMaxMinAvg(data.monCount, data.mon_tmps);
                    this.setTotalItem(2, tmp, '℃', 1);
                },
                setTotalItem: function setTotalItem(item, data, unit, fixed) {
                    this.tbls.total.data[item].high = data.max.text + ':' + data.max.val + unit;
                    this.tbls.total.data[item].low = data.min.text + ':' + data.min.val + unit;
                    this.tbls.total.data[item].avg = Number(data.avg.toFixed(fixed)) + unit;
                },
                setOption: function setOption() {
                    this.loading.hide();
                    var data = this.allData;
                    // 设置单体表格数据
                    this.setMonInfoTbl(data);
                    // 设置统计信息表格
                    this.setTotal(data);
                    // 单体个数
                    var monCount = data.monCount;
                    // 设置分页的总数据量
                    this.setPageTotal(monCount);
                    // 获取起始和结束电池单体
                    var startEnd = this.getStartEndIndex();
 
                    //console.log(data);
                    // 遍历data的值
                    var monNum = []; // 单体编号
                    var monVol = []; // 单体电压
                    var monRes = []; // 单体内阻
                    var monTmp = []; // 单体温度
                    for (var i = startEnd.start; i < startEnd.end; i++) {
                        monNum.push('#' + (i + 1));
                        monVol.push(data.mon_vols[i]);
                        monRes.push(data.mon_ress[i]);
                        monTmp.push(data.mon_tmps[i]);
                    }
                    // 单体电压
                    this.options.monVol.option.categories = monNum;
                    this.options.monVol.option.data = monVol;
 
                    // 单体内阻
                    this.options.monRes.option.categories = monNum;
                    this.options.monRes.option.data = monRes;
 
                    // 单体温度
                    this.options.monTmp.option.categories = monNum;
                    this.options.monTmp.option.data = monTmp;
                    // 更新图表
                    this.updateGrahp();
                },
                updateGrahp: function updateGrahp() {
                    // 更新单体电压
                    if (this.tabs.active == 2) {
                        // bui.alert(7788);
                        this.$refs['monVolBar'].setOption(this.options.monVol.option);
                    }
 
                    // 更新单体内阻
                    if (this.tabs.active == 3) {
                        this.$refs['monResBar'].setOption(this.options.monRes.option);
                    }
 
                    // 更新单体温度
                    if (this.tabs.active == 4) {
                        this.$refs['monTmpBar'].setOption(this.options.monTmp.option);
                    }
                },
                setBattInfo: function setBattInfo(data) {
                    var battInfo = {
                        sysstate: data.sysstate,
                        sysversion: data.sysversion,
                        battstate: data.battstate,
                        isOutTime: data.isOutTime,
                        groupcurr: data.groupcurr,
                        groupvol: data.groupvol,
                        monCount: data.monCount,
                        testTimelong: data.testTimelong
                    };
                    // 设置电池的信息
                    this.battInfo = battInfo;
                },
                getMaxMinAvg: function getMaxMinAvg(monCount, data, unit) {
                    // 获取较高,较低单体信息和平均值
                    // 构造对象
                    var rs = {
                        min: {
                            text: '#1',
                            val: data[0]
                        },
                        max: {
                            text: '#1',
                            val: data[0]
                        },
                        avg: 0
                    };
                    var sum = data[0];
                    // 遍历monCount
                    for (var i = 1; i < monCount; i++) {
                        // 较大值
                        if (data[i] > rs.max.val) {
                            rs.max.text = "#" + (i + 1);
                            rs.max.val = data[i];
                        } else if (data[i] == rs.max.val) {
                            rs.max.text += ",#" + (i + 1);
                        }
                        // 较小值
                        if (data[i] < rs.min.val) {
                            rs.min.text = "#" + (i + 1);
                            rs.min.val = data[i];
                        } else if (data[i] == rs.min.val) {
                            rs.min.text += ",#" + (i + 1);
                        }
                        sum += data[i];
                    }
                    rs.avg = sum / monCount;
                    return rs;
                },
                confirmStartRes: function confirmStartRes() {
                    var self = this;
                    var num = this.num;
                    if (num == -1) {
                        this.$message({
                            message: '请先选择电池组',
                            type: 'warning'
                        });
                        return;
                    }
                    // 确认框
                    this.$confirm('启动内阻测试?', '确认信息', {
                        distinguishCancelAndClose: true,
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        callback: function callback(action, instance) {
                            if (action == 'confirm') {
                                self.startBattResTest(num);
                            }
                        }
                    });
                },
                startBattResTest: function startBattResTest(num) {
                    var self = this;
                    //console.log(num);
                    if (num == -1) {
                        this.$message({
                            message: '请先选择电池组',
                            type: 'warning'
                        });
                        return;
                    }
                    // 加载等待
                    this.loading.show();
                    if (typeof DeviceService != 'undefined') {
                        DeviceService.startBattResTest(num);
                    } else {
                        this.battInfo.sysstate = 1;
                        // 提示
                        this.$message({
                            message: '请使用手机端启动!',
                            type: 'warning'
                        });
 
                        setTimeout(function () {
                            self.loading.hide();
                        }, 4000);
                    }
                },
                confirmStopRes: function confirmStopRes() {
                    var self = this;
                    var num = this.num;
                    if (num == -1) {
                        this.$message({
                            message: '请先选择电池组',
                            type: 'warning'
                        });
                        return;
                    }
                    // 确认框
                    this.$confirm('停止内阻测试?', '确认信息', {
                        distinguishCancelAndClose: true,
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        callback: function callback(action, instance) {
                            if (action == 'confirm') {
                                self.stopBattResTest(num);
                            }
                        }
                    });
                },
                stopBattResTest: function stopBattResTest(num) {
                    var self = this;
                    //console.log(num);
                    if (num == -1) {
                        this.$message({
                            message: '请先选择电池组',
                            type: 'warning'
                        });
                        return;
                    }
                    // 加载等待
                    this.loading.show();
                    if (typeof DeviceService != 'undefined') {
                        DeviceService.stopBattResTest(num);
                    } else {
                        this.battInfo.sysstate = 0;
                        // 提示
                        this.$message({
                            message: '请使用手机端停止!',
                            type: 'warning'
                        });
 
                        setTimeout(function () {
                            self.loading.hide();
                        }, 4000);
                    }
                },
                confirmRestart: function confirmRestart() {
                    var self = this;
                    var num = this.num;
                    if (num == -1) {
                        this.$message({
                            message: '请先选择电池组',
                            type: 'warning'
                        });
                        return;
                    }
                    // 确认框
                    this.$confirm('重启汇集器?', '确认信息', {
                        distinguishCancelAndClose: true,
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        callback: function callback(action, instance) {
                            if (action == 'confirm') {
                                self.reStartSystem(num);
                            }
                        }
                    });
                },
                reStartSystem: function reStartSystem(num) {
                    var self = this;
                    //console.log(num);
                    if (num == -1) {
                        this.$message({
                            message: '请先选择电池组',
                            type: 'warning'
                        });
                        return;
                    }
                    // 加载等待
                    this.loading.show();
                    if (typeof DeviceService != 'undefined') {
                        DeviceService.reStartSystem(num);
                    } else {
                        this.battInfo.sysstate = 0;
                        // 提示
                        this.$message({
                            message: '请使用手机端重启!',
                            type: 'warning'
                        });
 
                        setTimeout(function () {
                            self.loading.hide();
                        }, 4000);
                    }
                },
                setHt: function setHt() {
                    var pgHt = this.$refs.tabItemHt.offsetHeight - 1;
                    this.options.monVol.height = pgHt + 'px';
                    this.options.monRes.height = pgHt + 'px';
                    this.options.monTmp.height = pgHt + 'px';
                    this.tbls.monInfo.height = pgHt + 'px';
                },
                handlePreBtn: function handlePreBtn() {
                    var self = this;
                    if (this.options.page.curr <= 1) {
                        this.$message('当前已经是第一页');
                        return;
                    }
                    this.options.page.curr--;
                    this.loading.show();
                    setTimeout(function () {
                        // 设置配置项
                        self.setOption();
                    }, 500);
                },
                handleNextBtn: function handleNextBtn() {
                    var self = this;
                    if (this.options.page.curr * this.options.page.size >= this.options.page.total) {
                        this.$message('当前已经是最后一页');
                        return;
                    }
                    this.options.page.curr++;
                    this.loading.show();
                    setTimeout(function () {
                        // 设置配置项
                        self.setOption();
                    }, 500);
                },
                initPage: function initPage() {
                    // 初始化图表分页信息
                    // 初始化页数为1
                    this.options.page.curr = 1;
                    // 设置total
                    this.options.page.total = 0;
                },
                getStartEndIndex: function getStartEndIndex() {
                    // 根据分页信息获取起始和结束点
                    var page = this.options.page;
                    var start = (page.curr - 1) * page.size;
                    var end = (page.curr - 1) * page.size + page.size;
                    if (end > page.total) {
                        end = page.total;
                    }
                    return {
                        start: start,
                        end: end
                    };
                },
                setPageTotal: function setPageTotal(total) {
                    // 设置分页的总数据量
                    this.options.page.total = total;
                    if (total == 0) {
                        this.options.page.pageTotal = 1;
                    } else {
                        this.options.page.pageTotal = Math.ceil(total / this.options.page.size);
                    }
                },
                monHandlerClick: function monHandlerClick(event) {
                    var self = this;
                    var page = this.options.page;
                    var monNum = event.point.index + 1 + (page.curr - 1) * page.size;
                    this.options.monResLine.title = '单体#' + monNum + '内阻折线图';
                    // 构造查询对象
                    var searchParams = {
                        BattGroupId: this.BattGroupId,
                        mon_num: monNum
                    };
                    // 开启等待框
                    this.loading.show();
                    if (typeof BattresdataService != "undefined") {
                        BattresdataService.serchByCondition(JSON.stringify(searchParams));
                    } else {
                        setTimeout(function () {
                            self.loading.hide();
                            self.setMonResLine([{
                                mon_res: 10,
                                test_starttime: '2019-12-03 10:09:00'
                            }, {
                                mon_res: 11,
                                test_starttime: '2019-12-03 11:09:00'
                            }, {
                                mon_res: 9,
                                test_starttime: '2019-12-03 12:09:00'
                            }]);
                            self.uiDialog.open();
                        }, 1000);
                    }
                },
                setMonResLine: function setMonResLine(data) {
                    var monRes = [[]];
                    var times = [];
                    // 遍历data
                    for (var i = 0; i < data.length; i++) {
                        var _data = data[i];
                        monRes[0].push(_data.mon_res);
                        times.push(_data.test_starttime);
                    }
                    this.options.monResLine.categories = times;
                    this.options.monResLine.data = monRes;
                    // 设置配置项
                    this.$refs.monResLine.setOption(this.options.monResLine);
                }
            },
            created: function created() {
                var self = this;
                // 显示左侧弹出框
                setTimeout(function () {
                    self.shows.drawer = true;
                }, 0);
                // 显示单体列表
                setTimeout(function () {
                    self.shows.monList = true;
                }, 0);
                // 显示统计信息
                setTimeout(function () {
                    self.shows.total = true;
                }, 0);
                // 显示单体电压
                setTimeout(function () {
                    self.shows.monVol = true;
                }, 0);
                // 显示单体内阻
                setTimeout(function () {
                    self.shows.monRes = true;
                }, 0);
                // 显示单体温度
                setTimeout(function () {
                    self.shows.monTmp = true;
                }, 0);
                // 显示单体内阻折线
                setTimeout(function () {
                    self.shows.monResLine = true;
                }, 0);
            },
            computed: {
                getTitle: function getTitle() {
                    return this.title + '-监测数据';
                },
                getRestart: function getRestart() {
                    var rs = true;
                    // 电池组状态为浮充,系统状态为常规状态
                    if (this.battInfo.battstate == 0 && this.battInfo.sysstate == 0) {
                        rs = false;
                    }
                    return rs;
                },
                getBattNum: function getBattNum() {
                    var rs = "";
                    if (this.num != -1) {
                        rs = '#' + this.num;
                    }
                    return rs;
                },
                setPagingPreBtn: function setPagingPreBtn() {
                    var rs = true;
                    if (this.tabs.active == 0 || this.tabs.active == 1 || this.options.page.curr <= 1) {
                        return false;
                    }
 
                    return rs;
                },
                setPagingNextBtn: function setPagingNextBtn() {
                    var rs = true;
                    if (this.tabs.active == 0 || this.tabs.active == 1 || this.options.page.curr * this.options.page.size >= this.options.page.total) {
                        return false;
                    }
                    return rs;
                }
            },
            mounted: function mounted() {
                var self = this;
                // 页面选项卡
                var uiTab = bui.tab({
                    id: "#uiTab",
                    animate: false,
                    swipe: false
                });
 
                // 选项卡绑定事件
                uiTab.on('to', function (index) {
                    self.tabs.active = index;
                    self.tabsChange();
                });
 
                // 自定义居中弹出框
                this.uiDialog = bui.dialog({
                    id: "#dialogCenter",
                    width: 700,
                    autoClose: false
                });
 
                // 查询所有已经安装的电池组
                this.searchAll();
 
                // 设置高度
                this.setHt();
 
                // 后台触发事件查询所有的电池组信息
                window['BattinfServicesearchAllcalljs'] = function (res) {
                    var data = res.data;
                    self.setList(data);
                };
 
                // 后台触发返回读取电池组信息
                window['DeviceServicereadBattMonInfocalljs'] = function (res) {
                    //console.log(res);
                    // 设置页面信息
                    self.setPageContent(res);
                    // 开启延时执行
                    self.timer.open();
                };
 
                // 启动内阻测试
                window['DeviceServicestartBattResTestcalljs'] = function (res) {
                    //console.log(res);
                    // 关闭等待
                    self.loading.hide();
                    // 根据返回结果显示内容
                    if (res.code == 1) {
                        self.$message({
                            message: '启动成功!',
                            type: 'success'
                        });
                    } else {
                        self.$message.error('启动失败!');
                    }
                };
 
                // 停止内阻测试
                window['DeviceServicestopBattResTestcalljs'] = function (res) {
                    //console.log(res);
                    // 关闭等待
                    self.loading.hide();
                    // 根据返回结果显示内容
                    if (res.code == 1) {
                        self.$message({
                            message: '停止成功!',
                            type: 'success'
                        });
                    } else {
                        self.$message.error('停止失败!');
                    }
                };
                // 停止内阻测试
                window['DeviceServicereStartSystemcalljs'] = function (res) {
                    //console.log(res);
                    // 关闭等待
                    self.loading.hide();
                    // 根据返回结果显示内容
                    if (res.code == 1) {
                        self.$message({
                            message: '重启汇集器成功!',
                            type: 'success'
                        });
                    } else {
                        self.$message.error('重启汇集器失败!');
                    }
                };
 
                // 获取单体内阻信息
                window['BattresdataServiceserchByConditioncalljs'] = function (res) {
                    console.log(res);
                    // 关闭等待
                    self.loading.hide();
                    // 根据返回结果显示内容
                    if (res.code == 1) {
                        self.setMonResLine(res.data);
                    } else {
                        self.setMonResLine([]);
                    }
                    // 显示面板
                    self.uiDialog.open();
                };
            },
 
            destroyed: function destroyed() {
                // 注销方法
                window.BattinfServicesearchAllcalljs = null;
                window.DeviceServicereadBattMonInfocalljs = null;
                window.DeviceServicestartBattResTestcalljs = null;
                window.DeviceServicestopBattResTestcalljs = null;
                // 停止计时器
                this.timer.stop();
            }
        });
    },
    destroyed: function destroyed() {
        this.vm.$destroy();
    }
});