1
0
forked from dyf/APP

102真机测试完成

This commit is contained in:
liub
2025-12-01 16:24:22 +08:00
parent 052a7116c5
commit 6a2688caf4
6 changed files with 253 additions and 80 deletions

View File

@ -16,7 +16,7 @@
<view class="row">
<image class="img" src="/static/images/6155/DeviceDetail/time.png" mode="aspectFit"></image>
<view class="txt">
<view class="bigTxt">{{formData.sta_charge?dic.sta_charge[formData.sta_charge]:"" }}</view>
<view class="bigTxt">{{formData.sta_charge?dic.sta_charge[formData.sta_charge+'']:"未充电" }}</view>
<view class="smallTxt">设备状态</view>
</view>
</view>
@ -46,10 +46,10 @@
</view> -->
</view>
<view class="warnnig" :class="{'displayNone':formData.sta_sosadd===''}">
<view class="warnnig" v-for="item,index in warnDevices">
<view>闯入报警</view>
<view>
{{getWarDevice(formData.sta_sosadd)}}
{{item.name}}
</view>
</view>
@ -114,6 +114,7 @@
</view>
<view class="rightTxt">
<text class="bigTxt">{{item.name}}</text>
<text class="smallTxt" v-if="item.group==='sta_RadarType'">{{Distance}}</text>
</view>
</view>
@ -160,6 +161,10 @@
<global-loading ref="loading" />
<BottomSlideMenuPlus :config="Status.BottomMenu" @itemClick="btnClick" @close="closeActionSheet">
</BottomSlideMenuPlus>
</view>
</template>
@ -218,9 +223,31 @@
show: false,
showHeader: true,
menuItems: [{
text: '强光',
icon: '/static/images/6155/DeviceDetail/qiang.png'
}],
text: '2M',
value:'status_2M',
icon: ''
},
{
text: '4M',
value:'status_4M',
icon: ''
},
{
text: '7M',
value:'status_7M',
icon: ''
},
{
text: '10M',
value:'status_10M',
icon: ''
},
{
text: '关闭',
value:'status_off',
icon: ''
}
],
activeIndex: -1,
bgColor: '#2a2a2a',
itemBgColor: '#3a3a3a',
@ -254,12 +281,13 @@
statu: '',
sta_address: '',
bleStatu: false,
sta_charge:'',
sta_LedType: '',
sta_RadarType: '',
sta_Online: '',
warnTime: '',
sta_sosadd: "",
sta_sosName:'',
sta_IntrusTime: ''
},
@ -349,10 +377,7 @@
showConfirm: false
},
groupDevices: [],
audioData: {
packetCtn: 0,
hexs: []
}
warnDevices:[]
}
},
@ -429,7 +454,28 @@
this.Status.pageHide = false;
},
computed: {
Distance:function(){
let f=this.Status.BottomMenu.menuItems.find((item,index)=>{
return item.value===this.formData.sta_RadarType;
});
if(f){
return f.text;
}
return '关闭';
},
activeIndex:function(){
let active=4;
let f=this.Status.BottomMenu.menuItems.find((item,index)=>{
if(item.value===this.formData.sta_RadarType){
active=index;
}
});
return active;
}
},
methods: {
@ -441,7 +487,8 @@
if (item.group == 'sta_RadarType') {
this.toggleRedar(item, index);
// this.toggleRedar(item, index);
this.showRedarSetting(item,index);
return;
}
@ -507,6 +554,25 @@
}
},
showRedarSetting(){
this.Status.BottomMenu.show=true;
this.Status.BottomMenu.showBtn=false;
this.Status.BottomMenu.title="感应距离设置";
this.Status.BottomMenu.textAlign="center";
this.Status.BottomMenu.showMask=true;
this.Status.BottomMenu.activeIndex=this.activeIndex;
},
btnClick(item,index){
this.Status.BottomMenu.show=false;
console.log("选中的项:"+index+",值:"+JSON.stringify(item));
this.toggleRedar(item,index);
},
closeActionSheet(){
this.Status.BottomMenu.show=false;
},
toggleRedar(item, index) { //雷达启停
let f = this.getDevice();
@ -521,7 +587,7 @@
deviceId: '12345'
}
// #endif
let val = item.key;
let val = item.value;
if (this.formData.sta_RadarType === val) {
val = 'status_off';
}
@ -533,7 +599,9 @@
ble.sendString(f.deviceId, json, f.writeServiceId, f.wirteCharactId, 30)
.then(res => {
debugger;
this.formData.sta_RadarType = val;
this.Status.BottomMenu.activeIndex=index;
these.setBleFormData();
resolve();
})
@ -750,33 +818,58 @@
console.log("json=", json)
let keys = Object.keys(json);
let active=-1;
let f=this.Status.BottomMenu.menuItems.find((item,index)=>{
if(item.value===json.sta_RadarType){
active=index;
}
});
this.Status.BottomMenu.activeIndex=active;
let msg = [];
if (json.sta_PowerPercent <= 20 && (json.sta_charge===0 || json.sta_charge==='0')) {
msg.push("设备电量低");
}
if(json.sta_sosadd_off){//某个设备解除报警
this.warnDevices.filter((d,index)=>{
if(d.mac===json.sta_sosadd_off){
this.warnDevices.splice(index,1);
}
});
}
let keys = Object.keys(json);
keys.forEach(key => {
if (key in this.formData) {
// console.log("key=",key+",value=",json[key]);
this.formData[key] = json[key];
}
});
let msg = [];
if (this.formData.sta_PowerPercent <= 20) {
msg.push("设备电量低");
}
if (json.sta_sosadd_off == this.formData.sta_sosadd) {
this.formData.sta_sosadd = "";
let name=this.getWarDevice(json.sta_sosadd_off);
msg.push('"' + name + '"取消报警');
}
if (this.formData.sta_sosadd !== "") {
console.log("查询设备中");
this.searchDevice(this.formData.sta_sosadd).catch(ex => {}).then(dev => {
if (json.sta_sosadd) {//某个设备闯入报警
console.log("查询设备中",json.sta_sosadd);
this.searchDevice(json.sta_sosadd).catch(ex => {}).then(dev => {
console.log("dev=", dev);
let d=this.warnDevices.find(v=>{return v.mac===json.sta_sosadd});
let deviceName="";
if (dev) {
// this.formData.sta_sosName=dev.deviceName;
msg.push('"' + dev.deviceName + '"闯入报警中');
deviceName=dev.deviceName;
} else {
msg.push('闯入报警中');
// this.formData.sta_sosName="";
}
if(!d){
this.warnDevices.push({mac:json.sta_sosadd,name:deviceName});
}
this.showMsg(msg.join(','));
});
@ -805,6 +898,7 @@
},
getWarDevice(macStr) {
console.log("macStr=",macStr);
if (macStr) {
if (!macStr.includes(':')) {
@ -834,13 +928,13 @@
let f = this.groupDevices.find(v => {
return v.deviceMac === macStr;
});
console.log("111111111");
// console.log("111111111");
if (f) {
console.log("找到设备", f);
resolve(f);
return;
}
console.log("111111111");
// console.log("111111111");
if (macStr == this.device.deviceMac) {
console.log("当前设备", this.device);
resolve(this.device);
@ -1058,9 +1152,6 @@
buttonText: '确定',
okCallback: null
});
},
btnClick() {
}
}
}