|
@@ -143,7 +143,7 @@ Page({
|
|
|
var a = wx.getStorageSync('group')
|
|
|
a.push({id:res.data.data.id,groupName:ever.content,devices:[]})
|
|
|
wx.setStorageSync('group', a)
|
|
|
- }
|
|
|
+ }
|
|
|
else{
|
|
|
var b = wx.getStorageSync('group')
|
|
|
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) + '....'
|
|
|
}
|
|
|
}
|
|
|
- that.setData({array: Group})
|
|
|
+ that.setData({array: Group})
|
|
|
}
|
|
|
else{
|
|
|
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{
|
|
|
var arr = res.result.split(' ');
|
|
|
var a = arr[0]//设备id
|
|
@@ -419,7 +464,7 @@ Page({
|
|
|
showCancel:false
|
|
|
})
|
|
|
}
|
|
|
- })
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
})
|
|
@@ -677,4 +722,4 @@ Page({
|
|
|
onShareAppMessage() {
|
|
|
|
|
|
}
|
|
|
-})
|
|
|
+})
|