670加入机器状态、设备详情加接口请求
This commit is contained in:
@ -328,7 +328,7 @@
|
||||
});
|
||||
if (!f) {
|
||||
|
||||
|
||||
these.getDetail();
|
||||
these.showBleUnConnect();
|
||||
return;
|
||||
}
|
||||
@ -347,7 +347,7 @@
|
||||
these.formData.deviceId = f.deviceId;
|
||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId);
|
||||
these.setBleFormData();
|
||||
|
||||
these.getDetail();
|
||||
|
||||
|
||||
});
|
||||
@ -875,7 +875,7 @@
|
||||
setMode(mode, type) {
|
||||
|
||||
let dataValue = 0;
|
||||
|
||||
|
||||
|
||||
switch (mode) {
|
||||
case 0:
|
||||
@ -1203,7 +1203,22 @@
|
||||
|
||||
setTimeout(task, 0);
|
||||
},
|
||||
getDetail() {
|
||||
var that = this;
|
||||
usrApi.getDetail(this.device.id).then(res => {
|
||||
|
||||
if (res && res.code == 200) {
|
||||
res = res.data;
|
||||
let personnelInfo = res.personnelInfo;
|
||||
if (personnelInfo) {
|
||||
these.formData.textLines[2] = personnelInfo.unitName;
|
||||
these.formData.textLines[1] = personnelInfo.name;
|
||||
these.formData.textLines[0] = personnelInfo.position;
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
ack: function() {
|
||||
|
||||
|
||||
|
||||
@ -255,10 +255,10 @@
|
||||
cMode: false,
|
||||
modeCurr: 'low',
|
||||
|
||||
company: '黄石消防支队',
|
||||
name: '菜英俊',
|
||||
job: '小队长',
|
||||
id: 'HSXF01061',
|
||||
company: '',
|
||||
name: '',
|
||||
job: '',
|
||||
id: '',
|
||||
iswarn: false
|
||||
},
|
||||
rgb565Data: [],
|
||||
@ -314,6 +314,7 @@
|
||||
|
||||
|
||||
these.showBleUnConnect();
|
||||
these.getDetail();
|
||||
return;
|
||||
}
|
||||
let form = f.formData;
|
||||
@ -331,7 +332,7 @@
|
||||
these.formData.deviceId = f.deviceId;
|
||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId);
|
||||
these.setBleFormData();
|
||||
|
||||
these.getDetail();
|
||||
|
||||
|
||||
});
|
||||
@ -457,6 +458,23 @@
|
||||
|
||||
return f;
|
||||
},
|
||||
getDetail() {
|
||||
var that = this;
|
||||
usrApi.getDetail(this.device.id).then(res => {
|
||||
|
||||
if (res && res.code == 200) {
|
||||
res = res.data;
|
||||
let personnelInfo = res.personnelInfo;
|
||||
if (personnelInfo) {
|
||||
that.formData.company = personnelInfo.unitName;
|
||||
that.formData.name = personnelInfo.name;
|
||||
that.formData.job = personnelInfo.position;
|
||||
that.formData.id = personnelInfo.code
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
setBleFormData() {
|
||||
ble.data.LinkedList.find((v) => {
|
||||
if (v.deviceId == these.formData.deviceId) {
|
||||
@ -959,8 +977,8 @@
|
||||
}
|
||||
|
||||
uni.uploadFile({
|
||||
// url: 'http://114.55.111.217/video/upload',
|
||||
url: baseURL+"app/video/upload",
|
||||
url: 'http://114.55.111.217/video/upload',
|
||||
// url: baseURL+"app/video/upload",
|
||||
filePath: videoPath,
|
||||
name: 'file',
|
||||
header: {
|
||||
|
||||
@ -33,13 +33,30 @@
|
||||
<text class="lbl">设备名称</text>
|
||||
<text class="value">{{device.deviceName}}</text>
|
||||
</view>
|
||||
<view class="item">
|
||||
<text class="lbl">设备状态</text>
|
||||
<text class="value">{{formData.sta_system}}</text>
|
||||
</view>
|
||||
<view class="item">
|
||||
<text class="lbl">定位信息</text>
|
||||
<view>
|
||||
<view>{{formData.lon}} {{formData.lat}}</view>
|
||||
<text class="value">{{formData.address}}</text>
|
||||
<view class="multiValue">
|
||||
<view class="valueItem">
|
||||
{{formData.Lon}}
|
||||
|
||||
</view>
|
||||
<view class="valueItem">
|
||||
|
||||
{{formData.Lat}}
|
||||
|
||||
</view>
|
||||
<view class="valueItem">
|
||||
|
||||
<view style="width:80%;float: right;text-align: right;">{{formData.address}}</view>
|
||||
<view class="clear"></view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -358,7 +375,8 @@
|
||||
warnLevel: "", //报警级别
|
||||
staticWarn: false, //静止报警
|
||||
fourGStrenth: 0, //4G信号强度
|
||||
deviceId: ""
|
||||
deviceId: "",
|
||||
sta_system: "" //设备状态,0关机,1仅充电,2开机未充电,3,开机且充电
|
||||
},
|
||||
device: {
|
||||
id: "",
|
||||
@ -413,6 +431,7 @@
|
||||
var device = data.data;
|
||||
these.Status.apiType = data.apiType;
|
||||
these.device = device;
|
||||
|
||||
if (these.device.deviceImei) {
|
||||
these.initMQ();
|
||||
}
|
||||
@ -425,6 +444,7 @@
|
||||
return false;
|
||||
});
|
||||
if (!f) {
|
||||
these.getDetail();
|
||||
return;
|
||||
}
|
||||
let form = f.formData;
|
||||
@ -440,6 +460,7 @@
|
||||
} else if (these.device.deviceImei) {
|
||||
these.formData['imei'] = these.device.deviceImei;
|
||||
}
|
||||
these.getDetail();
|
||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId);
|
||||
});
|
||||
|
||||
@ -454,6 +475,74 @@
|
||||
|
||||
},
|
||||
methods: {
|
||||
getDetail() {
|
||||
var that = this;
|
||||
api.getDetail(this.device.id).then(res => {
|
||||
|
||||
if (res && res.code == 200) {
|
||||
res = res.data;
|
||||
let json=res;
|
||||
console.log("res=",res);
|
||||
that.formData.Lon = res.longitude;
|
||||
that.formData.Lat = res.latitude;
|
||||
that.formData.address = res.address;
|
||||
let personnelInfo = res.personnelInfo;
|
||||
if (personnelInfo) {
|
||||
that.formData.company = personnelInfo.unitName;
|
||||
that.formData.usrname = personnelInfo.name;
|
||||
that.formData.job = personnelInfo.position;
|
||||
that.formData.usrid = personnelInfo.code
|
||||
}
|
||||
|
||||
let dic = {
|
||||
"3": "hight",
|
||||
"2": "center",
|
||||
"1": "low",
|
||||
"0": "close",
|
||||
|
||||
};
|
||||
let staticLevelText = dic[json.staDetectGrade];
|
||||
that.formData.modeCurr = staticLevelText;
|
||||
|
||||
dic = {
|
||||
"0": "none",
|
||||
"1": "ruo",
|
||||
"2": "center",
|
||||
"3": "hight",
|
||||
"4": "veryhight",
|
||||
};
|
||||
let warn = dic[json.staDetectResult];
|
||||
that.formData.warnLevel = warn;
|
||||
|
||||
let lightingLevelText = json.staLightGrade === 1 ? 'hight' : json.staLightGrade === 2 ? 'low' :
|
||||
'close';
|
||||
that.formData.lightCurr = lightingLevelText;
|
||||
|
||||
that.formData.battary = json.staPowerPercent
|
||||
|
||||
|
||||
let hours = Math.floor(json.staPowerTime / 60);
|
||||
let remainingMinutes = json.staPowerTime % 60;
|
||||
let xuhang = '0分';
|
||||
// 处理不同情况的显示
|
||||
if (hours === 0) {
|
||||
xuhang = `${remainingMinutes}分`;
|
||||
} else if (remainingMinutes === 0) {
|
||||
xuhang = `${hours}小时`;
|
||||
} else {
|
||||
xuhang = `${hours}小时${remainingMinutes}分`;
|
||||
}
|
||||
|
||||
that.formData.xuhang = xuhang;
|
||||
|
||||
let sosText = json.staSOSGrade === 2 ? 'rb' : json.staSOSGrade === 1 ? "sg" : "close";
|
||||
that.formData.SOS = sosText;
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getWarnStyle(index) {
|
||||
let className = "";
|
||||
|
||||
@ -540,6 +629,7 @@
|
||||
console.log("收到设备上报的数据", payload);
|
||||
this.parseDataMQ(json);
|
||||
}
|
||||
//以下操作已改到后端
|
||||
// else if (keys.indexOf('sta_PicTrans') > -1) { //发送开机画面
|
||||
// console.log("收到开机画面答复", payload);
|
||||
// // this.SendImgMQ(json);
|
||||
@ -598,56 +688,80 @@
|
||||
},
|
||||
parseDataMQ(json) {
|
||||
let receiveData = {};
|
||||
let staticLevelText = "";
|
||||
let dic = {
|
||||
"3": "hight",
|
||||
"2": "center",
|
||||
"1": "low",
|
||||
"0": "close",
|
||||
|
||||
};
|
||||
staticLevelText = dic[json.sta_DetectGrade];
|
||||
let dic = {};
|
||||
if ("sta_DetectGrade" in json) {
|
||||
dic = {
|
||||
"3": "hight",
|
||||
"2": "center",
|
||||
"1": "low",
|
||||
"0": "close",
|
||||
|
||||
let lightingLevelText = json.sta_LightGrade ===
|
||||
1 ? 'hight' :
|
||||
json.sta_LightGrade ===
|
||||
2 ?
|
||||
'low' :
|
||||
'close';
|
||||
let warn = "";
|
||||
dic = {
|
||||
"0": "none",
|
||||
"1": "ruo",
|
||||
"2": "center",
|
||||
"3": "hight",
|
||||
"4": "veryhight",
|
||||
};
|
||||
warn = dic[json.sta_DetectResult];
|
||||
};
|
||||
let staticLevelText = dic[json.sta_DetectGrade];
|
||||
receiveData.modeCurr = staticLevelText;
|
||||
}
|
||||
|
||||
if ("sta_LightGrade" in json) {
|
||||
|
||||
let sosText = null;
|
||||
if (json.sta_SOSGrade !== undefined) {
|
||||
let lightingLevelText = json.sta_LightGrade === 1 ? 'hight' : json.sta_LightGrade === 2 ? 'low' :
|
||||
'close';
|
||||
receiveData.lightCurr = lightingLevelText;
|
||||
}
|
||||
|
||||
if ("sta_DetectResult" in json) {
|
||||
|
||||
sosText = json.sta_SOSGrade === 2 ? 'rb' :
|
||||
json.sta_SOSGrade === 1 ? "sg" : "close"
|
||||
dic = {
|
||||
"0": "none",
|
||||
"1": "ruo",
|
||||
"2": "center",
|
||||
"3": "hight",
|
||||
"4": "veryhight",
|
||||
};
|
||||
let warn = dic[json.sta_DetectResult];
|
||||
receiveData.warnLevel = warn;
|
||||
}
|
||||
|
||||
if ("sta_SOSGrade" in json) {
|
||||
let sosText = json.sta_SOSGrade === 2 ? 'rb' : json.sta_SOSGrade === 1 ? "sg" : "close";
|
||||
receiveData.SOS = sosText;
|
||||
}
|
||||
let staticWarn = json.sta_ShakeBit === 1;
|
||||
|
||||
receiveData.modeCurr = staticLevelText;
|
||||
receiveData.lightCurr = lightingLevelText;
|
||||
receiveData.xuhang = json.sta_PowerTime + "分钟";
|
||||
receiveData.battary = json.sta_PowerPercent;
|
||||
if ("sta_ShakeBit" in json) {
|
||||
let staticWarn = json.sta_ShakeBit === 1;
|
||||
receiveData.staticWarn = staticWarn;
|
||||
}
|
||||
|
||||
receiveData.warnLevel = warn;
|
||||
receiveData.staticWarn = staticWarn;
|
||||
receiveData.fourGStrenth = json.sta_4gSinal;
|
||||
receiveData.imei = json.sta_imei;
|
||||
receiveData.Lon = json.sta_longitude;
|
||||
receiveData.Lat = json.sta_latitude;
|
||||
if ("sta_PowerTime" in json) {
|
||||
let hours = Math.floor(json.sta_PowerTime / 60);
|
||||
let remainingMinutes = json.sta_PowerTime % 60;
|
||||
let xuhang = '0分';
|
||||
// 处理不同情况的显示
|
||||
if (hours === 0) {
|
||||
xuhang = `${remainingMinutes}分`;
|
||||
} else if (remainingMinutes === 0) {
|
||||
xuhang = `${hours}小时`;
|
||||
} else {
|
||||
xuhang = `${hours}小时${remainingMinutes}分`;
|
||||
}
|
||||
|
||||
receiveData.xuhang = xuhang;
|
||||
}
|
||||
|
||||
("sta_PowerPercent" in json) && (receiveData.battary = json.sta_PowerPercent);
|
||||
("sta_4gSinal" in json) && (receiveData.fourGStrenth = json.sta_4gSinal);
|
||||
("sta_imei" in json) && (receiveData.imei = json.sta_imei);
|
||||
("sta_longitude" in json) && (receiveData.Lon = json.sta_longitude);
|
||||
("sta_latitude" in json) && (receiveData.Lat = json.sta_latitude);
|
||||
if ("sta_system" in json) {
|
||||
dic = {
|
||||
"0": "关机",
|
||||
"1": "仅充电",
|
||||
"2": "开机未充电",
|
||||
"3": "开机且充电"
|
||||
}
|
||||
receiveData.sta_system = dic[json.sta_system];
|
||||
}
|
||||
this.refreshFormData(receiveData, 'auto');
|
||||
return receiveData;
|
||||
},
|
||||
@ -686,14 +800,14 @@
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
let key = keys[i];
|
||||
if (key in these.formData) {
|
||||
these.formData[key] = data[key];
|
||||
this.formData[key] = data[key];
|
||||
}
|
||||
}
|
||||
if (this.formData.imei) {
|
||||
this.initMQ();
|
||||
}
|
||||
if (this.formData.staticWarn) { //有静止报警
|
||||
these.showPop({
|
||||
this.showPop({
|
||||
message: "设备静止报警中",
|
||||
iconUrl: "/static/images/6155/DeviceDetail/warnning.png",
|
||||
borderColor: "#e034344d",
|
||||
@ -701,8 +815,6 @@
|
||||
buttonText: "确定",
|
||||
clickEvt: "staticWarn"
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
this.setBleFormData();
|
||||
@ -1576,8 +1688,8 @@
|
||||
}
|
||||
console.log("baseURL=", baseURL);
|
||||
uni.uploadFile({
|
||||
// url: 'http://114.55.111.217/video/upload',
|
||||
url: baseURL + "/app/video/upload",
|
||||
url: 'http://114.55.111.217/video/upload',
|
||||
// url: baseURL + "/app/video/upload",
|
||||
filePath: videoPath,
|
||||
name: 'file',
|
||||
header: {
|
||||
@ -1617,7 +1729,7 @@
|
||||
|
||||
|
||||
} else {
|
||||
console.log("服务器未返回正确的数据");
|
||||
console.log("服务器未返回正确的数据", arr);
|
||||
|
||||
|
||||
these.showPop({
|
||||
@ -1996,7 +2108,7 @@
|
||||
text: "请稍候..."
|
||||
});
|
||||
this.setBleFormData();
|
||||
|
||||
|
||||
|
||||
let data = {
|
||||
"sendMsg": this.formData.msgTxt,
|
||||
@ -2187,7 +2299,8 @@
|
||||
|
||||
.eqinfo .item {
|
||||
width: 100%;
|
||||
height: 60rpx;
|
||||
min-height: 60rpx;
|
||||
height: auto;
|
||||
line-height: 60rpx;
|
||||
padding: 0rpx 28rpx;
|
||||
box-sizing: border-box;
|
||||
@ -2204,7 +2317,7 @@
|
||||
font-family: PingFang SC;
|
||||
font-size: 28rpx;
|
||||
font-weight: 400;
|
||||
|
||||
width: 140rpx;
|
||||
letter-spacing: 0.07px;
|
||||
text-align: left;
|
||||
}
|
||||
@ -2219,6 +2332,26 @@
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.eqinfo .multiValue {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: wrap;
|
||||
align-content: flex-end;
|
||||
align-items: flex-end;
|
||||
justify-content: flex-start;
|
||||
width: calc(100% - 140rpx)
|
||||
}
|
||||
|
||||
.eqinfo .valueItem {
|
||||
height: auto;
|
||||
line-height: 40rpx;
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
font-family: PingFang SC;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
letter-spacing: 0.07px;
|
||||
}
|
||||
|
||||
.lamp {
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
|
||||
@ -158,7 +158,7 @@
|
||||
var these = null;
|
||||
var BrighInteval = null;
|
||||
var recei = null;
|
||||
|
||||
|
||||
export default {
|
||||
components: {
|
||||
TextToHexV1
|
||||
@ -317,7 +317,7 @@
|
||||
|
||||
let device = data.data;
|
||||
these.device = device;
|
||||
|
||||
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
if (v.macAddress == device.deviceMac) {
|
||||
console.log("找到设备了", v);
|
||||
@ -328,7 +328,7 @@
|
||||
});
|
||||
if (!f) {
|
||||
|
||||
|
||||
these.getDetail();
|
||||
these.showBleUnConnect();
|
||||
return;
|
||||
}
|
||||
@ -347,7 +347,7 @@
|
||||
these.formData.deviceId = f.deviceId;
|
||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId);
|
||||
these.setBleFormData();
|
||||
|
||||
these.getDetail();
|
||||
|
||||
|
||||
});
|
||||
@ -385,15 +385,15 @@
|
||||
}
|
||||
switch (this.formData.mode) {
|
||||
case 0:
|
||||
|
||||
|
||||
|
||||
|
||||
txt = "强光模式";
|
||||
|
||||
|
||||
break;
|
||||
case 1:
|
||||
txt = "弱光模式";
|
||||
break;
|
||||
|
||||
|
||||
case 2:
|
||||
txt = "爆闪模式";
|
||||
break;
|
||||
@ -403,7 +403,7 @@
|
||||
default:
|
||||
txt = "关闭";
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
return txt;
|
||||
}
|
||||
@ -419,9 +419,9 @@
|
||||
return f;
|
||||
},
|
||||
bleValueNotify: function(receive, device, path) {
|
||||
|
||||
|
||||
let str = recei.ReceiveData(receive, device, path);
|
||||
|
||||
|
||||
console.log("处理接收到的数据:" + str);
|
||||
return;
|
||||
let data = recei.ReceiveData(receive, device, path);
|
||||
@ -529,29 +529,31 @@
|
||||
}
|
||||
});
|
||||
},
|
||||
showBleUnConnect(){
|
||||
showBleUnConnect() {
|
||||
this.showPop({
|
||||
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonText:'去连接',
|
||||
okCallback:function(){
|
||||
buttonText: '去连接',
|
||||
okCallback: function() {
|
||||
console.log("1111");
|
||||
uni.navigateTo({
|
||||
url:"/pages/common/addBLE/addEquip",
|
||||
events: {
|
||||
BindOver: function(data) {
|
||||
console.log(data)
|
||||
}
|
||||
},
|
||||
success: function(res) {
|
||||
// 通过eventChannel向被打开页面传送数据
|
||||
res.eventChannel.emit('detailData', { data: these.device })
|
||||
},
|
||||
fail(ex){
|
||||
console.log("跳转失败",ex);
|
||||
}
|
||||
url: "/pages/common/addBLE/addEquip",
|
||||
events: {
|
||||
BindOver: function(data) {
|
||||
console.log(data)
|
||||
}
|
||||
},
|
||||
success: function(res) {
|
||||
// 通过eventChannel向被打开页面传送数据
|
||||
res.eventChannel.emit('detailData', {
|
||||
data: these.device
|
||||
})
|
||||
},
|
||||
fail(ex) {
|
||||
console.log("跳转失败", ex);
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
@ -642,8 +644,8 @@
|
||||
these.showPop({
|
||||
message: "上传成功",
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png",
|
||||
borderColor : '#BBE600',
|
||||
buttonBgColor : '#BBE600'
|
||||
borderColor: '#BBE600',
|
||||
buttonBgColor: '#BBE600'
|
||||
});
|
||||
|
||||
resolve();
|
||||
@ -889,9 +891,9 @@
|
||||
case 1:
|
||||
dataValue = 0x02;
|
||||
break;
|
||||
// case 2:
|
||||
// dataValue = 0x02;
|
||||
// break;
|
||||
// case 2:
|
||||
// dataValue = 0x02;
|
||||
// break;
|
||||
case 2:
|
||||
dataValue = 0x03;
|
||||
break;
|
||||
@ -974,7 +976,7 @@
|
||||
if (this.Status.Pop.clickEvt == 'SendUsr') {
|
||||
|
||||
}
|
||||
if(this.Status.Pop.okCallback){
|
||||
if (this.Status.Pop.okCallback) {
|
||||
this.Status.Pop.okCallback();
|
||||
}
|
||||
this.Status.Pop.showPop = false;
|
||||
@ -992,11 +994,11 @@
|
||||
okCallback: null,
|
||||
cancelCallback: null,
|
||||
popType: 'custom',
|
||||
buttonText:'确定',
|
||||
buttonText: '确定',
|
||||
clickEvt: ''
|
||||
};
|
||||
if (!option) {
|
||||
|
||||
|
||||
}
|
||||
let keys = Object.keys(option);
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
@ -1011,7 +1013,7 @@
|
||||
}
|
||||
this.Status.Pop[key] = defaultCfg[key];
|
||||
}
|
||||
|
||||
|
||||
this.Status.Pop.showPop = true;
|
||||
},
|
||||
sendUsr() {
|
||||
@ -1171,18 +1173,18 @@
|
||||
console.log("发送成功");
|
||||
this.showPop({
|
||||
message: "发送成功",
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png",
|
||||
borderColor : '#BBE600',
|
||||
buttonBgColor : '#BBE600'
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png",
|
||||
borderColor: '#BBE600',
|
||||
buttonBgColor: '#BBE600'
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
let json = {
|
||||
deviceId: these.device.id,
|
||||
name: these.formData.textLines[1],
|
||||
position: these.formData.textLines[0],
|
||||
deviceId: these.device.id,
|
||||
name: these.formData.textLines[1],
|
||||
position: these.formData.textLines[0],
|
||||
unitName: these.formData.textLines[2],
|
||||
code: ""
|
||||
};
|
||||
@ -1199,7 +1201,22 @@
|
||||
|
||||
setTimeout(task, 0);
|
||||
},
|
||||
getDetail() {
|
||||
var that = this;
|
||||
usrApi.getDetail(this.device.id).then(res => {
|
||||
|
||||
if (res && res.code == 200) {
|
||||
res = res.data;
|
||||
let personnelInfo = res.personnelInfo;
|
||||
if (personnelInfo) {
|
||||
these.formData.textLines[2] = personnelInfo.unitName;
|
||||
these.formData.textLines[1] = personnelInfo.name;
|
||||
these.formData.textLines[0] = personnelInfo.position;
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
ack: function() {
|
||||
|
||||
|
||||
|
||||
@ -56,6 +56,7 @@
|
||||
<view class="w50 fleft">静止报警状态:{{receiveData.staticWarn}}</view>
|
||||
<view class="w50 fleft">4G信号强度:{{receiveData.fourGStrenth}}</view>
|
||||
<view class="w50 fleft">SOS模式:{{receiveData.SOS}}</view>
|
||||
<view class="w50 fleft">设备状态:{{receiveData.sta_system}}</view>
|
||||
<view class="clear"></view>
|
||||
</view>
|
||||
<view>重发包序号:{{reSendNumber}}</view>
|
||||
@ -226,7 +227,7 @@
|
||||
<script>
|
||||
import gbk from '@/utils/gbk.js';
|
||||
import MqttClient from '@/utils/mqtt.js';
|
||||
import request,{
|
||||
import request, {
|
||||
baseURL
|
||||
} from '@/utils/request.js';
|
||||
var videoChannel = null;
|
||||
@ -294,7 +295,8 @@
|
||||
IMEI: "",
|
||||
Lon: "",
|
||||
Lat: "",
|
||||
SOS: ""
|
||||
SOS: "",
|
||||
sta_system: ""
|
||||
},
|
||||
subscits: [],
|
||||
videoPath: "",
|
||||
@ -354,7 +356,7 @@
|
||||
parseDataMQ(json) {
|
||||
|
||||
|
||||
|
||||
|
||||
let staticLevelText = "";
|
||||
let dic = {
|
||||
"3": "高档",
|
||||
@ -363,14 +365,16 @@
|
||||
"0": "关闭",
|
||||
|
||||
};
|
||||
staticLevelText = dic[json.sta_DetectGrade];
|
||||
if ("sta_DetectGrade" in json) {
|
||||
staticLevelText = dic[json.sta_DetectGrade.toString()];
|
||||
}
|
||||
|
||||
|
||||
let lightingLevelText = "";
|
||||
if ("sta_LightGrade" in json) {
|
||||
lightingLevelText = json.sta_LightGrade === 1 ? '强光' : json.sta_LightGrade === 2 ? '弱光' : '关闭';
|
||||
}
|
||||
|
||||
let lightingLevelText = json.sta_LightGrade ===
|
||||
1 ? '强光' :
|
||||
json.sta_LightGrade ===
|
||||
2 ?
|
||||
'弱光' :
|
||||
'关闭';
|
||||
let warn = "";
|
||||
dic = {
|
||||
"0": "无预警",
|
||||
@ -379,25 +383,47 @@
|
||||
"3": "强预警",
|
||||
"4": "非常强预警",
|
||||
};
|
||||
warn = dic[json.sta_DetectResult];
|
||||
if ("sta_DetectResult" in json) {
|
||||
warn = dic[json.sta_DetectResult.toString()];
|
||||
}
|
||||
|
||||
|
||||
let sosText = json.sta_SOSGrade === 2 ? '红蓝模式' :
|
||||
json.sta_SOSGrade === 1 ? "爆闪模式" : "关闭"
|
||||
|
||||
let staticWarn = json.sta_ShakeBit === 1 ? '正在报警' : '未报警';
|
||||
let sosText = "";
|
||||
if ("sta_SOSGrade" in json) {
|
||||
|
||||
sosText=json.sta_SOSGrade === 2 ? '红蓝模式' : json.sta_SOSGrade === 1 ? "爆闪模式" : "关闭"
|
||||
}
|
||||
|
||||
|
||||
let staticWarn = "";
|
||||
if ("sta_ShakeBit" in json) {
|
||||
json.sta_ShakeBit === 1 ? '正在报警' : '未报警';
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ("sta_system" in json) {
|
||||
dic = {
|
||||
"0": "关机",
|
||||
"1": "仅充电",
|
||||
"2": "开机未充电",
|
||||
"3": "开机且充电"
|
||||
}
|
||||
this.receiveData.sta_system = dic[json.sta_system.toString()];
|
||||
}
|
||||
|
||||
this.receiveData.staticLevel = staticLevelText;
|
||||
this.receiveData.lightingLevel = lightingLevelText;
|
||||
this.receiveData.lightingTime = json.sta_PowerTime + "分钟";
|
||||
this.receiveData.batteryLevel = json.sta_PowerPercent + "%";
|
||||
("sta_PowerTime" in json) && (this.receiveData.lightingTime = json.sta_PowerTime + "分钟");
|
||||
("sta_PowerPercent" in json) && (this.receiveData.batteryLevel = json.sta_PowerPercent + "%");
|
||||
this.receiveData.SOS = sosText;
|
||||
this.receiveData.warnLevel = warn;
|
||||
this.receiveData.staticWarn = staticWarn;
|
||||
this.receiveData.fourGStrenth = json.sta_4gSinal;
|
||||
this.receiveData.IMEI = json.sta_imei;
|
||||
this.receiveData.Lon = json.sta_longitude;
|
||||
this.receiveData.Lat = json.sta_latitude;
|
||||
("sta_4gSinal" in json) && (this.receiveData.fourGStrenth = json.sta_4gSinal);
|
||||
("sta_imei" in json ) && (this.receiveData.IMEI = json.sta_imei);
|
||||
("sta_longitude" in json) && (this.receiveData.Lon = json.sta_longitude);
|
||||
("sta_latitude" in json) && (this.receiveData.Lat = json.sta_latitude);
|
||||
|
||||
},
|
||||
parseData(receive) {
|
||||
@ -1285,6 +1311,7 @@
|
||||
setTimeout(() => {
|
||||
uni.onBLECharacteristicValueChange((
|
||||
receive) => {
|
||||
console.log("收到设备数据",receive);
|
||||
these.parseData(receive);
|
||||
});
|
||||
}, 100)
|
||||
@ -2101,7 +2128,7 @@
|
||||
let json = JSON.parse(payload);
|
||||
let keys = Object.keys(json);
|
||||
console.log("keys=", keys);
|
||||
if (keys.indexOf('sta_DetectGrade') > -1) { //上报的报文
|
||||
if (keys.indexOf('sta_system') > -1) { //上报的报文
|
||||
console.log("收到设备上报的数据", payload);
|
||||
this.parseDataMQ(json);
|
||||
} else if (keys.indexOf('sta_PicTrans') > -1) { //发送开机画面
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
|
||||
<script>
|
||||
import Common from '@/utils/Common';
|
||||
|
||||
import request,{ baseURL } from '@/utils/request.js';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@ -123,15 +123,19 @@
|
||||
|
||||
let p2 = new Promise((resolve, reject) => {
|
||||
let start = new Date();
|
||||
console.log("Common.baseURL=" + Common.baseURL);
|
||||
console.log("baseURL=" + baseURL);
|
||||
const token ="";// uni.getStorageSync('token');
|
||||
const clientid ="";// uni.getStorageSync('clientID');
|
||||
uni.uploadFile({
|
||||
// url: Common.baseURL + 'video/upload',
|
||||
url:'http://192.168.110.56:8000/app/video/upload',
|
||||
url: 'http://114.55.111.217/video/upload',
|
||||
// url:baseURL+"/app/video/upload",
|
||||
filePath: this.videoPath,
|
||||
name: 'file',
|
||||
header: {
|
||||
"Method": "POST",
|
||||
"Content-Type": "multipart/form-data"
|
||||
"Content-Type": "multipart/form-data",
|
||||
"Authorization": 'Bearer ' + token,
|
||||
"clientid": clientid
|
||||
},
|
||||
timeout: 600000,
|
||||
fail: (ex) => {
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
|
||||
<script>
|
||||
import Common from '../../../utils/Common';
|
||||
import { baseURL } from '../../../utils/request';
|
||||
var mqttClient=null;
|
||||
export default {
|
||||
data() {
|
||||
@ -127,14 +128,19 @@ var mqttClient=null;
|
||||
|
||||
let p2=new Promise((resolve,reject)=>{
|
||||
let start = new Date();
|
||||
console.log("Common.baseURL="+Common.baseURL);
|
||||
console.log("baseURL="+baseURL);
|
||||
const token ="";// uni.getStorageSync('token');
|
||||
const clientid ="";// uni.getStorageSync('clientID');
|
||||
uni.uploadFile({
|
||||
url:Common.baseURL+'video/upload',
|
||||
url: 'http://114.55.111.217/video/upload',
|
||||
// url:baseURL+"/app/video/upload",
|
||||
filePath: this.videoPath,
|
||||
name: 'file',
|
||||
header: {
|
||||
"Method": "POST",
|
||||
"Content-Type": "multipart/form-data"
|
||||
"Content-Type": "multipart/form-data",
|
||||
"Authorization": 'Bearer ' + token,
|
||||
"clientid": clientid
|
||||
},
|
||||
timeout: 600000,
|
||||
fail: (ex) => {
|
||||
|
||||
Reference in New Issue
Block a user