liubp
2025-12-19 5bdaf416d66b675131004de1aba5d161772a52b0
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
/**
 入驻小区
 **/
(function (vc) {
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROWS = 10;
    vc.extends({
        data: {
            newContractManageInfo: {
                contracts: [],
                total: 0,
                records: 1,
                moreCondition: false,
                contractId: '',
                conditions: {
                    contractNameLike: '',
                    // communityId: vc.getCurrentCommunity().communityId,
                    contractCode: '',
                    contractType: '',
                    state: ''
                },
                contractTypes: [],
            }
        },
        _initMethod: function () {
            vc.component._listContracts(DEFAULT_PAGE, DEFAULT_ROWS);
            $that._listContractTypes();
        },
        _initEvent: function () {
            vc.on('newContractManage', 'listContract', function (_param) {
                vc.component._listContracts(DEFAULT_PAGE, DEFAULT_ROWS);
            });
            vc.on('pagination', 'page_event', function (_currentPage) {
                vc.component._listContracts(_currentPage, DEFAULT_ROWS);
            });
        },
        methods: {
            _listContracts: function (_page, _rows) {
                vc.component.newContractManageInfo.conditions.page = _page;
                vc.component.newContractManageInfo.conditions.row = _rows;
                var param = {
                    params: vc.component.newContractManageInfo.conditions
                };
                param.params.contractNameLike = param.params.contractNameLike.trim();
                // param.params.communityId = vc.getCurrentCommunity().communityId;
                param.params.contractCode = param.params.contractCode.trim();
                //发送get请求
                vc.http.apiGet('/contract/queryContract',
                    param,
                    function (json, res) {
                        var _newContractManageInfo = JSON.parse(json);
                        vc.component.newContractManageInfo.total = _newContractManageInfo.total;
                        vc.component.newContractManageInfo.records = _newContractManageInfo.records;
                        vc.component.newContractManageInfo.contracts = _newContractManageInfo.data;
                        vc.emit('pagination', 'init', {
                            total: vc.component.newContractManageInfo.records,
                            dataCount: vc.component.newContractManageInfo.total,
                            currentPage: _page
                        });
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            _listContractTypes: function (_page, _rows) {
                let param = {
                    params: {
                        page: 1,
                        row: 50
                    }
                };
                //发送get请求
                vc.http.apiGet('/contract/queryContractType',
                    param,
                    function (json, res) {
                        let _contractTypeManageInfo = JSON.parse(json);
                        $that.newContractManageInfo.contractTypes = _contractTypeManageInfo.data;
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            _openContractImport: function () {
                vc.emit('importContract', 'openimportContractModal', {});
            },
            _openAddContractModal: function () {
                //vc.emit('addContract', 'openAddContractModal', {});
                vc.jumpToPage('/#/pages/admin/addContract')
            },
            _openEditContractModel: function (_contract) {
                vc.emit('editContract', 'openEditContractModal', _contract);
            },
            _openDeleteContractModel: function (_contract) {
                vc.emit('deleteContract', 'openDeleteContractModal', _contract);
            },
            //查询
            _queryContractMethod: function () {
                vc.component._listContracts(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            //重置
            _resetContractMethod: function () {
                vc.component.newContractManageInfo.conditions.contractNameLike = "";
                // vc.component.newContractManageInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
                vc.component.newContractManageInfo.conditions.contractCode = "";
                vc.component.newContractManageInfo.conditions.contractType = "";
                vc.component._listContracts(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            _moreCondition: function () {
                if (vc.component.newContractManageInfo.moreCondition) {
                    vc.component.newContractManageInfo.moreCondition = false;
                } else {
                    vc.component.newContractManageInfo.moreCondition = true;
                }
            },
            _printContract: function (_contract) {
                window.open("/print.html#/pages/admin/printContract?contractTypeId=" + _contract.contractType + "&contractId=" + _contract.contractId);
            }
        }
    });
})(window.vc);