完成102添加联机日志,报警日志
This commit is contained in:
@ -1,5 +1,26 @@
|
||||
<template>
|
||||
<view class="content contentBg">
|
||||
<uni-nav-bar class="nvbar" leftIcon="left" @clickLeft="navigatorBack">
|
||||
<view slot="left">
|
||||
<uni-icons type="back" size="23" color="#FFFFFF"></uni-icons>
|
||||
</view>
|
||||
<view slot="default" class="center uninavebartext">
|
||||
{{Status.navbar.title}}
|
||||
</view>
|
||||
<view slot="right">
|
||||
<view class="navbarRight center">
|
||||
<view class="imgContent" @click.stop="handleRightClick(item,index)"
|
||||
v-for="item,index in Status.navbar.icons">
|
||||
<image class="img" :src="item.src" mode="aspectFit"></image>
|
||||
<view class="baber" v-if="item.math">{{item.math>9?'9+':item.math}}</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
</uni-nav-bar>
|
||||
|
||||
<view class="eq">
|
||||
<view class="leftImg" @click.stop="previewImg(device.devicePic?device.devicePic:formData.img)">
|
||||
<image class="img" :src="device.devicePic?device.devicePic:formData.img" mode="aspectFit"></image>
|
||||
@ -16,7 +37,8 @@
|
||||
<view class="row">
|
||||
<image class="img" src="/static/images/6155/DeviceDetail/time.png" mode="aspectFit"></image>
|
||||
<view class="txt">
|
||||
<view class="bigTxt">{{formData.sta_charge?dic.sta_charge[formData.sta_charge+'']:"未充电" }}</view>
|
||||
<view class="bigTxt">{{formData.sta_charge?dic.sta_charge[formData.sta_charge+'']:"未充电" }}
|
||||
</view>
|
||||
<view class="smallTxt">设备状态</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -46,7 +68,7 @@
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<view class="warnnig" v-for="item,index in warnDevices">
|
||||
<view class="warnnig" v-for="item,index in warnDevices">
|
||||
<view>闯入报警!</view>
|
||||
<view>
|
||||
{{item.name}}
|
||||
@ -161,9 +183,9 @@
|
||||
|
||||
|
||||
<global-loading ref="loading" />
|
||||
|
||||
|
||||
<BottomSlideMenuPlus :config="Status.BottomMenu" @itemClick="btnClick" @close="closeActionSheet">
|
||||
|
||||
|
||||
</BottomSlideMenuPlus>
|
||||
</view>
|
||||
</template>
|
||||
@ -223,30 +245,30 @@
|
||||
show: false,
|
||||
showHeader: true,
|
||||
menuItems: [{
|
||||
text: '2M',
|
||||
value:'status_2M',
|
||||
icon: ''
|
||||
},
|
||||
{
|
||||
text: '4M',
|
||||
value:'status_4M',
|
||||
icon: ''
|
||||
},
|
||||
{
|
||||
text: '7M',
|
||||
value:'status_7M',
|
||||
icon: ''
|
||||
},
|
||||
{
|
||||
text: '10M',
|
||||
value:'status_10M',
|
||||
icon: ''
|
||||
},
|
||||
{
|
||||
text: '关闭',
|
||||
value:'status_off',
|
||||
icon: ''
|
||||
}
|
||||
text: '2M',
|
||||
value: 'status_2M',
|
||||
icon: ''
|
||||
},
|
||||
{
|
||||
text: '4M',
|
||||
value: 'status_4M',
|
||||
icon: ''
|
||||
},
|
||||
{
|
||||
text: '7M',
|
||||
value: 'status_7M',
|
||||
icon: ''
|
||||
},
|
||||
{
|
||||
text: '10M',
|
||||
value: 'status_10M',
|
||||
icon: ''
|
||||
},
|
||||
{
|
||||
text: '关闭',
|
||||
value: 'status_off',
|
||||
icon: ''
|
||||
}
|
||||
],
|
||||
activeIndex: -1,
|
||||
bgColor: '#2a2a2a',
|
||||
@ -269,6 +291,21 @@
|
||||
showClose: false
|
||||
},
|
||||
usrToggle: false,
|
||||
navbar: {
|
||||
icons: [{
|
||||
src: '/static/images/common/history.png',
|
||||
callback: this.gotoHistory,
|
||||
math: 0
|
||||
},
|
||||
{
|
||||
src: '/static/images/common/shape.png',
|
||||
callback: this.gotoShare
|
||||
}
|
||||
],
|
||||
title: 'HBY102'
|
||||
|
||||
},
|
||||
apiType: ''
|
||||
},
|
||||
formData: {
|
||||
img: '/static/images/common/HBY102.png',
|
||||
@ -281,13 +318,13 @@
|
||||
statu: '',
|
||||
sta_address: '',
|
||||
bleStatu: false,
|
||||
sta_charge:'',
|
||||
sta_charge: '',
|
||||
sta_LedType: '',
|
||||
sta_RadarType: '',
|
||||
sta_Online: '',
|
||||
warnTime: '',
|
||||
sta_sosadd: "",
|
||||
sta_sosName:'',
|
||||
sta_sosName: '',
|
||||
sta_IntrusTime: ''
|
||||
|
||||
},
|
||||
@ -300,7 +337,8 @@
|
||||
show: true,
|
||||
img: '/static/images/100/light.png',
|
||||
activeImg: '/static/images/100/lightActive.png',
|
||||
group: 'sta_LedType'
|
||||
group: 'sta_LedType',
|
||||
permission: '1'
|
||||
},
|
||||
{
|
||||
key: 'led_low_flash',
|
||||
@ -308,7 +346,8 @@
|
||||
show: true,
|
||||
img: '/static/images/102/lowFlash.png',
|
||||
activeImg: '/static/images/102/lowFlashActive.png',
|
||||
group: 'sta_LedType'
|
||||
group: 'sta_LedType',
|
||||
permission: '1'
|
||||
},
|
||||
{
|
||||
key: 'led_steady',
|
||||
@ -316,7 +355,8 @@
|
||||
show: true,
|
||||
img: '/static/images/102/liting.png',
|
||||
activeImg: '/static/images/102/litingActive.png',
|
||||
group: 'sta_LedType'
|
||||
group: 'sta_LedType',
|
||||
permission: '1'
|
||||
},
|
||||
{
|
||||
key: 'status_on',
|
||||
@ -324,7 +364,8 @@
|
||||
show: true,
|
||||
img: '/static/images/102/redar.png',
|
||||
activeImg: '/static/images/102/redarActive.png',
|
||||
group: 'sta_RadarType'
|
||||
group: 'sta_RadarType',
|
||||
permission: '48'
|
||||
},
|
||||
{
|
||||
key: 'E49_on',
|
||||
@ -332,7 +373,8 @@
|
||||
show: true,
|
||||
img: '/static/images/102/line.png',
|
||||
activeImg: '/static/images/102/lineActive.png',
|
||||
group: 'sta_Online'
|
||||
group: 'sta_Online',
|
||||
permission: '49'
|
||||
},
|
||||
{
|
||||
key: 'led_off',
|
||||
@ -377,7 +419,8 @@
|
||||
showConfirm: false
|
||||
},
|
||||
groupDevices: [],
|
||||
warnDevices:[]
|
||||
warnDevices: [],
|
||||
permissions: []
|
||||
}
|
||||
},
|
||||
|
||||
@ -404,9 +447,20 @@
|
||||
|
||||
eventChannel.on('detailData', function(data) {
|
||||
|
||||
// console.log("收到父页面的参数:" + JSON.stringify(data));
|
||||
console.log("收到父页面的参数:" + JSON.stringify(data));
|
||||
var device = data.data;
|
||||
these.Status.apiType = data.apiType;
|
||||
if (data.apiType !== 'listA') {
|
||||
Common.getdeviceShareId(data.data.id).then(res => {
|
||||
if (res.code == 200) {
|
||||
if (res.data.permission) {
|
||||
these.permissions = res.data.permission.split(',');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
these.device = device;
|
||||
these.getWarns();
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
if (v.macAddress == device.deviceMac) {
|
||||
// console.log("找到设备了", v);
|
||||
@ -452,34 +506,181 @@
|
||||
},
|
||||
onShow() {
|
||||
this.Status.pageHide = false;
|
||||
this.getLinkedCnt();
|
||||
},
|
||||
computed: {
|
||||
Distance:function(){
|
||||
let f=this.Status.BottomMenu.menuItems.find((item,index)=>{
|
||||
|
||||
return item.value===this.formData.sta_RadarType;
|
||||
|
||||
|
||||
Distance: function() {
|
||||
let f = this.Status.BottomMenu.menuItems.find((item, index) => {
|
||||
|
||||
return item.value === this.formData.sta_RadarType;
|
||||
|
||||
|
||||
});
|
||||
if(f){
|
||||
if (f) {
|
||||
return f.text;
|
||||
}
|
||||
return '关闭';
|
||||
},
|
||||
activeIndex:function(){
|
||||
let active=4;
|
||||
let f=this.Status.BottomMenu.menuItems.find((item,index)=>{
|
||||
|
||||
if(item.value===this.formData.sta_RadarType){
|
||||
active=index;
|
||||
activeIndex: function() {
|
||||
let active = 4;
|
||||
let f = this.Status.BottomMenu.menuItems.find((item, index) => {
|
||||
|
||||
if (item.value === this.formData.sta_RadarType) {
|
||||
active = index;
|
||||
}
|
||||
});
|
||||
return active;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getLinkedCnt() {//获取在线设备的数量
|
||||
|
||||
let f = this.getDevice();
|
||||
// #ifdef APP-PLUS
|
||||
if (!f) {
|
||||
return;
|
||||
}
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
f = {
|
||||
deviceId: '12345'
|
||||
}
|
||||
// #endif
|
||||
|
||||
|
||||
if (ble) {
|
||||
let buffer = {
|
||||
ins_Quantity: "query"
|
||||
};
|
||||
ble.sendString(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 30).then(res=>{
|
||||
setTimeout(()=>{
|
||||
this.getWarns();
|
||||
},1500);
|
||||
}).catch(()=>{
|
||||
this.getWarns();
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
getWarns() {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!these.device.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
let warnKey = "102_" + these.device.id + "_warning";
|
||||
let linkKey = "102_" + these.device.id + "_linked";
|
||||
let p1 = new Promise((succ, err) => {
|
||||
uni.getStorage({
|
||||
key: warnKey,
|
||||
success(res) {
|
||||
let data = res.data;
|
||||
let fs = data.filter(v => {
|
||||
return !v.read
|
||||
});
|
||||
succ(fs);
|
||||
},
|
||||
fail(ex) {
|
||||
err(null);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
let p2 = new Promise((succ, err) => {
|
||||
uni.getStorage({
|
||||
key: linkKey,
|
||||
success(res) {
|
||||
console.error("获取到联机数据",res);
|
||||
let data = res.data;
|
||||
let fs = data.filter(v => {
|
||||
return !v.read
|
||||
});
|
||||
console.error("未读联机数据",fs);
|
||||
succ(fs);
|
||||
},
|
||||
fail(ex) {
|
||||
err(null);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Promise.allSettled([p1, p2]).then(results => {
|
||||
let fs = [];
|
||||
|
||||
if (results[0].status == 'fulfilled') {
|
||||
fs=fs.concat(results[0].value);
|
||||
}
|
||||
if (results[1].status == 'fulfilled') {
|
||||
fs=fs.concat(results[1].value);
|
||||
}
|
||||
console.error("获取到未读消息",fs);
|
||||
these.$set(these.Status.navbar.icons[0], "math", fs.length);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
gotoHistory(item, s) {
|
||||
|
||||
uni.navigateTo({
|
||||
url: '/pages/102/HBY102_History',
|
||||
success: (res) => {
|
||||
res.eventChannel.emit('detailData', {
|
||||
data: these.device
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
gotoShare(item, s) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/common/share/index',
|
||||
events: {
|
||||
ack: function(data) {}
|
||||
},
|
||||
success: (res) => {
|
||||
let json = {
|
||||
persissonType: '102'
|
||||
};
|
||||
Object.assign(json, this.device);
|
||||
res.eventChannel.emit('share', {
|
||||
data: json
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
handleRightClick(item, s) {
|
||||
if (item && item.callback) {
|
||||
item.callback(item, s);
|
||||
} else {
|
||||
uni.showModal({
|
||||
content: '敬请期待'
|
||||
})
|
||||
|
||||
}
|
||||
},
|
||||
navigatorBack() {
|
||||
uni.navigateBack();
|
||||
},
|
||||
actionSett(item, index) {
|
||||
|
||||
if (!this.permissions.includes(item.permission) && this.Status.apiType !== 'listA') {
|
||||
|
||||
this.showPop({
|
||||
message: '无操作权限',
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
okCallback: null,
|
||||
buttonText: "确定"
|
||||
})
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (item.group == 'sta_LedType') {
|
||||
this.sosSetting(item, index);
|
||||
return;
|
||||
@ -488,7 +689,7 @@
|
||||
|
||||
if (item.group == 'sta_RadarType') {
|
||||
// this.toggleRedar(item, index);
|
||||
this.showRedarSetting(item,index);
|
||||
this.showRedarSetting(item, index);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -555,24 +756,24 @@
|
||||
|
||||
|
||||
},
|
||||
showRedarSetting(){
|
||||
this.Status.BottomMenu.show=true;
|
||||
this.Status.BottomMenu.showBtn=false;
|
||||
|
||||
this.Status.BottomMenu.title="感应距离设置";
|
||||
|
||||
this.Status.BottomMenu.textAlign="center";
|
||||
|
||||
this.Status.BottomMenu.showMask=true;
|
||||
this.Status.BottomMenu.activeIndex=this.activeIndex;
|
||||
showRedarSetting() {
|
||||
this.Status.BottomMenu.show = true;
|
||||
this.Status.BottomMenu.showBtn = false;
|
||||
|
||||
this.Status.BottomMenu.title = "感应距离设置";
|
||||
|
||||
this.Status.BottomMenu.textAlign = "center";
|
||||
|
||||
this.Status.BottomMenu.showMask = true;
|
||||
this.Status.BottomMenu.activeIndex = this.activeIndex;
|
||||
},
|
||||
btnClick(item,index){
|
||||
this.Status.BottomMenu.show=false;
|
||||
console.log("选中的项:"+index+",值:"+JSON.stringify(item));
|
||||
this.toggleRedar(item,index);
|
||||
btnClick(item, index) {
|
||||
this.Status.BottomMenu.show = false;
|
||||
console.log("选中的项:" + index + ",值:" + JSON.stringify(item));
|
||||
this.toggleRedar(item, index);
|
||||
},
|
||||
closeActionSheet(){
|
||||
this.Status.BottomMenu.show=false;
|
||||
closeActionSheet() {
|
||||
this.Status.BottomMenu.show = false;
|
||||
},
|
||||
toggleRedar(item, index) { //雷达启停
|
||||
let f = this.getDevice();
|
||||
@ -601,7 +802,7 @@
|
||||
.then(res => {
|
||||
debugger;
|
||||
this.formData.sta_RadarType = val;
|
||||
this.Status.BottomMenu.activeIndex=index;
|
||||
this.Status.BottomMenu.activeIndex = index;
|
||||
these.setBleFormData();
|
||||
resolve();
|
||||
})
|
||||
@ -642,6 +843,19 @@
|
||||
|
||||
sosSetting(item, isOk) {
|
||||
|
||||
if (!this.permissions.includes('46') && this.Status.apiType !== 'listA') {
|
||||
|
||||
this.showPop({
|
||||
message: '无操作权限',
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
okCallback: null,
|
||||
buttonText: "确定"
|
||||
})
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.key == 'led_alarm' && this.formData.sta_LedType == 'led_alarm') {
|
||||
return;
|
||||
}
|
||||
@ -817,59 +1031,66 @@
|
||||
let json = recei.ReceiveData(receive, device, pagePath, recArr);
|
||||
|
||||
console.log("json=", json)
|
||||
setTimeout(()=>{
|
||||
this.getWarns();
|
||||
},500);
|
||||
|
||||
|
||||
|
||||
let active=-1;
|
||||
let f=this.Status.BottomMenu.menuItems.find((item,index)=>{
|
||||
|
||||
if(item.value===json.sta_RadarType){
|
||||
active=index;
|
||||
|
||||
let active = -1;
|
||||
let f = this.Status.BottomMenu.menuItems.find((item, index) => {
|
||||
|
||||
if (item.value === json.sta_RadarType) {
|
||||
active = index;
|
||||
}
|
||||
});
|
||||
this.Status.BottomMenu.activeIndex=active;
|
||||
this.Status.BottomMenu.activeIndex = active;
|
||||
|
||||
let msg = [];
|
||||
if (json.sta_PowerPercent <= 20 && (json.sta_charge===0 || json.sta_charge==='0')) {
|
||||
if (json.sta_PowerPercent <= 20 && (json.sta_charge === 0 || json.sta_charge === '0')) {
|
||||
msg.push("设备电量低");
|
||||
}
|
||||
|
||||
if(json.sta_sosadd_off){//某个设备解除报警
|
||||
this.warnDevices.filter((d,index)=>{
|
||||
if(d.mac===json.sta_sosadd_off){
|
||||
this.warnDevices.splice(index,1);
|
||||
|
||||
if (json.sta_sosadd_off) { //某个设备解除报警
|
||||
this.warnDevices.filter((d, index) => {
|
||||
if (d.mac === json.sta_sosadd_off) {
|
||||
this.warnDevices.splice(index, 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
let keys = Object.keys(json);
|
||||
|
||||
|
||||
keys.forEach(key => {
|
||||
if (key in this.formData) {
|
||||
// console.log("key=",key+",value=",json[key]);
|
||||
this.formData[key] = json[key];
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (json.sta_sosadd) {//某个设备闯入报警
|
||||
console.log("查询设备中",json.sta_sosadd);
|
||||
|
||||
if (json.sta_sosadd) { //某个设备闯入报警
|
||||
console.log("查询设备中", json.sta_sosadd);
|
||||
this.searchDevice(json.sta_sosadd).catch(ex => {}).then(dev => {
|
||||
console.log("dev=", dev);
|
||||
let d=this.warnDevices.find(v=>{return v.mac===json.sta_sosadd});
|
||||
let deviceName="";
|
||||
let d = this.warnDevices.find(v => {
|
||||
return v.mac === json.sta_sosadd
|
||||
});
|
||||
let deviceName = "";
|
||||
if (dev) {
|
||||
// this.formData.sta_sosName=dev.deviceName;
|
||||
msg.push('"' + dev.deviceName + '"闯入报警中');
|
||||
deviceName=dev.deviceName;
|
||||
|
||||
deviceName = dev.deviceName;
|
||||
|
||||
} else {
|
||||
msg.push('闯入报警中');
|
||||
// this.formData.sta_sosName="";
|
||||
}
|
||||
if(!d){
|
||||
this.warnDevices.push({mac:json.sta_sosadd,name:deviceName});
|
||||
if (!d) {
|
||||
this.warnDevices.push({
|
||||
mac: json.sta_sosadd,
|
||||
name: deviceName
|
||||
});
|
||||
}
|
||||
this.showMsg(msg.join(','));
|
||||
});
|
||||
@ -898,7 +1119,7 @@
|
||||
},
|
||||
|
||||
getWarDevice(macStr) {
|
||||
console.log("macStr=",macStr);
|
||||
console.log("macStr=", macStr);
|
||||
if (macStr) {
|
||||
|
||||
if (!macStr.includes(':')) {
|
||||
@ -1158,6 +1379,11 @@
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.uninavebartext {
|
||||
width: 100%;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 30rpx;
|
||||
box-sizing: border-box;
|
||||
@ -1919,4 +2145,65 @@
|
||||
letter-spacing: 0.07px;
|
||||
|
||||
}
|
||||
|
||||
.navbarRight {
|
||||
width: 60px;
|
||||
height: 100%;
|
||||
|
||||
}
|
||||
|
||||
.navbarRight .imgContent {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.navbarRight .imgContent:first-child {
|
||||
margin-right: 36rpx;
|
||||
width: 38rpx !important;
|
||||
height: 38rpx !important;
|
||||
margin-top: -2rpx;
|
||||
}
|
||||
|
||||
.navbarRight .imgContent .baber {
|
||||
position: absolute;
|
||||
z-index: 100;
|
||||
width: 30rpx;
|
||||
height: 30rpx;
|
||||
line-height: 30rpx;
|
||||
right: -15rpx;
|
||||
top: -15rpx;
|
||||
border-radius: 50%;
|
||||
background: #f12828;
|
||||
color: #ffffff;
|
||||
font-family: 'PingFang SC';
|
||||
font-style: Regular;
|
||||
font-size: 20rpx;
|
||||
font-weight: 400;
|
||||
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
|
||||
}
|
||||
|
||||
.navbarRight .imgContent .img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.navbarRight .imgContent .img:last-child {
|
||||
padding: 1rpx;
|
||||
}
|
||||
|
||||
.nvbar {
|
||||
top: 0px;
|
||||
}
|
||||
|
||||
/deep/ .uni-navbar--fixed {
|
||||
top: 0px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user