完成自定义模板导出

This commit is contained in:
java110 2022-03-09 15:43:47 +08:00
parent 2f3d052ca4
commit da5465a5ed
5 changed files with 230 additions and 20 deletions

View File

@ -0,0 +1,45 @@
<div id="exportFeeImportExcelModel" class="modal fade" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-body">
<h3 class="m-t-none m-b ">模板导出</h3>
<div class="ibox-content">
<div>
<div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">楼栋</label>
<div class="col-sm-10">
<label>
<input type="checkbox" v-model="exportFeeImportExcelInfo.isFloorAll" @change="changeAllFloors()" >全部
</label>
<label class="margin-left" v-for="(item,index) in exportFeeImportExcelInfo.floors">
<input type="checkbox" v-model="exportFeeImportExcelInfo.floorIds" @change="changeItemFloor()" :value="item.floorId"> {{item.floorName}}
</label>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">费用项</label>
<div class="col-sm-10">
<label>
<input type="checkbox" v-model="exportFeeImportExcelInfo.isConfigAll" @change="changeAllConfig()" >全部
</label>
<label class="margin-left" v-for="(item,index) in exportFeeImportExcelInfo.configs">
<input type="checkbox" v-model="exportFeeImportExcelInfo.configIds" @change="changeItemConfig()" :value="item.configId"> {{item.feeName}}
</label>
</div>
</div>
<div class="ibox-content">
<button class="btn btn-primary float-right" type="button" v-on:click="_exportExcel()">
<i class="fa fa-check"></i>&nbsp;导出
</button>
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;" data-dismiss="modal">
<i class="fa fa-close"></i>&nbsp;取消
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,168 @@
(function(vc) {
vc.extends({
data: {
exportFeeImportExcelInfo: {
communityId: vc.getCurrentCommunity().communityId,
isFloorAll: true,
isConfigAll: true,
configIds: [],
configs: [],
floorIds: [],
floors: [],
}
},
_initMethod: function() {},
_initEvent: function() {
vc.on('exportFeeImportExcel', 'openExportFeeImportExcelModal', function(_param) {
$that._loadExportFloors();
$that._listExportFeeConfigs();
$('#exportFeeImportExcelModel').modal('show');
});
},
methods: {
_importData: function() {
// 导入数据
if (!vc.component.checkOwnerFileType(vc.component.exportFeeImportExcelInfo.excelTemplate.name.split('.')[1])) {
vc.toast('不是有效的Excel格式');
return;
}
if (!vc.component.checkOwnerFileSize(vc.component.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('objType', $that.importRoomFeeInfo.objType);
vc.http.upload(
'exportFeeImportExcel',
'importData',
param, {
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) {
//关闭model
vc.toast(_json.data);
$('#exportFeeImportExcelModel').modal('hide');
// vc.jumpToPage('/#/pages/property/listOwner')
vc.emit('room', 'listRoom', {});
return;
}
vc.toast(_json.msg, 10000);
},
function(errInfo, error) {
console.log('请求失败处理');
vc.toast(errInfo, 10000);
});
},
clearAddFeeConfigInfo: function() {
// var _feeTypeCds = vc.component.importRoomFeeInfo.feeTypeCds;
vc.component.exportFeeImportExcelInfo = {
communityId: vc.getCurrentCommunity().communityId,
isFloorAll: true,
isConfigAll: true,
configIds: [],
configs: [],
floorIds: [],
floors: [],
};
},
changeItemConfig: function() {
if ($that.exportFeeImportExcelInfo.configIds.length < $that.exportFeeImportExcelInfo.configs.length) {
$that.exportFeeImportExcelInfo.isConfigAll = false;
return;
}
$that.exportFeeImportExcelInfo.isConfigAll = true;
},
changeItemFloor: function() {
if ($that.exportFeeImportExcelInfo.floorIds.length < $that.exportFeeImportExcelInfo.floors.length) {
$that.exportFeeImportExcelInfo.isFloorAll = false;
return;
}
$that.exportFeeImportExcelInfo.isFloorAll = true;
},
_loadExportFloors: function() {
var param = {
params: {
page: 1,
row: 150,
communityId: vc.getCurrentCommunity().communityId
}
};
//发送get请求
vc.http.get('listFloor',
'list',
param,
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) {
console.log('请求失败处理');
}
);
},
_listExportFeeConfigs: function() {
var param = {
params: {
page: 1,
row: 100,
communityId: vc.getCurrentCommunity().communityId
}
};
//发送get请求
vc.http.get('feeConfigManage', 'list', param,
function(json, res) {
let _feeConfigManageInfo = JSON.parse(json);
$that.exportFeeImportExcelInfo.configs = _feeConfigManageInfo.feeConfigs;
_feeConfigManageInfo.feeConfigs.forEach(item => {
$that.exportFeeImportExcelInfo.configIds.push(item.configId);
});
},
function(errInfo, error) {
console.log('请求失败处理');
});
},
changeAllConfig: function() {
$that.exportFeeImportExcelInfo.configIds = [];
if (!$that.exportFeeImportExcelInfo.isConfigAll) {
return;
}
$that.exportFeeImportExcelInfo.configs.forEach(item => {
$that.exportFeeImportExcelInfo.configIds.push(item.configId);
});
},
changeAllFloors: function() {
$that.exportFeeImportExcelInfo.floorIds = [];
if (!$that.exportFeeImportExcelInfo.isFloorAll) {
return;
}
$that.exportFeeImportExcelInfo.floors.forEach(item => {
$that.exportFeeImportExcelInfo.floorIds.push(item.floorId);
});
},
}
});
})(window.vc);

