|
@@ -41,7 +41,7 @@
|
|
|
<view class="register_li_min" v-if="pageType==0">
|
|
|
<view>*</view>
|
|
|
<view>当前压力:</view>
|
|
|
- <input v-model="form.currentPressure" @change="calculateAmountFun()" placeholder="请输入当前压力值" type="text" >
|
|
|
+ <input v-model="form.currentPressure" @input="onKeyVinInput($event)" type="number" @change="calculateAmountFun()" placeholder="请输入当前压力值">
|
|
|
</view>
|
|
|
<view class="register_li_min" v-if="pageType==0">
|
|
|
<view>*</view>
|
|
@@ -70,7 +70,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import { useRegisterDetail,useRegisterAdd,airbottleStockFindByBeaconTag,airbottleUsageRecordAdd} from '@/api/index.js'
|
|
|
+ import {airbottleStockFindByBeaconTag,airbottleUsageRecordAdd} from '@/api/index.js'
|
|
|
import { config } from '@/api/request/config.js'
|
|
|
import { dateTimePicker,getMonthDay} from '@/api/../component/date.js'
|
|
|
export default {
|
|
@@ -128,6 +128,20 @@
|
|
|
|
|
|
},
|
|
|
methods: {
|
|
|
+ //限制只能输入数字
|
|
|
+ onKeyVinInput(e) {
|
|
|
+ const o = e.detail.value
|
|
|
+ const inputRule = /[^\-?\d.]/g
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.form.currentPressure = o.replace(inputRule, '');
|
|
|
+ if (this.form.currentPressure == '') {
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ //执行对应代码
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
currentDateFun(){
|
|
|
let date = new Date(); //Fri Oct 29 2021 16:37:56 GMT+0800 (CST)
|
|
|
this.startYear= date.getFullYear(); //获取完整的年份(4位)
|
|
@@ -231,11 +245,11 @@
|
|
|
},
|
|
|
//输入当前压力值后计算本次使用量
|
|
|
calculateAmountFun(){
|
|
|
- let num=parseInt(this.form.gasPressure)-parseInt(this.form.currentPressure)
|
|
|
+ let num=parseFloat(this.form.gasPressure)-parseFloat(this.form.currentPressure)
|
|
|
if(num<=0){
|
|
|
num=0;
|
|
|
}
|
|
|
- this.$set(this.form,'usageAmount',num)
|
|
|
+ this.$set(this.form,'usageAmount',num.toFixed(2))
|
|
|
},
|
|
|
// //开始时间选中事件
|
|
|
// startChange(form,e){
|
|
@@ -340,6 +354,7 @@
|
|
|
}
|
|
|
}
|
|
|
self.form=data.data;
|
|
|
+ this.$set(this.form,'usageTime',0);
|
|
|
this.$set(this.form,'usageStartTime',self.currentDate);
|
|
|
|
|
|
console.log(self.currentDate)
|