完成6075J蓝牙对接
This commit is contained in:
@ -23,29 +23,29 @@
|
||||
</view>
|
||||
<view class="rightTxt">
|
||||
<view class="row">
|
||||
<image class="img" src="/static/images/6155/DeviceDetail/battry.png" mode="aspectFit"></image>
|
||||
<image class="img" src="/static/images/common/battry.png" mode="aspectFit"></image>
|
||||
<view class="txt">
|
||||
<view class="bigTxt">{{formData.sta_PowerPercent}}%</view>
|
||||
<view class="smallTxt">电量</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<image class="img" src="/static/images/6155/DeviceDetail/time.png" mode="aspectFit"></image>
|
||||
<image class="img" src="/static/images/common/time.png" mode="aspectFit"></image>
|
||||
<view class="txt">
|
||||
<view class="bigTxt">{{battery}}</view>
|
||||
<view class="bigTxt">{{formData.sta_PowerTime}}</view>
|
||||
<view class="smallTxt">续航时间</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="warnnig" :class="formData.sta_ShakeBit!==0 && formData.showShakeBit ?'':'displayNone'">
|
||||
<view>{{formData.sta_ShakeBit==1?'设备疑似受到外力碰撞':'设备声光报警中'}}!</view>
|
||||
<view class="warnnig" :class="formData.sta_ShakeBit!==0 ?'':'displayNone'">
|
||||
<view>{{formData.sta_ShakeBit==3?'设备疑似受到外力碰撞':'设备声光报警中'}}!</view>
|
||||
<view @click.stop="SOSToggle()">
|
||||
<uni-icons type="closeempty" color="#FFFFFFde" size="16"></uni-icons>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
@ -76,7 +76,10 @@
|
||||
<text class="lbl">设备状态</text>
|
||||
<text class="value valueFont">{{sta_system}}</text>
|
||||
</view>
|
||||
|
||||
<view class="item">
|
||||
<text class="lbl">环境温度</text>
|
||||
<text class="value " :class="heatStyle">{{formData.sta_Heat}}</text>
|
||||
</view>
|
||||
<view class="item">
|
||||
<text class="lbl">定位信息</text>
|
||||
<view class="multiValue" @click.stop="gotoMap()">
|
||||
@ -108,7 +111,7 @@
|
||||
<view class="item">
|
||||
<view>
|
||||
<text class="lbl">海拔高度</text>
|
||||
<view class="value valueFont leftIndent">{{formData.sta_height}}m</view>
|
||||
<view class="value valueFont leftIndent">{{formData.sta_Height}}m</view>
|
||||
</view>
|
||||
<view>
|
||||
<text class="lbl">相对高度</text>
|
||||
@ -150,23 +153,23 @@
|
||||
<text class="smallTxt">{{FuLight}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="mode " :class="{active:formData.sta_laser===1}" v-on:click.stop="laserToggle">
|
||||
<view class="mode " :class="{active:formData.sta_laser==1}" v-on:click.stop="laserToggle">
|
||||
<view class="leftImg">
|
||||
|
||||
<image class="img" src="/static/images/common/jig.png" v-show="formData.sta_laser!==1"
|
||||
<image class="img" src="/static/images/common/jig.png" v-show="formData.sta_laser!=1"
|
||||
mode="aspectFit"></image>
|
||||
<image class="img" src="/static/images/common/jigA.png" v-show="formData.sta_laser===1"
|
||||
<image class="img" src="/static/images/common/jigA.png" v-show="formData.sta_laser==1"
|
||||
mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="rightTxt">
|
||||
<text class="bigTxt">激光模式</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="mode " :class="{active:formData.sta_ShakeBit!==0}" v-on:click.stop="SOSToggle">
|
||||
<view class="mode " :class="{active:formData.sta_ShakeBit!=0}" v-on:click.stop="SOSToggle">
|
||||
<view class="leftImg">
|
||||
<image class="img" src="/static/images/common/sg.png" v-show="formData.sta_ShakeBit===0"
|
||||
<image class="img" src="/static/images/common/sg.png" v-show="formData.sta_ShakeBit==0"
|
||||
mode="aspectFit"></image>
|
||||
<image class="img" src="/static/images/common/sgActive.png" v-show="formData.sta_ShakeBit!==0"
|
||||
<image class="img" src="/static/images/common/sgActive.png" v-show="formData.sta_ShakeBit!=0"
|
||||
mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="rightTxt">
|
||||
@ -236,7 +239,7 @@
|
||||
<view>
|
||||
|
||||
<view class="item">
|
||||
<input maxlength="16" class="value" style="text-indent: 20rpx;" v-model="formData.msgTxt"
|
||||
<input maxlength="16" class="value" style="text-indent: 20rpx;" v-model="formData.sendMsg"
|
||||
placeholder="请输入文字" placeholder-class="usrplace" />
|
||||
</view>
|
||||
|
||||
@ -296,19 +299,19 @@
|
||||
var eventChannel = null;
|
||||
var these = null;
|
||||
var ble = null;
|
||||
var rec = null;
|
||||
var recei = null;
|
||||
var mq = null;
|
||||
var pagePath = "pages/6075J/BJQ6075J";
|
||||
var brightnessTimer = null;
|
||||
export default {
|
||||
components: {
|
||||
TextToHexV1
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
Status: {
|
||||
|
||||
|
||||
|
||||
|
||||
pageHide: false,
|
||||
apiType: "listA",
|
||||
navbar: {
|
||||
@ -325,7 +328,7 @@
|
||||
height: 90
|
||||
},
|
||||
usrToggle: true,
|
||||
|
||||
|
||||
},
|
||||
formData: {
|
||||
img: '/static/images/common/BJQ6075.png',
|
||||
@ -334,7 +337,7 @@
|
||||
sta_imei: "", //sta_imei
|
||||
sta_longitude: "", //经度
|
||||
sta_latitude: "", //纬度
|
||||
address:'',
|
||||
address: '',
|
||||
|
||||
textLines: [],
|
||||
company: "湖北星汉文化", //单位
|
||||
@ -348,19 +351,20 @@
|
||||
bleStatu: false,
|
||||
|
||||
sta_LightGrade: "", //主灯档位
|
||||
sta_LightGrade: "", //副灯档位
|
||||
sta_ShakeBit: "1", //报警状态
|
||||
sta_Side_Light: "", //副灯档位
|
||||
sta_ShakeBit: 0, //报警状态
|
||||
sta_4gSinal: "", //4G信号强度
|
||||
sta_laser: "", //激光状态
|
||||
sta_brightness: 100, //亮度
|
||||
sta_SOSGrade: "1", //强制报警状态
|
||||
|
||||
showSosGrade:false,
|
||||
showShakeBit:false,
|
||||
sta_height:'',//海拔
|
||||
sta_releaHeight:'',
|
||||
sta_BreakNews:'',
|
||||
deviceId:''
|
||||
|
||||
|
||||
|
||||
sta_Height: '', //海拔
|
||||
sta_Heat: '', //温度
|
||||
sta_releaHeight: '',
|
||||
sta_BreakNews: '',
|
||||
deviceId: ''
|
||||
},
|
||||
device: {
|
||||
id: "",
|
||||
@ -412,12 +416,12 @@
|
||||
staPowerPercent: null,
|
||||
staDetectResult: null
|
||||
},
|
||||
inteval:50
|
||||
inteval: 80
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
getbleStatu() {
|
||||
|
||||
|
||||
if (this.formData.bleStatu === true) {
|
||||
return '已连接';
|
||||
}
|
||||
@ -449,20 +453,24 @@
|
||||
}
|
||||
return state;
|
||||
},
|
||||
battery(){
|
||||
let hours = Math.floor(this.formData.sta_PowerTime / 60);
|
||||
let remainingMinutes = this.formData.sta_PowerTime % 60;
|
||||
|
||||
let xuhang = '0分';
|
||||
// 处理不同情况的显示
|
||||
if (hours === 0) {
|
||||
xuhang = `${remainingMinutes}分`;
|
||||
} else if (remainingMinutes === 0) {
|
||||
xuhang = `${hours}小时`;
|
||||
} else {
|
||||
xuhang = `${hours}小时${remainingMinutes}分`;
|
||||
|
||||
heatStyle() {
|
||||
if (this.formData.sta_Heat < 0) {
|
||||
return 'hanleng';
|
||||
}
|
||||
return xuhang;
|
||||
if (this.formData.sta_Heat >= 0 && this.formData.sta_Heat <= 30) {
|
||||
return 'green';
|
||||
}
|
||||
if (this.formData.sta_Heat > 30 && this.formData.sta_Heat <= 40) {
|
||||
return 're'
|
||||
}
|
||||
if (this.formData.sta_Heat > 40 && this.formData.sta_Heat <= 60) {
|
||||
return 'yanRe'
|
||||
}
|
||||
if (this.formData.sta_Heat > 60) {
|
||||
return 'kuRe'
|
||||
}
|
||||
return '';
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@ -486,15 +494,15 @@
|
||||
},
|
||||
onShow() {
|
||||
this.Status.pageHide = false;
|
||||
|
||||
let f=this.getDevice();
|
||||
if(f){
|
||||
these.formData.bleStatu = 'connecting';
|
||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||
console.log("连接成功")
|
||||
these.formData.bleStatu = true;
|
||||
});
|
||||
}
|
||||
|
||||
let f = this.getDevice();
|
||||
if (f) {
|
||||
these.formData.bleStatu = 'connecting';
|
||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||
console.log("连接成功")
|
||||
these.formData.bleStatu = true;
|
||||
});
|
||||
}
|
||||
},
|
||||
onHide: function() {
|
||||
this.Status.pageHide = true;
|
||||
@ -506,10 +514,10 @@
|
||||
this.initActionData();
|
||||
|
||||
this.initWatch();
|
||||
|
||||
|
||||
|
||||
rec = BleReceive.getBleReceive();
|
||||
|
||||
recei = BleReceive.getBleReceive();
|
||||
ble = BleTool.getBleTool();
|
||||
|
||||
|
||||
@ -568,9 +576,9 @@
|
||||
},
|
||||
methods: {
|
||||
getDetail() {
|
||||
|
||||
|
||||
api.getDetail(this.device.id).then(res => {
|
||||
|
||||
|
||||
if (res && res.code == 200) {
|
||||
res = res.data;
|
||||
let json = res;
|
||||
@ -586,53 +594,41 @@
|
||||
this.formData.job = personnelInfo.position;
|
||||
this.formData.usrid = personnelInfo.code
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
this.formData.sta_PowerPercent = json.staPowerPercent
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
this.formData.sta_PowerTime = json.staPowerTime;
|
||||
|
||||
|
||||
this.formData.sta_SOSGrade = json.staSOSGrade;
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
},
|
||||
initWatch(){
|
||||
this.$watch("formData.sta_SOSGrade", (newVal, oldVal) => {
|
||||
console.log("报警状态发生变化");
|
||||
if (newVal == 1) {
|
||||
this.formData.showSosGrade = true;
|
||||
initWatch() {
|
||||
|
||||
this.$watch("formData.sta_Heat", (newVal, oldVal) => {
|
||||
if (newVal) {
|
||||
if (newVal < -30) {
|
||||
MsgError("危险:环境温度过低,当前温度" + newVal + ",请立即撤离", "确定");
|
||||
}
|
||||
if (newVal >= 40 && newVal < 60) {
|
||||
MsgWarning("注意:环境温度过高,当前温度" + newVal, "确定");
|
||||
} else if (newVal >= 60 && newVal < 80) {
|
||||
MsgWarning("警告:环境温度过高,当前温度" + newVal + ",注意停留时间", "确定");
|
||||
} else if (newVal >= 80) {
|
||||
MsgError("危险:环境温度过高,当前温度" + newVal + ",请立即撤离", "确定");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.$watch("formData.sta_ShakeBit", (newVal, oldVal) => {
|
||||
console.log("碰撞状态发生变化");
|
||||
if (newVal != 0) {
|
||||
this.formData.showShakeBit = true;
|
||||
|
||||
this.$watch("formData.sta_BreakNews", (newVal, oldVal) => {
|
||||
if (newVal) {
|
||||
MsgSuccess("用户已确认收到紧急通知", "确定", these);
|
||||
setTimeout(() => {
|
||||
these.formData.sta_BreakNews = "";
|
||||
}, 10);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
this.$watch("formData.sta_BreakNews",(newVal,oldVal)=>{
|
||||
if(newVal){
|
||||
MsgSuccess("用户已确认收到紧急通知","确定",these);
|
||||
setTimeout(()=>{
|
||||
these.formData.sta_BreakNews="";
|
||||
},10);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
this.$watch("formData.sta_PowerPercent", (newVal, oldVal) => {
|
||||
console.log("电量发生变化");
|
||||
if (newVal <=20 && this.formData.sta_system===2 || this.formData.sta_system===0) {
|
||||
if (newVal <= 20 && (this.formData.sta_system === 2 || this.formData.sta_system === 0)) {
|
||||
//电量在20%及以及下,且是未充电状态提醒
|
||||
showPop({
|
||||
message: "设备电量低于20%,请充电",
|
||||
@ -642,13 +638,13 @@
|
||||
buttonTextColor: '#232323de',
|
||||
showCancel: false,
|
||||
showHeader: false,
|
||||
visibleClose: true,
|
||||
visibleClose: true,
|
||||
textColor: '#E03434',
|
||||
iconUrl:'/static/images/common/path.png'
|
||||
},this);
|
||||
iconUrl: '/static/images/common/path.png'
|
||||
}, this);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
checkSendVideo() {
|
||||
|
||||
@ -1004,43 +1000,44 @@
|
||||
}
|
||||
|
||||
let f = this.getDevice();
|
||||
|
||||
|
||||
|
||||
|
||||
var sendImagePackets = function(ReSendNo) {
|
||||
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
|
||||
// 总数据包数
|
||||
let totalPackets = 52;
|
||||
let currentPacket = 1;
|
||||
|
||||
|
||||
if (ReSendNo) {
|
||||
totalPackets = ReSendNo;
|
||||
currentPacket = ReSendNo;
|
||||
}
|
||||
|
||||
|
||||
if (f) {
|
||||
// 发送单个数据包
|
||||
const sendNextPacket = () => {
|
||||
if (currentPacket > totalPackets) {
|
||||
hideLoading(these);
|
||||
these.closeAction();
|
||||
these.showPop({
|
||||
showPop({
|
||||
showPop: true,
|
||||
message: "上传成功",
|
||||
iconUrl: "/static/images/common/success.png",
|
||||
});
|
||||
|
||||
setTimeout(()=>{
|
||||
ble.sendString(f.deviceId, "transmit complete", f.writeServiceId, f
|
||||
.wirteCharactId);
|
||||
},1000);
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
ble.sendString(f.deviceId, "transmit complete", f
|
||||
.writeServiceId, f
|
||||
.wirteCharactId);
|
||||
}, 1000);
|
||||
|
||||
these.rgb565Data = null;
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// 计算当前包的数据
|
||||
let packetSize = 250;
|
||||
// if (currentPacket <= 51) {
|
||||
@ -1048,7 +1045,7 @@
|
||||
// } else {
|
||||
// packetSize = 50; // 最后一个包100字节
|
||||
// }
|
||||
|
||||
|
||||
// 创建数据包
|
||||
const startIndex = (currentPacket - 1) * packetSize;
|
||||
const endIndex = Math.min(startIndex + packetSize, these.rgb565Data
|
||||
@ -1062,14 +1059,14 @@
|
||||
const bufferSize = 505; // 5 + packetData.length * 2; // 头部5字节 + 数据部分
|
||||
const buffer = new ArrayBuffer(bufferSize);
|
||||
const dataView = new DataView(buffer);
|
||||
|
||||
|
||||
// 填充头部
|
||||
dataView.setUint8(0, 0x55); // 帧头
|
||||
dataView.setUint8(1, 0x02); // 帧类型:开机画面
|
||||
dataView.setUint8(2, '0x' + currentPacket.toString(16).padStart(2,
|
||||
'0')); // 包序号
|
||||
|
||||
|
||||
|
||||
|
||||
if (packetData.length == 250) {
|
||||
dataView.setUint8(3, 0x01);
|
||||
dataView.setUint8(4, 0xF4);
|
||||
@ -1077,32 +1074,28 @@
|
||||
dataView.setUint8(3, 0x00);
|
||||
dataView.setUint8(4, 0x64);
|
||||
}
|
||||
|
||||
|
||||
// 填充数据(每个RGB565值占2字节)
|
||||
for (let i = 0; i < packetData.length; i++) {
|
||||
dataView.setUint16(5 + i * 2, packetData[i], false); // 大端字节序
|
||||
}
|
||||
|
||||
if (currentPacket > 51) { //第52包补FF
|
||||
for (var i = 105; i < bufferSize; i++) {
|
||||
dataView.setUint8(i, 0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//发送数据包
|
||||
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId,
|
||||
10)
|
||||
.then(() => {
|
||||
|
||||
|
||||
|
||||
|
||||
updateLoading(these, {
|
||||
text: "正在发送:" + currentPacket + "/" +
|
||||
totalPackets
|
||||
})
|
||||
currentPacket++;
|
||||
|
||||
|
||||
setTimeout(sendNextPacket, these.inteval);
|
||||
}).catch(err => {
|
||||
console.log("发送数据包失败了" + JSON.stringify(err));
|
||||
@ -1111,7 +1104,7 @@
|
||||
return;
|
||||
}
|
||||
these.closeAction();
|
||||
these.showPop({
|
||||
showPop({
|
||||
message: err.msg,
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
@ -1122,7 +1115,7 @@
|
||||
reject(err);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if (ReSendNo) {
|
||||
sendNextPacket(ReSendNo);
|
||||
return;
|
||||
@ -1131,10 +1124,10 @@
|
||||
ble.sendString(f.deviceId, "picture transmit start", f.writeServiceId,
|
||||
f.wirteCharactId).then(() => {
|
||||
setTimeout(sendNextPacket, 120);
|
||||
|
||||
|
||||
}).catch((err) => {
|
||||
console.log("握手没有成功");
|
||||
these.showPop({
|
||||
showPop({
|
||||
message: err.msg,
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
@ -1164,10 +1157,10 @@
|
||||
|
||||
|
||||
these.rgb565Data = Common.convertToRGB565(data.piexls);
|
||||
|
||||
|
||||
setTimeout(function() {
|
||||
sendImagePackets().catch(() => {
|
||||
|
||||
|
||||
});
|
||||
}, 0)
|
||||
|
||||
@ -1205,7 +1198,7 @@
|
||||
ins_brightness: e.detail.value
|
||||
}
|
||||
|
||||
this.sendData(json, null, 'string').then(res=>{
|
||||
this.sendData(json, null, 'string').then(res => {
|
||||
this.setBleFormData();
|
||||
}).catch(ex => {
|
||||
|
||||
@ -1220,18 +1213,18 @@
|
||||
},
|
||||
getLightMode(type) {
|
||||
let item = null;
|
||||
let index = null;
|
||||
let value = null;
|
||||
if (type === 'main') {
|
||||
index = 0;
|
||||
value = this.formData.sta_LightGrade;
|
||||
item = this.dic.actionSheets[0];
|
||||
|
||||
} else {
|
||||
index = 1;
|
||||
value = this.formData.sta_Side_Light;
|
||||
item = this.dic.actionSheets[1];
|
||||
}
|
||||
|
||||
let f = item.menuItems.find(v => {
|
||||
if (v.value == this.dic.actionSheets[index].value) {
|
||||
if (v.value == value) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
@ -1286,37 +1279,37 @@
|
||||
item.menuItems = [{
|
||||
text: '强光',
|
||||
icon: '/static/images/lightImg/qiang.png',
|
||||
value: '1',
|
||||
value: 1,
|
||||
key: 'ins_LightGrade'
|
||||
},
|
||||
{
|
||||
text: '工作光',
|
||||
icon: '/static/images/lightImg/work.png',
|
||||
value: '2',
|
||||
value: 2,
|
||||
key: 'ins_LightGrade'
|
||||
},
|
||||
{
|
||||
text: '节能光',
|
||||
icon: '/static/images/lightImg/jieN.png',
|
||||
value: '3',
|
||||
value: 3,
|
||||
key: 'ins_LightGrade'
|
||||
},
|
||||
{
|
||||
text: '爆闪',
|
||||
icon: '/static/images/lightImg/shan.png',
|
||||
value: '4',
|
||||
value: 4,
|
||||
key: 'ins_LightGrade'
|
||||
},
|
||||
{
|
||||
text: 'SOS',
|
||||
icon: '/static/images/lightImg/sos.png',
|
||||
value: '5',
|
||||
value: 5,
|
||||
key: 'ins_LightGrade'
|
||||
},
|
||||
{
|
||||
text: '关闭',
|
||||
icon: '/static/images/lightImg/closeLight.png',
|
||||
value: '6',
|
||||
value: 6,
|
||||
key: 'ins_LightGrade'
|
||||
}
|
||||
];
|
||||
@ -1329,31 +1322,31 @@
|
||||
item1.menuItems = [{
|
||||
text: '泛光',
|
||||
icon: '/static/images/lightImg/fan.png',
|
||||
value: '2',
|
||||
value: 2,
|
||||
key: 'ins_Side_Light'
|
||||
},
|
||||
{
|
||||
text: '泛光爆闪',
|
||||
icon: '/static/images/lightImg/fan.png',
|
||||
value: '3',
|
||||
value: 3,
|
||||
key: 'ins_Side_Light'
|
||||
},
|
||||
{
|
||||
text: '警示灯',
|
||||
icon: '/static/images/lightImg/warn.png',
|
||||
value: '1',
|
||||
value: 1,
|
||||
key: 'ins_Side_Light'
|
||||
},
|
||||
{
|
||||
text: '警示灯/泛光',
|
||||
icon: '/static/images/lightImg/warn.png',
|
||||
value: '4',
|
||||
value: 4,
|
||||
key: 'ins_Side_Light'
|
||||
},
|
||||
{
|
||||
text: '关闭',
|
||||
icon: '/static/images/lightImg/closeLight.png',
|
||||
value: '5',
|
||||
value: 5,
|
||||
key: 'ins_Side_Light'
|
||||
}
|
||||
];
|
||||
@ -1418,13 +1411,16 @@
|
||||
this.dic.actionSheets = [item, item1, item3];
|
||||
},
|
||||
SOSToggle() {
|
||||
debugger;
|
||||
if (!this.permissions.includes('42') && this.Status.apiType !== 'listA') {
|
||||
|
||||
MsgError('无操作权限', '确定', these);
|
||||
return;
|
||||
}
|
||||
let val = 1;
|
||||
if (this.formData.sta_ShakeBit === 1) {
|
||||
if (this.formData.sta_ShakeBit == 3) {
|
||||
val = 0;
|
||||
} else if (this.formData.sta_ShakeBit == 1) {
|
||||
val = 0;
|
||||
}
|
||||
|
||||
@ -1438,22 +1434,22 @@
|
||||
console.error("出现错误", ex)
|
||||
});
|
||||
}
|
||||
let msg=val==1?'确定开启声光报警':'确定关闭声光报警';
|
||||
|
||||
showPop({
|
||||
message: msg,
|
||||
iconUrl: "/static/images/670/sgActive.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonText: '确定',
|
||||
buttonTextColor: '#232323de',
|
||||
showCancel: true,
|
||||
buttonCancelText: '取消',
|
||||
okCallback: send
|
||||
}, these);
|
||||
|
||||
|
||||
|
||||
let msg = val == 1 ? '确定开启声光报警' : '确定关闭声光报警';
|
||||
|
||||
showPop({
|
||||
message: msg,
|
||||
iconUrl: "/static/images/670/sgActive.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonText: '确定',
|
||||
buttonTextColor: '#232323de',
|
||||
showCancel: true,
|
||||
buttonCancelText: '取消',
|
||||
okCallback: send
|
||||
}, these);
|
||||
|
||||
|
||||
|
||||
},
|
||||
laserToggle() {
|
||||
if (!this.permissions.includes('2') && this.Status.apiType !== 'listA') {
|
||||
@ -1508,6 +1504,7 @@
|
||||
let key = li.key.replace(/ins_/g, 'sta_');
|
||||
this.formData[key] = li.value;
|
||||
this.setBleFormData();
|
||||
this.formData.sta_brightness = 100;
|
||||
}).catch((ex) => {
|
||||
console.error("出现错误", ex)
|
||||
});
|
||||
@ -1674,11 +1671,14 @@
|
||||
}, 0);
|
||||
},
|
||||
sendMsg() {
|
||||
debugger;
|
||||
if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') {
|
||||
MsgError('无操作权限', '确定', these);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
this.formData.sendMsg.padStart(16, ' ');
|
||||
|
||||
this.formData.textLines = [this.formData.sendMsg.slice(0, 8), this.formData.sendMsg.slice(8, 16)];
|
||||
@ -1907,11 +1907,13 @@
|
||||
},
|
||||
getDevice: function() {
|
||||
|
||||
console.log("LinkedList=", ble.data.LinkedList);
|
||||
console.log("this.device=", this.device);
|
||||
// console.log("LinkedList=", ble.data.LinkedList);
|
||||
// console.log("this.device=", this.device);
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
if(v.macAddress == these.device.deviceMac){
|
||||
if(!this.formData.deviceId){this.formData.deviceId=v.deviceId};
|
||||
if (v.macAddress == these.device.deviceMac) {
|
||||
if (!this.formData.deviceId) {
|
||||
this.formData.deviceId = v.deviceId
|
||||
};
|
||||
return true;
|
||||
}
|
||||
});
|
||||
@ -1987,10 +1989,17 @@
|
||||
keys.forEach(key => {
|
||||
this.formData[key] = data[key];
|
||||
});
|
||||
|
||||
this.$set(this.dic.actionSheets[0], 'value', this.formData.sta_LightGrade);
|
||||
this.$set(this.dic.actionSheets[1], 'value', this.formData.sta_Side_Light);
|
||||
|
||||
this.setBleFormData();
|
||||
},
|
||||
|
||||
|
||||
setBleFormData() {
|
||||
if (!ble) {
|
||||
return;
|
||||
}
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
if (v.deviceId == these.formData.deviceId) {
|
||||
v.formData = these.formData;
|
||||
@ -2078,11 +2087,37 @@
|
||||
}, 1000);
|
||||
|
||||
});
|
||||
},
|
||||
bleStatuToggle() {
|
||||
let f = this.getDevice();
|
||||
if (!f) {
|
||||
this.showBleUnConnect();
|
||||
return;
|
||||
}
|
||||
if (this.formData.bleStatu === true) {
|
||||
this.formData.bleStatu = 'dicconnect';
|
||||
ble.disconnectDevice(f.deviceId).finally(r => {
|
||||
this.formData.bleStatu = false;
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.formData.bleStatu === false || this.formData.bleStatu === 'err') {
|
||||
this.formData.bleStatu = 'connecting';
|
||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||
these.formData.bleStatu = true;
|
||||
}).catch(ex => {
|
||||
these.formData.bleStatu = 'err';
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
gotoMap() {
|
||||
let promise = lnglatConvert.wgs84_to_gcj02(this.formData.sta_longitude, this.formData.sta_latitude);
|
||||
promise.then(lnglat => {
|
||||
|
||||
|
||||
this.detailData.longitude = lnglat[0];
|
||||
this.detailData.latitude = lnglat[1];
|
||||
uni.navigateTo({
|
||||
@ -2097,7 +2132,7 @@
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
proDetail: function(pgetpe) {
|
||||
|
||||
@ -2914,4 +2949,20 @@
|
||||
text-indent: 10rpx;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.hanleng {
|
||||
color: #66CCFF;
|
||||
}
|
||||
|
||||
.re {
|
||||
color: #FFB74D
|
||||
}
|
||||
|
||||
.yanRe {
|
||||
color: #F57C00;
|
||||
}
|
||||
|
||||
.kuRe {
|
||||
color: #B71C1C;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user