(function (vc) { vc.extends({ data: { addPhoneBillFlowInfo: { communityId: vc.getCurrentCommunity().communityId, deviceNum: "", roomNum: "", curDegrees: "", curReadingTime: "", roomId: "", roomName: "", meterType: "" }, meterTypes: [] }, _initMethod: function () { if (typeof this._listMeterTypes === 'function') { this._listMeterTypes(); } }, _initEvent: function () { vc.on('addPhoneBillFlow', 'openAddPhoneBillFlowModal', function (_param) { $that.addPhoneBillFlowInfo.roomId = _param.roomId; $that.addPhoneBillFlowInfo.roomName = _param.roomName; $('#addPhoneBillFlowModal').modal('show'); }); }, methods: { _listMeterTypes: function () { let param = { params: { page: 1, row: 100, communityId: vc.getCurrentCommunity().communityId } }; vc.http.apiGet('/meterType.listMeterType', param, function (json, res) { let _json = JSON.parse(json); $that.meterTypes = _json.data; }, function (errInfo, error) { console.log('请求失败处理'); } ); }, _addPhoneBillFlowMethod: function () { if (!this.addPhoneBillFlowInfo.deviceNum) { vc.toast("请输入设备编号"); return; } if (!this.addPhoneBillFlowInfo.roomNum) { vc.toast("请输入房间编号"); return; } if (!this.addPhoneBillFlowInfo.curDegrees) { vc.toast("请输入本期度数"); return; } if (!this.addPhoneBillFlowInfo.curReadingTime) { vc.toast("请输入本期读表时间"); return; } if (!this.addPhoneBillFlowInfo.meterType) { vc.toast("请选择抄表类型"); return; } let _data = { communityId: this.addPhoneBillFlowInfo.communityId, deviceNumber: this.addPhoneBillFlowInfo.deviceNum, roomNum: this.addPhoneBillFlowInfo.roomNum, curDegrees: this.addPhoneBillFlowInfo.curDegrees, curReadingTime: this.addPhoneBillFlowInfo.curReadingTime, roomId: this.addPhoneBillFlowInfo.roomId, meterType: this.addPhoneBillFlowInfo.meterType }; vc.http.post( 'phoneBillFlowInfo', 'savePhoneBillFlowInfo', _data, { emulateJSON: true, headers: { "Content-Type": "application/json" } }, function (json, res) { let _json = JSON.parse(json); if (_json.code == 0) { vc.toast("保存成功"); $('#addPhoneBillFlowModal').modal('hide'); $that._clearAddPhoneBillFlowForm(); vc.emit('phoneMeterManage', 'listPhoneBillFlow', {}); return; } vc.toast(_json.msg); }, function (errInfo, error) { console.log('请求失败处理'); vc.toast(errInfo); } ); }, _clearAddPhoneBillFlowForm: function () { this.addPhoneBillFlowInfo = { communityId: vc.getCurrentCommunity().communityId, deviceNum: "", roomNum: "", curDegrees: "", curReadingTime: "", roomId: "", roomName: "", meterType: "" }; } } }); })(window.vc);