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
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
/**
 入驻小区
 **/
(function (vc) {
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROWS = 10;
    vc.extends({
        data: {
            contractTypeManageInfo: {
                contractTypes: [],
                contractTypeAttrs: [],
                contractTypeSpec: '',
                templatecontent: '',
                total: 0,
                records: 1,
                moreCondition: false,
                contractTypeId: '',
                componentShow: 'contractTypeList',
                audits: [],
                conditions: {
                    typeName: '',
                    audit: '',
                    contractTypeId: '',
                    // communityId: vc.getCurrentCommunity().communityId,
 
                }
            }
        },
        _initMethod: function () {
            vc.getDict('contract_type', "audit", function (_data) {
                vc.component.contractTypeManageInfo.audits = _data;
            });
            vc.component._listContractTypes(DEFAULT_PAGE, DEFAULT_ROWS);
        },
        _initEvent: function () {
            vc.on('contractTypeManage', 'componentShow', function (_param) {
                vc.component.contractTypeManageInfo.componentShow = 'contractTypeList';
            });
            vc.on('contractTypeManage', 'listContractType', function (_param) {
                vc.component._listContractTypes(DEFAULT_PAGE, DEFAULT_ROWS);
            });
            vc.on('pagination', 'page_event', function (_currentPage) {
                vc.component._listContractTypes(_currentPage, DEFAULT_ROWS);
            });
        },
        methods: {
            _listContractTypes: function (_page, _rows) {
                vc.component.contractTypeManageInfo.conditions.page = _page;
                vc.component.contractTypeManageInfo.conditions.row = _rows;
                var param = {
                    params: vc.component.contractTypeManageInfo.conditions
                };
                // param.params.communityId = vc.getCurrentCommunity().communityId;
                param.params.typeName = param.params.typeName.trim();
                param.params.audit = param.params.audit.trim();
                //发送get请求
                vc.http.apiGet('/contract/queryContractType',
                    param,
                    function (json, res) {
                        var _contractTypeManageInfo = JSON.parse(json);
                        vc.component.contractTypeManageInfo.total = _contractTypeManageInfo.total;
                        vc.component.contractTypeManageInfo.records = _contractTypeManageInfo.records;
                        vc.component.contractTypeManageInfo.contractTypes = _contractTypeManageInfo.data;
                        vc.emit('pagination', 'init', {
                            total: vc.component.contractTypeManageInfo.records,
                            dataCount: vc.component.contractTypeManageInfo.total,
                            currentPage: _page
                        });
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            _openAddContractTypeModal: function () {
                vc.emit('addContractType', 'openAddContractTypeModal', {});
            },
            _openEditContractTypeModel: function (_contractType) {
                vc.emit('editContractType', 'openEditContractTypeModal', _contractType);
            },
            _openDeleteContractTypeModel: function (_contractType) {
                vc.emit('deleteContractType', 'openDeleteContractTypeModal', _contractType);
            },
            //查询
            _queryContractTypeMethod: function () {
                vc.component._listContractTypes(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            //重置
            _resetContractTypeMethod: function () {
                vc.component.contractTypeManageInfo.conditions.typeName = "";
                // vc.component.contractTypeManageInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
                vc.component.contractTypeManageInfo.conditions.audit = "";
                vc.component._listContractTypes(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            _openContractTypeSpecModel: function (_contractType) {
                vc.jumpToPage('/#/pages/admin/contractTypeSpecManage?contractTypeId=' + _contractType.contractTypeId);
            },
            _toAuditPage: function () {
                vc.jumpToPage('/#/pages/property/workflowManage?tab=流程管理');
            },
            _loadContractAttrs: function (_contractTypeId) {
                var param = {
                    params: {
                        page: 1,
                        row: 1,
                        contractTypeId: _contractTypeId
                    }
                };
                //发送模板get请求
                vc.http.apiGet('/contract/printContractTemplate',
                    param,
                    function (json, res) {
                        let _info = JSON.parse(json);
                        let _data = _info.data;
                        $that.contractTypeManageInfo.contractTypeAttrs = [];
                        // 合同信息
                        $that.contractdata = _data.contract[0];
                        //合同属性
                        $that.contractTypeManageInfo.contractTypeSpec = _data.contractTypeSpec;
                        $that.contractTypeManageInfo.contractTypeSpec.forEach(function (e) {
                            let rname = e.specName;
                            let reg = '#' + rname + '#';
                            $that.contractTypeManageInfo.contractTypeAttrs.push(reg);
                        });
                        //基本属性
                        $that.baseRepalce = _data.baseRepalce;
                        if ($that.baseRepalce) {
                            $that.baseRepalce.forEach(function (e) {
                                let rname = e.name;
                                let rkey = e.key;
                                var contractarr = Object.keys($that.contractdata);
                                for (var a in contractarr) {
                                    if (rkey == contractarr[a]) {
                                        let reg = '#' + rname + '#';
                                        $that.contractTypeManageInfo.contractTypeAttrs.push(reg);
                                    }
                                }
                            });
                        }
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            _openContractTemplate: function (_contractType) {
                $that.contractTypeManageInfo.componentShow = '';
                vc.component._loadContractAttrs(_contractType.contractTypeId);
                vc.emit('addTemplateView', 'openTemplate', _contractType);
            },
            _moreCondition: function () {
                if (vc.component.contractTypeManageInfo.moreCondition) {
                    vc.component.contractTypeManageInfo.moreCondition = false;
                } else {
                    vc.component.contractTypeManageInfo.moreCondition = true;
                }
            }
        }
    });
})(window.vc);