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