|
1 |
| -(function(vc) { |
| 1 | +(function (vc) { |
2 | 2 | vc.extends({
|
3 | 3 | data: {
|
4 | 4 | exportFeeImportExcelInfo: {
|
5 |
| - communityId: vc.getCurrentCommunity().communityId, |
| 5 | + communityId: '', |
6 | 6 | isFloorAll: true,
|
7 | 7 | isConfigAll: true,
|
8 | 8 | configIds: [],
|
|
11 | 11 | floors: [],
|
12 | 12 | }
|
13 | 13 | },
|
14 |
| - _initMethod: function() {}, |
15 |
| - _initEvent: function() { |
16 |
| - vc.on('exportFeeImportExcel', 'openExportFeeImportExcelModal', function(_param) { |
| 14 | + _initMethod: function () { |
| 15 | + $that.exportFeeImportExcelInfo.communityId = vc.getCurrentCommunity().communityId; |
| 16 | + }, |
| 17 | + _initEvent: function () { |
| 18 | + vc.on('exportFeeImportExcel', 'openExportFeeImportExcelModal', function (_param) { |
17 | 19 | $that._loadExportFloors();
|
18 | 20 | $that._listExportFeeConfigs();
|
19 | 21 | $('#exportFeeImportExcelModel').modal('show');
|
20 | 22 | });
|
21 | 23 | },
|
22 | 24 | methods: {
|
23 |
| - _importData: function() { |
| 25 | + _importData: function () { |
24 | 26 |
|
25 | 27 | // 导入数据
|
26 |
| - if (!vc.component.checkOwnerFileType(vc.component.exportFeeImportExcelInfo.excelTemplate.name.split('.')[1])) { |
| 28 | + if (!$that.checkOwnerFileType($that.exportFeeImportExcelInfo.excelTemplate.name.split('.')[1])) { |
27 | 29 | vc.toast('不是有效的Excel格式');
|
28 | 30 | return;
|
29 | 31 | }
|
30 |
| - if (!vc.component.checkOwnerFileSize(vc.component.exportFeeImportExcelInfo.excelTemplate.size)) { |
| 32 | + if (!$that.checkOwnerFileSize($that.exportFeeImportExcelInfo.excelTemplate.size)) { |
31 | 33 | vc.toast('Excel文件大小不能超过2M');
|
32 | 34 | return;
|
33 | 35 | }
|
34 | 36 | var param = new FormData();
|
35 |
| - param.append("uploadFile", vc.component.exportFeeImportExcelInfo.excelTemplate); |
36 |
| - param.append('communityId', vc.component.exportFeeImportExcelInfo.communityId); |
37 |
| - // param.append('feeTypeCd', vc.component.importRoomFeeInfo.feeTypeCd); |
| 37 | + param.append("uploadFile", $that.exportFeeImportExcelInfo.excelTemplate); |
| 38 | + param.append('communityId', $that.exportFeeImportExcelInfo.communityId); |
| 39 | + // param.append('feeTypeCd', $that.importRoomFeeInfo.feeTypeCd); |
38 | 40 | // param.append('objType', $that.importRoomFeeInfo.objType);
|
39 | 41 | vc.http.upload(
|
40 | 42 | 'exportFeeImportExcel',
|
41 | 43 | 'importData',
|
42 | 44 | param, {
|
43 |
| - emulateJSON: true, |
44 |
| - //添加请求头 |
45 |
| - headers: { |
46 |
| - "Content-Type": "multipart/form-data" |
47 |
| - } |
48 |
| - }, |
49 |
| - function(json, res) { |
| 45 | + emulateJSON: true, |
| 46 | + //添加请求头 |
| 47 | + headers: { |
| 48 | + "Content-Type": "multipart/form-data" |
| 49 | + } |
| 50 | + }, |
| 51 | + function (json, res) { |
50 | 52 | //vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
51 | 53 | let _json = JSON.parse(json);
|
52 | 54 | if (_json.code == 0) {
|
|
59 | 61 | }
|
60 | 62 | vc.toast(_json.msg, 10000);
|
61 | 63 | },
|
62 |
| - function(errInfo, error) { |
| 64 | + function (errInfo, error) { |
63 | 65 | console.log('请求失败处理');
|
64 | 66 | vc.toast(errInfo, 10000);
|
65 | 67 | });
|
66 | 68 | },
|
67 |
| - clearAddFeeConfigInfo: function() { |
68 |
| - // var _feeTypeCds = vc.component.importRoomFeeInfo.feeTypeCds; |
69 |
| - vc.component.exportFeeImportExcelInfo = { |
| 69 | + clearAddFeeConfigInfo: function () { |
| 70 | + // var _feeTypeCds = $that.importRoomFeeInfo.feeTypeCds; |
| 71 | + $that.exportFeeImportExcelInfo = { |
70 | 72 | communityId: vc.getCurrentCommunity().communityId,
|
71 | 73 | isFloorAll: true,
|
72 | 74 | isConfigAll: true,
|
|
77 | 79 | };
|
78 | 80 | },
|
79 | 81 |
|
80 |
| - changeItemConfig: function() { |
| 82 | + changeItemConfig: function () { |
81 | 83 | if ($that.exportFeeImportExcelInfo.configIds.length < $that.exportFeeImportExcelInfo.configs.length) {
|
82 | 84 | $that.exportFeeImportExcelInfo.isConfigAll = false;
|
83 | 85 | return;
|
84 | 86 | }
|
85 | 87 | $that.exportFeeImportExcelInfo.isConfigAll = true;
|
86 | 88 | },
|
87 | 89 |
|
88 |
| - changeItemFloor: function() { |
| 90 | + changeItemFloor: function () { |
89 | 91 | if ($that.exportFeeImportExcelInfo.floorIds.length < $that.exportFeeImportExcelInfo.floors.length) {
|
90 | 92 | $that.exportFeeImportExcelInfo.isFloorAll = false;
|
91 | 93 | return;
|
92 | 94 | }
|
93 | 95 | $that.exportFeeImportExcelInfo.isFloorAll = true;
|
94 | 96 | },
|
95 | 97 |
|
96 |
| - _loadExportFloors: function() { |
| 98 | + _loadExportFloors: function () { |
97 | 99 | var param = {
|
98 | 100 | params: {
|
99 | 101 | page: 1,
|
100 | 102 | row: 150,
|
101 | 103 | communityId: vc.getCurrentCommunity().communityId,
|
102 |
| - |
| 104 | + |
103 | 105 | }
|
104 | 106 | };
|
105 | 107 |
|
106 | 108 | //发送get请求
|
107 | 109 | vc.http.apiGet('/floor.queryFloors',
|
108 | 110 | param,
|
109 |
| - function(json, res) { |
| 111 | + function (json, res) { |
110 | 112 | let listFloorData = JSON.parse(json);
|
111 | 113 | $that.exportFeeImportExcelInfo.floors = listFloorData.apiFloorDataVoList;
|
112 | 114 | listFloorData.apiFloorDataVoList.forEach(item => {
|
113 | 115 | $that.exportFeeImportExcelInfo.floorIds.push(item.floorId);
|
114 | 116 | });
|
115 | 117 | },
|
116 |
| - function(errInfo, error) { |
| 118 | + function (errInfo, error) { |
117 | 119 | console.log('请求失败处理');
|
118 | 120 | }
|
119 | 121 | );
|
120 | 122 | },
|
121 |
| - _listExportFeeConfigs: function() { |
| 123 | + _listExportFeeConfigs: function () { |
122 | 124 | var param = {
|
123 | 125 | params: {
|
124 | 126 | page: 1,
|
125 | 127 | row: 100,
|
126 | 128 | communityId: vc.getCurrentCommunity().communityId,
|
127 |
| - isDefault:'F' |
| 129 | + isDefault: 'F' |
128 | 130 | }
|
129 | 131 | };
|
130 | 132 |
|
131 | 133 | //发送get请求
|
132 | 134 | vc.http.apiGet('/feeConfig.listFeeConfigs', param,
|
133 |
| - function(json, res) { |
| 135 | + function (json, res) { |
134 | 136 | let _feeConfigManageInfo = JSON.parse(json);
|
135 | 137 | $that.exportFeeImportExcelInfo.configs = _feeConfigManageInfo.feeConfigs;
|
136 | 138 |
|
|
139 | 141 | });
|
140 | 142 |
|
141 | 143 | },
|
142 |
| - function(errInfo, error) { |
| 144 | + function (errInfo, error) { |
143 | 145 | console.log('请求失败处理');
|
144 | 146 | });
|
145 | 147 | },
|
146 | 148 |
|
147 |
| - changeAllConfig: function() { |
| 149 | + changeAllConfig: function () { |
148 | 150 | $that.exportFeeImportExcelInfo.configIds = [];
|
149 | 151 | if (!$that.exportFeeImportExcelInfo.isConfigAll) {
|
150 | 152 | return;
|
|
154 | 156 | $that.exportFeeImportExcelInfo.configIds.push(item.configId);
|
155 | 157 | });
|
156 | 158 | },
|
157 |
| - changeAllFloors: function() { |
| 159 | + changeAllFloors: function () { |
158 | 160 | $that.exportFeeImportExcelInfo.floorIds = [];
|
159 | 161 | if (!$that.exportFeeImportExcelInfo.isFloorAll) {
|
160 | 162 | return;
|
|
164 | 166 | $that.exportFeeImportExcelInfo.floorIds.push(item.floorId);
|
165 | 167 | });
|
166 | 168 | },
|
167 |
| - _exportExcel: function() { |
| 169 | + _exportExcel: function () { |
168 | 170 | let _floorIds = $that.exportFeeImportExcelInfo.floorIds.join(',');
|
169 | 171 | let _configIds = $that.exportFeeImportExcelInfo.configIds.join(',');
|
170 |
| - vc.jumpToPage('/callComponent/importAndExportFee/exportData?floorIds=' + _floorIds + "&configIds=" + _configIds + "&communityId=" + vc.getCurrentCommunity().communityId + "&type=1001"); |
171 |
| - $('#exportFeeImportExcelModel').modal('hide'); |
| 172 | + let param = { |
| 173 | + params: { |
| 174 | + floorIds: _floorIds, |
| 175 | + configIds: _configIds, |
| 176 | + communityId: vc.getCurrentCommunity().communityId, |
| 177 | + type: '1001', |
| 178 | + pagePath: 'exportCreateFeeTemplate' |
| 179 | + } |
| 180 | + }; |
| 181 | + //发送get请求 |
| 182 | + vc.http.apiGet('/export.exportData', param, |
| 183 | + function (json, res) { |
| 184 | + let _json = JSON.parse(json); |
| 185 | + vc.toast(_json.msg); |
| 186 | + if (_json.code == 0) { |
| 187 | + $('#exportFeeImportExcelModel').modal('hide'); |
| 188 | + setTimeout(function () { |
| 189 | + vc.jumpToPage('/#/pages/property/downloadTempFile?tab=下载中心') |
| 190 | + }, 500); |
| 191 | + } |
| 192 | + }, |
| 193 | + function (errInfo, error) { |
| 194 | + console.log('请求失败处理'); |
| 195 | + }); |
172 | 196 |
|
173 | 197 | }
|
174 | 198 | }
|
|
0 commit comments