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
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
(function(vc) {
 
    vc.extends({
        data: {
            printRepairDetailInfo: {
                repairId: '',
                repairTypeName: '',
                appointmentTime: '',
                repairName: '',
                tel: '',
                repairObjName: '',
                context: '',
                repairUsers: [],
                maintenanceType: '',
                repairMaterials: '',
                repairFee: '',
            },
            printFlag: '0',
            nowTime: ''
        },
        _initMethod: function() {
            // 加载数据
            vc.component._initPrintRepairDetailDateInfo();
            // 当前时间
            let myDate = new Date();
            $that.nowTime = myDate.toLocaleDateString();
        },
        _initEvent: function() {
            // vc.on('printPurchaseApply', 'openPrintPurchaseApplyModal', function (_purchaseApplyDetailInfo) {
            //     $that.printRepairDetailInfo = _purchaseApplyDetailInfo;
            //     $('#printPurchaseApplyModel').modal('show');
            // });
        },
        methods: {
            _initPrintRepairDetailDateInfo: function() {
                let _repairId = vc.getParam('repairId');
                let _repairType = vc.getParam("repairType")
                var param = {
                    params: {
                        page: 1,
                        row: 1,
                        repairId: _repairId,
                        communityId: vc.getCurrentCommunity().communityId,
                        repairType: _repairType
                    }
                };
 
                //发送get请求
                vc.http.apiGet('/ownerRepair.listOwnerRepairs',
                    param,
                    function(json, res) {
                        var _repairDetailInfo = JSON.parse(json);
                        console.log('here Res :', _repairDetailInfo);
                        vc.copyObject(_repairDetailInfo.data[0], $that.printRepairDetailInfo);
                        console.log('that.info : ', $that.printRepairDetailInfo);
                        //查询处理轨迹
                        $that._loadRepairUser();
                    },
                    function(errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
 
            },
 
            /**
             * 查询处理轨迹
             */
            _loadRepairUser: function() {
                var param = {
                    params: {
                        page: 1,
                        row: 100,
                        communityId: vc.getCurrentCommunity().communityId,
                        repairId: $that.printRepairDetailInfo.repairId
                    }
                };
                //发送get请求
                vc.http.apiGet('ownerRepair.listRepairStaffs',
                    param,
                    function(json, res) {
                        var _repairStaffsInfo = JSON.parse(json);
                        let _repairs = _repairStaffsInfo.data;
                        console.log('repairUsers : ', _repairs);
                        $that.printRepairDetailInfo.repairUsers = _repairs;
                    },
                    function(errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
 
            _printPurchaseApplyDiv: 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);