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
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
/**
 入驻小区
 **/
(function (vc) {
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROWS = 10;
    vc.extends({
        data: {
            ownerRepairManageInfo: {
                ownerRepairs: [],
                total: 0,
                records: 1,
                moreCondition: false,
                repairName: '',
                repairTypes: [],
                states: [],
                conditions: {
                    repairId: '',
                    repairName: '',
                    tel: '',
                    repairType: '',
                    repairTypeName: '',
                    ownerId: '',
                    state: '',
                    reqSource: 'pc_mobile'
                }
            }
        },
        _initMethod: function () {
            //$that._listOwnerRepairs(DEFAULT_PAGE, DEFAULT_ROWS);
            //$that._validateParam();
            vc.getDict('r_repair_pool', "state", function (_data) {
                $that.ownerRepairManageInfo.states = _data;
            });
            $that._listOwnerRepairs(DEFAULT_PAGE, DEFAULT_ROWS);
            //与字典表关联
            // vc.getDict('r_repair_pool', "repair_type", function (_data) {
            //     $that.ownerRepairManageInfo.repairTypes = _data;
            // });
            // 获取repair_types 不再从字典表查询
            $that._listRepairTypes(DEFAULT_PAGE, 50);
            //与字典表关联
            vc.getDict('r_repair_pool', "state", function (_data) {
                $that.ownerRepairManageInfo.states = _data;
            });
        },
        _initEvent: function () {
            vc.on('ownerRepairManage', 'listOwnerRepair', function (_param) {
                $that._listOwnerRepairs(DEFAULT_PAGE, DEFAULT_ROWS);
            });
            vc.on('pagination', 'page_event', function (_currentPage) {
                $that._listOwnerRepairs(_currentPage, DEFAULT_ROWS);
            });
        },
        methods: {
            // 查询repair_types
            _listRepairTypes: function (_page, _rows) {
                var param = {
                    params: {
                        page: _page,
                        row: _rows,
                        communityId: vc.getCurrentCommunity().communityId
                    }
                };
                //发送get请求
                vc.http.apiGet('repair.listRepairSettings',
                    param,
                    function (json, res) {
                        var _repairTypesInfo = JSON.parse(json);
                        $that.ownerRepairManageInfo.repairTypes = _repairTypesInfo.data;
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            //查询方法
            _listOwnerRepairs: function (_page, _rows) {
                $that.ownerRepairManageInfo.conditions.page = _page;
                $that.ownerRepairManageInfo.conditions.row = _rows;
                $that.ownerRepairManageInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
                // $that.ownerRepairManageInfo.conditions.state = '1000';
                var param = {
                    params: $that.ownerRepairManageInfo.conditions
                };
                //报修ID去空
                param.params.repairId = param.params.repairId.trim();
                //报修人去空
                param.params.repairName = param.params.repairName.trim();
                //报修电话去空
                param.params.tel = param.params.tel.trim();
                //发送get请求
                vc.http.apiGet('/ownerRepair.listOwnerRepairs',
                    param,
                    function (json, res) {
                        var _ownerRepairManageInfo = JSON.parse(json);
                        $that.ownerRepairManageInfo.total = _ownerRepairManageInfo.total;
                        $that.ownerRepairManageInfo.records = _ownerRepairManageInfo.records;
                        $that.ownerRepairManageInfo.ownerRepairs = _ownerRepairManageInfo.data;
                        vc.emit('pagination', 'init', {
                            total: $that.ownerRepairManageInfo.records,
                            dataCount: $that.ownerRepairManageInfo.total,
                            currentPage: _page
                        });
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            //重置方法
            _resetListOwnerRepairs: function (_page, _rows) {
                $that.ownerRepairManageInfo.conditions.repairId = '';
                $that.ownerRepairManageInfo.conditions.repairName = '';
                $that.ownerRepairManageInfo.conditions.tel = '';
                $that.ownerRepairManageInfo.conditions.repairType = '';
                $that.ownerRepairManageInfo.conditions.state = '';
                $that._listOwnerRepairs(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            _openAddOwnerRepairModal: function () {
                vc.emit('addOwnerRepair', 'openAddOwnerRepairModal', $that.ownerRepairManageInfo.conditions);
            },
            _openEditOwnerRepairModel: function (_ownerRepair) {
                _ownerRepair.roomName = $that.ownerRepairManageInfo.conditions.roomName;
                _ownerRepair.roomId = $that.ownerRepairManageInfo.conditions.roomId;
                vc.emit('editOwnerRepair', 'openEditOwnerRepairModal', _ownerRepair);
            },
            _openDeleteOwnerRepairModel: function (_ownerRepair) {
                vc.emit('deleteOwnerRepair', 'openDeleteOwnerRepairModal', _ownerRepair);
            },
            //查询
            _queryOwnerRepairMethod: function () {
                $that._listOwnerRepairs(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            //重置
            _resetOwnerRepairMethod: function () {
                $that._resetListOwnerRepairs(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            _openDispatchRepair: function (_ownerRepair) {
                vc.jumpToPage('/#/pages/property/repairDispatchStep?repairId=' + _ownerRepair.repairId);
            },
            _moreCondition: function () {
                if ($that.ownerRepairManageInfo.moreCondition) {
                    $that.ownerRepairManageInfo.moreCondition = false;
                } else {
                    $that.ownerRepairManageInfo.moreCondition = true;
                }
            }
        }
    });
})(window.vc);