批量报警、批量发送消息,分供应商处理

This commit is contained in:
liub
2026-03-10 14:07:13 +08:00
parent 4cacdbe7f7
commit 2be522977c
15 changed files with 1273 additions and 1011 deletions

View File

@ -18,13 +18,16 @@
<image src="/static/images/common/more.png" mode="aspectFit" class="more"></image>
</view>
</view>
<!-- <view class="sendFlex" v-if="activeTab && activeTab.id !== ''&& activeTabInfo.communicationMode==0 || activeTabInfo.communicationMode==2">
<view class="callpolice" @click="callpolice">报警</view>
<view class="Sendmessage" @click="location">位置</view>
<view class="Sendmessage" @click="handleSend" v-if="activeTabInfo.typeName!=='HBY100-J'">发送信息</view>
</view> -->
<!-- <scroll-view class="device-list" scroll-y @scrolltolower="onScrollToLower" :lower-threshold="100" style="height:80vh;"> -->
<mescroll-uni class="device-list" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption"
<view class="sendFlex"
v-show="showSendFlex"
>
<view class="callpolice" @click="callpolice" v-show="showWarn">报警</view>
<view class="Sendmessage" @click="location" v-show="showMap">位置</view>
<view class="Sendmessage" @click="handleSend"
v-show="ShowSendmessage">发送信息</view>
</view>
<mescroll-uni class="device-list" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption"
:down="downOption" :fixed="false" :style="{ height: mescrollHeight + 'px' }">
<view v-if="deviceList.length>0">
<uni-swipe-action ref="swipeAction">
@ -40,15 +43,15 @@
<view class="device-name">
<view>设备:{{item.deviceName}}</view>
<view class="ID">
<view class="ID" v-if="item.communicationMode==0 || item.communicationMode==2">ID:{{item.deviceImei}}
<view class="ID"
v-if="item.communicationMode==0 || item.communicationMode==2">
ID:{{item.deviceImei}}
</view>
<view class="ID" v-else>ID:{{item.deviceMac}}</view>
<!-- 在线状态 -->
<view class="onlines"
v-if="item.onlineStatus==1">在线</view>
<view class="onlines" v-if="item.onlineStatus==1">在线</view>
<!-- 离线状态 -->
<view class="offlines"
v-if="item.onlineStatus==0">离线</view>
<view class="offlines" v-if="item.onlineStatus==0">离线</view>
<view>电量{{item.battery || '0'}}%</view>
</view>
</view>
@ -74,7 +77,7 @@
暂无数据
</view> -->
</mescroll-uni>
<!-- </scroll-view> -->
</view>
<!-- 删除弹框 -->
<view class="agreement-mask" v-if="deleteShow" @click.stop="closePopup('delete')" catchtouchmove="true">
@ -116,7 +119,7 @@
<view class="tooltip-content" @click.stop>
<view class="tooltip-item" v-for="(item, index) in menuItems" :key="index"
@click="handleMenuClick(item)">
<image :src="item.icon" class="item-icon" mode="aspectFit"/>
<image :src="item.icon" class="item-icon" mode="aspectFit" />
<text>{{ item.text }}</text>
</view>
</view>
@ -146,17 +149,34 @@
} from '@/api/common/index.js'
import bleTool from '@/utils/BleHelper.js';
import MescrollUni from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-uni.vue'
import BleReceive from '@/utils/BleReceive';
import BleReceive from '@/utils/BleReceive';
var pagePath = 'pages/common/index';
var ble = null;
var timeout = null;
var recei=null;
var recei = null;
export default {
components: {
MescrollUni
},
computed:{
showSendFlex(){
// return this.activeTab && this.activeTab.id !== ''&& (this.activeTabInfo.communicationMode==0 || this.activeTabInfo.communicationMode==2);
if(this.showMap || this.ShowSendmessage || this.showWarn){
return true;
}
return false;
},
ShowSendmessage(){
return this.dic.showMsgTypes.indexOf(this.activeTabInfo.typeName)>-1
},
showMap(){
return this.dic.showMapTypes.indexOf(this.activeTabInfo.typeName)>-1
},
showWarn(){
return this.dic.showCallPolice.indexOf(this.activeTabInfo.typeName)>-1
}
},
data() {
return {
mescroll: null,
@ -187,8 +207,7 @@ import BleReceive from '@/utils/BleReceive';
navTitle: "我的设备",
deleteShow: false,
RenameModel: false,
menuItems: [
{
menuItems: [{
text: '扫一扫添加',
icon: '/static/images/common/scane.png',
action: 'scan'
@ -233,7 +252,12 @@ import BleReceive from '@/utils/BleReceive';
deviceId: '',
deviceName: "", //重命名
activeTabInfo: ''
activeTabInfo: '',
dic: {
showMsgTypes: ['BJQ6170', 'HBY210', 'HBY670', 'BJQ6075', 'BJQ6075J'],//需要发送消息的类型
showMapTypes:['BJQ6170','HBY210','HBY670','BJQ6075','HBY018A','HBY100-J','BJQ6075J','HBY008A','HBY100-Y'],//需要显示地图的类型
showCallPolice:['BJQ6170','HBY210','HBY670','BJQ6075','HBY018A','HBY100-J','BJQ6075J','HBY008A','HBY100-Y']//需要发送报警的类型
}
}
},
methods: {
@ -254,7 +278,7 @@ import BleReceive from '@/utils/BleReceive';
// 下拉刷新
downCallback() {
if (this.mescroll) {
this.mescroll.resetUpScroll(false);
this.mescroll.scrollTo(0, 0);
@ -266,7 +290,7 @@ import BleReceive from '@/utils/BleReceive';
// 上拉加载
upCallback() {
this.getData();
},
@ -387,7 +411,7 @@ import BleReceive from '@/utils/BleReceive';
if (res.code == 200) {
//console.log("deviceTypeList=" + JSON.stringify(res.data));
this.tabs = [{
id: '',
id: '',
name: '全部设备',
typeName: '全部设备'
},
@ -412,7 +436,7 @@ import BleReceive from '@/utils/BleReceive';
getData() {
var task = () => {
return new Promise((resolve, reject) => {
let data = {
pageNum: this.mescroll.num,
@ -496,9 +520,9 @@ import BleReceive from '@/utils/BleReceive';
case 'scan':
// 扫一扫
uni.navigateTo({
url:'/pages/common/addScan/ScanEquip'
url: '/pages/common/addScan/ScanEquip'
});
break;
case 'bluetooth':
uni.navigateTo({
@ -619,7 +643,7 @@ import BleReceive from '@/utils/BleReceive';
const deviceType = currentTab.id || '';
console.log(`跳转到发送信息页面\n当前设备类型: ${deviceType}\n设备类型名称: ${currentTab.typeName}`);
uni.navigateTo({
url: '/pages/6170/callPolice/index',
url: '/pages/common/callPolice/index',
events: {
ack: function(data) {}
},
@ -666,7 +690,7 @@ import BleReceive from '@/utils/BleReceive';
// 列表跳转
handleFile(item) {
let url = item.detailPageUrl;
// url="/pages/6075/BJQ6075L";
// url="/pages/6075/BJQ6075L";
// if(!url){
// url="/pages/6075/BJQ6075"
// }
@ -715,7 +739,7 @@ import BleReceive from '@/utils/BleReceive';
},
},
onShow() {
if (ble) {
//因为vue视图只能后退不能隐藏后再显示
//所以回到首页后将其他所有页面的订阅都删除
@ -723,12 +747,12 @@ import BleReceive from '@/utils/BleReceive';
}
},
onLoad() {
// console.error("首页加载");
this.getTab()
this.downCallback();
// 绑定页面做了监听,新增成功,刷新页面
uni.$on('refreshDeviceList', () => {
this.getTab() // 刷新数据
@ -771,9 +795,9 @@ import BleReceive from '@/utils/BleReceive';
recei.ReceiveData(receive, device, path, recArr);
this.updateBleStatu();
}, pagePath);
let phone=uni.getStorageSync("phone");
if(phone==='17671332251'){//先写死方便自己使用,后面按人员权限区分
let phone = uni.getStorageSync("phone");
if (phone === '17671332251') { //先写死方便自己使用,后面按人员权限区分
this.menuItems.push({
text: '上报设备',
icon: '/static/images/common/add.png',