|
@@ -143,7 +143,7 @@ Page({
|
|
var a = wx.getStorageSync('group')
|
|
var a = wx.getStorageSync('group')
|
|
a.push({id:res.data.data.id,groupName:ever.content,devices:[]})
|
|
a.push({id:res.data.data.id,groupName:ever.content,devices:[]})
|
|
wx.setStorageSync('group', a)
|
|
wx.setStorageSync('group', a)
|
|
- }
|
|
|
|
|
|
+ }
|
|
else{
|
|
else{
|
|
var b = wx.getStorageSync('group')
|
|
var b = wx.getStorageSync('group')
|
|
b.push({id:res.data.data.id,groupName:ever.content,devices:[]})
|
|
b.push({id:res.data.data.id,groupName:ever.content,devices:[]})
|
|
@@ -165,7 +165,7 @@ Page({
|
|
})
|
|
})
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- }
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
})
|
|
@@ -196,7 +196,7 @@ Page({
|
|
Group[i].groupName = Group[i].groupName.slice(0,9) + '....'
|
|
Group[i].groupName = Group[i].groupName.slice(0,9) + '....'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- that.setData({array: Group})
|
|
|
|
|
|
+ that.setData({array: Group})
|
|
}
|
|
}
|
|
else{
|
|
else{
|
|
wx.showModal({
|
|
wx.showModal({
|
|
@@ -320,6 +320,51 @@ Page({
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
+ //dsx添加的设备
|
|
|
|
+ else if( res.result.substring(0,2) == 86 ){
|
|
|
|
+ let ID = res.result
|
|
|
|
+ let SN = res.result
|
|
|
|
+ //添加设备
|
|
|
|
+ postDevice({groupId:Idindex,deviceSn:SN,deviceId:ID,module:1,deviceName:SN}).then(add =>{
|
|
|
|
+ if(add.data.code == 0){
|
|
|
|
+ //查询设备
|
|
|
|
+ getDevice(add.data.data.id,Idindex).then(get =>{
|
|
|
|
+ var Get = get.data.data
|
|
|
|
+ console.log(Get)
|
|
|
|
+ switch(Get.status){
|
|
|
|
+ case 0:
|
|
|
|
+ Get.status = '离线'
|
|
|
|
+ break
|
|
|
|
+ case 1:
|
|
|
|
+ Get.status = '在线'
|
|
|
|
+ break
|
|
|
|
+ }
|
|
|
|
+ if(group[index].devices != null){
|
|
|
|
+ group[index].devices.push(Get)
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ group[index].devices = []
|
|
|
|
+ group[index].devices.push(Get)
|
|
|
|
+ }
|
|
|
|
+ wx.setStorageSync('group', group)
|
|
|
|
+ var Group = wx.getStorageSync('group')
|
|
|
|
+ for(let i = 0;i < Group.length;i++){
|
|
|
|
+ if(Group[i].groupName.length > 10){
|
|
|
|
+ Group[i].groupName = Group[i].groupName.slice(0,9) + '....'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ that.setData({array: Group})
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ wx.showModal({
|
|
|
|
+ title:'提示',
|
|
|
|
+ content:add.data.msg,
|
|
|
|
+ showCancel:false
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
else{
|
|
else{
|
|
var arr = res.result.split(' ');
|
|
var arr = res.result.split(' ');
|
|
var a = arr[0]//设备id
|
|
var a = arr[0]//设备id
|
|
@@ -419,7 +464,7 @@ Page({
|
|
showCancel:false
|
|
showCancel:false
|
|
})
|
|
})
|
|
}
|
|
}
|
|
- })
|
|
|
|
|
|
+ })
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
})
|
|
@@ -677,4 +722,4 @@ Page({
|
|
onShareAppMessage() {
|
|
onShareAppMessage() {
|
|
|
|
|
|
}
|
|
}
|
|
-})
|
|
|
|
|
|
+})
|