Merge branch 'main' of http://47.107.152.87:3000/dyf/APP
This commit is contained in:
@ -255,10 +255,7 @@
|
||||
hideLoading,
|
||||
updateLoading
|
||||
} from '@/utils/loading.js'
|
||||
import {
|
||||
request,
|
||||
baseURL
|
||||
} from '../../utils/request';
|
||||
import request, { baseURL } from '@/utils/request.js';
|
||||
|
||||
import Common from '@/utils/Common.js'
|
||||
const pagePath = "/pages/100/HBY100";
|
||||
|
||||
@ -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>
|
||||
1327
pages/102/HBY102_History.vue
Normal file
1327
pages/102/HBY102_History.vue
Normal file
File diff suppressed because it is too large
Load Diff
@ -228,7 +228,7 @@
|
||||
:key="index"
|
||||
>
|
||||
<checkbox
|
||||
v-model="selectedSoundFiles"
|
||||
|
||||
:value="file"
|
||||
@change="handleSoundFileSelect"
|
||||
/>
|
||||
@ -356,9 +356,7 @@
|
||||
laserModeSettings, //激光模式设置
|
||||
mapReverseGeocoding //地图逆解析
|
||||
} from '@/api/6170/deviceControl.js'
|
||||
import {
|
||||
getDeviceId
|
||||
} from '../../store/BLETools';
|
||||
|
||||
import {
|
||||
baseURL,
|
||||
getToken,
|
||||
|
||||
@ -107,7 +107,7 @@
|
||||
|
||||
<view class="lampMode">
|
||||
<view class="colorContent">
|
||||
<view v-for="item,index in dic.groups" class="item"
|
||||
<view v-for="item,index in formData.groups" class="item"
|
||||
:class="{active:item.id==formData.sta_GroupType,marginNoLeft:index%3===0}"
|
||||
@click.stop="groupSetting(item,index)">
|
||||
|
||||
@ -125,15 +125,15 @@
|
||||
<view class="lamp noPadding">
|
||||
<view class="title">箭头模式</view>
|
||||
<view class="smlltitle">
|
||||
箭头朝向
|
||||
朝向/颜色
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view class="arrowContent marginTop10">
|
||||
<view class="modeSetting">
|
||||
|
||||
<view class="arrow" @click.stop="ArrowSet('red_front')"
|
||||
:class="formData.sta_ArrowType=='red_front'?'active':''">
|
||||
<view class="arrow" @click.stop="ArrowModeSet('right_off')"
|
||||
:class="formData.sta_ArrowMode=='right_off'?'active':''">
|
||||
<view class="outCircle">
|
||||
<view class="item">
|
||||
<image class="img nomal" src="/static/images/4877/arrow.png" mode="aspectFit"></image>
|
||||
@ -141,10 +141,10 @@
|
||||
</image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="text">红色朝前</view>
|
||||
<view class="text">朝左</view>
|
||||
</view>
|
||||
<view class="arrow" @click.stop="ArrowSet('green_back')"
|
||||
:class="formData.sta_ArrowType=='green_back'?'active':''">
|
||||
<view class="arrow" @click.stop="ArrowModeSet('right_on')"
|
||||
:class="formData.sta_ArrowMode=='right_on'?'active':''">
|
||||
<view class="outCircle">
|
||||
<view class="item">
|
||||
<image class="img nomal translate" src="/static/images/4877/arrow.png" mode="aspectFit">
|
||||
@ -153,10 +153,37 @@
|
||||
mode="aspectFit"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="text">绿色朝后</view>
|
||||
<view class="text">朝右</view>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
|
||||
<view class="modeSetting">
|
||||
|
||||
<view class="arrow" @click.stop="ArrowSet('red_front')"
|
||||
:class="formData.sta_ArrowType=='red_front'?'redactive':''">
|
||||
<view class="outCircle">
|
||||
<view class="item">
|
||||
<view class="text">红色</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="arrow" @click.stop="ArrowSet('green_back')"
|
||||
:class="formData.sta_ArrowType=='green_back'?'greenactive':''">
|
||||
<view class="outCircle">
|
||||
<view class="item">
|
||||
<view class="text">绿色</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<view class="lamp noPadding">
|
||||
@ -248,14 +275,11 @@
|
||||
hideLoading,
|
||||
updateLoading
|
||||
} from '@/utils/loading.js'
|
||||
import {
|
||||
request,
|
||||
baseURL
|
||||
} from '../../utils/request';
|
||||
import request, { baseURL } from '@/utils/request.js';
|
||||
import {
|
||||
colors as groupColors
|
||||
} from '@/api/4877/BJQ4877.js';
|
||||
|
||||
|
||||
import MqTool from '@/utils/MqHelper.js'
|
||||
|
||||
const pagePath = "/pages/4877/BJQ4877";
|
||||
@ -265,7 +289,7 @@
|
||||
var recei = null;
|
||||
var interval = null;
|
||||
var slidTime = null;
|
||||
var mq=null;
|
||||
var mq = null;
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@ -346,7 +370,11 @@
|
||||
sta_GroupType: -1, //配组
|
||||
sta_ArrowType: '', //箭头方向
|
||||
warnTime: 0,
|
||||
sta_Channel: 80
|
||||
sta_Channel: 31,
|
||||
sta_ArrowMode:'',
|
||||
groups: [
|
||||
|
||||
]
|
||||
},
|
||||
dic: {
|
||||
SOS: [{
|
||||
@ -361,10 +389,8 @@
|
||||
img: '/static/images/4877/fan.png',
|
||||
activeImg: '/static/images/4877/fanActive.png'
|
||||
}
|
||||
],
|
||||
groups: [
|
||||
|
||||
]
|
||||
|
||||
},
|
||||
device: {
|
||||
id: "",
|
||||
@ -391,19 +417,19 @@
|
||||
onUnload() {
|
||||
console.log("页面卸载,释放资源");
|
||||
ble.removeAllCallback(pagePath);
|
||||
if(mq){
|
||||
mq.unSubscribes();
|
||||
mq.disconnect();
|
||||
if (mq) {
|
||||
mq.unSubscribes();
|
||||
mq.disconnect();
|
||||
}
|
||||
ble=null;
|
||||
mq=null;
|
||||
ble = null;
|
||||
mq = null;
|
||||
clearInterval(interval);
|
||||
},
|
||||
onLoad: function() {
|
||||
these = this;
|
||||
recei = BleReceive.getBleReceive();
|
||||
ble = BleTool.getBleTool();
|
||||
mq=MqTool.getMqTool();
|
||||
mq = MqTool.getMqTool();
|
||||
this.dic.gropus = [];
|
||||
|
||||
|
||||
@ -433,19 +459,28 @@
|
||||
return false;
|
||||
});
|
||||
|
||||
these.dic.groups = groups;
|
||||
these.formData.groups = groups;
|
||||
|
||||
}
|
||||
var device = data.data;
|
||||
these.device = device;
|
||||
|
||||
let arr=[{topic:'C/4877_Groups_'+these.device.id,callback:these.getCheckedColors}];
|
||||
mq.init().then(res=>{
|
||||
mq.subscribes(arr).catch(ex=>{
|
||||
console.error("ex=",ex);
|
||||
|
||||
let arr = [{
|
||||
topic: 'C/4877_Groups_' + these.device.id,
|
||||
callback: these.getCheckedColors
|
||||
}
|
||||
// ,
|
||||
// {
|
||||
// topic: 'C/4877_Channel_' + these.device.id,
|
||||
// callback: these.getChannel
|
||||
// }
|
||||
];
|
||||
mq.init().then(res => {
|
||||
mq.subscribes(arr).catch(ex => {
|
||||
console.error("ex=", ex);
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
if (v.macAddress == device.deviceMac) {
|
||||
// console.log("找到设备了", v);
|
||||
@ -474,8 +509,8 @@
|
||||
|
||||
these.formData.bleStatu = false;
|
||||
these.formData.deviceId = f.deviceId;
|
||||
these.formData.warnTime=null;
|
||||
these.formData.sta_SOSType='sos_off';
|
||||
these.formData.warnTime = null;
|
||||
these.formData.sta_SOSType = 'sos_off';
|
||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||
these.formData.bleStatu = true;
|
||||
});
|
||||
@ -496,38 +531,53 @@
|
||||
|
||||
},
|
||||
methods: {
|
||||
getCheckedColors(rec){
|
||||
console.error("收到MQ消息:",rec);
|
||||
try{
|
||||
|
||||
let str=rec.receive.payloadString;
|
||||
let arr=JSON.parse(str);
|
||||
|
||||
|
||||
let groups = groupColors.filter((v,index) => {
|
||||
if(arr[index]===1){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
these.dic.groups = groups;
|
||||
|
||||
let checks = groups.map(item => {
|
||||
return item.id
|
||||
});
|
||||
|
||||
uni.setStorage({
|
||||
key: "4877CheckColor_" + this.device.id,
|
||||
data: checks
|
||||
});
|
||||
|
||||
|
||||
}catch(err){
|
||||
|
||||
getChannel(rec) {
|
||||
console.error("收到MQ信道保留消息:", rec);
|
||||
try {
|
||||
|
||||
let str = rec.receive.payloadString;
|
||||
let json = JSON.parse(str);
|
||||
if('ins_channel' in json){
|
||||
this.formData.sta_Channel=json.ins_channel;
|
||||
these.setBleFormData();
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
getCheckedColors(rec) {
|
||||
console.error("收到MQ消息:", rec);
|
||||
try {
|
||||
|
||||
let str = rec.receive.payloadString;
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
|
||||
let groups = groupColors.filter((v, index) => {
|
||||
if (arr[index] === 1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
these.formData.groups = groups;
|
||||
console.error("groups=",these.formData.groups);
|
||||
let checks = groups.map(item => {
|
||||
return item.id
|
||||
});
|
||||
|
||||
uni.setStorage({
|
||||
key: "4877CheckColor_" + this.device.id,
|
||||
data: checks
|
||||
});
|
||||
|
||||
|
||||
} catch (err) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
ShowChannelEdit() {
|
||||
this.Status.ShowEditChannel = true;
|
||||
@ -547,15 +597,15 @@
|
||||
promptTitle: '',
|
||||
modelValue: '',
|
||||
visibleClose: false,
|
||||
okCallback: ()=>{
|
||||
okCallback: () => {
|
||||
this.onChannelChanging();
|
||||
this.Status.ShowEditChannel=false;
|
||||
this.Status.ShowEditChannel = false;
|
||||
},
|
||||
showSlot: true,
|
||||
buttonCancelText: '取消',
|
||||
showCancel: true,
|
||||
cancelCallback:()=>{
|
||||
this.Status.ShowEditChannel=false;
|
||||
cancelCallback: () => {
|
||||
this.Status.ShowEditChannel = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -566,7 +616,7 @@
|
||||
return;
|
||||
}
|
||||
let f = this.getDevice();
|
||||
|
||||
|
||||
if (!f) {
|
||||
this.showBleUnConnect();
|
||||
return;
|
||||
@ -580,6 +630,14 @@
|
||||
json = JSON.stringify(json);
|
||||
ble.sendString(f.deviceId, json, f.writeServiceId, f.wirteCharactId, 30).then(res => {
|
||||
console.log("发送成功");
|
||||
|
||||
// mq.sendData('C/4877_Channel_' + these.device.id, JSON.stringify(json), true).then(
|
||||
// res => {
|
||||
// console.log("发送成功,", res)
|
||||
// }).catch(err => {
|
||||
// console.error("err=", err);
|
||||
// });
|
||||
|
||||
this.setBleFormData();
|
||||
}).catch(ex => {
|
||||
this.showMsg(ex.msg);
|
||||
@ -587,6 +645,31 @@
|
||||
}, 200)
|
||||
|
||||
|
||||
},
|
||||
ArrowModeSet(val) {
|
||||
if (this.formData.sta_SOSType === 'sos') {
|
||||
this.showMsg("设备强制报警中,请先关闭报警")
|
||||
return;
|
||||
}
|
||||
|
||||
let f = this.getDevice();
|
||||
if (!f) {
|
||||
this.showBleUnConnect();
|
||||
return;
|
||||
}
|
||||
if (this.formData.sta_ArrowMode === val) {
|
||||
return;
|
||||
}
|
||||
|
||||
var json = {
|
||||
ins_right_side: val
|
||||
}
|
||||
json = JSON.stringify(json);
|
||||
ble.sendString(f.deviceId, json, f.writeServiceId, f.wirteCharactId, 30).then(res => {
|
||||
this.formData.sta_ArrowMode = val;
|
||||
}).catch(ex => {
|
||||
this.showMsg(ex.msg);
|
||||
});
|
||||
},
|
||||
ArrowSet(val) {
|
||||
if (this.formData.sta_SOSType === 'sos') {
|
||||
@ -631,7 +714,7 @@
|
||||
return false;
|
||||
});
|
||||
|
||||
these.dic.groups = arr;
|
||||
these.formData.groups = arr;
|
||||
these.CheckGroupOver(data.allFlag);
|
||||
}
|
||||
},
|
||||
@ -648,17 +731,17 @@
|
||||
return;
|
||||
}
|
||||
|
||||
mq.sendData('C/4877_Groups_'+these.device.id,JSON.stringify(arr),true).then(res=>{
|
||||
console.log("发送成功,",res)
|
||||
}).catch(err=>{
|
||||
console.error("err=",err);
|
||||
mq.sendData('C/4877_Groups_' + these.device.id, JSON.stringify(arr), true).then(res => {
|
||||
console.log("发送成功,", res)
|
||||
}).catch(err => {
|
||||
console.error("err=", err);
|
||||
});
|
||||
var json = {
|
||||
ins_GroupType: arr
|
||||
}
|
||||
json = JSON.stringify(json);
|
||||
ble.sendString(f.deviceId, json, f.writeServiceId, f.wirteCharactId, 30).then(res => {
|
||||
|
||||
this.setBleFormData();
|
||||
}).catch(ex => {
|
||||
this.showMsg(ex.msg);
|
||||
});
|
||||
@ -672,11 +755,11 @@
|
||||
// borderColor: "#e034344d",
|
||||
// buttonBgColor: "#E03434",
|
||||
// okCallback: () => {
|
||||
clearInterval(interval);
|
||||
clearInterval(interval);
|
||||
|
||||
this.sosSetting({
|
||||
val: val
|
||||
});
|
||||
this.sosSetting({
|
||||
val: val
|
||||
});
|
||||
// },
|
||||
// buttonText: "解除",
|
||||
// showCancel: true,
|
||||
@ -715,21 +798,21 @@
|
||||
}
|
||||
groupSet();
|
||||
},
|
||||
SOSEvt(){
|
||||
SOSEvt() {
|
||||
if (this.formData.sta_SOSType == 'sos') {
|
||||
this.formData.sta_ArrowType='arrow_off';
|
||||
this.formData.sta_ArrowType = 'arrow_off';
|
||||
this.formData.warnTime = 0;
|
||||
clearInterval(interval);
|
||||
interval = setInterval(() => {
|
||||
this.formData.warnTime += 1;
|
||||
}, 1000)
|
||||
}else{
|
||||
} else {
|
||||
clearInterval(interval);
|
||||
interval=null;
|
||||
interval = null;
|
||||
this.formData.warnTime = 0;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
sosSetting(item, index) {
|
||||
|
||||
let f = this.getDevice();
|
||||
@ -750,7 +833,7 @@
|
||||
ble.sendString(f.deviceId, json, f.writeServiceId, f.wirteCharactId, 30).then(res => {
|
||||
this.formData.sta_GroupType = -1;
|
||||
this.formData.sta_SOSType = json.ins_SOSType
|
||||
|
||||
|
||||
these.SOSEvt();
|
||||
|
||||
})
|
||||
@ -759,9 +842,9 @@
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
let confirmTask=()=>{
|
||||
|
||||
|
||||
let confirmTask = () => {
|
||||
this.showPop({
|
||||
message: '确定' + (this.formData.sta_SOSType === 'sos' ? '关闭' : '开启') + '声光报警模式?',
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||
@ -777,14 +860,14 @@
|
||||
confirmTask();
|
||||
|
||||
} else if (item.val === 'sos_off') {
|
||||
|
||||
if(this.formData.sta_SOSType === 'sos'){
|
||||
|
||||
if (this.formData.sta_SOSType === 'sos') {
|
||||
confirmTask();
|
||||
}else{
|
||||
} else {
|
||||
task();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
if (this.formData.sta_SOSType === 'sos') {
|
||||
@ -922,14 +1005,14 @@
|
||||
this.formData[key] = data[key];
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
let msg = [];
|
||||
if (data.sta_SOSType == 'sos') {
|
||||
msg.push("设备声光报警中");
|
||||
|
||||
|
||||
}
|
||||
if('sta_SOSType' in data){
|
||||
if ('sta_SOSType' in data) {
|
||||
these.SOSEvt();
|
||||
}
|
||||
if (data.sta_PowerPercent <= 20) {
|
||||
@ -1566,7 +1649,7 @@
|
||||
border-radius: 16rpx;
|
||||
background: rgba(26, 26, 26, 1);
|
||||
width: 100%;
|
||||
padding: 10rpx 0rpx;
|
||||
padding: 20rpx 0rpx;
|
||||
}
|
||||
|
||||
.modeSetting {
|
||||
@ -1600,7 +1683,22 @@
|
||||
letter-spacing: 0.14rpx;
|
||||
|
||||
}
|
||||
|
||||
|
||||
.modeSetting .arrow .outCircle .text {
|
||||
margin-top:0rpx !important;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
.arrowContent .line {
|
||||
width:calc(100% - 60rpx);
|
||||
|
||||
height: 0rpx;
|
||||
border-bottom:1px solid #ffffff30;
|
||||
margin: 30rpx ;
|
||||
}
|
||||
.modeSetting .arrow .outCircle {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
@ -1632,6 +1730,8 @@
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.modeSetting .arrow.active .outCircle {
|
||||
border: 4rpx solid rgba(174, 214, 0, 1);
|
||||
padding: 4rpx;
|
||||
@ -1642,6 +1742,35 @@
|
||||
border-radius: 50%;
|
||||
|
||||
}
|
||||
|
||||
|
||||
.modeSetting .arrow.redactive .outCircle {
|
||||
border: 4rpx solid #EC2A2A;
|
||||
padding: 4rpx;
|
||||
}
|
||||
|
||||
.modeSetting .arrow.redactive .item {
|
||||
background: #EC2A2A;
|
||||
border-radius: 50%;
|
||||
|
||||
}
|
||||
|
||||
.modeSetting .arrow.greenactive .outCircle {
|
||||
border: 4rpx solid #00BD00;
|
||||
padding: 4rpx;
|
||||
}
|
||||
|
||||
.modeSetting .arrow.greenactive .item {
|
||||
background: #00BD00;
|
||||
border-radius: 50%;
|
||||
|
||||
}
|
||||
|
||||
.modeSetting .arrow.redactive .item .text,
|
||||
.modeSetting .arrow.greenactive .item .text{
|
||||
color:#FFFFFFde !important;
|
||||
}
|
||||
|
||||
|
||||
.modeSetting .item .img {
|
||||
width: 52rpx;
|
||||
|
||||
@ -240,10 +240,7 @@
|
||||
hideLoading,
|
||||
updateLoading
|
||||
} from '@/utils/loading.js'
|
||||
import {
|
||||
request,
|
||||
baseURL
|
||||
} from '../../utils/request';
|
||||
import request, { baseURL } from '@/utils/request.js';
|
||||
|
||||
import usrApi from '@/api/670/HBY670.js'
|
||||
const pagePath = "/pages/4877/BJQ4877";
|
||||
|
||||
1968
pages/6107/BJQ6107.vue
Normal file
1968
pages/6107/BJQ6107.vue
Normal file
File diff suppressed because it is too large
Load Diff
2166
pages/6155/BJQ6155.vue
Normal file
2166
pages/6155/BJQ6155.vue
Normal file
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,7 @@
|
||||
|
||||
|
||||
<qf-image-cropper :src="src" :showAngle="false" :width="cropWidth" :height="cropHeight" fileType="jpg"
|
||||
@crop="handleCrop" :gpu="true">
|
||||
@crop="handleCrop" :areaScale="0.1" :minScale="0.1" :gpu="true">
|
||||
</qf-image-cropper>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -234,10 +234,7 @@
|
||||
hideLoading,
|
||||
updateLoading
|
||||
} from '@/utils/loading.js'
|
||||
import {
|
||||
request,
|
||||
baseURL
|
||||
} from '../../utils/request';
|
||||
import request, { baseURL } from '@/utils/request.js';
|
||||
|
||||
import usrApi from '@/api/670/HBY670.js'
|
||||
const pagePath = "pages/6331/BJQ6331";
|
||||
|
||||
@ -56,6 +56,10 @@
|
||||
</view>
|
||||
|
||||
<view class="modeSetting">
|
||||
<view class="item" :class="formData.modeCurr=='smalllow'?'active':''"
|
||||
@click="MainModeSetting('smalllow','staticBattery')">
|
||||
<view class="p100 center">前置</view>
|
||||
</view>
|
||||
<view class="item" :class="formData.modeCurr=='low'?'active':''"
|
||||
@click="MainModeSetting('low','staticBattery')">
|
||||
<view class="p100 center">低档</view>
|
||||
@ -68,10 +72,14 @@
|
||||
@click="MainModeSetting('hight','staticBattery')">
|
||||
<view class="p100 center">高档</view>
|
||||
</view>
|
||||
<view class="item " :class="formData.modeCurr=='close'?'active':''"
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- <view class="item " :class="formData.modeCurr=='close'?'active':''"
|
||||
@click="MainModeSetting('close','staticBattery')">
|
||||
<view class="p100 center">关闭</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<view class="lampMode">
|
||||
<view class="mode fleft" :class="formData.cMode?'active':''" v-on:click.stop="LampToggle()">
|
||||
@ -181,10 +189,7 @@
|
||||
hideLoading,
|
||||
updateLoading
|
||||
} from '@/utils/loading.js'
|
||||
import {
|
||||
request,
|
||||
baseURL
|
||||
} from '../../utils/request';
|
||||
import request, { baseURL } from '@/utils/request.js';
|
||||
|
||||
import usrApi from '@/api/670/HBY670.js'
|
||||
const pagePath = "/pages/650/HBY650";
|
||||
@ -335,6 +340,7 @@
|
||||
|
||||
|
||||
these.showBleUnConnect();
|
||||
console.error("111111");
|
||||
these.getDetail();
|
||||
return;
|
||||
}
|
||||
@ -348,13 +354,14 @@
|
||||
}
|
||||
these.formData.blename = f.name ? f.name : "Unname";
|
||||
these.formData.deviceName = device.deviceName;
|
||||
|
||||
|
||||
these.formData.bleStatu = false;
|
||||
these.formData.deviceId = f.deviceId;
|
||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||
these.formData.bleStatu = true;
|
||||
});
|
||||
these.setBleFormData();
|
||||
console.error("222222");
|
||||
these.getDetail();
|
||||
|
||||
|
||||
@ -566,7 +573,7 @@
|
||||
getDetail() {
|
||||
var that = this;
|
||||
usrApi.getDetail(this.device.id).then(res => {
|
||||
console.log("res=", res);
|
||||
console.log("获取人员信息=", res);
|
||||
if (res && res.code == 200) {
|
||||
res = res.data;
|
||||
let personnelInfo = res.personnelInfo;
|
||||
@ -575,8 +582,24 @@
|
||||
that.formData.name = personnelInfo.name;
|
||||
that.formData.job = personnelInfo.position;
|
||||
that.formData.id = personnelInfo.code
|
||||
return;
|
||||
}
|
||||
}
|
||||
let phone = uni.getStorageSync('phone');
|
||||
if (phone === '17671332251') {
|
||||
console.log("default=",that.device);
|
||||
that.formData.company = '湖北消防总队';
|
||||
that.formData.name = '胡红军';
|
||||
that.formData.job = '中队长';
|
||||
let arr=that.device.bluetoothName.split('-');
|
||||
if(arr.length>1){
|
||||
that.formData.id =arr[arr.length-1];
|
||||
}else{
|
||||
that.formData.id =that.device.bluetoothName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
@ -594,16 +617,19 @@
|
||||
},
|
||||
MainModeSetting: function(type, byteType) {
|
||||
if (this.formData.modeCurr == type) {
|
||||
return;
|
||||
type = 'close';
|
||||
}
|
||||
showLoading(this, {
|
||||
text: "请稍候..."
|
||||
});
|
||||
let task = () => {
|
||||
this.formData.modeCurr = type;
|
||||
|
||||
let dataValue = 0x00;
|
||||
let btype = 0x00;
|
||||
switch (type) {
|
||||
case "smalllow":
|
||||
dataValue = 0x68;
|
||||
break;
|
||||
case "low": //低档
|
||||
dataValue = 0x67;
|
||||
break;
|
||||
@ -655,8 +681,7 @@
|
||||
// 发送数据
|
||||
|
||||
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 10).then(() => {
|
||||
|
||||
|
||||
this.formData.modeCurr = type;
|
||||
console.log("发送成功了");
|
||||
}).catch((ex) => {
|
||||
|
||||
@ -1084,10 +1109,12 @@
|
||||
hideLoading(these);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("baseURL=", baseURL);
|
||||
console.log("token", token);
|
||||
console.log("clientID", clientid);
|
||||
uni.uploadFile({
|
||||
// url: 'http://114.55.111.217/video/upload',
|
||||
url: baseURL + "app/video/upload",
|
||||
url: baseURL + "/app/video/upload",
|
||||
filePath: videoPath,
|
||||
name: 'file',
|
||||
header: {
|
||||
@ -1115,6 +1142,7 @@
|
||||
|
||||
let res = arr[1];
|
||||
res = JSON.parse(res.data);
|
||||
|
||||
if (res.data) {
|
||||
these.videoHexArray = res.data;
|
||||
updateLoading(these, {
|
||||
|
||||
@ -1,10 +1,21 @@
|
||||
<template>
|
||||
<view class="content contentBg">
|
||||
<custom-navbar :title="Status.navbar.title" :showBack="Status.navbar.showBack" color="#FFFFFF"
|
||||
:rightIcons="Status.navbar.icons" @icon-click="handleRightClick"></custom-navbar>
|
||||
<view>
|
||||
<!-- <custom-navbar :title="Status.navbar.title" :showBack="Status.navbar.showBack" color="#FFFFFF"
|
||||
:rightIcons="Status.navbar.icons" @icon-click="handleRightClick" backgroundColor="#121212"></custom-navbar>
|
||||
-->
|
||||
<uni-nav-bar :border="false" @clickLeft="prevPage" fixed="true" statusBar="true"
|
||||
background-color="#121212" color="#FFFFFF" :title="Status.navbar.title">
|
||||
<template v-slot:left><view>
|
||||
<uni-icons type="left" size="24" color="#FFFFFF"></uni-icons>
|
||||
</view></template>
|
||||
<block slot="right">
|
||||
<view class="navbarRight center">
|
||||
<image @click.stop="handleRightClick(index,item)" v-for="item,index in Status.navbar.icons" class="img" :src="item.src" mode="aspectFit"></image>
|
||||
</view>
|
||||
|
||||
</block>
|
||||
</uni-nav-bar>
|
||||
|
||||
</view>
|
||||
<view class="eq" :style="{marginTop:Status.navbar.height+'px'}">
|
||||
<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>
|
||||
@ -90,8 +101,7 @@
|
||||
<view :class="getWarnStyle(5)" class="net netfive"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="warnnig" :class="formData.qzwarn ?'':'displayNone'"
|
||||
@click="CloseWarn(true)">
|
||||
<view class="warnnig" :class="formData.qzwarn ?'':'displayNone'" @click="CloseWarn(true)">
|
||||
<view>设备强制报警中!</view>
|
||||
<view class="netContent" :class="{'displayNone':!Status.staticWarn.time}">
|
||||
{{Status.staticWarn.time}}s
|
||||
@ -219,8 +229,8 @@
|
||||
<view>
|
||||
|
||||
<view class="item">
|
||||
<input maxlength="16" class="value" style="text-indent: 20rpx;" v-model="formData.msgTxt" placeholder="请输入文字"
|
||||
placeholder-class="usrplace" />
|
||||
<input maxlength="16" class="value" style="text-indent: 20rpx;" v-model="formData.msgTxt"
|
||||
placeholder="请输入文字" placeholder-class="usrplace" />
|
||||
</view>
|
||||
|
||||
</view>
|
||||
@ -294,11 +304,8 @@
|
||||
hideLoading,
|
||||
updateLoading
|
||||
} from '@/utils/loading.js'
|
||||
import {
|
||||
request,
|
||||
baseURL
|
||||
} from '../../utils/request';
|
||||
import lnglatConvert from '@/utils/wgs84_to_gcj02.js'
|
||||
import request, { baseURL } from '@/utils/request.js';
|
||||
import lnglatConvert from '@/utils/wgs84_to_gcj02.js';
|
||||
|
||||
const pagePath = "/pages/670/HBY670";
|
||||
var ble = null;
|
||||
@ -560,6 +567,11 @@
|
||||
|
||||
},
|
||||
methods: {
|
||||
prevPage() {
|
||||
uni.navigateBack({
|
||||
|
||||
})
|
||||
},
|
||||
deviceRecovry(res) {
|
||||
if (this.Status.pageHide) {
|
||||
return;
|
||||
@ -679,20 +691,24 @@
|
||||
});
|
||||
},
|
||||
gotoMap() {
|
||||
let lnglat = lnglatConvert.wgs84_to_gcj02(this.formData.Lon, this.formData.Lat);
|
||||
this.detailData.longitude = lnglat[0];
|
||||
this.detailData.latitude = lnglat[1];
|
||||
uni.navigateTo({
|
||||
url: '/pages/common/map/index',
|
||||
events: {
|
||||
ack: function(data) {}
|
||||
},
|
||||
success: (res) => {
|
||||
res.eventChannel.emit('Map', {
|
||||
data: this.detailData
|
||||
});
|
||||
}
|
||||
})
|
||||
let promise = lnglatConvert.wgs84_to_gcj02(this.formData.Lon, this.formData.Lat);
|
||||
promise.then(lnglat => {
|
||||
|
||||
this.detailData.longitude = lnglat[0];
|
||||
this.detailData.latitude = lnglat[1];
|
||||
uni.navigateTo({
|
||||
url: '/pages/common/map/index',
|
||||
events: {
|
||||
ack: function(data) {}
|
||||
},
|
||||
success: (res) => {
|
||||
res.eventChannel.emit('Map', {
|
||||
data: this.detailData
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
},
|
||||
getDetail() {
|
||||
var that = this;
|
||||
@ -799,7 +815,7 @@
|
||||
return className;
|
||||
},
|
||||
handleRightClick: function(s, e) {
|
||||
|
||||
|
||||
if (s === 0) {
|
||||
console.log("消息");
|
||||
uni.navigateTo({
|
||||
@ -832,8 +848,8 @@
|
||||
},
|
||||
|
||||
initMQ() {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
if (mqttClient) {
|
||||
// console.log("无需再次初始化")
|
||||
resolve();
|
||||
@ -869,7 +885,8 @@
|
||||
if (keys.indexOf('sta_BreakNews') > -
|
||||
1) { //紧急通知
|
||||
if (json.sta_BreakNews ===
|
||||
'I get it') // && this.Status.msgOkTime && this.Status.msgOkIntval){
|
||||
'I get it'
|
||||
) // && this.Status.msgOkTime && this.Status.msgOkIntval){
|
||||
{
|
||||
these.showPop({
|
||||
showPop: true,
|
||||
@ -973,9 +990,9 @@
|
||||
if ("sta_SOSGrade" in json) {
|
||||
let sosText = json.sta_SOSGrade === 2 ? 'rb' : json.sta_SOSGrade === 1 ? "sg" : "close";
|
||||
receiveData.SOS = sosText;
|
||||
|
||||
receiveData.qzwarn=sosText==='sg';
|
||||
|
||||
|
||||
receiveData.qzwarn = sosText === 'sg';
|
||||
|
||||
}
|
||||
|
||||
if ("sta_ShakeBit" in json) {
|
||||
@ -1059,14 +1076,14 @@
|
||||
if (this.formData.imei) {
|
||||
this.initMQ();
|
||||
}
|
||||
let msgs=[];
|
||||
if(this.formData.qzwarn){
|
||||
let msgs = [];
|
||||
if (this.formData.qzwarn) {
|
||||
msgs.push("设备强制报警中");
|
||||
}
|
||||
if (this.formData.staticWarn) { //有静止报警
|
||||
msgs.push("设备静止报警中");
|
||||
}
|
||||
if(msgs.length>0){
|
||||
if (msgs.length > 0) {
|
||||
this.showPop({
|
||||
message: msgs.join(";"),
|
||||
iconUrl: "/static/images/6155/DeviceDetail/warnning.png",
|
||||
@ -1076,7 +1093,7 @@
|
||||
clickEvt: "staticWarn"
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.setBleFormData();
|
||||
},
|
||||
@ -3320,4 +3337,13 @@
|
||||
.net.active {
|
||||
background: #FFFFFF !important;
|
||||
}
|
||||
|
||||
.navbarRight .img{
|
||||
width: 35rpx;
|
||||
height: 35rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
.uni-navbar--fixed{
|
||||
top:0rpx;
|
||||
}
|
||||
</style>
|
||||
@ -483,8 +483,9 @@
|
||||
if (this.Status.pageHide) {
|
||||
return;
|
||||
}
|
||||
|
||||
let json = recei.ReceiveData(receive, device, path, recArr);
|
||||
|
||||
console.log("收到消息:",receive.hexs);
|
||||
if (!json) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
var these = null;
|
||||
var eventChannel = null;
|
||||
var ble = null;
|
||||
|
||||
var inteval=null;
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@ -118,7 +118,7 @@
|
||||
|
||||
onUnload() {
|
||||
console.log("返回取消订阅");
|
||||
|
||||
clearInterval(inteval);
|
||||
ble.removeAllCallback(pagePath);
|
||||
},
|
||||
onLoad(option) {
|
||||
@ -226,7 +226,7 @@
|
||||
}
|
||||
})
|
||||
|
||||
let inteval = setInterval(this.initDevice, 10000);
|
||||
inteval = setInterval(this.initDevice, 10000);
|
||||
}
|
||||
|
||||
|
||||
@ -291,6 +291,7 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
clearInterval(inteval);
|
||||
} else {
|
||||
deviceInvalid();
|
||||
}
|
||||
|
||||
@ -120,6 +120,7 @@
|
||||
var ble = null;
|
||||
var these = null;
|
||||
var eventChannel = null;
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@ -334,7 +335,7 @@
|
||||
|
||||
//搜索到新设备的回调 (Always active)
|
||||
ble.addDeviceFound((arr) => {
|
||||
console.log("--- 收到原始扫描数据 ---", JSON.stringify(arr));
|
||||
// console.log("--- 收到原始扫描数据 ---", JSON.stringify(arr));
|
||||
if (these.Status.isPageHidden) {
|
||||
return;
|
||||
}
|
||||
@ -343,7 +344,7 @@
|
||||
}
|
||||
arr = arr.devices;
|
||||
|
||||
console.log(`本次扫描批次发现 ${arr.length} 个设备`);
|
||||
// console.log(`本次扫描批次发现 ${arr.length} 个设备`);
|
||||
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
let device = arr[i];
|
||||
@ -351,9 +352,9 @@
|
||||
|
||||
let f = these.EquipMents.find((v, index) => {
|
||||
if (v.deviceId == device.deviceId) {
|
||||
console.log(
|
||||
`更新设备信号: ${device.name || device.deviceId}, RSSI: ${device.RSSI}`
|
||||
);
|
||||
// console.log(
|
||||
// `更新设备信号: ${device.name || device.deviceId}, RSSI: ${device.RSSI}`
|
||||
// );
|
||||
these.$set(these.EquipMents[index], 'RSSI', device.RSSI);
|
||||
return true;
|
||||
}
|
||||
@ -361,7 +362,7 @@
|
||||
});
|
||||
|
||||
if (!f) {
|
||||
console.log("+++ 发现新设备,准备添加到列表:", JSON.stringify(device));
|
||||
// console.log("+++ 发现新设备,准备添加到列表:", JSON.stringify(device));
|
||||
|
||||
if (these.device && these.device.bluetoothName && device.name) {
|
||||
if (these.device.bluetoothName === device.name || (device.name && device.name
|
||||
@ -417,27 +418,32 @@
|
||||
|
||||
//收到设备的消息回调
|
||||
ble.addReceiveCallback((receivData, f, path, arr) => {
|
||||
console.log("000000");
|
||||
console.log("000000",receivData);
|
||||
if (these.Status.isPageHidden) {
|
||||
return;
|
||||
}
|
||||
console.log("1111111");
|
||||
if (f.macAddress && these.device) {
|
||||
console.log("222222");
|
||||
clearInterval(this.Status.intval);
|
||||
this.Status.intval = null;
|
||||
this.Status.time = null;
|
||||
|
||||
showLoading(these, {
|
||||
text: '正在验证设备'
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
these.DeviceVerdict(f.deviceId);
|
||||
}, 0);
|
||||
if(receivData.bytes[0]===0xFC && receivData.hexs.length>=7){
|
||||
console.log("22222222");
|
||||
}
|
||||
if(receivData.str.indexOf('mac address:')>-1 || receivData.str.indexOf('sta_address')>-1
|
||||
|| (receivData.bytes[0]===0xFC && receivData.bytes.length>=7))
|
||||
{
|
||||
console.log("1111111");
|
||||
if (f.macAddress && these.device) {
|
||||
console.log("222222");
|
||||
clearInterval(this.Status.intval);
|
||||
this.Status.intval = null;
|
||||
this.Status.time = null;
|
||||
|
||||
showLoading(these, {
|
||||
text: '正在验证设备'
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
these.DeviceVerdict(f.deviceId);
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
}, pagePath);
|
||||
}
|
||||
}
|
||||
@ -452,7 +458,7 @@
|
||||
}
|
||||
|
||||
startValidDevice();
|
||||
these.refreshBleList();
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
@ -502,6 +508,8 @@
|
||||
});
|
||||
},
|
||||
async refreshBleList() {
|
||||
|
||||
|
||||
const systemInfo = uni.getSystemInfoSync();
|
||||
if (systemInfo.uniPlatform == 'web') {
|
||||
return;
|
||||
@ -520,37 +528,42 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ble.StopSearch().finally(() => {
|
||||
|
||||
let disconnectPromises = [];
|
||||
if (ble.data && ble.data.LinkedList) {
|
||||
ble.data.LinkedList.forEach(device => {
|
||||
console.log(`Requesting disconnect for ${device.deviceId}`);
|
||||
disconnectPromises.push(ble.disconnectDevice(device.deviceId));
|
||||
});
|
||||
}
|
||||
|
||||
Promise.allSettled(disconnectPromises).finally(() => {
|
||||
|
||||
these.EquipMents = [];
|
||||
these.PairEquip = [];
|
||||
|
||||
ble.StartSearch().then(result => {
|
||||
console.log("Fresh scan started successfully.");
|
||||
}).catch(err => {
|
||||
console.error("Failed to start fresh scan:", err);
|
||||
if (err.code === 10001) {
|
||||
these.showOpenSetting();
|
||||
} else {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '开始搜索失败:' + err.msg
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
ble.StopSearch().finally(() => {
|
||||
|
||||
let disconnectPromises = [];
|
||||
if (ble.data && ble.data.LinkedList) {
|
||||
ble.data.LinkedList.forEach(device => {
|
||||
console.log(`Requesting disconnect for ${device.deviceId}`);
|
||||
disconnectPromises.push(ble.disconnectDevice(device.deviceId));
|
||||
});
|
||||
}
|
||||
|
||||
Promise.allSettled(disconnectPromises).finally(() => {
|
||||
|
||||
these.EquipMents = [];
|
||||
these.PairEquip = [];
|
||||
|
||||
ble.StartSearch().then(result => {
|
||||
console.log("Fresh scan started successfully.");
|
||||
}).catch(err => {
|
||||
console.error("Failed to start fresh scan:", err);
|
||||
if (err.code === 10001) {
|
||||
these.showOpenSetting();
|
||||
} else {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '开始搜索失败:' + err.msg
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
},
|
||||
isItemLink: function(item, index) {
|
||||
let src = '/static/images/BLEAdd/noLink.png';
|
||||
@ -599,8 +612,6 @@
|
||||
if (index > -1) {
|
||||
this.PairEquip.splice(index, 1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
console.log("f=", f);
|
||||
@ -708,8 +719,8 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
console.log("验证设备")
|
||||
these.DeviceVerdict(item.deviceId);
|
||||
// console.log("验证设备")
|
||||
// these.DeviceVerdict(item.deviceId);
|
||||
}
|
||||
let execLink = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
<view class="alltype">
|
||||
<!-- 车辆列表 -->
|
||||
<view class="vehicle-list" v-if="vehicles.length>0">
|
||||
<view v-for="(item, index) in vehicles" :key="index">
|
||||
<view class="typeContent" v-for="(item, index) in vehicles" :key="index">
|
||||
<view class="vehicle-item" @click="alltypeInfo(item)">
|
||||
<image src="/static/images/common/bip.6.png" mode="" class="IMG"></image>
|
||||
<image :src="item.img" mode="aspectFit" class="IMG"></image>
|
||||
</view>
|
||||
<view class="plate-number">{{ item.typeName }}</view>
|
||||
</view>
|
||||
@ -20,30 +20,130 @@
|
||||
<script>
|
||||
import {
|
||||
deviceTypeList,
|
||||
typeAll
|
||||
} from '@/api/common/index.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
vehicles: [],
|
||||
typeImgs: [{
|
||||
"Name": "HBY018A",
|
||||
"sigName": "018A",
|
||||
"url": "/static/images/common/018A.png"
|
||||
},
|
||||
{
|
||||
"Name": "HBY102",
|
||||
"sigName": "102",
|
||||
"url": "/static/images/common/HBY102.png"
|
||||
},
|
||||
{
|
||||
"Name": "BJQ6075",
|
||||
"sigName": "6075",
|
||||
"url": "/static/images/common/BJQ6075.png"
|
||||
},
|
||||
{
|
||||
"Name": "HBY100",
|
||||
"sigName": "100",
|
||||
"url": "/static/images/common/HBY100J.png"
|
||||
},
|
||||
{
|
||||
"Name": "BJQ4877",
|
||||
"sigName": "4877",
|
||||
"url": "/static/images/common/BJQ4877.png"
|
||||
},
|
||||
{
|
||||
"Name": "BJQ7307",
|
||||
"sigName": "7307",
|
||||
"url": "/static/images/common/7307.png"
|
||||
},
|
||||
{
|
||||
"Name": "BJQ7305",
|
||||
"sigName": "7305",
|
||||
"url": "/static/images/common/7305.png"
|
||||
},
|
||||
{
|
||||
"Name": "HBY650",
|
||||
"sigName": "650",
|
||||
"url": "/static/images/common/HBY650.png"
|
||||
},
|
||||
{
|
||||
"Name": "BJQ6155",
|
||||
"sigName": "6155",
|
||||
"url": "/static/images/common/HBY6155.png"
|
||||
},
|
||||
{
|
||||
"Name": "HBY670",
|
||||
"sigName": "670",
|
||||
"url": "/static/images/common/HBY670.png"
|
||||
},
|
||||
{
|
||||
"Name": "HBY210",
|
||||
"sigName": "210",
|
||||
"url": "/static/images/common/210.png"
|
||||
},
|
||||
{
|
||||
"Name": "BJQ6170",
|
||||
"sigName": "6170",
|
||||
"url": "/static/images/common/bip.6.png"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getTab() {
|
||||
deviceTypeList({}).then((res) => {
|
||||
let p1 = deviceTypeList({});
|
||||
let p2 = typeAll();
|
||||
|
||||
Promise.allSettled([p1, p2]).then(result => {
|
||||
let res = result[0].status === 'fulfilled' ? result[0].value : {};
|
||||
let res1 = result[1].status === 'fulfilled' ? result[1].value : {};
|
||||
if (res.code == 200) {
|
||||
this.vehicles = res.data
|
||||
if (res1.code != 200) {
|
||||
for (let i = 0; i < res.data.length; i++) {
|
||||
let f = this.typeImgs.find(v => {
|
||||
if (res.data[i].typeName.toLowerCase() === v.Name.toLowerCase()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
if (f) {
|
||||
res.data[i].img = f.url;
|
||||
}else{
|
||||
res.data[i].img = "/static/images/common/bip.6.png";
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
let all = res1.data;
|
||||
for (let i = 0; i < res.data.length; i++) {
|
||||
let f = all.find(v => {
|
||||
if (res.data[i].id === v.deviceTypeId) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
if (f && f.devicePic) {
|
||||
res.data[i].img = f.devicePic;
|
||||
}else{
|
||||
res.data[i].img = "/static/images/common/bip.6.png";
|
||||
}
|
||||
}
|
||||
}
|
||||
this.vehicles = res.data;
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
alltypeInfo(item) {
|
||||
uni.switchTab({
|
||||
url: '/pages/common/index/index',
|
||||
success: (res) => {
|
||||
res.eventChannel.emit('index', {
|
||||
data: item
|
||||
});
|
||||
let eventChannel = this.getOpenerEventChannel();
|
||||
eventChannel.emit('index', item);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
@ -65,8 +165,10 @@
|
||||
.vehicle-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: row;
|
||||
align-content: center;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
|
||||
}
|
||||
|
||||
@ -77,14 +179,17 @@
|
||||
}
|
||||
|
||||
.vehicle-item {
|
||||
padding: 24rpx 0;
|
||||
|
||||
background: rgba(26, 26, 26, 1);
|
||||
border-radius: 16rpx;
|
||||
width: 156rpx;
|
||||
height: 156rpx;
|
||||
margin-right: 16rpx;
|
||||
margin-bottom: 16rpx;
|
||||
line-height: 156rpx;
|
||||
border-radius: 9px;
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
|
||||
margin-bottom: 15rpx;
|
||||
|
||||
display: grid;
|
||||
align-content: center;
|
||||
justify-content: center;
|
||||
|
||||
}
|
||||
|
||||
@ -96,6 +201,9 @@
|
||||
|
||||
.plate-number {
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
font-size: 27rpx;
|
||||
font-family: 'PingFang SC';
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.noDATA {
|
||||
@ -103,4 +211,8 @@
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
transform: translate(-0%, 100%);
|
||||
}
|
||||
|
||||
.typeContent {
|
||||
padding-bottom: 15rpx;
|
||||
}
|
||||
</style>
|
||||
@ -24,7 +24,7 @@
|
||||
<view class="Sendmessage" @click="handleSend">发送信息</view>
|
||||
</view>
|
||||
<!-- <scroll-view class="device-list" scroll-y @scrolltolower="onScrollToLower" :lower-threshold="100" style="height:80vh;"> -->
|
||||
<mescroll-uni class="device-list" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption"
|
||||
<mescroll-uni class="device-list" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption"
|
||||
:down="downOption" :fixed="false" :style="{ height: mescrollHeight + 'px' }">
|
||||
<view v-if="deviceList.length>0">
|
||||
<uni-swipe-action ref="swipeAction">
|
||||
@ -146,16 +146,17 @@
|
||||
} from '@/api/common/index.js'
|
||||
import bleTool from '@/utils/BleHelper.js';
|
||||
import MescrollUni from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-uni.vue'
|
||||
|
||||
import BleReceive from '@/utils/BleReceive';
|
||||
|
||||
var pagePath = 'pages/common/index';
|
||||
var ble = null;
|
||||
var timeout = null;
|
||||
var recei=null;
|
||||
export default {
|
||||
components: {
|
||||
MescrollUni
|
||||
},
|
||||
|
||||
|
||||
data() {
|
||||
return {
|
||||
mescroll: null,
|
||||
@ -224,7 +225,7 @@
|
||||
textNoMore: '没有更多数据了'
|
||||
},
|
||||
mescrollHeight: 0,
|
||||
|
||||
|
||||
size: 10, // 每页条数
|
||||
total: 0, // 总数据量
|
||||
|
||||
@ -251,31 +252,31 @@
|
||||
},
|
||||
// 下拉刷新
|
||||
downCallback() {
|
||||
|
||||
|
||||
console.log("下拉加载")
|
||||
if(this.mescroll){
|
||||
if (this.mescroll) {
|
||||
this.mescroll.resetUpScroll(false);
|
||||
this.mescroll.scrollTo(0,0);
|
||||
}
|
||||
this.mescroll.scrollTo(0, 0);
|
||||
}
|
||||
this.getData();
|
||||
|
||||
|
||||
},
|
||||
// 上拉加载
|
||||
upCallback() {
|
||||
|
||||
|
||||
console.log("上拉加载")
|
||||
|
||||
|
||||
this.getData();
|
||||
},
|
||||
bleStateBreak(){
|
||||
bleStateBreak() {
|
||||
console.error("蓝牙适配器不可用");
|
||||
this.updateBleStatu();
|
||||
},
|
||||
bleStateRecovery() {
|
||||
console.log("蓝牙适配器恢复可用,重连断开的设备");
|
||||
ble.linkAllDevices();
|
||||
|
||||
|
||||
},
|
||||
bleBreak(res) {
|
||||
console.error("蓝牙断开连接", res);
|
||||
@ -292,28 +293,39 @@
|
||||
|
||||
},
|
||||
|
||||
updateBleStatu(deviceId) { //更新列表的蓝牙连接状态
|
||||
updateBleStatu() { //更新列表的蓝牙连接状态,电池 电量
|
||||
if (ble) {
|
||||
|
||||
for (var i = 0; i < this.deviceList.length; i++) {
|
||||
|
||||
let bleStatu = false;
|
||||
|
||||
let f = null;
|
||||
if (ble.data && ble.data.LinkedList) {
|
||||
ble.data.LinkedList.find(v => {
|
||||
if (deviceId && v.deviceId != deviceId) {
|
||||
return false;
|
||||
}
|
||||
f = ble.data.LinkedList.find(v => {
|
||||
|
||||
if (v.macAddress && v.device && v.device.id) {
|
||||
if (v.device.id == this.deviceList[i].id && v.Linked) {
|
||||
|
||||
bleStatu = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
return v.device.id == this.deviceList[i].id;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
this.$set(this.deviceList[i], 'bleStatu', bleStatu);
|
||||
if (f) {
|
||||
|
||||
this.$set(this.deviceList[i], 'bleStatu', f.Linked);
|
||||
if (f.formData) {
|
||||
let battary = 0;
|
||||
if ('battary' in f.formData) {
|
||||
battary = f.formData.battary;
|
||||
} else if ('sta_PowerPercent' in f.formData) {
|
||||
battary = f.formData.sta_PowerPercent;
|
||||
} else if ('sta_battery' in f.formData) {
|
||||
battary = f.formData.sta_battery;
|
||||
}
|
||||
this.$set(this.deviceList[i], 'battery', battary);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -329,22 +341,37 @@
|
||||
// 所有分享,所有类型
|
||||
handleshareClick(item) {
|
||||
this.showshare = false; // 关闭弹窗
|
||||
var that = this;
|
||||
switch (item.action) {
|
||||
case 'type':
|
||||
uni.navigateTo({
|
||||
url: '/pages/common/allType/index'
|
||||
url: '/pages/common/allType/index',
|
||||
events: {
|
||||
index(data) {
|
||||
if (data && data.id) {
|
||||
that.tabs.find((v, i) => {
|
||||
if (v.id === data.id) {
|
||||
that.switchTab(v, i);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 'share':
|
||||
uni.navigateTo({
|
||||
url: "/pages/common/allShare/index"
|
||||
url: "/pages/common/allShare/index",
|
||||
|
||||
})
|
||||
break;
|
||||
}
|
||||
},
|
||||
// 点击弹框外的区域关闭
|
||||
closePopup(type) {
|
||||
|
||||
|
||||
if (type === 'delete') {
|
||||
this.deleteShow = false;
|
||||
uni.showTabBar(); // 显示TabBar
|
||||
@ -378,7 +405,7 @@
|
||||
this.deviceList = [];
|
||||
this.activeTab = index;
|
||||
this.activeTabInfo = tab
|
||||
|
||||
|
||||
|
||||
|
||||
this.downCallback();
|
||||
@ -393,10 +420,10 @@
|
||||
pageNum: this.mescroll.num,
|
||||
pageSize: this.size,
|
||||
deviceType: this.activeTabInfo ? this.activeTabInfo.id : '', // 使用传入的设备类型
|
||||
isAsc:'desc',
|
||||
orderByColumn:'bindingTime'
|
||||
isAsc: 'desc',
|
||||
orderByColumn: 'bindingTime'
|
||||
}
|
||||
if(!data.pageNum){
|
||||
if (!data.pageNum) {
|
||||
this.mescroll.endSuccess(0, false);
|
||||
resolve();
|
||||
return;
|
||||
@ -410,33 +437,34 @@
|
||||
}));
|
||||
|
||||
// 如果是第一页或切换分类,替换数据
|
||||
if(data.pageNum === 1){
|
||||
this.deviceList =newDevices
|
||||
}else{
|
||||
if (data.pageNum === 1) {
|
||||
this.deviceList = newDevices
|
||||
} else {
|
||||
//防止后端返回的数据包含已有数据
|
||||
for (var i = 0; i < newDevices.length; i++) {
|
||||
let device=newDevices[i];
|
||||
let f=this.deviceList.find(v=>{
|
||||
return v.id===device.id;
|
||||
let device = newDevices[i];
|
||||
let f = this.deviceList.find(v => {
|
||||
return v.id === device.id;
|
||||
});
|
||||
if(!f){
|
||||
if (!f) {
|
||||
this.deviceList.push(device);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.updateBleStatu();
|
||||
|
||||
this.total = res.total;
|
||||
// 判断是否加载完成
|
||||
let hasNext = true;
|
||||
if (res.rows.length < this.size || this.deviceList.length >= this.total) {
|
||||
if (res.rows.length < this.size || this.deviceList.length >= this
|
||||
.total) {
|
||||
hasNext = false;
|
||||
} else {
|
||||
hasNext = true;
|
||||
}
|
||||
this.mescroll.endSuccess(res.rows.length, hasNext);
|
||||
}else{
|
||||
} else {
|
||||
this.mescroll.endSuccess(0, false);
|
||||
}
|
||||
}).finally(() => {
|
||||
@ -448,16 +476,16 @@
|
||||
//防止下拉刷新的同时会调用一次上拉加载的问题
|
||||
timeout = setTimeout(task, 50);
|
||||
},
|
||||
|
||||
|
||||
// 添加扫一扫图标
|
||||
scan() {
|
||||
this.showTooltip = !this.showTooltip;
|
||||
},
|
||||
closePopMenu(){
|
||||
setTimeout(()=>{
|
||||
closePopMenu() {
|
||||
setTimeout(() => {
|
||||
this.showTooltip = false;
|
||||
this.showshare = false;
|
||||
},100);
|
||||
}, 100);
|
||||
},
|
||||
closePopupTooltip() {
|
||||
this.showTooltip = !this.showTooltip
|
||||
@ -470,6 +498,9 @@
|
||||
case 'scan':
|
||||
// 扫一扫
|
||||
uni.scanCode({
|
||||
autoDecodeCharset:true,
|
||||
autoZoom:true,
|
||||
barCodeInput:true,
|
||||
success: (res) => {
|
||||
console.log('条码内容:', res);
|
||||
// 清除之前的数据
|
||||
@ -484,14 +515,19 @@
|
||||
if ('imei' in json) {
|
||||
url =
|
||||
`/pages/common/qrcode/qrcode?deviceId=${encodeURIComponent(json.imei)}`;
|
||||
} else if ('blue' in json) {
|
||||
if (!json.blue.includes(':')) {
|
||||
json.blue = json.blue.replace(
|
||||
/(.{2})/g, '$1:')
|
||||
.slice(0, -1)
|
||||
} else if ('blue' in json || 'ble' in json) {
|
||||
if(json.ble){
|
||||
json.blue=json.ble;
|
||||
}
|
||||
url =
|
||||
`/pages/common/addBLE/LinkBle?mac=${encodeURIComponent(json.blue)}`;
|
||||
if(json.blue){
|
||||
if (!json.blue.includes(':')) {
|
||||
json.blue = json.blue.replace(
|
||||
/(.{2})/g, '$1:')
|
||||
.slice(0, -1)
|
||||
}
|
||||
}
|
||||
|
||||
url =`/pages/common/addBLE/LinkBle?mac=${encodeURIComponent(json.blue)}`;
|
||||
}
|
||||
} catch (ex) {
|
||||
|
||||
@ -519,7 +555,9 @@
|
||||
},
|
||||
// 右滑点击事件处理
|
||||
handleSwipeClick(e, item, index) {
|
||||
const {content} = e
|
||||
const {
|
||||
content
|
||||
} = e
|
||||
setTimeout(() => {
|
||||
console.log(item, 'eeeee');
|
||||
switch (e.content.text) {
|
||||
@ -554,10 +592,10 @@
|
||||
icon: 'none',
|
||||
duration: 1000
|
||||
});
|
||||
|
||||
this.deviceList.find((v,i)=>{
|
||||
if(v.id==data.id){
|
||||
this.deviceList.splice(i,1);
|
||||
|
||||
this.deviceList.find((v, i) => {
|
||||
if (v.id == data.id) {
|
||||
this.deviceList.splice(i, 1);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -595,10 +633,10 @@
|
||||
icon: 'none',
|
||||
duration: 1000
|
||||
});
|
||||
|
||||
this.deviceList.find((v,i)=>{
|
||||
if(v.id===data.id){
|
||||
this.$set(this.deviceList[i],'deviceName',data.deviceName);
|
||||
|
||||
this.deviceList.find((v, i) => {
|
||||
if (v.id === data.id) {
|
||||
this.$set(this.deviceList[i], 'deviceName', data.deviceName);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -671,7 +709,7 @@
|
||||
let url = item.detailPageUrl;
|
||||
// console.log("url=",url);
|
||||
// if(!url){
|
||||
//url="/pages/670/HBY670"
|
||||
// url="/pages/6075/BJQ6075"
|
||||
// }
|
||||
uni.navigateTo({
|
||||
url: url,
|
||||
@ -691,7 +729,7 @@
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
updateDeviceStatus(data) {
|
||||
this.deviceList = this.deviceList
|
||||
.map(item => {
|
||||
@ -717,7 +755,16 @@
|
||||
.filter(Boolean);
|
||||
},
|
||||
},
|
||||
onShow() {
|
||||
|
||||
if (ble) {
|
||||
//因为vue视图只能后退不能隐藏后再显示
|
||||
//所以回到首页后将其他所有页面的订阅都删除
|
||||
ble.removeAllCallbackByRetain(pagePath);
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
|
||||
console.error("首页加载");
|
||||
this.getTab()
|
||||
this.downCallback();
|
||||
@ -732,7 +779,7 @@
|
||||
this.downCallback();
|
||||
});
|
||||
ble = bleTool.getBleTool();
|
||||
|
||||
recei = BleReceive.getBleReceive();
|
||||
//蓝牙连接成功的回调
|
||||
ble.addRecoveryCallback((res) => {
|
||||
console.log("蓝牙连接成功的回调");
|
||||
@ -750,12 +797,19 @@
|
||||
console.log("蓝牙适配器恢复可用的回调");
|
||||
this.bleStateRecovery();
|
||||
}, pagePath);
|
||||
|
||||
|
||||
//蓝牙适配器不可用的回调
|
||||
ble.addStateBreakCallback(res=>{
|
||||
ble.addStateBreakCallback(res => {
|
||||
console.error("蓝牙适配器不可用的回调");
|
||||
this.bleStateBreak();
|
||||
},pagePath);
|
||||
}, pagePath);
|
||||
|
||||
//接收到消息的回调
|
||||
ble.addReceiveCallback((receive, device, path, recArr) => {
|
||||
console.error("首页收到消息了");
|
||||
recei.ReceiveData(receive, device, path, recArr);
|
||||
this.updateBleStatu();
|
||||
}, pagePath);
|
||||
|
||||
this.getSystemInfoSyncH();
|
||||
},
|
||||
@ -765,8 +819,9 @@
|
||||
uni.$off('refreshDeviceList');
|
||||
},
|
||||
onUnload() {
|
||||
console.log("onUnload...");
|
||||
uni.$off('deviceStatusUpdate');
|
||||
ble && ble.removeAllCallback();
|
||||
ble && ble.removeAllCallback(pagePath);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1139,13 +1194,15 @@
|
||||
background-color: rgba(35, 35, 35, 0.87);
|
||||
color: rgba(255, 255, 255, 1);
|
||||
}
|
||||
.mask{
|
||||
|
||||
.mask {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 9998;
|
||||
background-color: #00000000;
|
||||
}
|
||||
|
||||
/* 提示框样式 */
|
||||
.tooltip-box {
|
||||
position: fixed;
|
||||
|
||||
@ -65,7 +65,7 @@
|
||||
|
||||
<script>
|
||||
import {
|
||||
deviceShareId,
|
||||
|
||||
deviceShareCode,
|
||||
deviceShareAdd
|
||||
} from '@/api/6170/share.js'
|
||||
|
||||
Reference in New Issue
Block a user