670加入机器状态、设备详情加接口请求

This commit is contained in:
liub
2025-09-18 17:31:40 +08:00
parent 404e42a7d8
commit cb44810c6b
10 changed files with 454 additions and 221 deletions

View File

@ -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() {