Files
PropertyDeployment/resources/Web/MicroCommunityWeb/html/pages/fee/shareReading/shareReading.js
2025-12-09 20:22:03 +08:00

125 lines
4.7 KiB
JavaScript

/**
入驻小区
**/
(function (vc) {
var DEFAULT_PAGE = 1;
var DEFAULT_ROWS = 10;
vc.extends({
data: {
shareReadingInfo: {
shareReadings: [],
states:[],
floorShares:[],
total: 0,
records: 1,
moreCondition: false,
readingId: '',
conditions: {
fsmId: '',
state:'',
communityId: '',
startTime:'',
endTime:''
}
}
},
_initMethod: function () {
vc.getDict('floor_share_reading', "state", function (_data) {
$that.shareReadingInfo.states = [{
statusCd: '',
name: vc.i18n('全部','shareReading'),
}]
_data.forEach(item => {
$that.shareReadingInfo.states.push(item);
});
});
vc.initDate('startTime', function (_value) {
$that.shareReadingInfo.conditions.startTime = _value;
});
vc.initDate('endTime', function (_value) {
$that.shareReadingInfo.conditions.endTime = _value;
});
$that._listFloorShares();
$that._listShareReadings(DEFAULT_PAGE, DEFAULT_ROWS);
},
_initEvent: function () {
vc.on('shareReading', 'listShareReading', function (_param) {
$that._listShareReadings(DEFAULT_PAGE, DEFAULT_ROWS);
});
vc.on('pagination', 'page_event', function (_currentPage) {
$that._listShareReadings(_currentPage, DEFAULT_ROWS);
});
},
methods: {
_listShareReadings: function (_page, _rows) {
$that.shareReadingInfo.conditions.page = _page;
$that.shareReadingInfo.conditions.row = _rows;
$that.shareReadingInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
let param = {
params: $that.shareReadingInfo.conditions
};
//发送get请求
vc.http.apiGet('/meter.listFloorShareReading',
param,
function (json, res) {
let _json = JSON.parse(json);
$that.shareReadingInfo.total = _json.total;
$that.shareReadingInfo.records = _json.records;
$that.shareReadingInfo.shareReadings = _json.data;
vc.emit('pagination', 'init', {
total: $that.shareReadingInfo.records,
currentPage: _page
});
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
_openAddShareReadingModal: function () {
vc.emit('addShareReading', 'openAddShareReadingModal', {});
},
_openAuditShareReadingModel: function (_shareReading) {
vc.emit('auditShareReading', 'openAuditShareReadingModal', _shareReading);
},
_openDeleteShareReadingModel: function (_shareReading) {
vc.emit('deleteShareReading', 'openDeleteShareReadingModal', _shareReading);
},
_queryShareReadingMethod: function () {
$that._listShareReadings(DEFAULT_PAGE, DEFAULT_ROWS);
},
swatchShareState: function (_state) {
$that.shareReadingInfo.conditions.state = _state.statusCd;
$that._listShareReadings(DEFAULT_PAGE, DEFAULT_ROWS);
},
_listFloorShares: function () {
let param = {
params: {
page:1,
row:300,
communityId:vc.getCurrentCommunity().communityId
}
};
//发送get请求
vc.http.apiGet('/meter.listFloorShareMeter',
param,
function (json, res) {
let _json = JSON.parse(json);
$that.shareReadingInfo.floorShares = _json.data;
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
_openShareFee:function(_reading){
vc.jumpToPage('/#/pages/fee/shareReadingFee?readingId='+_reading.readingId);
}
}
});
})(window.vc);