zhangjiaqing
8 天以前 1cef3adee31c6934c0da4b4f0b8a6f5ac03b364f
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
(function (vc) {
 
    vc.extends({
        data: {
            equipmentInfo: {
                machineIds:[],
                equipmentAccounts:[],
            },
            yqName:'',
            printFlag:'0',
            nowTime: ''
        },
        _initMethod: function () {
            $that.equipmentInfo.machineIds = vc.getParam('machineIds');
            vc.component._initlDateInfo();
            // 当前时间
            vc.component.equipmentInfo.yqName = vc.getCurrentCommunity().name;
            let myDate = new Date();
            $that.nowTime = myDate.toLocaleDateString();
        },
        _initEvent: function () {
          
        },
        methods: {
            _initlDateInfo: function () {
                var param = {
                    params: {
                        page: 1,
                        row: 100,
                        machineIds: $that.equipmentInfo.machineIds,
                        communityId: vc.getCurrentCommunity().communityId
                    }
                };
                //发送get请求
                    vc.http.apiGet('/equipmentAccount.listEquipmentAccount',
                    param,
                    function (json, res) {
                        var _equipmentAccountManageInfo = JSON.parse(json);
                        vc.component.equipmentInfo.equipmentAccounts =_equipmentAccountManageInfo.data;
                        setTimeout(function(){
                            $that._generatorQrCode();
                        },2000)
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            _generatorQrCode:function(){
                $that.equipmentInfo.equipmentAccounts.forEach(item => {
                    let qrcode = new QRCode('a'+item.machineId, {
                        text: item.url,  //你想要填写的文本
                        width: 200, //生成的二维码的宽度
                        height: 200, //生成的二维码的高度
                        colorDark: "#000000", // 生成的二维码的深色部分
                        colorLight: "#ffffff", //生成二维码的浅色部分
                        correctLevel: QRCode.CorrectLevel.H
                    });
                });
            },
            _printInspectionRouteDiv: function () {
                
                $that.printFlag = '1';
                console.log('console.log($that.printFlag);',$that.printFlag);
                document.getElementById("print-btn").style.display="none";//隐藏
 
                window.print();
                //$that.printFlag = false;
                window.opener=null;
                window.close();
            },
            _closePage: function () {
                window.opener=null;
                window.close();
            }
        }
    });
 
})(window.vc);