优化代码

This commit is contained in:
wuxw 2024-06-12 18:04:14 +08:00
parent 40344013b3
commit 81f6c9f620

View File

@ -2,6 +2,10 @@
<view> <view>
<view class="block__title">上期抄表</view> <view class="block__title">上期抄表</view>
<view class="cu-form-group">
<view class="title">房屋</view>
<input placeholder="房屋"  v-model="roomNum" disabled="true"></input>
</view>
<view class="cu-form-group"> <view class="cu-form-group">
<view class="title">上期度数</view> <view class="title">上期度数</view>
<input placeholder="上期度数"  v-model="preDegrees"></input> <input placeholder="上期度数"  v-model="preDegrees"></input>
@ -33,12 +37,24 @@
</template> </template>
<script> <script>
import {queryFeeTypesItems,queryPreMeterWater,saveMeterWater,listMeterType} from '../../api/meter/meter.js' import {
queryFeeTypesItems,
queryPreMeterWater,
saveMeterWater,
listMeterType
} from '../../api/meter/meter.js'
import dateObj from '../../lib/java110/utils/date.js' import dateObj from '../../lib/java110/utils/date.js'
import uniDatetimePicker from '../../components/uni-datetime-picker/uni-datetime-picker.vue' import uniDatetimePicker from '../../components/uni-datetime-picker/uni-datetime-picker.vue'
import {getCurrentCommunity} from '../../api/community/community.js' import {
getCurrentCommunity
} from '../../api/community/community.js'
// //
import {preventClick} from '../../lib/java110/utils/common.js'; import {
preventClick
} from '../../lib/java110/utils/common.js';
import {
loadRooms
} from '../../api/room/room.js';
import Vue from 'vue' import Vue from 'vue'
Vue.prototype.$preventClick = preventClick; Vue.prototype.$preventClick = preventClick;
export default { export default {
@ -49,9 +65,9 @@
communityId: '', communityId: '',
objType: '3333', objType: '3333',
preDegrees: 0, preDegrees: 0,
preReadingTime: null, preReadingTime: null,
curDegrees: '', curDegrees: '',
curReadingTime: null, curReadingTime: null,
remark: '', remark: '',
}; };
}, },
@ -69,10 +85,25 @@
this.curReadingTime = dateObj.getCurrentDateTime(); this.curReadingTime = dateObj.getCurrentDateTime();
this._queryPreMeterWater(); this._queryPreMeterWater();
this._loadRoom();
}, },
methods: { methods: {
_loadRoom: function() {
let _that = this;
loadRooms(this, {
page: 1,
row: 1,
roomId: this.roomId,
communityId: this.communityId
}).then(_data => {
console.log(_data)
_that.roomNum = _data.data.rooms[0].roomName;
})
},
// //
_queryPreMeterWater() { _queryPreMeterWater() {
let _objData = { let _objData = {
@ -94,6 +125,13 @@
}, },
submitMeter() { submitMeter() {
if (!this.java110Context.hasPrivilege('502021012558990030')) {
uni.showToast({
icon: 'none',
title: '无权限,联系管理员'
});
return;
}
let msg = ''; let msg = '';
if (this.roomId == '') { if (this.roomId == '') {
msg = "请选择房屋"; msg = "请选择房屋";