116 lines
4.4 KiB
JavaScript
116 lines
4.4 KiB
JavaScript
(function (vc) {
|
|
|
|
vc.extends({
|
|
data: {
|
|
syncMeterMachineChargeInfo: {
|
|
implBean: '',
|
|
syncQueryStartTime: '',
|
|
syncQueryEndTime: '',
|
|
factorys: []
|
|
}
|
|
},
|
|
_initMethod: function () {
|
|
$that._listFactorys();
|
|
vc.initDateTime('syncQueryStartTime',function(_value){
|
|
$that.syncMeterMachineChargeInfo.syncQueryStartTime = _value;
|
|
});
|
|
vc.initDateTime('syncQueryEndTime',function(_value){
|
|
$that.syncMeterMachineChargeInfo.syncQueryEndTime = _value;
|
|
});
|
|
},
|
|
_initEvent: function () {
|
|
vc.on('syncMeterMachineCharge', 'openSyncMeterMachineChargeModal', function () {
|
|
$('#syncMeterMachineChargeModel').modal('show');
|
|
});
|
|
},
|
|
methods: {
|
|
addMeterQrcodeValidate() {
|
|
return vc.validate.validate({
|
|
syncMeterMachineChargeInfo: $that.syncMeterMachineChargeInfo
|
|
}, {
|
|
'syncMeterMachineChargeInfo.implBean': [
|
|
{
|
|
limit: "required",
|
|
param: "",
|
|
errInfo: "设备厂商不能为空"
|
|
},
|
|
],
|
|
'syncMeterMachineChargeInfo.syncQueryStartTime': [
|
|
{
|
|
limit: "required",
|
|
param: "",
|
|
errInfo: "开始时间不能为空"
|
|
},
|
|
],
|
|
'syncMeterMachineChargeInfo.syncQueryEndTime': [
|
|
{
|
|
limit: "required",
|
|
param: "",
|
|
errInfo: "结束时间不能为空"
|
|
},
|
|
]
|
|
});
|
|
},
|
|
saveMeterQrcodeInfo: function () {
|
|
console.log("saveMeterQrcodeInfo");
|
|
if (!$that.addMeterQrcodeValidate()) {
|
|
vc.toast(vc.validate.errInfo);
|
|
return;
|
|
}
|
|
let param = {
|
|
params: {
|
|
implBean: $that.syncMeterMachineChargeInfo.implBean,
|
|
queryStartTime: $that.syncMeterMachineChargeInfo.syncQueryStartTime,
|
|
queryEndTime: $that.syncMeterMachineChargeInfo.syncQueryEndTime,
|
|
communityId: vc.getCurrentCommunity().communityId,
|
|
}
|
|
}
|
|
console.log("param",param);
|
|
vc.http.apiGet('/meterMachineCharge.syncMeterMachineCharge', param,
|
|
function(json, res) {
|
|
let _json = JSON.parse(json);
|
|
if (_json.code === 0) {
|
|
//关闭model
|
|
$('#syncMeterMachineChargeModel').modal('hide');
|
|
$that.clearAddMeterQrcodeInfo();
|
|
vc.emit('pagination', 'page_event', {});
|
|
return;
|
|
}
|
|
vc.toast(_json.msg);
|
|
},
|
|
function(errInfo, error) {
|
|
console.log('请求失败处理');
|
|
}
|
|
);
|
|
},
|
|
_listFactorys: function(_page, _rows) {
|
|
let param = {
|
|
params: {
|
|
page: 1,
|
|
row: 500,
|
|
}
|
|
};
|
|
//发送get请求
|
|
vc.http.apiGet('/meterMachine.listMeterMachineFactory', param,
|
|
function(json, res) {
|
|
let _feeConfigManageInfo = JSON.parse(json);
|
|
$that.syncMeterMachineChargeInfo.factorys = _feeConfigManageInfo.data;
|
|
|
|
},
|
|
function(errInfo, error) {
|
|
console.log('请求失败处理');
|
|
}
|
|
);
|
|
},
|
|
clearAddMeterQrcodeInfo: function () {
|
|
$that.syncMeterMachineChargeInfo = {
|
|
implBean: '',
|
|
syncQueryStartTime: '',
|
|
syncQueryEndTime: '',
|
|
factorys: []
|
|
};
|
|
}
|
|
}
|
|
});
|
|
})(window.vc);
|