完成100

This commit is contained in:
liub
2025-11-07 11:57:35 +08:00
parent c39cbcb34d
commit 2493bb7113
16 changed files with 1278 additions and 527 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
<template>
<view class="content contentBg">
<view class="eq">
<view class="leftImg" @click.stop="previewImg(formData.img)">
<image class="img" :src="formData.img?formData.img:'/static/images/4877/4877equip.png'"
<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>
</view>
<view class="rightTxt">
@ -27,6 +27,10 @@
<text class="lbl">设备名称</text>
<text class="value">{{device.deviceName}}</text>
</view>
<view class="item">
<text class="lbl">Mac地址</text>
<text class="value">{{device.deviceMac}}</text>
</view>
<view class="item">
<text class="lbl">蓝牙名称</text>
<text class="value">{{device.bluetoothName}}</text>
@ -312,7 +316,7 @@
usrToggle: true,
},
formData: {
img: '/static/images/4877/4877equip.png',
img: '/static/images/common/BJQ4877.png',
sta_PowerPercent: '',
xuhang: '',
blename: '',
@ -439,7 +443,7 @@
}
these.formData.blename = f.name ? f.name : "Unname";
these.formData.deviceName = device.deviceName;
these.formData.img = device.devicePic;
these.formData.bleStatu = false;
these.formData.deviceId = f.deviceId;
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {

View File

@ -1,8 +1,9 @@
<template>
<view class="content contentBg">
<view class="eq">
<view class="leftImg" @click.stop="previewImg(formData.img)">
<image class="img" :src="formData.img" mode="aspectFit"></image>
<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>
</view>
<view class="rightTxt">
<view class="row">
@ -27,6 +28,10 @@
<text class="lbl">设备名称</text>
<text class="value">{{device.deviceName}}</text>
</view>
<view class="item">
<text class="lbl">Mac地址</text>
<text class="value">{{device.deviceMac}}</text>
</view>
<view class="item">
<text class="lbl">设备状态</text>
<text class="value">{{formData.statu}}</text>
@ -228,7 +233,7 @@
}
},
formData: {
img: '',
img: '/static/images/common/HBY6155.png',
battary: '',
xuhang: '',
deviceName: '',
@ -355,7 +360,7 @@
}
these.formData.blename = f.name ? f.name : "Unname";
these.formData.deviceName = device.deviceName;
these.formData.img = device.devicePic;
these.formData.id = device.id;
these.formData.deviceId = f.deviceId;
these.formData.bleStatu = false;

View File

@ -1,22 +0,0 @@
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>

View File

@ -1,8 +1,8 @@
<template>
<view class="content contentBg">
<view class="eq">
<view class="leftImg" @click.stop="previewImg(formData.img)">
<image class="img" :src="formData.img" mode="aspectFit"></image>
<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>
</view>
<view class="rightTxt">
<view class="row">
@ -26,6 +26,10 @@
<text class="lbl">设备名称</text>
<text class="value">{{device.deviceName}}</text>
</view>
<view class="item">
<text class="lbl">Mac地址</text>
<text class="value">{{device.deviceMac}}</text>
</view>
<view class="item">
<text class="lbl">蓝牙名称</text>
<text class="value">{{device.bluetoothName}}</text>
@ -308,7 +312,7 @@
usrToggle: true,
},
formData: {
img: '/static/images/6155/DeviceDetail/equip.png',
img: '/static/images/common/BJQ6331.png',
battary: '',
xuhang: '',
blename: '',
@ -395,7 +399,7 @@
}
these.formData.blename = f.name ? f.name : "Unname";
these.formData.deviceName = device.deviceName;
these.formData.img = device.devicePic;
these.formData.deviceId = f.deviceId;
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {

View File

@ -1,8 +1,8 @@
<template>
<view class="content contentBg">
<view class="eq">
<view class="leftImg" @click.stop="previewImg(formData.img)">
<image class="img" :src="formData.img" mode="aspectFit"></image>
<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>
</view>
<view class="rightTxt">
<view class="row">
@ -26,6 +26,10 @@
<text class="lbl">蓝牙名称</text>
<text class="value">{{device.bluetoothName}}</text>
</view>
<view class="item">
<text class="lbl">Mac地址</text>
<text class="value">{{device.deviceMac}}</text>
</view>
<view class="item">
<text class="lbl">设备名称</text>
<text class="value">{{device.deviceName}}</text>
@ -250,7 +254,7 @@
usrToggle: true,
},
formData: {
img: '/static/images/6155/DeviceDetail/equip.png',
img: '/static/images/common/HBY650.png',
battary: '',
xuhang: '',
blename: '',
@ -344,7 +348,7 @@
}
these.formData.blename = f.name ? f.name : "Unname";
these.formData.deviceName = device.deviceName;
these.formData.img = device.devicePic;
these.formData.bleStatu = false;
these.formData.deviceId = f.deviceId;
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {

View File

@ -2,10 +2,12 @@
<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>
</view>
<view class="eq" :style="{marginTop:Status.navbar.height+'px'}">
<view class="leftImg" @click.stop="previewImg(device['devicePic'])">
<image class="img" :src="device['devicePic']" mode="aspectFit"></image>
<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>
</view>
<view class="rightTxt">
<view class="row">
@ -25,13 +27,18 @@
</view>
</view>
<view class="eqinfo">
<view class="item">
<text class="lbl">设备名称</text>
<text class="value valueFont">{{device.deviceName}}</text>
</view>
<view class="item">
<text class="lbl">设备IMEI</text>
<text class="value valueFont">{{device.deviceImei}}</text>
</view>
<view class="item">
<text class="lbl">设备名称</text>
<text class="value valueFont">{{device.deviceName}}</text>
<text class="lbl">Mac地址</text>
<text class="value">{{device.deviceMac}}</text>
</view>
<view class="item">
<text class="lbl">蓝牙名称</text>
@ -382,6 +389,7 @@
bleLinkCnt: 0
},
formData: {
img:'/static/images/common/HBY670.png',
battary: "", //电量
xuhang: "", //续航
imei: "", //imei
@ -518,6 +526,7 @@
let keys = Object.keys(form);
for (var i = keys.length; i >= 0; i--) {
let key = keys[i];
these.formData[key] = form[key];
}
}

