Skip to content

Commit cdef24f

Browse files
committed
优化用户类型
1 parent 570d5ce commit cdef24f

File tree

3 files changed

+81
-53
lines changed

3 files changed

+81
-53
lines changed

public/components/property/exportFeeImportExcel/exportFeeImportExcel.js

Lines changed: 61 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
(function(vc) {
1+
(function (vc) {
22
vc.extends({
33
data: {
44
exportFeeImportExcelInfo: {
5-
communityId: vc.getCurrentCommunity().communityId,
5+
communityId: '',
66
isFloorAll: true,
77
isConfigAll: true,
88
configIds: [],
@@ -11,42 +11,44 @@
1111
floors: [],
1212
}
1313
},
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) {
1719
$that._loadExportFloors();
1820
$that._listExportFeeConfigs();
1921
$('#exportFeeImportExcelModel').modal('show');
2022
});
2123
},
2224
methods: {
23-
_importData: function() {
25+
_importData: function () {
2426

2527
// 导入数据
26-
if (!vc.component.checkOwnerFileType(vc.component.exportFeeImportExcelInfo.excelTemplate.name.split('.')[1])) {
28+
if (!$that.checkOwnerFileType($that.exportFeeImportExcelInfo.excelTemplate.name.split('.')[1])) {
2729
vc.toast('不是有效的Excel格式');
2830
return;
2931
}
30-
if (!vc.component.checkOwnerFileSize(vc.component.exportFeeImportExcelInfo.excelTemplate.size)) {
32+
if (!$that.checkOwnerFileSize($that.exportFeeImportExcelInfo.excelTemplate.size)) {
3133
vc.toast('Excel文件大小不能超过2M');
3234
return;
3335
}
3436
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);
3840
// param.append('objType', $that.importRoomFeeInfo.objType);
3941
vc.http.upload(
4042
'exportFeeImportExcel',
4143
'importData',
4244
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) {
5052
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
5153
let _json = JSON.parse(json);
5254
if (_json.code == 0) {
@@ -59,14 +61,14 @@
5961
}
6062
vc.toast(_json.msg, 10000);
6163
},
62-
function(errInfo, error) {
64+
function (errInfo, error) {
6365
console.log('请求失败处理');
6466
vc.toast(errInfo, 10000);
6567
});
6668
},
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 = {
7072
communityId: vc.getCurrentCommunity().communityId,
7173
isFloorAll: true,
7274
isConfigAll: true,
@@ -77,60 +79,60 @@
7779
};
7880
},
7981

80-
changeItemConfig: function() {
82+
changeItemConfig: function () {
8183
if ($that.exportFeeImportExcelInfo.configIds.length < $that.exportFeeImportExcelInfo.configs.length) {
8284
$that.exportFeeImportExcelInfo.isConfigAll = false;
8385
return;
8486
}
8587
$that.exportFeeImportExcelInfo.isConfigAll = true;
8688
},
8789

88-
changeItemFloor: function() {
90+
changeItemFloor: function () {
8991
if ($that.exportFeeImportExcelInfo.floorIds.length < $that.exportFeeImportExcelInfo.floors.length) {
9092
$that.exportFeeImportExcelInfo.isFloorAll = false;
9193
return;
9294
}
9395
$that.exportFeeImportExcelInfo.isFloorAll = true;
9496
},
9597

96-
_loadExportFloors: function() {
98+
_loadExportFloors: function () {
9799
var param = {
98100
params: {
99101
page: 1,
100102
row: 150,
101103
communityId: vc.getCurrentCommunity().communityId,
102-
104+
103105
}
104106
};
105107

106108
//发送get请求
107109
vc.http.apiGet('/floor.queryFloors',
108110
param,
109-
function(json, res) {
111+
function (json, res) {
110112
let listFloorData = JSON.parse(json);
111113
$that.exportFeeImportExcelInfo.floors = listFloorData.apiFloorDataVoList;
112114
listFloorData.apiFloorDataVoList.forEach(item => {
113115
$that.exportFeeImportExcelInfo.floorIds.push(item.floorId);
114116
});
115117
},
116-
function(errInfo, error) {
118+
function (errInfo, error) {
117119
console.log('请求失败处理');
118120
}
119121
);
120122
},
121-
_listExportFeeConfigs: function() {
123+
_listExportFeeConfigs: function () {
122124
var param = {
123125
params: {
124126
page: 1,
125127
row: 100,
126128
communityId: vc.getCurrentCommunity().communityId,
127-
isDefault:'F'
129+
isDefault: 'F'
128130
}
129131
};
130132

131133
//发送get请求
132134
vc.http.apiGet('/feeConfig.listFeeConfigs', param,
133-
function(json, res) {
135+
function (json, res) {
134136
let _feeConfigManageInfo = JSON.parse(json);
135137
$that.exportFeeImportExcelInfo.configs = _feeConfigManageInfo.feeConfigs;
136138

@@ -139,12 +141,12 @@
139141
});
140142

141143
},
142-
function(errInfo, error) {
144+
function (errInfo, error) {
143145
console.log('请求失败处理');
144146
});
145147
},
146148

147-
changeAllConfig: function() {
149+
changeAllConfig: function () {
148150
$that.exportFeeImportExcelInfo.configIds = [];
149151
if (!$that.exportFeeImportExcelInfo.isConfigAll) {
150152
return;
@@ -154,7 +156,7 @@
154156
$that.exportFeeImportExcelInfo.configIds.push(item.configId);
155157
});
156158
},
157-
changeAllFloors: function() {
159+
changeAllFloors: function () {
158160
$that.exportFeeImportExcelInfo.floorIds = [];
159161
if (!$that.exportFeeImportExcelInfo.isFloorAll) {
160162
return;
@@ -164,11 +166,33 @@
164166
$that.exportFeeImportExcelInfo.floorIds.push(item.floorId);
165167
});
166168
},
167-
_exportExcel: function() {
169+
_exportExcel: function () {
168170
let _floorIds = $that.exportFeeImportExcelInfo.floorIds.join(',');
169171
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+
});
172196

173197
}
174198
}

public/pages/property/downloadTempFile/downloadTempFile.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,33 +21,33 @@
2121
}
2222
},
2323
_initMethod: function () {
24-
vc.component._listFiles(DEFAULT_PAGE, DEFAULT_ROWS);
24+
$that._listFiles(DEFAULT_PAGE, DEFAULT_ROWS);
2525
},
2626
_initEvent: function () {
2727
vc.on('downloadTempFile', 'listFile', function (_param) {
28-
vc.component._listFiles(DEFAULT_PAGE, DEFAULT_ROWS);
28+
$that._listFiles(DEFAULT_PAGE, DEFAULT_ROWS);
2929
});
3030
vc.on('pagination', 'page_event', function (_currentPage) {
31-
vc.component._listFiles(_currentPage, DEFAULT_ROWS);
31+
$that._listFiles(_currentPage, DEFAULT_ROWS);
3232
});
3333
},
3434
methods: {
3535
_listFiles: function (_page, _rows) {
36-
vc.component.downloadTempFileInfo.conditions.page = _page;
37-
vc.component.downloadTempFileInfo.conditions.row = _rows;
38-
var param = {
39-
params: vc.component.downloadTempFileInfo.conditions
36+
$that.downloadTempFileInfo.conditions.page = _page;
37+
$that.downloadTempFileInfo.conditions.row = _rows;
38+
let param = {
39+
params: $that.downloadTempFileInfo.conditions
4040
};
4141
//发送get请求
4242
vc.http.apiGet('/userDownloadFile.listUserDownloadFile',
4343
param,
4444
function (json, res) {
45-
var _downloadTempFileInfo = JSON.parse(json);
46-
vc.component.downloadTempFileInfo.total = _downloadTempFileInfo.total;
47-
vc.component.downloadTempFileInfo.records = _downloadTempFileInfo.records;
48-
vc.component.downloadTempFileInfo.files = _downloadTempFileInfo.data;
45+
let _json = JSON.parse(json);
46+
$that.downloadTempFileInfo.total = _json.total;
47+
$that.downloadTempFileInfo.records = _json.records;
48+
$that.downloadTempFileInfo.files = _json.data;
4949
vc.emit('pagination', 'init', {
50-
total: vc.component.downloadTempFileInfo.records,
50+
total: $that.downloadTempFileInfo.records,
5151
currentPage: _page
5252
});
5353
},
@@ -67,13 +67,13 @@
6767
vc.emit('deteteDownloadTempFile', 'openDeteteDownloadTempFileModal', _file);
6868
},
6969
_queryDownloadTempFileMethod: function () {
70-
vc.component._listFiles(DEFAULT_PAGE, DEFAULT_ROWS);
70+
$that._listFiles(DEFAULT_PAGE, DEFAULT_ROWS);
7171
},
7272
_moreCondition: function () {
73-
if (vc.component.downloadTempFileInfo.moreCondition) {
74-
vc.component.downloadTempFileInfo.moreCondition = false;
73+
if ($that.downloadTempFileInfo.moreCondition) {
74+
$that.downloadTempFileInfo.moreCondition = false;
7575
} else {
76-
vc.component.downloadTempFileInfo.moreCondition = true;
76+
$that.downloadTempFileInfo.moreCondition = true;
7777
}
7878
}
7979
}

public/vcCore/vcFramework.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,6 +1224,10 @@
12241224
});
12251225
},
12261226
upload: function (componentCode, componentMethod, param, options, successCallback, errorCallback) {
1227+
let _accessToken = vcFramework.getData('hc_accessToken');
1228+
if(_accessToken){
1229+
Vue.http.headers.common['Authorization'] = 'Bearer '+_accessToken.token;
1230+
}
12271231
vcFramework.loading('open');
12281232
Vue.http.post('/callComponent/upload/' + componentCode + "/" + componentMethod, param, options)
12291233
.then(function (res) {

0 commit comments

Comments
 (0)