670加入机器状态、设备详情加接口请求
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user