|
@ -3,9 +3,9 @@
|
|
|
<div class='bgc-17b3ec ptb10 plr15 c-fff c-f14'>
|
|
|
<div class='flex f_y_c f_x_s'>
|
|
|
<span>设备实时温湿度</span>
|
|
|
<van-button size="small" type="text" class='tbtn w60 bgc-fff c-17B3EC'>获取</van-button>
|
|
|
<van-button size="small" type="text" class='tbtn w60 bgc-fff c-17B3EC' @click='initMain'>获取</van-button>
|
|
|
</div>
|
|
|
<div class='c-f20'>22°<span class='ml20'>70%</span></div>
|
|
|
<div class='c-f20'>{{form.temperature}}°<span class='ml20'>{{form.humidity}}%</span></div>
|
|
|
<div class='mt10'>设备实时温度每10分钟会从设备端返回一次</div>
|
|
|
</div>
|
|
|
<div class='mt10 p10 bgc-fff c-f14 c-333 c-border-tb'>
|
|
@ -20,8 +20,8 @@
|
|
|
<div class='flex f_y_c'>
|
|
|
<span>加热控制:</span>
|
|
|
<van-radio-group class='ml20' v-model="form.heat" direction="horizontal">
|
|
|
<van-radio :name="0">关闭</van-radio>
|
|
|
<van-radio :name="1">开启</van-radio>
|
|
|
<van-radio name="0">关闭</van-radio>
|
|
|
<van-radio name="1">开启</van-radio>
|
|
|
</van-radio-group>
|
|
|
</div>
|
|
|
<div class='flex mt20'>
|
|
@ -147,10 +147,14 @@ export default{
|
|
|
}
|
|
|
},
|
|
|
save(){
|
|
|
this.form.humiditycontrol = this.form.humiditycontrol?'1':'0';
|
|
|
this.form.temperaturecontrol = this.form.temperaturecontrol?'1':'0'
|
|
|
//this.form.heat = !this.form.heat?'0':this.form.heat
|
|
|
medicineAbinetApi.updateTAndH(this.form).then(res=>{
|
|
|
this.$loading('加载中..')
|
|
|
let json = {}
|
|
|
Object.assign(json, JSON.parse(JSON.stringify(this.form)));
|
|
|
json.humiditycontrol = json.humiditycontrol?'1':'0';
|
|
|
json.temperaturecontrol = json.temperaturecontrol?'1':'0'
|
|
|
json.heat = !json.heat&&json.heat!=0?'0':this.form.heat
|
|
|
medicineAbinetApi.updateTAndH(json).then(res=>{
|
|
|
this.$toast.clear()
|
|
|
if(res.status==200){
|
|
|
this.$toast(res.message);
|
|
|
this.goBack();
|
|
@ -158,25 +162,30 @@ export default{
|
|
|
this.$toast(res.message)
|
|
|
}
|
|
|
}).catch(err=>{
|
|
|
this.$toast.clear()
|
|
|
this.$toast(err.message)
|
|
|
})
|
|
|
},
|
|
|
initMain(){
|
|
|
this.$loading('加载中..')
|
|
|
medicineAbinetApi.findDeviceById({deviceId: this.$route.query.id}).then(res=>{
|
|
|
this.$toast.clear()
|
|
|
if(res.status==200){
|
|
|
console.log(res);
|
|
|
this.form.humidity = res.obj.device.humidity;
|
|
|
this.form.humiditycontrol = res.obj.device.humidity?true:false;
|
|
|
this.form.humiditycontrol = res.obj.device.humiditycontrol&&res.obj.device.humiditycontrol==1?true:false;
|
|
|
this.form.temperature = res.obj.device.temperature;
|
|
|
this.form.temperaturecontrol = res.obj.device.temperaturecontrol?true:false;
|
|
|
this.form.heat = res.obj.device.heat?true:false;
|
|
|
this.form.temperaturecontrol = res.obj.device.temperaturecontrol&&res.obj.device.temperaturecontrol==1?true:false;
|
|
|
this.form.heat = res.obj.device.heat;
|
|
|
this.checked1 = res.obj.device.warningTemperatureHeight!==null||res.obj.device.warningTemperatureLow!==null;
|
|
|
this.checked2 = res.obj.device.waringHumidityHeight!==null||res.obj.device.waringHumidityLow!==null;
|
|
|
this.form.waringHumidityHeight = res.obj.device.waringHumidityHeight;
|
|
|
this.form.warningTemperatureHeight = res.obj.device.warningTemperatureHeight;
|
|
|
this.form.warningTemperatureLow = res.obj.device.warningTemperatureLow;
|
|
|
this.form.waringHumidityLow = res.obj.device.waringHumidityLow;
|
|
|
}
|
|
|
}).catch(err=>{
|
|
|
|
|
|
this.$toast.clear()
|
|
|
})
|
|
|
}
|
|
|
},
|