| | |
| | | vc.on('importOwnerRoom', 'openImportOwnerRoomModal', function(_param) { |
| | | $('#importOwnerRoomModel').modal('show'); |
| | | }); |
| | | |
| | | // 监听模态框关闭事件,重置表单 |
| | | $('#importOwnerRoomModel').on('hidden.bs.modal', function (e) { |
| | | $that.resetImportForm(); |
| | | }); |
| | | }, |
| | | methods: { |
| | | importOwnerRoomValidate() { |
| | |
| | | }); |
| | | |
| | | }, |
| | | // 重置导入表单 |
| | | resetImportForm() { |
| | | $that.importOwnerRoomInfo = { |
| | | communityId: vc.getCurrentCommunity().communityId, |
| | | excelTemplate: '' |
| | | }; |
| | | // 重置文件输入框 |
| | | document.getElementById('excelTemplate').value = ''; |
| | | console.log('导入表单已重置'); |
| | | }, |
| | | _importData: function() { |
| | | if (!$that.importOwnerRoomValidate()) { |
| | | vc.toast(vc.validate.errInfo); |
| | |
| | | // return; |
| | | // } |
| | | // 使用实际的userId,如果没有则使用默认值 |
| | | let userId = vc.getData() && vc.getData().userInfo && vc.getData().userInfo.userId ? vc.getData().userInfo.userId : '-1'; |
| | | let userId = '-1'; |
| | | try { |
| | | // 尝试从不同来源获取userId |
| | | let userInfo = vc.getData('userInfo'); |
| | | if (userInfo && userInfo.userId) { |
| | | userId = userInfo.userId; |
| | | } else { |
| | | // 尝试从localStorage直接获取 |
| | | let localUserInfo = JSON.parse(window.localStorage.getItem('userInfo')); |
| | | if (localUserInfo && localUserInfo.userId) { |
| | | userId = localUserInfo.userId; |
| | | } |
| | | } |
| | | } catch (e) { |
| | | console.error('获取userId失败:', e); |
| | | } |
| | | console.log('使用的userId:', userId); |
| | | |
| | | // 构建表单数据,与车辆导入保持一致 |
| | | var param = new FormData(); |
| | |
| | | }, |
| | | _changeFeeTypeCd: function(_feeTypeCd) {}, |
| | | getExcelTemplate: function(e) { |
| | | $that.importOwnerRoomInfo.excelTemplate = e.target.files[0]; |
| | | if (e.target.files && e.target.files[0]) { |
| | | $that.importOwnerRoomInfo.excelTemplate = e.target.files[0]; |
| | | console.log('选择的文件:', $that.importOwnerRoomInfo.excelTemplate); |
| | | } else { |
| | | $that.importOwnerRoomInfo.excelTemplate = ''; |
| | | console.log('未选择文件'); |
| | | } |
| | | }, |
| | | checkOwnerFileType: function(fileType) { |
| | | const acceptTypes = ['xlsx', 'xls']; |
| | |
| | | return; |
| | | } |
| | | var _advertisementSummaryInfo = JSON.parse(json); |
| | | var contractData = _advertisementSummaryInfo.data || []; |
| | | |
| | | // 强制Vue更新 - 解决响应式问题 |
| | | vc.component.advertisementSummaryInfo.total = _advertisementSummaryInfo.total; |
| | | vc.component.advertisementSummaryInfo.records = _advertisementSummaryInfo.records; |
| | | vc.component.advertisementSummaryInfo.contracts = _advertisementSummaryInfo.data; |
| | | vc.emit('pagination', 'init', { |
| | | total: vc.component.advertisementSummaryInfo.records, |
| | | dataCount: vc.component.advertisementSummaryInfo.total, |
| | | currentPage: _page |
| | | }); |
| | | vc.component.advertisementSummaryInfo.contracts = []; |
| | | |
| | | setTimeout(() => { |
| | | // 深拷贝数据,确保响应式 |
| | | var deepCopiedData = JSON.parse(JSON.stringify(contractData)); |
| | | vc.component.advertisementSummaryInfo.contracts = deepCopiedData; |
| | | |
| | | // 手动触发Vue更新 |
| | | if (vc.$forceUpdate) { |
| | | vc.$forceUpdate(); |
| | | } |
| | | |
| | | vc.emit('pagination', 'init', { |
| | | total: vc.component.advertisementSummaryInfo.records, |
| | | dataCount: vc.component.advertisementSummaryInfo.total, |
| | | currentPage: _page |
| | | }); |
| | | }, 0); |
| | | } catch (e) { |
| | | console.error('处理合同数据失败:', e); |
| | | } |
| | |
| | | param, |
| | | function (json, res) { |
| | | var _contractChangeManageInfo = JSON.parse(json); |
| | | var contractData = _contractChangeManageInfo.data || []; |
| | | |
| | | // 强制Vue更新 - 解决响应式问题 |
| | | vc.component.contractChangeManageInfo.total = _contractChangeManageInfo.total; |
| | | vc.component.contractChangeManageInfo.records = _contractChangeManageInfo.records; |
| | | vc.component.contractChangeManageInfo.contracts = _contractChangeManageInfo.data; |
| | | vc.emit('pagination', 'init', { |
| | | total: vc.component.contractChangeManageInfo.records, |
| | | dataCount: vc.component.contractChangeManageInfo.total, |
| | | currentPage: _page |
| | | }); |
| | | vc.component.contractChangeManageInfo.contracts = []; |
| | | |
| | | setTimeout(() => { |
| | | // 深拷贝数据,确保响应式 |
| | | var deepCopiedData = JSON.parse(JSON.stringify(contractData)); |
| | | vc.component.contractChangeManageInfo.contracts = deepCopiedData; |
| | | |
| | | // 手动触发Vue更新 |
| | | if (vc.$forceUpdate) { |
| | | vc.$forceUpdate(); |
| | | } |
| | | |
| | | vc.emit('pagination', 'init', { |
| | | total: vc.component.contractChangeManageInfo.records, |
| | | dataCount: vc.component.contractChangeManageInfo.total, |
| | | currentPage: _page |
| | | }); |
| | | }, 0); |
| | | }, |
| | | function (errInfo, error) { |
| | | console.log('请求失败处理'); |
| | |
| | | |
| | | vc.component.contractManageInfo.total = total; |
| | | vc.component.contractManageInfo.records = records; |
| | | vc.component.contractManageInfo.contracts = mappedContracts; |
| | | |
| | | vc.emit('pagination', 'init', { |
| | | total: records, // 使用实际数据条数 |
| | | dataCount: total, |
| | | currentPage: _page |
| | | }); |
| | | // 强制Vue更新 - 解决响应式问题 |
| | | vc.component.contractManageInfo.contracts = []; |
| | | setTimeout(() => { |
| | | // 深拷贝数据,确保响应式 |
| | | var deepCopiedData = JSON.parse(JSON.stringify(mappedContracts)); |
| | | vc.component.contractManageInfo.contracts = deepCopiedData; |
| | | |
| | | // 手动触发Vue更新 |
| | | if (vc.$forceUpdate) { |
| | | vc.$forceUpdate(); |
| | | } |
| | | |
| | | vc.emit('pagination', 'init', { |
| | | total: records, // 使用实际数据条数 |
| | | dataCount: total, |
| | | currentPage: _page |
| | | }); |
| | | }, 0); |
| | | }, |
| | | function (errInfo, error) { |
| | | console.log('请求失败处理'); |
| | |
| | | param, |
| | | function (json, res) { |
| | | var _expirationContractInfo = JSON.parse(json); |
| | | var contractData = _expirationContractInfo.data || []; |
| | | |
| | | // 强制Vue更新 - 解决响应式问题 |
| | | vc.component.expirationContractInfo.total = _expirationContractInfo.total; |
| | | vc.component.expirationContractInfo.records = _expirationContractInfo.records; |
| | | vc.component.expirationContractInfo.contracts = _expirationContractInfo.data; |
| | | vc.emit('pagination', 'init', { |
| | | total: vc.component.expirationContractInfo.records, |
| | | dataCount: vc.component.expirationContractInfo.total, |
| | | currentPage: _page |
| | | }); |
| | | vc.component.expirationContractInfo.contracts = []; |
| | | |
| | | setTimeout(() => { |
| | | // 深拷贝数据,确保响应式 |
| | | var deepCopiedData = JSON.parse(JSON.stringify(contractData)); |
| | | vc.component.expirationContractInfo.contracts = deepCopiedData; |
| | | |
| | | // 手动触发Vue更新 |
| | | if (vc.$forceUpdate) { |
| | | vc.$forceUpdate(); |
| | | } |
| | | |
| | | vc.emit('pagination', 'init', { |
| | | total: vc.component.expirationContractInfo.records, |
| | | dataCount: vc.component.expirationContractInfo.total, |
| | | currentPage: _page |
| | | }); |
| | | }, 0); |
| | | }, |
| | | function (errInfo, error) { |
| | | console.log('请求失败处理'); |
| | |
| | | } |
| | | }, |
| | | _initMethod: function () { |
| | | // 标记组件未销毁 |
| | | this._isDestroyed = false; |
| | | console.log('导入日志列表页面初始化,开始加载数据'); |
| | | // 直接调用数据加载方法,不等待mounted |
| | | this._listAssetImportLogs(DEFAULT_PAGE, DEFAULT_ROWS); |
| | | $that._listAssetImportLogs(DEFAULT_PAGE, DEFAULT_ROWS); |
| | | }, |
| | | _initEvent: function () { |
| | | var $this = this; |
| | | |
| | | // 监听全局的assetImportLog事件 |
| | | vc.on('assetImportLog', 'listAssetImportLog', function (_param) { |
| | | // 检查组件是否已销毁 |
| | | if (!$this._isDestroyed) { |
| | | $this._listAssetImportLogs(DEFAULT_PAGE, DEFAULT_ROWS); |
| | | } |
| | | $that._listAssetImportLogs(DEFAULT_PAGE, DEFAULT_ROWS); |
| | | }); |
| | | |
| | | // 监听分页事件 |
| | | vc.on('pagination', 'page_event', function (_currentPage) { |
| | | // 检查组件是否已销毁 |
| | | if (!$this._isDestroyed) { |
| | | $this._listAssetImportLogs(_currentPage, DEFAULT_ROWS); |
| | | } |
| | | $that._listAssetImportLogs(_currentPage, DEFAULT_ROWS); |
| | | }); |
| | | }, |
| | | _destroyedMethod: function () { |
| | | console.log('导入日志列表页面已销毁,清理资源'); |
| | | // 标记组件已销毁,用于异步回调中检查 |
| | | this._isDestroyed = true; |
| | | }, |
| | | methods: { |
| | | _listAssetImportLogs: function (_page, _rows) { |
| | | console.log('调用_listAssetImportLogs方法,页码:', _page, '行数:', _rows); |
| | | var $this = this; |
| | | |
| | | try { |
| | | // 确保communityId正确获取 |
| | |
| | | console.log('收到请求响应:', json, res); |
| | | |
| | | try { |
| | | // 检查组件是否已销毁 |
| | | if ($this._isDestroyed) { |
| | | console.log('组件已销毁,跳过数据处理'); |
| | | return; |
| | | } |
| | | |
| | | let _assetImportLogInfo = JSON.parse(json); |
| | | console.log('解析后的数据:', _assetImportLogInfo); |
| | | |
| | | // 验证数据格式,确保所有必要字段存在 |
| | | if (_assetImportLogInfo && _assetImportLogInfo.code == 0) { |
| | | // 为组件数据添加默认值,防止出现undefined错误 |
| | | $this.assetImportLogInfo.total = _assetImportLogInfo.total || 0; |
| | | $this.assetImportLogInfo.records = _assetImportLogInfo.records || 0; |
| | | $this.assetImportLogInfo.logs = _assetImportLogInfo.data || []; |
| | | var logData = _assetImportLogInfo.data || []; |
| | | |
| | | console.log('设置组件数据:', $this.assetImportLogInfo); |
| | | // 强制Vue更新 - 解决响应式问题 |
| | | $that.assetImportLogInfo.total = _assetImportLogInfo.total || 0; |
| | | $that.assetImportLogInfo.records = _assetImportLogInfo.records || 0; |
| | | $that.assetImportLogInfo.logs = []; |
| | | |
| | | // 初始化分页组件 |
| | | vc.emit('pagination', 'init', { |
| | | total: $this.assetImportLogInfo.records, |
| | | dataCount: $this.assetImportLogInfo.total, |
| | | currentPage: _page |
| | | }); |
| | | setTimeout(() => { |
| | | // 深拷贝数据,确保响应式 |
| | | var deepCopiedData = JSON.parse(JSON.stringify(logData)); |
| | | $that.assetImportLogInfo.logs = deepCopiedData; |
| | | |
| | | console.log('设置组件数据:', $that.assetImportLogInfo); |
| | | |
| | | // 手动触发Vue更新 |
| | | if ($that.$forceUpdate) { |
| | | $that.$forceUpdate(); |
| | | } |
| | | |
| | | // 初始化分页组件 |
| | | vc.emit('pagination', 'init', { |
| | | total: $that.assetImportLogInfo.records, |
| | | dataCount: $that.assetImportLogInfo.total, |
| | | currentPage: _page |
| | | }); |
| | | }, 0); |
| | | } else { |
| | | // 数据格式不符合预期,显示友好错误信息 |
| | | console.warn('导入日志数据格式不符合预期:', _assetImportLogInfo); |
| | | vc.toast('查询导入日志失败: ' + (_assetImportLogInfo.msg || '未知错误')); |
| | | // 重置数据,避免显示旧数据 |
| | | $this.assetImportLogInfo.total = 0; |
| | | $this.assetImportLogInfo.records = 0; |
| | | $this.assetImportLogInfo.logs = []; |
| | | $that.assetImportLogInfo.total = 0; |
| | | $that.assetImportLogInfo.records = 0; |
| | | $that.assetImportLogInfo.logs = []; |
| | | |
| | | // 重置分页组件 |
| | | vc.emit('pagination', 'init', { |
| | |
| | | console.error('解析导入日志失败:', e, json); |
| | | vc.toast('解析导入日志失败: ' + e.message); |
| | | // 重置数据,避免显示旧数据 |
| | | $this.assetImportLogInfo.total = 0; |
| | | $this.assetImportLogInfo.records = 0; |
| | | $this.assetImportLogInfo.logs = []; |
| | | $that.assetImportLogInfo.total = 0; |
| | | $that.assetImportLogInfo.records = 0; |
| | | $that.assetImportLogInfo.logs = []; |
| | | |
| | | // 重置分页组件 |
| | | vc.emit('pagination', 'init', { |
| | |
| | | } |
| | | }, |
| | | function (errInfo, error) { |
| | | // 检查组件是否已销毁 |
| | | if ($this._isDestroyed) { |
| | | console.log('组件已销毁,跳过错误处理'); |
| | | return; |
| | | } |
| | | |
| | | // 详细记录错误信息,便于调试 |
| | | console.error('请求导入日志失败:', errInfo, error); |
| | | |
| | |
| | | |
| | | vc.toast(errorMsg); |
| | | // 重置数据,避免显示旧数据 |
| | | $this.assetImportLogInfo.total = 0; |
| | | $this.assetImportLogInfo.records = 0; |
| | | $this.assetImportLogInfo.logs = []; |
| | | $that.assetImportLogInfo.total = 0; |
| | | $that.assetImportLogInfo.records = 0; |
| | | $that.assetImportLogInfo.logs = []; |
| | | |
| | | // 重置分页组件 |
| | | vc.emit('pagination', 'init', { |
| | |
| | | } |
| | | }, |
| | | _queryData: function () { |
| | | this._listAssetImportLogs(DEFAULT_PAGE, DEFAULT_ROWS); |
| | | $that._listAssetImportLogs(DEFAULT_PAGE, DEFAULT_ROWS); |
| | | }, |
| | | _openDetail: function (_log) { |
| | | vc.jumpToPage('/#/pages/property/assetImportLogDetail?logId=' + _log.logId + "&logType=" + _log.logType); |
| | |
| | | currentPage: 1, |
| | | }, |
| | | _initMethod: function () { |
| | | console.log('=== 组件初始化开始 ==='); |
| | | console.log('当前组件数据:', vc.component); |
| | | console.log('当前contractCreateFeeInfo:', vc.component.contractCreateFeeInfo); |
| | | |
| | | let _tempData = vc.getData(TEMP_SEARCH); |
| | | console.log('临时搜索数据:', _tempData); |
| | | |
| | | if (_tempData == null) { |
| | | console.log('首次加载,使用默认参数'); |
| | | vc.component.contractCreateFeeInfo.conditions.floorId = vc.getParam("floorId"); |
| | | vc.component.contractCreateFeeInfo.conditions.floorName = vc.getParam("floorName"); |
| | | console.log('调用listContract:', DEFAULT_PAGE, DEFAULT_ROW); |
| | | vc.component.listContract(DEFAULT_PAGE, DEFAULT_ROW); |
| | | } else { |
| | | console.log('使用临时数据', _tempData.currentPage); |
| | | vc.component.contractCreateFeeInfo.conditions = _tempData.conditions; |
| | | vc.component.updateCurrentPage(_tempData.currentPage); |
| | | console.log('调用listContract:', _tempData.currentPage, DEFAULT_ROW); |
| | | vc.component.listContract(_tempData.currentPage, DEFAULT_ROW); |
| | | } |
| | | console.log('=== 组件初始化完成 ==='); |
| | | }, |
| | | _initEvent: function () { |
| | | vc.on('room', 'chooseFloor', function (_param) { |
| | |
| | | }, |
| | | methods: { |
| | | listContract: function (_page, _row) { |
| | | vc.component.contractCreateFeeInfo.conditions.page = _page; |
| | | vc.component.contractCreateFeeInfo.conditions.row = _row; |
| | | vc.component.contractCreateFeeInfo.conditions.communityId = vc.getCurrentCommunity().communityId; |
| | | vc.component.contractCreateFeeInfo.conditions.contractName = vc.component.contractCreateFeeInfo.conditions.contractName.trim(); |
| | | vc.component.contractCreateFeeInfo.conditions.contractNameLike = vc.component.contractCreateFeeInfo.conditions.contractNameLike.trim(); |
| | | vc.component.contractCreateFeeInfo.conditions.contractCode = vc.component.contractCreateFeeInfo.conditions.contractCode.trim(); |
| | | vc.component.contractCreateFeeInfo.conditions.contractType = vc.component.contractCreateFeeInfo.conditions.contractType.trim(); |
| | | let _conditions = JSON.parse(JSON.stringify(vc.component.contractCreateFeeInfo.conditions)); |
| | | let param = { |
| | | params: _conditions |
| | | }; |
| | | vc.http.apiGet('/contract/queryContract', |
| | | param, |
| | | function (json, res) { |
| | | var listContractData = JSON.parse(json); |
| | | vc.component.contractCreateFeeInfo.total = listContractData.total; |
| | | vc.component.contractCreateFeeInfo.records = listContractData.records; |
| | | vc.component.contractCreateFeeInfo.contracts = listContractData.data; |
| | | vc.emit('pagination', 'init', { |
| | | total: vc.component.contractCreateFeeInfo.records, |
| | | dataCount: vc.component.contractCreateFeeInfo.total, |
| | | currentPage: _page |
| | | }); |
| | | vc.component.saveTempSearchData(); |
| | | }, |
| | | function (errInfo, error) { |
| | | console.log('请求失败处理'); |
| | | } |
| | | ); |
| | | try { |
| | | vc.component.contractCreateFeeInfo.conditions.page = _page; |
| | | vc.component.contractCreateFeeInfo.conditions.row = _row; |
| | | |
| | | // 调试communityId获取 |
| | | console.log('=== 获取communityId ==='); |
| | | console.log('vc.getCurrentCommunity():', vc.getCurrentCommunity()); |
| | | var currentCommunity = vc.getCurrentCommunity(); |
| | | var communityId = currentCommunity ? currentCommunity.communityId : ''; |
| | | console.log('获取到的communityId:', communityId); |
| | | |
| | | vc.component.contractCreateFeeInfo.conditions.communityId = communityId; |
| | | vc.component.contractCreateFeeInfo.conditions.contractName = vc.component.contractCreateFeeInfo.conditions.contractName.trim(); |
| | | vc.component.contractCreateFeeInfo.conditions.contractNameLike = vc.component.contractCreateFeeInfo.conditions.contractNameLike.trim(); |
| | | vc.component.contractCreateFeeInfo.conditions.contractCode = vc.component.contractCreateFeeInfo.conditions.contractCode.trim(); |
| | | vc.component.contractCreateFeeInfo.conditions.contractType = vc.component.contractCreateFeeInfo.conditions.contractType.trim(); |
| | | let _conditions = JSON.parse(JSON.stringify(vc.component.contractCreateFeeInfo.conditions)); |
| | | let param = { |
| | | params: _conditions |
| | | }; |
| | | |
| | | console.log('=== 开始查询合同数据 ==='); |
| | | console.log('查询参数:', param); |
| | | console.log('当前contracts:', vc.component.contractCreateFeeInfo.contracts); |
| | | console.log('当前contractCreateFeeInfo:', vc.component.contractCreateFeeInfo); |
| | | |
| | | vc.http.apiGet('/contract/queryContract', |
| | | param, |
| | | function (json, res) { |
| | | try { |
| | | console.log('=== 收到响应数据 ==='); |
| | | console.log('原始响应:', json); |
| | | console.log('响应类型:', typeof json); |
| | | |
| | | // 检查响应是否已经是对象 |
| | | var listContractData = typeof json === 'string' ? JSON.parse(json) : json; |
| | | console.log('处理后的数据:', listContractData); |
| | | |
| | | // 验证响应数据结构 |
| | | if (!listContractData) { |
| | | console.error('响应数据为空'); |
| | | vc.component.contractCreateFeeInfo.contracts = []; |
| | | vc.component.contractCreateFeeInfo.total = 0; |
| | | vc.component.contractCreateFeeInfo.records = 0; |
| | | return; |
| | | } |
| | | |
| | | console.log('data字段:', listContractData.data); |
| | | console.log('data类型:', typeof listContractData.data); |
| | | console.log('data是否为数组:', Array.isArray(listContractData.data)); |
| | | console.log('data长度:', listContractData.data ? listContractData.data.length : 0); |
| | | console.log('total:', listContractData.total); |
| | | console.log('records:', listContractData.records); |
| | | |
| | | // 保存数据前的状态 |
| | | console.log('保存前contracts:', vc.component.contractCreateFeeInfo.contracts); |
| | | |
| | | vc.component.contractCreateFeeInfo.total = listContractData.total || 0; |
| | | vc.component.contractCreateFeeInfo.records = listContractData.records || 0; |
| | | |
| | | // 强制Vue更新 - 解决响应式问题 |
| | | console.log('=== 开始强制更新 ==='); |
| | | vc.component.contractCreateFeeInfo.contracts = []; |
| | | console.log('清空后contracts:', vc.component.contractCreateFeeInfo.contracts); |
| | | |
| | | setTimeout(() => { |
| | | try { |
| | | // 确保data是数组 |
| | | var contractData = Array.isArray(listContractData.data) ? listContractData.data : []; |
| | | console.log('准备赋值的data:', contractData); |
| | | console.log('准备赋值的data长度:', contractData.length); |
| | | |
| | | // 深拷贝数据,确保响应式 |
| | | var deepCopiedData = JSON.parse(JSON.stringify(contractData)); |
| | | console.log('深拷贝后的数据:', deepCopiedData); |
| | | |
| | | vc.component.contractCreateFeeInfo.contracts = deepCopiedData; |
| | | console.log('保存后contracts:', vc.component.contractCreateFeeInfo.contracts); |
| | | console.log('保存后contracts长度:', vc.component.contractCreateFeeInfo.contracts.length); |
| | | console.log('保存后contractCreateFeeInfo:', vc.component.contractCreateFeeInfo); |
| | | |
| | | // 手动触发Vue更新 |
| | | if (vc.$forceUpdate) { |
| | | console.log('调用$forceUpdate'); |
| | | vc.$forceUpdate(); |
| | | } |
| | | |
| | | // 确保分页组件初始化 |
| | | vc.emit('pagination', 'init', { |
| | | total: vc.component.contractCreateFeeInfo.records, |
| | | dataCount: vc.component.contractCreateFeeInfo.total, |
| | | currentPage: _page |
| | | }); |
| | | |
| | | vc.component.saveTempSearchData(); |
| | | console.log('=== 查询完成 ==='); |
| | | } catch (innerError) { |
| | | console.error('处理响应数据时出错:', innerError); |
| | | vc.component.contractCreateFeeInfo.contracts = []; |
| | | } |
| | | }, 0); |
| | | } catch (error) { |
| | | console.error('解析响应数据时出错:', error); |
| | | vc.component.contractCreateFeeInfo.contracts = []; |
| | | } |
| | | }, |
| | | function (errInfo, error) { |
| | | console.error('请求失败处理:', errInfo, error); |
| | | // 请求失败时显示空数组 |
| | | vc.component.contractCreateFeeInfo.contracts = []; |
| | | vc.component.contractCreateFeeInfo.total = 0; |
| | | vc.component.contractCreateFeeInfo.records = 0; |
| | | // 确保分页组件初始化 |
| | | vc.emit('pagination', 'init', { |
| | | total: 0, |
| | | dataCount: 0, |
| | | currentPage: _page |
| | | }); |
| | | } |
| | | ); |
| | | } catch (error) { |
| | | console.error('查询合同数据时出错:', error); |
| | | vc.component.contractCreateFeeInfo.contracts = []; |
| | | } |
| | | }, |
| | | _openViewRoomCreateFee: function (_contract) { |
| | | vc.jumpToPage("/#/pages/contract/contractDetail?contractId=" + _contract.contractId + "&contractCode=" + _contract.contractCode); |
| | |
| | | vc.http.apiGet('/feeConfig.listFeeConfigs', param, |
| | | function(json, res) { |
| | | let _json = JSON.parse(json); |
| | | var feeConfigData = _json.feeConfigs || []; |
| | | |
| | | // 强制Vue更新 - 解决响应式问题 |
| | | $that.feeConfigManageInfo.total = _json.total; |
| | | $that.feeConfigManageInfo.records = _json.records; |
| | | $that.feeConfigManageInfo.feeConfigs = _json.feeConfigs; |
| | | vc.emit('pagination', 'init', { |
| | | total: $that.feeConfigManageInfo.records, |
| | | dataCount: $that.feeConfigManageInfo.total, |
| | | currentPage: _page |
| | | }); |
| | | $that.feeConfigManageInfo.feeConfigs = []; |
| | | |
| | | setTimeout(() => { |
| | | // 深拷贝数据,确保响应式 |
| | | var deepCopiedData = JSON.parse(JSON.stringify(feeConfigData)); |
| | | $that.feeConfigManageInfo.feeConfigs = deepCopiedData; |
| | | |
| | | // 手动触发Vue更新 |
| | | if ($that.$forceUpdate) { |
| | | $that.$forceUpdate(); |
| | | } |
| | | |
| | | vc.emit('pagination', 'init', { |
| | | total: $that.feeConfigManageInfo.records, |
| | | dataCount: $that.feeConfigManageInfo.total, |
| | | currentPage: _page |
| | | }); |
| | | }, 0); |
| | | }, |
| | | function(errInfo, error) { |
| | | console.log('请求失败处理'); |
| | |
| | | console.log('准备显示的抄表数据:', meterWatersData); |
| | | console.log('抄表数据数量:', meterWatersData.length); |
| | | |
| | | // 直接赋值,确保数据更新 |
| | | vc.component.meterWaterManageInfo.meterWaters = meterWatersData; |
| | | // 处理API返回的total和records为0但实际有数据的情况 |
| | | vc.component.meterWaterManageInfo.total = _json.total > 0 ? _json.total : meterWatersData.length; |
| | | vc.component.meterWaterManageInfo.records = _json.records > 0 ? _json.records : meterWatersData.length; |
| | | |
| | | console.log('数据更新后,meterWaters数量:', vc.component.meterWaterManageInfo.meterWaters.length); |
| | | console.log('数据更新后,total:', vc.component.meterWaterManageInfo.total); |
| | | console.log('数据更新后,records:', vc.component.meterWaterManageInfo.records); |
| | | // 强制Vue更新 - 解决响应式问题 |
| | | vc.component.meterWaterManageInfo.meterWaters = []; |
| | | |
| | | // 初始化分页 |
| | | vc.emit('pagination', 'init', { |
| | | total: vc.component.meterWaterManageInfo.records, |
| | | dataCount: vc.component.meterWaterManageInfo.total, |
| | | currentPage: _page |
| | | }); |
| | | |
| | | // 强制DOM更新,确保数据显示 |
| | | // 通过重新赋值数组引用,触发Vue的响应式更新 |
| | | vc.component.meterWaterManageInfo.meterWaters = [...vc.component.meterWaterManageInfo.meterWaters]; |
| | | console.log('强制DOM更新后,meterWaters数量:', vc.component.meterWaterManageInfo.meterWaters.length); |
| | | |
| | | // 手动刷新footable表格,确保数据正确显示 |
| | | setTimeout(() => { |
| | | if (window.$ && typeof window.$.fn.footable === 'function') { |
| | | console.log('手动刷新footable表格'); |
| | | $('.footable').footable('refresh'); |
| | | } |
| | | }, 100); |
| | | // 深拷贝数据,确保响应式 |
| | | var deepCopiedData = JSON.parse(JSON.stringify(meterWatersData)); |
| | | vc.component.meterWaterManageInfo.meterWaters = deepCopiedData; |
| | | |
| | | console.log('数据更新后,meterWaters数量:', vc.component.meterWaterManageInfo.meterWaters.length); |
| | | console.log('数据更新后,total:', vc.component.meterWaterManageInfo.total); |
| | | console.log('数据更新后,records:', vc.component.meterWaterManageInfo.records); |
| | | |
| | | // 初始化分页 |
| | | vc.emit('pagination', 'init', { |
| | | total: vc.component.meterWaterManageInfo.records, |
| | | dataCount: vc.component.meterWaterManageInfo.total, |
| | | currentPage: _page |
| | | }); |
| | | |
| | | // 强制DOM更新,确保数据显示 |
| | | // 通过重新赋值数组引用,触发Vue的响应式更新 |
| | | vc.component.meterWaterManageInfo.meterWaters = [...vc.component.meterWaterManageInfo.meterWaters]; |
| | | console.log('强制DOM更新后,meterWaters数量:', vc.component.meterWaterManageInfo.meterWaters.length); |
| | | |
| | | // 手动刷新footable表格,确保数据正确显示 |
| | | setTimeout(() => { |
| | | if (window.$ && typeof window.$.fn.footable === 'function') { |
| | | console.log('手动刷新footable表格'); |
| | | $('.footable').footable('refresh'); |
| | | } |
| | | }, 100); |
| | | }, 0); |
| | | } else { |
| | | console.error('API请求失败:', _json.msg || '未知错误'); |
| | | vc.component.meterWaterManageInfo.meterWaters = []; |
| | |
| | | if(_accessToken){ |
| | | Vue.http.headers.common['Authorization'] = 'Bearer '+_accessToken.token; |
| | | } |
| | | // 设置USER-ID请求头 |
| | | Vue.http.headers.common['USER-ID'] = '-1'; |
| | | try { |
| | | let userInfo = vcFramework.getData('userInfo'); |
| | | if (userInfo && userInfo.userId) { |
| | | Vue.http.headers.common['USER-ID'] = userInfo.userId; |
| | | } else { |
| | | let localUserInfo = JSON.parse(window.localStorage.getItem('userInfo')); |
| | | if (localUserInfo && localUserInfo.userId) { |
| | | Vue.http.headers.common['USER-ID'] = localUserInfo.userId; |
| | | } |
| | | } |
| | | } catch (e) { |
| | | console.error('设置USER-ID失败:', e); |
| | | } |
| | | console.log('上传请求使用的USER-ID:', Vue.http.headers.common['USER-ID']); |
| | | vcFramework.loading('open'); |
| | | Vue.http.post('/callComponent/upload/' + componentCode + "/" + componentMethod, param, options) |
| | | .then(function (res) { |