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: {
@@ -45,7 +45,9 @@
                callName: 'phoneMeterManage'
            });
            // 加载电话表数据
            $that._listPhoneBillFlows(DEFAULT_PAGE, DEFAULT_ROWS);
            if (typeof $that._listPhoneBillFlows === 'function') {
                $that._listPhoneBillFlows(DEFAULT_PAGE, DEFAULT_ROWS);
            }
        },
        /**
         * 初始化事件监听
@@ -87,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;
                
@@ -109,10 +111,16 @@
                        // 更新数据列表
                        $that.phoneMeterManageInfo.total = _json.total;
                        $that.phoneMeterManageInfo.records = _json.records;
                        $that.phoneMeterManageInfo.phoneBillFlows = _json.data;
                        // 直接使用API返回的电话费流水数据
                        $that.phoneMeterManageInfo.phoneBillFlows = _json.data || [];
                        // 计算总页数
                        var totalPages = Math.ceil(_json.total / _rows) || 1;
                        // 更新分页组件
                        vc.emit('pagination', 'init', {
                            total: $that.phoneMeterManageInfo.records,
                            total: totalPages,
                            dataCount: $that.phoneMeterManageInfo.total,
                            currentPage: _page
                        });
@@ -185,6 +193,9 @@
            _openPhoneBillFlowImport: function () {
                vc.emit('importPhoneBillFlow', 'openImportPhoneBillFlowModal', {});
            },
            _openBatchAddPhoneBillFlowModal: function () {
                vc.emit('batchAddPhoneBillFlow', 'openBatchAddPhoneBillFlowModal', {});
            },
            /**
             * 房间输入搜索
             * 功能:通过输入房间编号搜索房间
@@ -201,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';
            }
        }
    });