1
0
forked from dyf/APP

增加蓝牙设备人员信息登记上传

This commit is contained in:
liub
2025-09-16 14:51:23 +08:00
parent 778594574b
commit 6331190f0d
10 changed files with 481 additions and 394 deletions

View File

@ -145,20 +145,20 @@
<script>
import TextToHexV1 from '@/components/TextToHex/TextToHexV1.vue';
import bleTool from '@/utils/BleHelper.js';
import usrApi from '@/api/670/HBY670.js'
import {
showLoading,
hideLoading,
updateLoading
} from '@/utils/loading.js'
import {
registerPersonInfo
} from '@/api/6170/deviceControl.js';
import BleReceive from '@/utils/BleReceive';
var ble = null;
var these = null;
var BrighInteval = null;
var recei = null;
export default {
components: {
TextToHexV1
@ -261,6 +261,7 @@
},
onLoad: function() {
these = this;
recei = BleReceive.getBleReceive();
ble = bleTool.getBleTool();
// let bleName = 'FB_Site_UART'; //JQZM-EF4651 FB_Site_UART
@ -392,9 +393,13 @@
return f;
},
bleValueNotify: function(receive) {
console.log("处理接收到的数据:" + receive);
bleValueNotify: function(receive, device, path) {
let str = recei.ReceiveData(receive, device, pagePath);
console.log("处理接收到的数据:" + str);
return;
let data = recei.ReceiveData(receive, device, pagePath);
let bytes = receive.bytes;
if (bytes[0] == 0xFB && bytes[1] == 0x64 && bytes.length >= 8) {
@ -1120,19 +1125,16 @@
});
// let formdata = {
// code:"",
// name: these.formData.textLines[2],
// position: these.formData.textLines[1],
// unitName: these.formData.textLines[0],
// deviceId: these.device.id,
// deviceImei: these.device.deviceImei
// };
// registerPersonInfo(formdata).then(res=>{
// console.log("res=",res);
// }).catch(ex=>{
// console.log("ex=",ex);
// });
let json = {
deviceId: these.device.id,
name: these.formData.textLines[2],
position: these.formData.textLines[0],
unitName: these.formData.textLines[1],
code: ""
};
usrApi.sendUsr(json)
} else {
this.showPop({
message: "出现异常发送失败",

View File

@ -174,10 +174,8 @@
updateLoading
} from '@/utils/loading.js'
import {request,baseURL} from '../../utils/request';
import {
registerPersonInfo
} from '@/api/6170/deviceControl.js';
import usrApi from '@/api/670/HBY670.js'
const pagePath = "pages/650/HBY650";
var ble = null;
var these = null;
@ -1198,16 +1196,16 @@
visibleClose: true
});
these.setBleFormData();
// let formdata = {
// code: these.formData.id,
// name: these.formData.name,
// position: these.formData.job,
// unitName: these.formData.company,
// deviceId: these.device.id,
// deviceImei: these.device.deviceImei
// };
// registerPersonInfo(formdata);
let json = {
deviceId: these.device.id,
name: these.formData.company,
position: these.formData.name,
unitName: these.formData.job,
code: these.formData.id
};
usrApi.sendUsr(json)
return;
}

View File

@ -253,11 +253,9 @@
request,
baseURL
} from '../../utils/request';
import {
registerPersonInfo
} from '@/api/6170/deviceControl.js';
const pagePath = "pages/650/HBY650";
const pagePath = "pages/670/HBY670";
var ble = null;
var these = null;
var recei = null;
@ -1874,15 +1872,14 @@
hideLoading(these);
// let formdata = {
// code: these.formData.usrid,
// name: these.formData.usrname,
// position: these.formData.job,
// unitName: these.formData.company,
// deviceId: these.device.id,
// deviceImei: these.device.deviceImei
// };
// registerPersonInfo(formdata);
let json = {
deviceId: these.device.id,
name: these.formData.company,
position: these.formData.usrname,
unitName: these.formData.job,
code: these.formData.usrid
};
api.sendUsr(json)
return;
}

View File

@ -896,7 +896,7 @@
console
.log(
"收到mac地址:",
+
this
.receiveData
.macAddress

View File

@ -19,7 +19,7 @@
</view>
</view>
<view class="btnLink" @click="Link()">
连接
绑定
</view>
<global-loading ref="loading" />
@ -124,7 +124,7 @@
}
})
let inteval = setInterval(this.initDevice, 5000);
// let inteval = setInterval(this.initDevice, 5000);
},
methods: {
@ -152,7 +152,7 @@
ble.data.LinkedList.find((v) => {
if (v.deviceId == these.device.deviceId) {
for (var i = 0; i < keys.length; i++) {
// let key = keys[i];
let key = keys[i];
// if(!v.device){
// v.device={};
// }
@ -221,7 +221,8 @@
if (res.code == 200) {
these.Statu.bound = true;
these.Statu.boundRemark = "设备绑定成功!";
let data=these.serverDevice;
let keys = Object.keys(data);
ble.data.LinkedList.find((v) => {
if (v.deviceId == these.device.deviceId) {
for (var i = 0; i < keys.length; i++) {
@ -251,6 +252,7 @@
}).catch((ex) => {
these.Statu.bound = false;
these.Statu.boundRemark = '出现了未知的异常,操作失败';
console.log("ex=",ex);
}).finally(() => {
hideLoading(this);
});