| | |
| | | _initMethod: function() {}, |
| | | _initEvent: function() { |
| | | vc.on('importOwnerRoom', 'openImportOwnerRoomModal', function(_param) { |
| | | $that.clearAddFeeConfigInfo(); |
| | | $('#importOwnerRoomModel').modal('show'); |
| | | }); |
| | | }, |
| | |
| | | vc.toast('不是有效的Excel格式'); |
| | | return; |
| | | } |
| | | if (!$that.checkOwnerFileSize($that.importOwnerRoomInfo.excelTemplate.size)) { |
| | | vc.toast('Excel文件大小不能超过20M'); |
| | | return; |
| | | } |
| | | // 移除文件大小限制检查 |
| | | // if (!$that.checkOwnerFileSize($that.importOwnerRoomInfo.excelTemplate.size)) { |
| | | // vc.toast('Excel文件大小不能超过20M'); |
| | | // return; |
| | | // } |
| | | // 使用实际的userId,如果没有则使用默认值 |
| | | let userId = vc.getData() && vc.getData().userInfo && vc.getData().userInfo.userId ? vc.getData().userInfo.userId : '-1'; |
| | | |
| | |
| | | param.append('userId', userId); // 添加userId参数 |
| | | param.append('USER-ID', userId); // 添加USER-ID参数(大写形式),与车辆导入保持一致 |
| | | |
| | | // param.append('feeTypeCd', vc.component.importRoomFeeInfo.feeTypeCd); |
| | | // param.append('objType', $that.importRoomFeeInfo.objType); |
| | | // 上传文件并处理响应,与车辆导入保持一致 |
| | | vc.http.upload( |
| | | 'assetImport', // 模块名 |
| | |
| | | vc.toast("处理成功"); |
| | | console.log('导入成功,logId:', _json.data.logId); // 打印logId到console |
| | | $('#importOwnerRoomModel').modal('hide'); // 关闭模态框 |
| | | $that.clearAddFeeConfigInfo(); // 清空表单 |
| | | // 跳转到导入日志详情页面 |
| | | vc.jumpToPage('/#/pages/property/assetImportLogDetail?logId=' + _json.data.logId + '&logType=importRoomOwnerV2'); |
| | | return; |
| | |
| | | errorMsg = '导入失败,请检查数据格式是否正确,或联系管理员查看详细日志'; |
| | | } |
| | | // 优化错误信息显示,替换不友好的后端错误 |
| | | if (errorMsg.includes('excel sheet 未找到')) { |
| | | errorMsg = '导入失败:未找到正确的sheet,请确保Excel文件中包含名称为"房屋信息"的sheet,且名称正确无空格'; |
| | | if (errorMsg.includes('sheet 未找到') || errorMsg.includes('excel sheet')) { |
| | | errorMsg = '导入失败:未找到正确的sheet,请确保Excel文件中包含名称为"住宅物业费导入新模板"或"商铺物业费导入新模板"的sheet,且名称正确无空格'; |
| | | } |
| | | vc.toast(errorMsg, 10000); |
| | | }, |
| | |
| | | vc.toast(errorMsg, 10000); |
| | | // 关闭模态框 |
| | | $('#importOwnerRoomModel').modal('hide'); |
| | | // 清空表单 |
| | | $that.clearAddFeeConfigInfo(); |
| | | }); |
| | | }, |
| | | clearAddFeeConfigInfo: function() { |
| | | // var _feeTypeCds = $that.importRoomFeeInfo.feeTypeCds; |
| | | $that.importOwnerRoomInfo = { |
| | | communityId: vc.getCurrentCommunity().communityId, |
| | | excelTemplate: '' |
| | | // feeTypeCd: '', |
| | | // feeTypeCds: [], |
| | | // objType: '3333' |
| | | }; |
| | | // $that.importRoomFeeInfo.feeTypeCds = _feeTypeCds; |
| | | }, |
| | | _changeFeeTypeCd: function(_feeTypeCd) {}, |
| | | getExcelTemplate: function(e) { |
| | | //console.log("getExcelTemplate 开始调用") |
| | | $that.importOwnerRoomInfo.excelTemplate = e.target.files[0]; |
| | | // 重置input[type=file]的value,确保用户修改文件后再次选择同一文件时能触发change事件 |
| | | e.target.value = ''; |
| | | }, |
| | | checkOwnerFileType: function(fileType) { |
| | | const acceptTypes = ['xlsx', 'xls']; |
| | |
| | | } |
| | | } |
| | | }); |
| | | })(window.vc); |
| | | })(window.vc); |