/** 业主详情页面 **/ (function (vc) { vc.extends({ data: { feeDetailInfo: { viewOwnerFlag: '', roomNum: '', owner:{}, roomDto:{}, carFeeList: [], otherFeeList: [], propertyFeeList: [], name: "", age: "", sex: "", userName: "", remark: "", idCard: "", link: "", ownerPhoto: "/img/noPhoto.jpg", ownerAttrDtos: [], faceUrl: '', _currentTab: 'ownerDetailRoom', personType: '', personTypeName: '', personRole: '', personRoleName: '', concactLink: '', concactPerson: '', needBack: false, history: [{ year: 2020, value1: 200, value2: 200, value3: 200, }, { year: 2021, value1: 200, value2: 200, value3: 200, }, { year: 2023, value1: 200, value2: 200, value3: 200, }, { year: 2024, value1: 200, value2: 200, value3: 200, }, { year: 2025, value1: 200, value2: 200, value3: 200, } ], mail: [{ year: '中国邮政挂号信1', value1: 200, value2: 200, value3: 200, value4: 200, }, { year: '中国邮政挂号信1', value1: 200, value2: 200, value3: 200, value4: 200, }, { year: '中国邮政挂号信1', value1: 200, value2: 200, value3: 200, value4: 200, }, { year: '中国邮政挂号信1', value1: 200, value2: 200, value3: 200, value4: 200, }, { year: '中国邮政挂号信1', value1: 200, value2: 200, value3: 200, value4: 200, } ], phone: [{ year: '中国邮政挂号信1', value1: 200, value2: 200, value3: 200, value4: 200, }, { year: '中国邮政挂号信1', value1: 200, value2: 200, value3: 200, value4: 200, }, { year: '中国邮政挂号信1', value1: 200, value2: 200, value3: 200, value4: 200, }, { year: '中国邮政挂号信1', value1: 200, value2: 200, value3: 200, value4: 200, }, { year: '中国邮政挂号信1', value1: 200, value2: 200, value3: 200, value4: 200, } ], } }, _initMethod: function () { // 初始化时设置参数 this.feeDetailInfo.roomNum = vc.getParam('roomNum'); this.feeDetailInfo.needBack = vc.getParam('needBack'); let _currentTab = vc.getParam('currentTab'); if (_currentTab) { this.feeDetailInfo._currentTab = _currentTab; } console.log('费用明细组件初始化完成'); }, // 组件挂载完成后立即加载数据 mounted: function() { console.log('费用明细组件已挂载,立即加载数据'); // 立即加载数据 this._loadOwnerInfo(); // 添加全局刷新事件监听 vc.on('globalRefresh', 'refreshData', function () { if (vc.component) { console.log('收到全局刷新事件,重新加载费用明细数据'); vc.component._loadOwnerInfo(); } }); // 添加页面可见性变化监听 document.addEventListener('visibilitychange', () => { if (document.visibilityState === 'visible' && vc.component) { console.log('页面变为可见,重新加载费用明细数据'); vc.component._loadOwnerInfo(); } }); // 添加组件激活监听 window.addEventListener('hashchange', () => { if (window.location.hash.includes('managementFeesDetail') && vc.component) { console.log('组件激活,重新加载费用明细数据'); vc.component._loadOwnerInfo(); } }); }, _initEvent: function () { vc.on('ownerDetail', 'listOwnerData', function (_info) { if (vc.component) { vc.component._loadOwnerInfo(); } }); }, methods: { _computeTableDivWidth: function () { let mainWidth = document.getElementsByTagName('body')[0].clientWidth - document.getElementById('menu-nav').offsetWidth; //let treeWidth = document.getElementsByClassName('room-floor-unit-tree')[0].offsetWidth; mainWidth = mainWidth - 20 - 15 - 20; //document.getElementsByClassName('hc-table-div')[0].style.width=mainWidth+'px'; return mainWidth + 'px'; }, _loadOwnerInfo: function () { // 在方法内部使用this,确保组件上下文正确 const _this = this; let param = { params: { roomNum: _this.feeDetailInfo.roomNum, communityId: vc.getCurrentCommunity().communityId, } } //发送get请求 vc.http.apiGet('/fee.reportPropertyFeeCmd', param, function (json, res) { // 在回调中使用vc.component确保组件存在 if (!vc.component) { console.error('组件已销毁,无法更新费用明细数据'); return; } let _json = JSON.parse(json); console.log('===========json=========',_json.data); vc.copyObject(_json.data[0], vc.component.feeDetailInfo); vc.component.feeDetailInfo.owner = _json.data.owner; vc.component.feeDetailInfo.roomDto = _json.data.roomDto; vc.component.feeDetailInfo.carFeeList = _json.data.carFeeList; vc.component.feeDetailInfo.otherFeeList = _json.data.otherFeeList; vc.component.feeDetailInfo.propertyFeeList = _json.data.propertyFeeList; }, function (errInfo, error) { console.log('请求失败处理:', errInfo, error); } ); }, } }); })(window.vc);