mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-25 14:17:54 +08:00
优化车辆导入问题
This commit is contained in:
parent
53d6cb40c4
commit
f52e3b9f55
@ -2,39 +2,49 @@
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body">
|
||||
<h3 class="m-t-none m-b "><span><vc:i18n name="车辆导入" namespace="importOwnerCar"></vc:i18n></span></h3>
|
||||
<h3 class="m-t-none m-b ">
|
||||
<vc:i18n name="车辆导入" namespace="importOwnerCar"></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="importOwnerCar"></vc:i18n></span></label>
|
||||
<div class="col-sm-10">
|
||||
<div class="custom-file">
|
||||
<input id="excelTemplate" ref="excelTemplate" type="file" class="custom-file-input form-control" name="excelTemplate" v-on:change="getExcelTemplate($event)" accept=".xls,.xlsx">
|
||||
<label for="excelTemplate" class="custom-file-label">{{importOwnerCarInfo.excelTemplate==''?'必填,请选择数据文件':importOwnerCarInfo.excelTemplate.name}}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label"><span><vc:i18n name="下载模板" namespace="importOwnerCar"></vc:i18n></span></label>
|
||||
<div class="col-sm-10">
|
||||
请先下载
|
||||
<a :href="'/callComponent/importOwnerCar/exportData?communityId='+importOwnerCarInfo.communityId" target="_blank"><span><vc:i18n name="导入模板" namespace="importOwnerCar"></vc:i18n></span>
|
||||
</a> <span><vc:i18n name="准备数据后" namespace="importOwnerCar"></vc:i18n></span>,上传导入
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<button class="btn btn-primary float-right" type="button" v-on:click="_importData()">
|
||||
<i class="fa fa-check"></i> 导入
|
||||
</button>
|
||||
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;" data-dismiss="modal">
|
||||
<i class="fa fa-close"></i> 取消
|
||||
</button>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">
|
||||
<vc:i18n name="选择文件" namespace="importOwnerCar"></vc:i18n>
|
||||
</label>
|
||||
<div class="col-sm-10">
|
||||
<div class="custom-file">
|
||||
<input id="excelTemplate" ref="excelTemplate" type="file"
|
||||
class="custom-file-input form-control" name="excelTemplate"
|
||||
v-on:change="getExcelTemplate($event)" accept=".xls,.xlsx">
|
||||
<label for="excelTemplate"
|
||||
class="custom-file-label">{{importOwnerCarInfo.excelTemplate==''?'必填,请选择数据文件':importOwnerCarInfo.excelTemplate.name}}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">
|
||||
<vc:i18n name="下载模板" namespace="importOwnerCar"></vc:i18n>
|
||||
</label>
|
||||
<div class="col-sm-10">
|
||||
请先下载
|
||||
<a :href="'/callComponent/importOwnerCar/exportData?communityId='+importOwnerCarInfo.communityId"
|
||||
target="_blank">
|
||||
<vc:i18n name="导入模板" namespace="importOwnerCar"></vc:i18n>
|
||||
</a> <span>
|
||||
<vc:i18n name="准备数据后,上传导入" namespace="importOwnerCar"></vc:i18n>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<button class="btn btn-primary float-right" type="button" v-on:click="_importData()">
|
||||
<i class="fa fa-check"></i> 导入
|
||||
</button>
|
||||
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;"
|
||||
data-dismiss="modal">
|
||||
<i class="fa fa-close"></i> 取消
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -18,7 +18,7 @@
|
||||
methods: {
|
||||
importOwnerCarValidate() {
|
||||
return vc.validate.validate({
|
||||
importOwnerCarInfo: vc.component.importOwnerCarInfo
|
||||
importOwnerCarInfo: $that.importOwnerCarInfo
|
||||
}, {
|
||||
'importOwnerCarInfo.communityId': [{
|
||||
limit: "required",
|
||||
@ -39,26 +39,25 @@
|
||||
});
|
||||
},
|
||||
_importData: function() {
|
||||
if (!vc.component.importOwnerCarValidate()) {
|
||||
if (!$that.importOwnerCarValidate()) {
|
||||
vc.toast(vc.validate.errInfo);
|
||||
return;
|
||||
}
|
||||
// 导入数据
|
||||
if (!vc.component.checkOwnerFileType(vc.component.importOwnerCarInfo.excelTemplate.name.split('.')[1])) {
|
||||
if (!$that.checkOwnerFileType($that.importOwnerCarInfo.excelTemplate.name.split('.')[1])) {
|
||||
vc.toast('不是有效的Excel格式');
|
||||
return;
|
||||
}
|
||||
if (!vc.component.checkOwnerFileSize(vc.component.importOwnerCarInfo.excelTemplate.size)) {
|
||||
if (!$that.checkOwnerFileSize($that.importOwnerCarInfo.excelTemplate.size)) {
|
||||
vc.toast('Excel文件大小不能超过2M');
|
||||
return;
|
||||
}
|
||||
var param = new FormData();
|
||||
param.append("uploadFile", vc.component.importOwnerCarInfo.excelTemplate);
|
||||
param.append('communityId', vc.component.importOwnerCarInfo.communityId);
|
||||
// param.append('feeTypeCd', vc.component.importRoomFeeInfo.feeTypeCd);
|
||||
// param.append('objType', $that.importRoomFeeInfo.objType);
|
||||
param.append("uploadFile", $that.importOwnerCarInfo.excelTemplate);
|
||||
param.append('communityId', $that.importOwnerCarInfo.communityId);
|
||||
param.append('importAdapt', "importOwnerCar");
|
||||
vc.http.upload(
|
||||
'importOwnerCar',
|
||||
'assetImport',
|
||||
'importData',
|
||||
param, {
|
||||
emulateJSON: true,
|
||||
@ -69,15 +68,15 @@
|
||||
},
|
||||
function(json, res) {
|
||||
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
||||
if (res.status == 200) {
|
||||
let _json = JSON.parse(json);
|
||||
if (_json.code == 0) {
|
||||
//关闭model
|
||||
vc.toast("处理成功");
|
||||
$('#importOwnerCarModel').modal('hide');
|
||||
// vc.jumpToPage('/#/pages/property/listOwner')
|
||||
vc.emit('listOwnerCar', 'listOwnerCarData', {});
|
||||
vc.jumpToPage('/#/pages/property/assetImportLogDetail?logId=' + _json.data.logId + '&logType=importOwnerCar');
|
||||
return;
|
||||
}
|
||||
vc.toast(json, 10000);
|
||||
vc.toast(_json.msg, 10000);
|
||||
},
|
||||
function(errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
@ -88,20 +87,20 @@
|
||||
vc.jumpToPage('/callComponent/importOwnerCar/exportData?communityId=' + vc.getCurrentCommunity().communityId);
|
||||
},
|
||||
clearAddFeeConfigInfo: function() {
|
||||
// var _feeTypeCds = vc.component.importRoomFeeInfo.feeTypeCds;
|
||||
vc.component.importOwnerCarInfo = {
|
||||
// var _feeTypeCds = $that.importRoomFeeInfo.feeTypeCds;
|
||||
$that.importOwnerCarInfo = {
|
||||
communityId: vc.getCurrentCommunity().communityId,
|
||||
excelTemplate: ''
|
||||
// feeTypeCd: '',
|
||||
// feeTypeCds: [],
|
||||
// objType: '3333'
|
||||
};
|
||||
// vc.component.importRoomFeeInfo.feeTypeCds = _feeTypeCds;
|
||||
// $that.importRoomFeeInfo.feeTypeCds = _feeTypeCds;
|
||||
},
|
||||
_changeFeeTypeCd: function(_feeTypeCd) {},
|
||||
getExcelTemplate: function(e) {
|
||||
//console.log("getExcelTemplate 开始调用")
|
||||
vc.component.importOwnerCarInfo.excelTemplate = e.target.files[0];
|
||||
$that.importOwnerCarInfo.excelTemplate = e.target.files[0];
|
||||
},
|
||||
checkOwnerFileType: function(fileType) {
|
||||
const acceptTypes = ['xlsx', 'xls'];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user