优化代码

This commit is contained in:
wuxw 2023-10-07 17:56:44 +08:00
parent 29147a8a52
commit e2c11f34b7
4 changed files with 66 additions and 24 deletions

View File

@ -106,7 +106,27 @@
vc.toast('请选择抄表类型');
return;
}
vc.jumpToPage('/callComponent/importMeterWaterFee/exportData?communityId=' + vc.getCurrentCommunity().communityId + '&meterType=' + _meterType);
// vc.jumpToPage('/callComponent/importMeterWaterFee/exportData?communityId=' + + '&meterType=' + _meterType);
$('#importMeterWaterFeeModel').modal('hide');
let param = {
params: {
communityId:vc.getCurrentCommunity().communityId,
meterType:_meterType,
pagePath:'exportMeterWater'
}
};
//发送get请求
vc.http.apiGet('/export.exportData', param,
function(json, res) {
let _json = JSON.parse(json);
vc.toast(_json.msg);
if (_json.code == 0) {
vc.jumpToPage('/#/pages/property/downloadTempFile?tab=下载中心')
}
},
function(errInfo, error) {
console.log('请求失败处理');
});
},
_listImportMeterTypes: function (_page, _rows) {
var param = {

View File

@ -4,20 +4,20 @@
<div class="modal-content">
<div class="modal-body">
<h3 class="m-t-none m-b ">
<span><vc:i18n name="抄表导入" namespace="importMeterWaterFee2"></vc:i18n></span>2
<vc:i18n name="抄表导入2" namespace="importMeterWaterFee2"></vc:i18n>
</h3>
<div class="ibox-content">
<div>
<div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">
<span><vc:i18n name="费用类型" namespace="importMeterWaterFee2"></vc:i18n></span>
<vc:i18n name="费用类型" namespace="importMeterWaterFee2"></vc:i18n>
</label>
<div class="col-sm-10">
<select class="custom-select" v-model="importMeterWaterFee2Info.feeTypeCd"
@change="_changeImportMeterWaterFeeTypeCd2(importMeterWaterFee2Info.feeTypeCd)">
<option selected disabled value="">
{{vc.i18n('必填','importMeterWaterFee2')}},请选择费用类型
{{vc.i18n('必填,请选择费用类型','importMeterWaterFee2')}}
</option>
<option value="888800010015">{{vc.i18n('水费','importMeterWaterFee2')}}</option>
<option value="888800010016">{{vc.i18n('电费','importMeterWaterFee2')}}</option>
@ -27,12 +27,12 @@
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">
<span><vc:i18n name="收费项目" namespace="importMeterWaterFee2"></vc:i18n></span>
<vc:i18n name="收费项目" namespace="importMeterWaterFee2"></vc:i18n>
</label>
<div class="col-sm-10">
<select class="custom-select" v-model="importMeterWaterFee2Info.configId">
<option selected disabled value="">
{{vc.i18n('必填','importMeterWaterFee2')}},请选择收费项目
{{vc.i18n('必填,请选择收费项目','importMeterWaterFee2')}}
</option>
<option v-for="(item,index) in importMeterWaterFee2Info.feeConfigs" :key="index"
v-bind:value="item.configId">{{item.feeName}}
@ -42,12 +42,12 @@
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">
<span><vc:i18n name="抄表类型" namespace="importMeterWaterFee2"></vc:i18n></span>
<vc:i18n name="抄表类型" namespace="importMeterWaterFee2"></vc:i18n>
</label>
<div class="col-sm-10">
<select class="custom-select" v-model="importMeterWaterFee2Info.meterType">
<option selected disabled value="">
{{vc.i18n('必填','importMeterWaterFee2')}},请选择抄表类型
{{vc.i18n('必填,请选择抄表类型','importMeterWaterFee2')}}
</option>
<option v-for="(item,index) in importMeterWaterFee2Info.meterTypes" :key="index"
v-bind:value="item.typeId">{{item.typeName}}
@ -57,7 +57,7 @@
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">
<span><vc:i18n name="选择文件" namespace="importMeterWaterFee2"></vc:i18n></span>
<vc:i18n name="选择文件" namespace="importMeterWaterFee2"></vc:i18n>
</label>
<div class="col-sm-10">
<div class="custom-file">

View File

@ -13,7 +13,7 @@
},
_initMethod: function () {
vc.getDict('pay_fee_config', "fee_type_cd", function (_data) {
vc.component.importMeterWaterFee2Info.feeTypeCds = _data;
$that.importMeterWaterFee2Info.feeTypeCds = _data;
});
},
_initEvent: function () {
@ -26,7 +26,7 @@
methods: {
importMeterWaterFee2Validate() {
return vc.validate.validate({
importMeterWaterFee2Info: vc.component.importMeterWaterFee2Info
importMeterWaterFee2Info: $that.importMeterWaterFee2Info
}, {
'importMeterWaterFee2Info.communityId': [
{
@ -52,25 +52,25 @@
});
},
_importMeterWater2Data: function () {
if (!vc.component.importMeterWaterFee2Validate()) {
if (!$that.importMeterWaterFee2Validate()) {
vc.toast(vc.validate.errInfo);
return;
}
// 导入数据
if (!vc.component.checkFileType2(vc.component.importMeterWaterFee2Info.excelTemplate.name.split('.')[1])) {
if (!$that.checkFileType2($that.importMeterWaterFee2Info.excelTemplate.name.split('.')[1])) {
vc.toast('不是有效的Excel格式');
return;
}
if (!vc.component.checkFileSize2(vc.component.importMeterWaterFee2Info.excelTemplate.size)) {
if (!$that.checkFileSize2($that.importMeterWaterFee2Info.excelTemplate.size)) {
vc.toast('Excel文件大小不能超过2M');
return;
}
var param = new FormData();
param.append("uploadFile", vc.component.importMeterWaterFee2Info.excelTemplate);
param.append('communityId', vc.component.importMeterWaterFee2Info.communityId);
param.append('feeTypeCd', vc.component.importMeterWaterFee2Info.feeTypeCd);
param.append('configId', vc.component.importMeterWaterFee2Info.configId);
param.append('meterType', vc.component.importMeterWaterFee2Info.meterType);
param.append("uploadFile", $that.importMeterWaterFee2Info.excelTemplate);
param.append('communityId', $that.importMeterWaterFee2Info.communityId);
param.append('feeTypeCd', $that.importMeterWaterFee2Info.feeTypeCd);
param.append('configId', $that.importMeterWaterFee2Info.configId);
param.append('meterType', $that.importMeterWaterFee2Info.meterType);
param.append('importAdapt', "importMeterWaterFee");
param.append('importMeterDynamic', "true");
vc.http.upload(
@ -113,7 +113,29 @@
_feeName = item.typeName
}
});
vc.jumpToPage('/callComponent/importMeterWaterFee/exportData2?communityId=' + vc.getCurrentCommunity().communityId + '&meterType=' + _meterType + "&feeName=" + _feeName);
//vc.jumpToPage('/callComponent/importMeterWaterFee/exportData2?communityId=' + vc.getCurrentCommunity().communityId + '&meterType=' + _meterType + "&feeName=" + _feeName);
$('#importMeterWaterFee2Model').modal('hide');
let param = {
params: {
communityId:vc.getCurrentCommunity().communityId,
meterType:_meterType,
feeName:_feeName,
pagePath:'exportMeterWater2'
}
};
//发送get请求
vc.http.apiGet('/export.exportData', param,
function(json, res) {
let _json = JSON.parse(json);
vc.toast(_json.msg);
if (_json.code == 0) {
vc.jumpToPage('/#/pages/property/downloadTempFile?tab=下载中心')
}
},
function(errInfo, error) {
console.log('请求失败处理');
});
},
_listImport2MeterTypes: function () {
var param = {
@ -136,7 +158,7 @@
);
},
clearAddFeeConfigInfo2: function () {
vc.component.importMeterWaterFee2Info = {
$that.importMeterWaterFee2Info = {
communityId: vc.getCurrentCommunity().communityId,
excelTemplate: '',
configId: '',
@ -148,7 +170,7 @@
},
getExcelTemplate2: function (e) {
//console.log("getExcelTemplate 开始调用")
vc.component.importMeterWaterFee2Info.excelTemplate = e.target.files[0];
$that.importMeterWaterFee2Info.excelTemplate = e.target.files[0];
},
checkFileType2: function (fileType) {
const acceptTypes = ['xlsx'];
@ -182,7 +204,7 @@
vc.http.apiGet('/feeConfig.listFeeConfigs', param,
function (json, res) {
var _feeConfigManageInfo = JSON.parse(json);
vc.component.importMeterWaterFee2Info.feeConfigs = _feeConfigManageInfo.feeConfigs;
$that.importMeterWaterFee2Info.feeConfigs = _feeConfigManageInfo.feeConfigs;
},
function (errInfo, error) {
console.log('请求失败处理');

View File

@ -68,7 +68,7 @@
<div class="ibox">
<div class="ibox-title">
<h5>
<vc:i18n name="催缴记录" namespace="oweFeeCallable"></vc:i18n>
{{oweFeeCallableInfo.roomName}}
</h5>
<div class="ibox-tools" style="top:10px;">
<button type="button" class="btn btn-white btn-sm" v-on:click="_openWritePrintOweFeeCallableModal()">