zhangjiaqing
1 天以前 350fd63763da0d3a2ca9a7107dc30c6a007a7b70
public/pages/property/phoneMeterManage/phoneMeterManage.js
@@ -5,8 +5,8 @@
 */
(function (vc) {
    // 默认分页参数
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROWS = 10;
    var DEFAULT_PAGE = vc.paginationConfig ? vc.paginationConfig.defaultPage : 1;
    var DEFAULT_ROWS = vc.paginationConfig ? vc.paginationConfig.defaultRows : 20;
    
    vc.extends({
        data: {
@@ -89,7 +89,7 @@
            _listPhoneBillFlows: function (_page, _rows) {
                // 设置分页参数
                $that.phoneMeterManageInfo.conditions.page = _page;
                $that.phoneMeterManageInfo.conditions.row = _rows;
                $that.phoneMeterManageInfo.conditions.row = 10;
                // 设置小区ID
                $that.phoneMeterManageInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
                
@@ -112,28 +112,15 @@
                        $that.phoneMeterManageInfo.total = _json.total;
                        $that.phoneMeterManageInfo.records = _json.records;
                        
                        // 转换数据结构,将单元数据转换为电话费抄表数据格式
                        let convertedData = [];
                        if (_json.data && Array.isArray(_json.data)) {
                            _json.data.forEach(item => {
                                convertedData.push({
                                    deviceNum: item.unitNum || '-',
                                    objName: item.floorNum + '-' + item.unitNum || '-',
                                    preDegrees: '-',
                                    curDegrees: '-',
                                    preReadingTime: '-',
                                    curReadingTime: '-',
                                    createTime: '-',
                                    id: item.unitId || ''
                                });
                            });
                        }
                        // 直接使用API返回的电话费流水数据
                        $that.phoneMeterManageInfo.phoneBillFlows = _json.data || [];
                        
                        $that.phoneMeterManageInfo.phoneBillFlows = convertedData;
                        // 计算总页数
                        var totalPages = Math.ceil(_json.total / _rows) || 1;
                        
                        // 更新分页组件
                        vc.emit('pagination', 'init', {
                            total: $that.phoneMeterManageInfo.records,
                            total: totalPages,
                            dataCount: $that.phoneMeterManageInfo.total,
                            currentPage: _page
                        });
@@ -225,6 +212,21 @@
                        roomName: $that.phoneMeterManageInfo.conditions.roomNum
                    });
                }, 1500)
            },
            /**
             * 计算表格容器宽度
             * 功能:根据左侧树宽度动态计算表格容器宽度
             * @returns {string} 表格容器宽度
             */
            _computeTableDivWidth: function () {
                let treeWidth = 200;
                try {
                    treeWidth = document.getElementsByClassName('room-floor-unit-tree')[0].offsetWidth;
                } catch (e) {
                    // 忽略错误,使用默认值
                }
                let mainWidth = document.body.offsetWidth - treeWidth - 50;
                return mainWidth + 'px';
            }
        }
    });