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

168 lines
7.0 KiB
JavaScript

/**
入驻小区
**/
(function (vc) {
var DEFAULT_PAGE = 1;
var DEFAULT_ROWS = 10;
vc.extends({
data: {
meterWaterManageInfo: {
meterWaters: [],
total: 0,
records: 1,
moreCondition: false,
waterId: '',
meterTypes: [],
roomName:'',
conditions: {
waterId: '',
meterType: '',
roomNum: '',
objId:''
},
timer: {}
}
},
_initMethod: function () {
vc.emit('roomTreeDiv', 'initRoomTreeDiv', {
callName: 'meterWaterManage'
});
$that.listMeterTypes();
$that._listMeterWaters(DEFAULT_PAGE, DEFAULT_ROWS);
},
_initEvent: function () {
vc.on('meterWaterManage', 'selectRoom', function (_param) {
$that.meterWaterManageInfo.conditions.objId = _param.roomId;
$that.meterWaterManageInfo.conditions.roomNum = '';
$that.meterWaterManageInfo.roomName = _param.roomName;
$that._listMeterWaters(DEFAULT_PAGE, DEFAULT_ROWS);
});
vc.on('meterWaterManage', 'listMeterWater', function (_param) {
$that._listMeterWaters(DEFAULT_PAGE, DEFAULT_ROWS);
});
vc.on('pagination', 'page_event', function (_currentPage) {
$that._listMeterWaters(_currentPage, DEFAULT_ROWS);
});
vc.on('meterWaterManage', 'notifyRoom', function (_room) {
$that.meterWaterManageInfo.conditions.roomNum = _room.floorNum + "-" + _room.unitNum + "-" + _room.roomNum;
$that._listMeterWaters(DEFAULT_PAGE, DEFAULT_ROWS);
});
},
methods: {
_listMeterWaters: function (_page, _rows) {
$that.meterWaterManageInfo.conditions.page = _page;
$that.meterWaterManageInfo.conditions.row = _rows;
$that.meterWaterManageInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
let param = {
params: $that.meterWaterManageInfo.conditions
};
param.params.waterId = param.params.waterId.trim();
param.params.roomNum = param.params.roomNum.trim();
//发送get请求
vc.http.apiGet('/meterWater.listMeterWaters',
param,
function (json, res) {
let _json = JSON.parse(json);
$that.meterWaterManageInfo.total = _json.total;
$that.meterWaterManageInfo.records = _json.records;
$that.meterWaterManageInfo.meterWaters = _json.data;
vc.emit('pagination', 'init', {
total: $that.meterWaterManageInfo.records,
dataCount: $that.meterWaterManageInfo.total,
currentPage: _page
});
},
function (errInfo, error) {
console.log('请求失败处理');
}
);
},
_openAddMeterWaterModal: function () {
vc.emit('addMeterWater', 'openAddMeterWaterModal', {
roomId:$that.meterWaterManageInfo.conditions.objId,
roomName:$that.meterWaterManageInfo.roomName,
ownerName:''
});
},
_openEditMeterWaterModel: function (_meterWater) {
vc.emit('editMeterWater', 'openEditMeterWaterModal', _meterWater);
},
_openDeleteMeterWaterModel: function (_meterWater) {
vc.emit('deleteMeterWater', 'openDeleteMeterWaterModal', _meterWater);
},
//查询
_queryMeterWaterMethod: function () {
$that._listMeterWaters(DEFAULT_PAGE, DEFAULT_ROWS);
},
//重置
_resetMeterWaterMethod: function () {
$that.meterWaterManageInfo.conditions.roomNum = "";
$that.meterWaterManageInfo.conditions.meterType = "";
$that.meterWaterManageInfo.conditions.waterId = "";
$that._listMeterWaters(DEFAULT_PAGE, DEFAULT_ROWS);
},
_moreCondition: function () {
if ($that.meterWaterManageInfo.moreCondition) {
$that.meterWaterManageInfo.moreCondition = false;
} else {
$that.meterWaterManageInfo.moreCondition = true;
}
},
_openMeterWaterImport: function () {
vc.emit('importMeterWaterFee', 'openImportMeterWaterFeeModal', {});
},
_openMeterWaterImport2: function () {
vc.emit('importMeterWaterFee2', 'openImportMeterWaterFeeModal', {});
},
_openMeterQrCode:function(){
vc.emit('roomMeterQrcode', 'openRoomMeterQrcodeModal', {
roomId:$that.meterWaterManageInfo.conditions.objId,
roomName:$that.meterWaterManageInfo.roomName,
ownerName:''
});
},
_getMeteTypeName: function (_meterType) {
if (_meterType == '1010') {
return "电表";
} else if (_meterType == '2020') {
return "水表";
}
return "煤气费";
},
listMeterTypes: function () {
let param = {
params: {
page: 1,
row: 100,
communityId: vc.getCurrentCommunity().communityId
}
};
//发送get请求
vc.http.apiGet('/meterType.listMeterType',
param,
function (json, res) {
let _json = JSON.parse(json);
$that.meterWaterManageInfo.meterTypes = _json.data;
},
function (errInfo, error) {
console.log('请求失败处理');
}
);
},
_meterInputRoom: function () {
if ($that.meterWaterManageInfo.timer) {
clearTimeout($that.meterWaterManageInfo.timer)
}
$that.meterWaterManageInfo.timer = setTimeout(() => {
vc.emit('inputSearchRoomInfo', 'searchRoom', {
callComponent: 'meterWaterManage',
roomName: $that.meterWaterManageInfo.conditions.roomNum
});
}, 1500)
},
_openMeterType:function(){
vc.jumpToPage('/#/pages/property/meterTypeManage?tab=抄表类型');
}
}
});
})(window.vc);