| | |
| | | */ |
| | | (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: { |
| | |
| | | callName: 'phoneMeterManage' |
| | | }); |
| | | // 加载电话表数据 |
| | | $that._listPhoneBillFlows(DEFAULT_PAGE, DEFAULT_ROWS); |
| | | if (typeof $that._listPhoneBillFlows === 'function') { |
| | | $that._listPhoneBillFlows(DEFAULT_PAGE, DEFAULT_ROWS); |
| | | } |
| | | }, |
| | | /** |
| | | * 初始化事件监听 |
| | |
| | | _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; |
| | | |
| | |
| | | // 更新数据列表 |
| | | $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 |
| | | }); |
| | |
| | | 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'; |
| | | } |
| | | } |
| | | }); |