优化用户类型

This commit is contained in:
wuxw 2025-03-18 12:24:33 +08:00
parent 570d5ce86e
commit cdef24fedc
3 changed files with 81 additions and 53 deletions

View File

@ -1,8 +1,8 @@
(function(vc) {
(function (vc) {
vc.extends({
data: {
exportFeeImportExcelInfo: {
communityId: vc.getCurrentCommunity().communityId,
communityId: '',
isFloorAll: true,
isConfigAll: true,
configIds: [],
@ -11,42 +11,44 @@
floors: [],
}
},
_initMethod: function() {},
_initEvent: function() {
vc.on('exportFeeImportExcel', 'openExportFeeImportExcelModal', function(_param) {
_initMethod: function () {
$that.exportFeeImportExcelInfo.communityId = vc.getCurrentCommunity().communityId;
},
_initEvent: function () {
vc.on('exportFeeImportExcel', 'openExportFeeImportExcelModal', function (_param) {
$that._loadExportFloors();
$that._listExportFeeConfigs();
$('#exportFeeImportExcelModel').modal('show');
});
},
methods: {
_importData: function() {
_importData: function () {
// 导入数据
if (!vc.component.checkOwnerFileType(vc.component.exportFeeImportExcelInfo.excelTemplate.name.split('.')[1])) {
if (!$that.checkOwnerFileType($that.exportFeeImportExcelInfo.excelTemplate.name.split('.')[1])) {
vc.toast('不是有效的Excel格式');
return;
}
if (!vc.component.checkOwnerFileSize(vc.component.exportFeeImportExcelInfo.excelTemplate.size)) {
if (!$that.checkOwnerFileSize($that.exportFeeImportExcelInfo.excelTemplate.size)) {
vc.toast('Excel文件大小不能超过2M');
return;
}
var param = new FormData();
param.append("uploadFile", vc.component.exportFeeImportExcelInfo.excelTemplate);
param.append('communityId', vc.component.exportFeeImportExcelInfo.communityId);
// param.append('feeTypeCd', vc.component.importRoomFeeInfo.feeTypeCd);
param.append("uploadFile", $that.exportFeeImportExcelInfo.excelTemplate);
param.append('communityId', $that.exportFeeImportExcelInfo.communityId);
// param.append('feeTypeCd', $that.importRoomFeeInfo.feeTypeCd);
// param.append('objType', $that.importRoomFeeInfo.objType);
vc.http.upload(
'exportFeeImportExcel',
'importData',
param, {
emulateJSON: true,
//添加请求头
headers: {
"Content-Type": "multipart/form-data"
}
},
function(json, res) {
emulateJSON: true,
//添加请求头
headers: {
"Content-Type": "multipart/form-data"
}
},
function (json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
let _json = JSON.parse(json);
if (_json.code == 0) {
@ -59,14 +61,14 @@
}
vc.toast(_json.msg, 10000);
},
function(errInfo, error) {
function (errInfo, error) {
console.log('请求失败处理');
vc.toast(errInfo, 10000);
});
},
clearAddFeeConfigInfo: function() {
// var _feeTypeCds = vc.component.importRoomFeeInfo.feeTypeCds;
vc.component.exportFeeImportExcelInfo = {
clearAddFeeConfigInfo: function () {
// var _feeTypeCds = $that.importRoomFeeInfo.feeTypeCds;
$that.exportFeeImportExcelInfo = {
communityId: vc.getCurrentCommunity().communityId,
isFloorAll: true,
isConfigAll: true,
@ -77,7 +79,7 @@
};
},
changeItemConfig: function() {
changeItemConfig: function () {
if ($that.exportFeeImportExcelInfo.configIds.length < $that.exportFeeImportExcelInfo.configs.length) {
$that.exportFeeImportExcelInfo.isConfigAll = false;
return;
@ -85,7 +87,7 @@
$that.exportFeeImportExcelInfo.isConfigAll = true;
},
changeItemFloor: function() {
changeItemFloor: function () {
if ($that.exportFeeImportExcelInfo.floorIds.length < $that.exportFeeImportExcelInfo.floors.length) {
$that.exportFeeImportExcelInfo.isFloorAll = false;
return;
@ -93,44 +95,44 @@
$that.exportFeeImportExcelInfo.isFloorAll = true;
},
_loadExportFloors: function() {
_loadExportFloors: function () {
var param = {
params: {
page: 1,
row: 150,
communityId: vc.getCurrentCommunity().communityId,
}
};
//发送get请求
vc.http.apiGet('/floor.queryFloors',
param,
function(json, res) {
function (json, res) {
let listFloorData = JSON.parse(json);
$that.exportFeeImportExcelInfo.floors = listFloorData.apiFloorDataVoList;
listFloorData.apiFloorDataVoList.forEach(item => {
$that.exportFeeImportExcelInfo.floorIds.push(item.floorId);
});
},
function(errInfo, error) {
function (errInfo, error) {
console.log('请求失败处理');
}
);
},
_listExportFeeConfigs: function() {
_listExportFeeConfigs: function () {
var param = {
params: {
page: 1,
row: 100,
communityId: vc.getCurrentCommunity().communityId,
isDefault:'F'
isDefault: 'F'
}
};
//发送get请求
vc.http.apiGet('/feeConfig.listFeeConfigs', param,
function(json, res) {
function (json, res) {
let _feeConfigManageInfo = JSON.parse(json);
$that.exportFeeImportExcelInfo.configs = _feeConfigManageInfo.feeConfigs;
@ -139,12 +141,12 @@
});
},
function(errInfo, error) {
function (errInfo, error) {
console.log('请求失败处理');
});
},
changeAllConfig: function() {
changeAllConfig: function () {
$that.exportFeeImportExcelInfo.configIds = [];
if (!$that.exportFeeImportExcelInfo.isConfigAll) {
return;
@ -154,7 +156,7 @@
$that.exportFeeImportExcelInfo.configIds.push(item.configId);
});
},
changeAllFloors: function() {
changeAllFloors: function () {
$that.exportFeeImportExcelInfo.floorIds = [];
if (!$that.exportFeeImportExcelInfo.isFloorAll) {
return;
@ -164,11 +166,33 @@
$that.exportFeeImportExcelInfo.floorIds.push(item.floorId);
});
},
_exportExcel: function() {
_exportExcel: function () {
let _floorIds = $that.exportFeeImportExcelInfo.floorIds.join(',');
let _configIds = $that.exportFeeImportExcelInfo.configIds.join(',');
vc.jumpToPage('/callComponent/importAndExportFee/exportData?floorIds=' + _floorIds + "&configIds=" + _configIds + "&communityId=" + vc.getCurrentCommunity().communityId + "&type=1001");
$('#exportFeeImportExcelModel').modal('hide');
let param = {
params: {
floorIds: _floorIds,
configIds: _configIds,
communityId: vc.getCurrentCommunity().communityId,
type: '1001',
pagePath: 'exportCreateFeeTemplate'
}
};
//发送get请求
vc.http.apiGet('/export.exportData', param,
function (json, res) {
let _json = JSON.parse(json);
vc.toast(_json.msg);
if (_json.code == 0) {
$('#exportFeeImportExcelModel').modal('hide');
setTimeout(function () {
vc.jumpToPage('/#/pages/property/downloadTempFile?tab=下载中心')
}, 500);
}
},
function (errInfo, error) {
console.log('请求失败处理');
});
}
}

View File

@ -21,33 +21,33 @@
}
},
_initMethod: function () {
vc.component._listFiles(DEFAULT_PAGE, DEFAULT_ROWS);
$that._listFiles(DEFAULT_PAGE, DEFAULT_ROWS);
},
_initEvent: function () {
vc.on('downloadTempFile', 'listFile', function (_param) {
vc.component._listFiles(DEFAULT_PAGE, DEFAULT_ROWS);
$that._listFiles(DEFAULT_PAGE, DEFAULT_ROWS);
});
vc.on('pagination', 'page_event', function (_currentPage) {
vc.component._listFiles(_currentPage, DEFAULT_ROWS);
$that._listFiles(_currentPage, DEFAULT_ROWS);
});
},
methods: {
_listFiles: function (_page, _rows) {
vc.component.downloadTempFileInfo.conditions.page = _page;
vc.component.downloadTempFileInfo.conditions.row = _rows;
var param = {
params: vc.component.downloadTempFileInfo.conditions
$that.downloadTempFileInfo.conditions.page = _page;
$that.downloadTempFileInfo.conditions.row = _rows;
let param = {
params: $that.downloadTempFileInfo.conditions
};
//发送get请求
vc.http.apiGet('/userDownloadFile.listUserDownloadFile',
param,
function (json, res) {
var _downloadTempFileInfo = JSON.parse(json);
vc.component.downloadTempFileInfo.total = _downloadTempFileInfo.total;
vc.component.downloadTempFileInfo.records = _downloadTempFileInfo.records;
vc.component.downloadTempFileInfo.files = _downloadTempFileInfo.data;
let _json = JSON.parse(json);
$that.downloadTempFileInfo.total = _json.total;
$that.downloadTempFileInfo.records = _json.records;
$that.downloadTempFileInfo.files = _json.data;
vc.emit('pagination', 'init', {
total: vc.component.downloadTempFileInfo.records,
total: $that.downloadTempFileInfo.records,
currentPage: _page
});
},
@ -67,13 +67,13 @@
vc.emit('deteteDownloadTempFile', 'openDeteteDownloadTempFileModal', _file);
},
_queryDownloadTempFileMethod: function () {
vc.component._listFiles(DEFAULT_PAGE, DEFAULT_ROWS);
$that._listFiles(DEFAULT_PAGE, DEFAULT_ROWS);
},
_moreCondition: function () {
if (vc.component.downloadTempFileInfo.moreCondition) {
vc.component.downloadTempFileInfo.moreCondition = false;
if ($that.downloadTempFileInfo.moreCondition) {
$that.downloadTempFileInfo.moreCondition = false;
} else {
vc.component.downloadTempFileInfo.moreCondition = true;
$that.downloadTempFileInfo.moreCondition = true;
}
}
}

View File

@ -1224,6 +1224,10 @@
});
},
upload: function (componentCode, componentMethod, param, options, successCallback, errorCallback) {
let _accessToken = vcFramework.getData('hc_accessToken');
if(_accessToken){
Vue.http.headers.common['Authorization'] = 'Bearer '+_accessToken.token;
}
vcFramework.loading('open');
Vue.http.post('/callComponent/upload/' + componentCode + "/" + componentMethod, param, options)
.then(function (res) {