|
@@ -197,7 +197,7 @@
|
|
|
<view class="prop-item-left">{{item.name}}</view>
|
|
<view class="prop-item-left">{{item.name}}</view>
|
|
|
<view class="prop-item-right">
|
|
<view class="prop-item-right">
|
|
|
<view v-if="item.type === 'integer'" style="width:240rpx;position: absolute;top: 10rpx;;">
|
|
<view v-if="item.type === 'integer'" style="width:240rpx;position: absolute;top: 10rpx;;">
|
|
|
- <u-input :customStyle="inputStyle" fontSize="20rpx" placeholder="请输入整数" v-model="item.shadow">
|
|
|
|
|
|
|
+ <u-input :customStyle="inputStyle" fontSize="20rpx" type="number" placeholder="请输入整数" v-model="item.shadow">
|
|
|
</u-input>
|
|
</u-input>
|
|
|
</view>
|
|
</view>
|
|
|
<view style="width:240rpx;position: absolute;top:0rpx;" v-if="item.type === 'string'">
|
|
<view style="width:240rpx;position: absolute;top:0rpx;" v-if="item.type === 'string'">
|
|
@@ -378,7 +378,7 @@ export default {
|
|
|
destroyed() {
|
|
destroyed() {
|
|
|
// 取消订阅主题
|
|
// 取消订阅主题
|
|
|
this.mqttUnSubscribe(this.deviceInfo);
|
|
this.mqttUnSubscribe(this.deviceInfo);
|
|
|
- clearInterval(this.checkTimer);
|
|
|
|
|
|
|
+ clearTimeout(this.checkTimer);
|
|
|
},
|
|
},
|
|
|
methods:{
|
|
methods:{
|
|
|
// 抽屉状态发生变化触发
|
|
// 抽屉状态发生变化触发
|
|
@@ -423,7 +423,7 @@ export default {
|
|
|
arr.push(functionObj);
|
|
arr.push(functionObj);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- this.mqttPublish(1,this.deviceInfo,arr)
|
|
|
|
|
|
|
+ this.mqttPublish(2,this.deviceInfo,arr)
|
|
|
},
|
|
},
|
|
|
changeProp(key,val){
|
|
changeProp(key,val){
|
|
|
let item = null;
|
|
let item = null;
|
|
@@ -537,7 +537,6 @@ export default {
|
|
|
})
|
|
})
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- debugger;
|
|
|
|
|
this.publishThingsModel(this.deviceInfo,this.inputProp.map(item=>{return{"id":item.id,"value":item.value}}))
|
|
this.publishThingsModel(this.deviceInfo,this.inputProp.map(item=>{return{"id":item.id,"value":item.value}}))
|
|
|
},
|
|
},
|
|
|
/** 更新设备状态 */
|
|
/** 更新设备状态 */
|
|
@@ -574,9 +573,11 @@ export default {
|
|
|
let self = this;
|
|
let self = this;
|
|
|
if(!e){
|
|
if(!e){
|
|
|
e = {index:0};
|
|
e = {index:0};
|
|
|
|
|
+ this.childId = 0;
|
|
|
|
|
+ }else{
|
|
|
|
|
+ this.activeName = e.index;
|
|
|
|
|
+ this.childId = this.summary[this.activeName].id;
|
|
|
}
|
|
}
|
|
|
- this.activeName = e.index;
|
|
|
|
|
- this.childId = this.summary[this.activeName].id;
|
|
|
|
|
getDeviceStatus(this.id,this.childId).then(res=>{
|
|
getDeviceStatus(this.id,this.childId).then(res=>{
|
|
|
let data =res.data;
|
|
let data =res.data;
|
|
|
this.deviceInfo = data;
|
|
this.deviceInfo = data;
|
|
@@ -927,9 +928,25 @@ export default {
|
|
|
if(oneToMul){
|
|
if(oneToMul){
|
|
|
let info = this.summary[this.activeName];
|
|
let info = this.summary[this.activeName];
|
|
|
let childId = info.id;
|
|
let childId = info.id;
|
|
|
- modelId = modelId+"_"+childId;
|
|
|
|
|
|
|
+ if(childId){
|
|
|
|
|
+ modelId = modelId+"_"+childId;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
- arr.push({id:modelId,value:modelList[i].shadow});
|
|
|
|
|
|
|
+ let shadow = model.shadow;
|
|
|
|
|
+ let modelType = model.type;
|
|
|
|
|
+ let shadowInt = parseInt(shadow,10);
|
|
|
|
|
+ let isNumber = false;
|
|
|
|
|
+ let shadowStr = shadowInt+"";
|
|
|
|
|
+ if(shadowStr === shadow){
|
|
|
|
|
+ isNumber = true;
|
|
|
|
|
+ shadow = shadowInt;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(modelType == "integer" && !isNumber){
|
|
|
|
|
+ this.$modal.showToast(model.name+'的值必须是数字类型')
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ arr.push({id:modelId,value:shadow});
|
|
|
}
|
|
}
|
|
|
message = JSON.stringify(arr);
|
|
message = JSON.stringify(arr);
|
|
|
let self = this;
|
|
let self = this;
|
|
@@ -942,11 +959,9 @@ export default {
|
|
|
},
|
|
},
|
|
|
startCheck(){
|
|
startCheck(){
|
|
|
let self = this;
|
|
let self = this;
|
|
|
- if(this.checkTimer!= null){
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- this.checkTimer = setInterval(function (){
|
|
|
|
|
|
|
+ this.checkTimer = setTimeout(function (){
|
|
|
self.sendHeart();
|
|
self.sendHeart();
|
|
|
|
|
+ self.startCheck();
|
|
|
},20000);
|
|
},20000);
|
|
|
},
|
|
},
|
|
|
checkActive(){
|
|
checkActive(){
|
|
@@ -958,7 +973,7 @@ export default {
|
|
|
},3000);
|
|
},3000);
|
|
|
},
|
|
},
|
|
|
sendHeart(){
|
|
sendHeart(){
|
|
|
- console.log("发送心跳")
|
|
|
|
|
|
|
+ console.log("发送心跳111")
|
|
|
let device = this.deviceInfo;
|
|
let device = this.deviceInfo;
|
|
|
let self = this;
|
|
let self = this;
|
|
|
let topic = "/property-offline/post";
|
|
let topic = "/property-offline/post";
|