mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-23 21:36:37 +08:00
修复代码
This commit is contained in:
parent
33835c5056
commit
9fd68b7eb8
@ -1,4 +1,4 @@
|
||||
(function (vc) {
|
||||
(function(vc) {
|
||||
vc.extends({
|
||||
propTypes: {
|
||||
callBackListener: vc.propTypes.string, //父组件名称
|
||||
@ -24,14 +24,15 @@
|
||||
ownerName: '',
|
||||
objType: '3333',
|
||||
meterTypes: [],
|
||||
computingFormula:''
|
||||
computingFormula: '',
|
||||
price: 0
|
||||
}
|
||||
},
|
||||
_initMethod: function () {
|
||||
_initMethod: function() {
|
||||
$that._initAddMeterWaterDateInfo();
|
||||
},
|
||||
_initEvent: function () {
|
||||
vc.on('addMeterWater', 'openAddMeterWaterModal', function (_param) {
|
||||
_initEvent: function() {
|
||||
vc.on('addMeterWater', 'openAddMeterWaterModal', function(_param) {
|
||||
console.log('params :', _param);
|
||||
if (_param.hasOwnProperty("objType")) {
|
||||
$that.addMeterWaterInfo.objType = _param.objType;
|
||||
@ -50,7 +51,7 @@
|
||||
$('#addMeterWaterModel').modal('show');
|
||||
$that._listAddMeterTypes();
|
||||
});
|
||||
vc.on("addMeterWater", "notify", function (_param) {
|
||||
vc.on("addMeterWater", "notify", function(_param) {
|
||||
if (_param.hasOwnProperty("roomId") && _param.roomId != "") {
|
||||
vc.component.addMeterWaterInfo.roomId = _param.roomId;
|
||||
vc.component.addMeterWaterInfo.objId = _param.roomId;
|
||||
@ -62,7 +63,7 @@
|
||||
},
|
||||
methods: {
|
||||
// 将1-1-1 转化为 1栋1单元1室
|
||||
transRoomName: function (roomName) {
|
||||
transRoomName: function(roomName) {
|
||||
// 没有-则返回
|
||||
if (roomName.indexOf('-') < 0) {
|
||||
return roomName;
|
||||
@ -70,7 +71,7 @@
|
||||
roomName = roomName.split('-');
|
||||
return roomName[0] + '栋' + roomName[1] + '单元' + roomName[2] + '室';
|
||||
},
|
||||
_initAddMeterWaterDateInfo: function () {
|
||||
_initAddMeterWaterDateInfo: function() {
|
||||
$('.addPreReadingTime').datetimepicker({
|
||||
language: 'zh-CN',
|
||||
fontAwesome: 'fa',
|
||||
@ -81,7 +82,7 @@
|
||||
todayBtn: true
|
||||
});
|
||||
$('.addPreReadingTime').datetimepicker()
|
||||
.on('changeDate', function (ev) {
|
||||
.on('changeDate', function(ev) {
|
||||
var value = $(".addPreReadingTime").val();
|
||||
vc.component.addMeterWaterInfo.preReadingTime = value;
|
||||
});
|
||||
@ -95,7 +96,7 @@
|
||||
todayBtn: true
|
||||
});
|
||||
$('.addCurReadingTime').datetimepicker()
|
||||
.on('changeDate', function (ev) {
|
||||
.on('changeDate', function(ev) {
|
||||
var value = $(".addCurReadingTime").val();
|
||||
var start = Date.parse(new Date(vc.component.addMeterWaterInfo.preReadingTime))
|
||||
var end = Date.parse(new Date(value))
|
||||
@ -123,8 +124,7 @@
|
||||
return vc.validate.validate({
|
||||
addMeterWaterInfo: vc.component.addMeterWaterInfo
|
||||
}, {
|
||||
'addMeterWaterInfo.preDegrees': [
|
||||
{
|
||||
'addMeterWaterInfo.preDegrees': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "上期度数不能为空"
|
||||
@ -135,8 +135,7 @@
|
||||
errInfo: "上期度数格式错误"
|
||||
},
|
||||
],
|
||||
'addMeterWaterInfo.curDegrees': [
|
||||
{
|
||||
'addMeterWaterInfo.curDegrees': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "本期度数不能为空"
|
||||
@ -147,8 +146,7 @@
|
||||
errInfo: "本期度数格式错误"
|
||||
},
|
||||
],
|
||||
'addMeterWaterInfo.preReadingTime': [
|
||||
{
|
||||
'addMeterWaterInfo.preReadingTime': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "上期读表时间不能为空"
|
||||
@ -159,8 +157,7 @@
|
||||
errInfo: "上期读表时间格式错误"
|
||||
},
|
||||
],
|
||||
'addMeterWaterInfo.curReadingTime': [
|
||||
{
|
||||
'addMeterWaterInfo.curReadingTime': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "本期读表时间不能为空"
|
||||
@ -171,41 +168,36 @@
|
||||
errInfo: "本期读表时间格式错误"
|
||||
},
|
||||
],
|
||||
'addMeterWaterInfo.roomId': [
|
||||
{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "房屋必填"
|
||||
}
|
||||
],
|
||||
'addMeterWaterInfo.meterType': [
|
||||
{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "抄表类型必填"
|
||||
}
|
||||
],
|
||||
'addMeterWaterInfo.configId': [
|
||||
{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "费用必填"
|
||||
}
|
||||
],
|
||||
'addMeterWaterInfo.remark': [
|
||||
{
|
||||
limit: "maxLength",
|
||||
param: "500",
|
||||
errInfo: "备注格式错误"
|
||||
},
|
||||
],
|
||||
'addMeterWaterInfo.roomId': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "房屋必填"
|
||||
}],
|
||||
'addMeterWaterInfo.meterType': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "抄表类型必填"
|
||||
}],
|
||||
'addMeterWaterInfo.configId': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "费用必填"
|
||||
}],
|
||||
'addMeterWaterInfo.remark': [{
|
||||
limit: "maxLength",
|
||||
param: "500",
|
||||
errInfo: "备注格式错误"
|
||||
}, ],
|
||||
});
|
||||
},
|
||||
saveMeterWaterInfo: function () {
|
||||
saveMeterWaterInfo: function() {
|
||||
if (!vc.component.addMeterWaterValidate()) {
|
||||
vc.toast(vc.validate.errInfo);
|
||||
return;
|
||||
}
|
||||
if ($that.addMeterWaterInfo.computingFormula != '9009') {
|
||||
$that.addMeterWaterInfo.price = 0;
|
||||
}
|
||||
vc.component.addMeterWaterInfo.communityId = vc.getCurrentCommunity().communityId;
|
||||
//不提交数据将数据 回调给侦听处理
|
||||
if (vc.notNull($props.callBackListener)) {
|
||||
@ -215,11 +207,10 @@
|
||||
}
|
||||
vc.http.apiPost(
|
||||
'meterWater.saveMeterWater',
|
||||
JSON.stringify(vc.component.addMeterWaterInfo),
|
||||
{
|
||||
JSON.stringify(vc.component.addMeterWaterInfo), {
|
||||
emulateJSON: true
|
||||
},
|
||||
function (json, res) {
|
||||
function(json, res) {
|
||||
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
||||
let _json = JSON.parse(json);
|
||||
if (_json.code == 0) {
|
||||
@ -236,12 +227,12 @@
|
||||
}
|
||||
vc.message(_json.msg);
|
||||
},
|
||||
function (errInfo, error) {
|
||||
function(errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
vc.message(errInfo);
|
||||
});
|
||||
},
|
||||
_changeAddMeterWaterFeeTypeCd: function (_feeTypeCd) {
|
||||
_changeAddMeterWaterFeeTypeCd: function(_feeTypeCd) {
|
||||
var param = {
|
||||
params: {
|
||||
page: 1,
|
||||
@ -254,22 +245,22 @@
|
||||
};
|
||||
//发送get请求
|
||||
vc.http.get('roomCreateFeeAdd', 'list', param,
|
||||
function (json, res) {
|
||||
function(json, res) {
|
||||
var _feeConfigManageInfo = JSON.parse(json);
|
||||
vc.component.addMeterWaterInfo.feeConfigs = _feeConfigManageInfo.feeConfigs;
|
||||
},
|
||||
function (errInfo, error) {
|
||||
function(errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
});
|
||||
},
|
||||
_changeAddMeterType:function(){
|
||||
_changeAddMeterType: function() {
|
||||
$that._queryPreMeterWater($that.addMeterWaterInfo.roomId);
|
||||
},
|
||||
_queryPreMeterWater: function (_roomId) {
|
||||
_queryPreMeterWater: function(_roomId) {
|
||||
if (!_roomId) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
let param = {
|
||||
params: {
|
||||
communityId: vc.getCurrentCommunity().communityId,
|
||||
@ -280,7 +271,7 @@
|
||||
};
|
||||
//发送get请求
|
||||
vc.http.apiGet('/meterWater/queryPreMeterWater', param,
|
||||
function (json, res) {
|
||||
function(json, res) {
|
||||
let _meterWaterInfo = JSON.parse(json);
|
||||
let _total = _meterWaterInfo.total;
|
||||
if (_total < 1) {
|
||||
@ -290,13 +281,15 @@
|
||||
}
|
||||
$that.addMeterWaterInfo.preDegrees = _meterWaterInfo.data[0].curDegrees;
|
||||
$that.addMeterWaterInfo.preReadingTime = _meterWaterInfo.data[0].curReadingTime;
|
||||
$that.addMeterWaterInfo.price = _meterWaterInfo.data[0].price;
|
||||
if ($that.addMeterWaterInfo.computingFormula == '9009') {
|
||||
$that.addMeterWaterInfo.price = _meterWaterInfo.data[0].price;
|
||||
}
|
||||
},
|
||||
function (errInfo, error) {
|
||||
function(errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
});
|
||||
},
|
||||
_getChange: function () {
|
||||
_getChange: function() {
|
||||
//上期度数
|
||||
var preDegrees = parseFloat(vc.component.addMeterWaterInfo.preDegrees);
|
||||
//本期度数
|
||||
@ -306,7 +299,7 @@
|
||||
vc.component.addMeterWaterInfo.curDegrees = "";
|
||||
}
|
||||
},
|
||||
_listAddMeterTypes: function (_page, _rows) {
|
||||
_listAddMeterTypes: function(_page, _rows) {
|
||||
var param = {
|
||||
params: {
|
||||
page: 1,
|
||||
@ -318,15 +311,16 @@
|
||||
//发送get请求
|
||||
vc.http.apiGet('meterType.listMeterType',
|
||||
param,
|
||||
function (json, res) {
|
||||
function(json, res) {
|
||||
var _meterTypeManageInfo = JSON.parse(json);
|
||||
$that.addMeterWaterInfo.meterTypes = _meterTypeManageInfo.data;
|
||||
}, function (errInfo, error) {
|
||||
},
|
||||
function(errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
}
|
||||
);
|
||||
},
|
||||
clearAddMeterWaterInfo: function () {
|
||||
clearAddMeterWaterInfo: function() {
|
||||
vc.component.addMeterWaterInfo = {
|
||||
waterId: '',
|
||||
meterType: '',
|
||||
@ -346,17 +340,18 @@
|
||||
ownerName: '',
|
||||
objType: '3333',
|
||||
meterTypes: [],
|
||||
computingFormula:''
|
||||
computingFormula: '',
|
||||
price: 0
|
||||
};
|
||||
},
|
||||
changeFeeConfig:function(){
|
||||
changeFeeConfig: function() {
|
||||
let _configId = $that.addMeterWaterInfo.configId;
|
||||
$that.addMeterWaterInfo.feeConfigs.forEach(item => {
|
||||
if(_configId == item.configId){
|
||||
if (_configId == item.configId) {
|
||||
$that.addMeterWaterInfo.computingFormula = item.computingFormula;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
})(window.vc);
|
||||
})(window.vc);
|
||||
Loading…
Reference in New Issue
Block a user