BIN
public/img/logo_hc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -71,10 +71,16 @@
<div class="ibox-title">
<h5>房屋信息</h5>
<div class="ibox-tools" style="top:10px;">
<button type="button" class="btn btn-primary btn-sm" style="margin-left:10px" v-on:click="_openRoomCreateFeeAddModal(null,true)">
<button type="button" class="btn btn-white btn-sm" style="margin-left:10px" v-on:click="_openFeeImportExcel()">
自定义模板
</button>
<button type="button" class="btn btn-white btn-sm" style="margin-left:10px" v-on:click="_openRoomCreateFeeAddModal(null,true)">
自定义创建
</button>
<button type="button" class="btn btn-white btn-sm" style="margin-left:10px" v-on:click="_openRoomCreateFeeAddModal(null,true)">
<i class="fa fa-plus"></i> 批量创建
</button>
<button type="button" class="btn btn-primary btn-sm" style="margin-left:10px" v-on:click="_downloadCollectionLetterOrder()">
<button type="button" class="btn btn-white btn-sm" style="margin-left:10px" v-on:click="_downloadCollectionLetterOrder()">
<i class="fa fa-download"></i> 批量催缴单
</button>
</div>
@ -125,7 +131,7 @@
</td>
<td class="text-center">
<div class="btn-group" v-if="room.state != '2002'">
<button class="btn-white btn btn-xs" v-on:click="_toOwnerPayFee(room)">欠费缴费</button>
<button class="btn-white btn btn-xs" v-on:click="_toOwnerPayFee(room)">欠费</button>
</div>
<!-- <div class="btn-group" v-if="room.state != '2002'">
<button class="btn-white btn btn-xs"
@ -137,7 +143,7 @@
</button>
</div>
<div class="btn-group">
<button class="btn-white btn btn-xs" v-on:click="_openViewRoomCreateFee(room)">查看费用
<button class="btn-white btn btn-xs" v-on:click="_openViewRoomCreateFee(room)">费用
</button>
</div>
</td>
@ -159,4 +165,6 @@
</div>
<vc:create path="property/searchFloor" emitChooseFloor="room" emitLoadData="room"></vc:create>
<vc:create path="property/roomCreateFeeAdd"></vc:create>
<vc:create path="property/exportFeeImportExcel"></vc:create>
</div>

View File

@ -160,27 +160,13 @@
//重置
_resetRoomMethod: function() {
vc.resetObject(vc.component.roomCreateFeeInfo.conditions);
// vc.component.roomCreateFeeInfo.conditions.floorId = '';
// vc.component.roomCreateFeeInfo.conditions.ownerName = '';
// vc.component.roomCreateFeeInfo.conditions.floorName = '';
// vc.component.roomCreateFeeInfo.conditions.unitId = '';
// vc.component.roomCreateFeeInfo.conditions.roomNum = '';
// vc.component.roomCreateFeeInfo.conditions.roomId = '';
// vc.component.roomCreateFeeInfo.conditions.state = '';
// vc.component.roomCreateFeeInfo.conditions.section = '';
// vc.component.roomCreateFeeInfo.conditions.allNum = '';
// vc.component.roomCreateFeeInfo.conditions.idCard = '';
// vc.component.roomCreateFeeInfo.conditions.roomType = '';
vc.component.listRoom(DEFAULT_PAGE, DEFAULT_ROW);
},
_loadDataByParam: function() {
vc.component.roomCreateFeeInfo.conditions.floorId = vc.getParam("floorId");
vc.component.roomCreateFeeInfo.conditions.floorId = vc.getParam("floorName");
//如果 floodId 没有传 则,直接结束
/* if(!vc.notNull(vc.component.roomCreateFeeInfo.conditions.floorId)){
return ;
}*/
var param = {
let param = {
params: {
communityId: vc.getCurrentCommunity().communityId,
floorId: vc.component.roomCreateFeeInfo.conditions.floorId
@ -273,6 +259,9 @@
},
_downloadRoomCollectionLetterOrder: function(_room) {
vc.jumpToPage('/callComponent/feeManualCollection/downloadCollectionLetterOrder?communityId=' + vc.getCurrentCommunity().communityId + "&roomId=" + _room.roomId);
},
_openFeeImportExcel: function() {
vc.emit('exportFeeImportExcel', 'openExportFeeImportExcelModal', {})
}
}
});