删除测试App的部分文件,修复loading有时不显示的问题
This commit is contained in:
@ -48,8 +48,9 @@
|
||||
|
||||
<view class="warnnig" :class="{'displayNone':formData.sta_sosadd===''}">
|
||||
<view>闯入报警!</view>
|
||||
<view class="netContent">
|
||||
<view>
|
||||
{{getWarDevice(formData.sta_sosadd)}}
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -171,10 +172,9 @@
|
||||
hideLoading,
|
||||
updateLoading
|
||||
} from '@/utils/loading.js'
|
||||
import {
|
||||
request,
|
||||
import request, {
|
||||
baseURL
|
||||
} from '../../utils/request';
|
||||
} from '@/utils/request.js'
|
||||
|
||||
import Common from '@/utils/Common.js'
|
||||
const pagePath = "/pages/102/HBY102";
|
||||
@ -432,6 +432,7 @@
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
||||
actionSett(item, index) {
|
||||
if (item.group == 'sta_LedType') {
|
||||
this.sosSetting(item, index);
|
||||
@ -736,20 +737,7 @@
|
||||
urls: [img]
|
||||
})
|
||||
},
|
||||
getWarDevice(macStr){//获取正在报警的设备名
|
||||
let f = this.groupDevices.find(v => {
|
||||
return v.deviceMac === macStr;
|
||||
});
|
||||
if (f) {
|
||||
return f.deviceName;
|
||||
}
|
||||
|
||||
if(macStr == this.device.deviceMac) {
|
||||
return this.device.deviceName;
|
||||
}
|
||||
|
||||
return '';
|
||||
},
|
||||
|
||||
bleValueNotify(receive, device, path, recArr) { //订阅消息
|
||||
if (receive.deviceId !== this.formData.deviceId) {
|
||||
return;
|
||||
@ -770,14 +758,21 @@
|
||||
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 => {
|
||||
console.log("dev=", dev);
|
||||
if (dev) {
|
||||
msg.push('"' + dev.deviceName + '"闯入报警中');
|
||||
} else {
|
||||
@ -798,9 +793,9 @@
|
||||
// this.formData.sta_IntrusTime=instrusionTime;
|
||||
// }, 1000);
|
||||
} else {
|
||||
clearInterval(instrusionTime);
|
||||
instrusionTime = 0;
|
||||
this.formData.sta_IntrusTime = 0;
|
||||
// clearInterval(instrusionTime);
|
||||
// instrusionTime = 0;
|
||||
// this.formData.sta_IntrusTime = 0;
|
||||
}
|
||||
if (msg.length > 0) {
|
||||
this.showMsg(msg.join(','));
|
||||
@ -808,6 +803,26 @@
|
||||
|
||||
|
||||
},
|
||||
|
||||
getWarDevice(macStr) {
|
||||
if (macStr) {
|
||||
|
||||
if (!macStr.includes(':')) {
|
||||
macStr = macStr.replace(/(.{2})/g, '$1:').slice(0, -1)
|
||||
}
|
||||
|
||||
let f = this.groupDevices.find(v => {
|
||||
return v.deviceMac === macStr;
|
||||
});
|
||||
|
||||
if (f) {
|
||||
return f.deviceName;
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
},
|
||||
|
||||
searchDevice(macStr) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (macStr.includes(':')) {
|
||||
@ -819,45 +834,59 @@
|
||||
let f = this.groupDevices.find(v => {
|
||||
return v.deviceMac === macStr;
|
||||
});
|
||||
console.log("111111111");
|
||||
if (f) {
|
||||
console.log("找到设备", f);
|
||||
resolve(f);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("111111111");
|
||||
if (macStr == this.device.deviceMac) {
|
||||
console.log("当前设备", this.device);
|
||||
resolve(this.device);
|
||||
return;
|
||||
}
|
||||
console.log("111111111");
|
||||
try {
|
||||
|
||||
request({
|
||||
url: '/app/device/getDeviceInfoByDeviceMac',
|
||||
method: 'GET',
|
||||
data: {
|
||||
deviceMac: these.device.macAddress
|
||||
}
|
||||
}).then(res => {
|
||||
|
||||
console.log("获取设备信息", res);
|
||||
if (res && res.code == 200) {
|
||||
console.log("res=", res);
|
||||
let data = res.data;
|
||||
if (data) {
|
||||
this.groupDevices.push({
|
||||
deviceMac: data.deviceMac,
|
||||
deviceName: data.deviceName
|
||||
})
|
||||
resolve(data);
|
||||
return;
|
||||
request({
|
||||
url: '/app/device/getDeviceInfoByDeviceMac',
|
||||
method: 'GET',
|
||||
data: {
|
||||
deviceMac: macStr
|
||||
}
|
||||
}
|
||||
}).then(res => {
|
||||
|
||||
console.log("获取设备信息", res);
|
||||
if (res && res.code == 200) {
|
||||
console.log("res=", res);
|
||||
let data = res.data;
|
||||
if (data) {
|
||||
this.groupDevices.push({
|
||||
deviceMac: data.deviceMac,
|
||||
deviceName: data.deviceName
|
||||
})
|
||||
resolve(data);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
console.log("222222222");
|
||||
}
|
||||
|
||||
resolve(null);
|
||||
|
||||
}).catch(ex => {
|
||||
console.error("查询设备出现异常:", ex);
|
||||
resolve(null);
|
||||
|
||||
}).finally(com => {
|
||||
console.log("complete")
|
||||
});
|
||||
} catch (err) {
|
||||
console.error("err=", err);
|
||||
resolve(null);
|
||||
|
||||
}).catch(ex => {
|
||||
|
||||
resolve(null);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user