View File

@ -1,8 +1,8 @@
<template>
<view class="content contentBg">
<view class="eq">
<view class="leftImg" @click.stop="previewImg(formData.img)">
<image class="img" :src="formData.img" mode="aspectFit"></image>
<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>
</view>
<view class="rightTxt">
<view class="row">
@ -26,6 +26,10 @@
<text class="lbl">设备名称</text>
<text class="value">{{device.deviceName}}</text>
</view>
<view class="item">
<text class="lbl">Mac地址</text>
<text class="value">{{device.deviceMac}}</text>
</view>
<view class="item">
<text class="lbl">设备状态</text>
<text class="value">{{formData.statu}}</text>
@ -229,7 +233,7 @@
}
},
formData: {
img: '',
img: '/static/images/common/HBY6155.png',
battary: '',
xuhang: '',
deviceName: '',
@ -310,7 +314,7 @@
}
these.formData.blename = f.name ? f.name : "Unname";
these.formData.deviceName = device.deviceName;
these.formData.img = device.devicePic;
these.formData.id = device.id;
these.formData.deviceId = f.deviceId;
these.formData.bleStatu = false;

View File

@ -6,19 +6,19 @@
</image>
</view>
<view class="deviceName">
蓝牙名:{{device.name}}
蓝牙名:{{serverDevice?serverDevice['bluetoothName']: device.name}}
</view>
<view class="deviceName">
状态:{{deviceStatu}}
</view>
<view class="deviceName">
设备名:{{device.deviceName}}
设备名:{{serverDevice?serverDevice['deviceName']:device.deviceName}}
</view>
<view class="deviceId">
设备Mac:{{device.macAddress}}
设备Mac:{{serverDevice?serverDevice['deviceMac']:device.macAddress}}
</view>
<view class="deviceId">
设备IMEI:{{device.imei}}
设备IMEI:{{serverDevice?serverDevice['deviceImei']:device.imei}}
</view>
<view class="bound" :class="boundStatu">
{{Statu.boundRemark}}
@ -84,17 +84,18 @@
}
},
deviceStatu: function() {
if (!this.device.name) {
debugger;
if (!this.device.name && !this.device.macAddress) {
return "";
}
if (!this.device.linkStatu) {
if (!this.device.linkStatu && !this.device.macAddress) {
return "蓝牙未连接";
}
if (!this.device.macAddress) {
return '等待设备上报Mac地址';
}
if (!this.device.deviceName) {
if (!this.device.deviceName && !(this.serverDevice && this.serverDevice.deviceName)) {
if (this.Statu.isSearch) {
return "无效设备";
} else {
@ -105,7 +106,10 @@
}
}
} else {
return "找到有效设备"
return "找到有效设备"
}
return "";
@ -192,30 +196,39 @@
}
}, pagePath);
eventChannel = this.getOpenerEventChannel();
eventChannel.on('LinkItem', function(data) {
console.log("data=", data);
let f = ble.data.LinkedList.find((v) => {
return v.deviceId == data.deviceId;
});
if (f) {
let keys = Object.keys(f);
keys.forEach((v, index) => {
these.device[v] = f[v];
})
// console.log("LinkedList=", ble.data.LinkedList)
// console.log("f=", f);
// console.log("获取到设备", these.device);
if (f.macAddress) {
these.device.macAddress = f.macAddress;
these.initDevice();
if(option.mac){
this.device.macAddress=option.mac;
these.initDevice();
}
else{
eventChannel.on('LinkItem', function(data) {
console.log("data=", data);
let f = ble.data.LinkedList.find((v) => {
return v.deviceId == data.deviceId;
});
if (f) {
let keys = Object.keys(f);
keys.forEach((v, index) => {
these.device[v] = f[v];
})
// console.log("LinkedList=", ble.data.LinkedList)
// console.log("f=", f);
// console.log("获取到设备", these.device);
if (f.macAddress) {
these.device.macAddress = f.macAddress;
these.initDevice();
}
} else {
console.log("未获取到设备");
}
} else {
console.log("未获取到设备");
}
})
let inteval = setInterval(this.initDevice, 10000);
})
let inteval = setInterval(this.initDevice, 10000);
}
},
methods: {
reLinkdevice() {
@ -281,6 +294,7 @@
deviceInvalid();
}
} else {
this.serverDevice =null;
deviceInvalid();
}
@ -297,21 +311,21 @@
},
Link() {
// 调用绑定设备接口
let f = ble.data.LinkedList.find((v) => {
return v.deviceId == these.device.deviceId;
});
if (!f) {
// let f = ble.data.LinkedList.find((v) => {
// return v.deviceId == these.device.deviceId;
// });
// if (!f) {
// these.Statu.bound = false;
// these.Statu.boundRemark = "蓝牙连接不成功";
// return;
// }
if (!this.device.macAddress) {
these.Statu.bound = false;
these.Statu.boundRemark = "蓝牙连接不成功";
these.Statu.boundRemark = "获取设备Mac地址异常";
return;
}
if (!f.macAddress) {
these.Statu.bound = false;
these.Statu.boundRemark = "设备上报Mac地址异常";
return;
}
if (!this.device.deviceName) {
if (!this.serverDevice) {
these.Statu.bound = false;
these.Statu.boundRemark = "设备未入库";
return;

View File

@ -333,8 +333,8 @@
this.total = 0; // 重置总数
const deviceType = tab.id === '' ? undefined : tab.id;
this.$nextTick(() => {
this.getSystemInfoSyncH();
});
this.getSystemInfoSyncH();
});
this.getData(deviceType);
if (this.mescroll) {
this.mescroll.resetUpScroll();
@ -400,9 +400,54 @@
case 'scan':
uni.scanCode({
success: (res) => {
const cleanedResult = res.result.trim();
uni.navigateTo({
url: `/pages/common/qrcode/qrcode?deviceId=${encodeURIComponent(cleanedResult)}`
let cleanedResult = res.result.trim();
console.log("scanResult=", cleanedResult);
let promise = new Promise((resolve, reject) => {
let url = '';
try {
let json = JSON.parse(cleanedResult);
console.log("json=", json);
if ('blue' in json) {
let mac = json.blue;
if (mac) {
if (!mac.includes(':')) {
mac = mac.replace(/(.{2})/g,'$1:').slice(0,-1)
}
url =`/pages/common/addBLE/LinkBle?mac=${encodeURIComponent(mac)}`;
console.log("蓝牙设备",mac);
}
} else if ('imei' in json) {
let imei = json.imei;
if (iemi) {
url =
`/pages/common/qrcode/qrcode?deviceId=${encodeURIComponent(imei)}`;
console.log("4G设备:",imei)
}
}
} catch (error) {
console.error("识别二维码失败,",error);
} finally {
if(!url){
url =
`/pages/common/qrcode/qrcode?deviceId=${encodeURIComponent(cleanedResult)}`
console.log("未知设备:",cleanedResult)
}
resolve(url);
}
});
promise.then(res => {
uni.navigateTo({
url: res
});
});
},
fail: (err) => {
@ -456,9 +501,9 @@
if (this.$refs.swipeAction) {
this.$refs.swipeAction.closeAll();
}
console.log("111111",this.deviceId);
console.log("ble==null,",ble)
ble && ble.DropDevice(null,this.deviceId.id);
console.log("111111", this.deviceId);
console.log("ble==null,", ble)
ble && ble.DropDevice(null, this.deviceId.id);
} else {
uni.showToast({
title: res.msg,
@ -541,10 +586,10 @@
// 列表跳转
handleFile(item) {
let url = item.detailPageUrl;
// url="/pages/6331/BJQ6331";
uni.navigateTo({
url: url,
success: (res) => {