批量报警、批量发送消息,分供应商处理
This commit is contained in:
20
App.vue
20
App.vue
@ -30,13 +30,11 @@
|
||||
//以上代码仅在开发时使用,否则会出现不可预知的问题。
|
||||
|
||||
// #ifdef APP|APP-PLUS
|
||||
if (plus.runtime.isAgreePrivacy()) {
|
||||
|
||||
|
||||
bleTool.getBleTool();
|
||||
|
||||
var appid = plus.runtime.appid;
|
||||
console.log('应用的 appid 为:' + appid);
|
||||
|
||||
|
||||
uni.getPushClientId({
|
||||
success(res) {
|
||||
console.log("推送信息:", res);
|
||||
@ -66,7 +64,7 @@
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// #endif
|
||||
},
|
||||
@ -74,18 +72,15 @@
|
||||
console.log('App Show');
|
||||
|
||||
//将检查更新换到onshow,因为苹果用户喜欢一直挂着
|
||||
uni.getSystemInfo({
|
||||
success: function(res) {
|
||||
if (res.uniPlatform == 'app') {
|
||||
// #ifdef APP|APP-PLUS
|
||||
|
||||
let appid = plus.runtime.appid;
|
||||
if (appid !== 'HBuilder') {
|
||||
console.log("appid=", appid);
|
||||
|
||||
if (appid !== 'HBuilder') {
|
||||
upgrade.checkAndUpdateWgt();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
},
|
||||
onHide: function() {
|
||||
console.log('App Hide');
|
||||
@ -212,5 +207,4 @@
|
||||
font-family: "PingFangBold";
|
||||
src: url("~@/static/fonts/PingFangBold.ttf") format("opentype");
|
||||
}
|
||||
|
||||
</style>
|
||||
25
pages.json
25
pages.json
@ -52,8 +52,7 @@
|
||||
{
|
||||
"path": "pages/common/send/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "发送信息",
|
||||
"enablePullDownRefresh": true
|
||||
"navigationBarTitleText": "发送信息"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -102,10 +101,9 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/6170/callPolice/index",
|
||||
"path": "pages/common/callPolice/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "报警",
|
||||
"enablePullDownRefresh": true
|
||||
"navigationBarTitleText": "报警"
|
||||
}
|
||||
},
|
||||
|
||||
@ -160,14 +158,7 @@
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/6155/ImgCrop",
|
||||
"style": {
|
||||
"navigationBarTitleText": "图像裁剪",
|
||||
"navigationStyle": "custom",
|
||||
"fullscreen": true
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "pages/6075/BJQ6075",
|
||||
"style": {
|
||||
@ -447,6 +438,14 @@
|
||||
{
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/common/ImgCrop/ImgCrop",
|
||||
"style": {
|
||||
"navigationBarTitleText": "图像裁剪",
|
||||
"navigationStyle": "custom",
|
||||
"fullscreen": true
|
||||
}
|
||||
}
|
||||
|
||||
],
|
||||
|
||||
@ -679,7 +679,7 @@
|
||||
}
|
||||
let that = this;
|
||||
uni.navigateTo({
|
||||
url: "/pages/6155/ImgCrop",
|
||||
url: "/pages/ImgCrop/ImgCrop",
|
||||
events: {
|
||||
ImgCutOverPath: function(data) {
|
||||
that.selectedImage = data.picPath;
|
||||
|
||||
@ -1145,7 +1145,7 @@
|
||||
sourceType: ['album'],
|
||||
success: function(res) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/6155/ImgCrop",
|
||||
url: "/pages/ImgCrop/ImgCrop",
|
||||
events: {
|
||||
ImgCutOver: function(data) {
|
||||
|
||||
|
||||
@ -909,7 +909,7 @@
|
||||
sourceType: ['album'],
|
||||
success: function(res) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/6155/ImgCrop",
|
||||
url: "/pages/ImgCrop/ImgCrop",
|
||||
events: {
|
||||
ImgCutOver: function(data) {
|
||||
|
||||
|
||||
@ -1,100 +0,0 @@
|
||||
<template>
|
||||
<view>
|
||||
<canvas id="splashCanvas" canvas-id="splashCanvas" :style="{'width':width+'px','height':height+'px'}" style=" z-index: 9999;position: fixed; visibility: hidden;"></canvas>
|
||||
|
||||
|
||||
<qf-image-cropper :src="src" :showAngle="false" :width="cropWidth" :height="cropHeight" fileType="jpg"
|
||||
@crop="handleCrop" :areaScale="0.1" :minScale="0.1" :gpu="true">
|
||||
</qf-image-cropper>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import QfImageCropper from '@/uni_modules/qf-image-cropper/components/qf-image-cropper/qf-image-cropper.vue';
|
||||
export default {
|
||||
components: {
|
||||
QfImageCropper
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
src: "",
|
||||
Statu: false,
|
||||
width:160,
|
||||
height:80,
|
||||
times:10
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
cropWidth(){
|
||||
return this.width*this.times;
|
||||
}
|
||||
,
|
||||
cropHeight(){
|
||||
return this.height*this.times;
|
||||
}
|
||||
},
|
||||
onLoad: function(option) {
|
||||
const eventChannel = this.getOpenerEventChannel();
|
||||
var these = this;
|
||||
eventChannel.on('checkImg', (rec)=> {
|
||||
console.log("我收到你的消息了,消息内容是:" + JSON.stringify(rec));
|
||||
this.src = rec.data;
|
||||
this.width=rec.width?rec.width:160;
|
||||
this.height=rec.height?rec.height:80;
|
||||
this.times=rec.times?rec.times:10;
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
handleCrop(e) {
|
||||
|
||||
var these = this;
|
||||
const eventChannel = these.getOpenerEventChannel();
|
||||
this.Statu = true;
|
||||
console.log("裁剪完成");
|
||||
console.log(e.tempFilePath);
|
||||
eventChannel.emit('ImgCutOver_Path',e.tempFilePath);
|
||||
const ctx = uni.createCanvasContext('splashCanvas', this);
|
||||
ctx.drawImage(
|
||||
e.tempFilePath,
|
||||
0,0,these.width,these.height
|
||||
);
|
||||
setTimeout(() => {
|
||||
ctx.draw(false, ()=>{
|
||||
console.log("abcdefg")
|
||||
uni.canvasGetImageData({
|
||||
canvasId: 'splashCanvas',
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: these.width,
|
||||
height: these.height,
|
||||
success: (res) => {
|
||||
// 处理像素数据并发送
|
||||
|
||||
console.log("res.data.length="+res.data.length);
|
||||
eventChannel.emit('ImgCutOverPath', {
|
||||
picPath: e.tempFilePath
|
||||
});
|
||||
|
||||
eventChannel.emit('ImgCutOver',{piexls:res.data,picPath:e.tempFilePath});
|
||||
|
||||
uni.navigateBack();
|
||||
},
|
||||
fail: (err) => {
|
||||
reject(`获取canvas数据失败: ${err.errMsg}`);
|
||||
}
|
||||
});
|
||||
});
|
||||
}, 500);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.canvas {
|
||||
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
</style>
|
||||
@ -926,7 +926,7 @@
|
||||
sourceType: ['album'],
|
||||
success: function(res) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/6155/ImgCrop",
|
||||
url: "/pages/ImgCrop/ImgCrop",
|
||||
events: {
|
||||
ImgCutOver: function(data) {
|
||||
|
||||
|
||||
@ -979,7 +979,7 @@
|
||||
}
|
||||
let that = this;
|
||||
uni.navigateTo({
|
||||
url: "/pages/6155/ImgCrop",
|
||||
url: "/pages/ImgCrop/ImgCrop",
|
||||
events: {
|
||||
ImgCutOver: function(data) {
|
||||
that.selectedImage = data.picPath;
|
||||
|
||||
@ -1051,7 +1051,7 @@ import request, { baseURL } from '@/utils/request.js';
|
||||
var gotoCutImg = (imgPath) => {
|
||||
|
||||
uni.navigateTo({
|
||||
url: "/pages/6155/ImgCrop",
|
||||
url: "/pages/ImgCrop/ImgCrop",
|
||||
events: {
|
||||
ImgCutOver: function(data) {
|
||||
// console.log("我收到裁剪后的图片了,感谢老铁," + data)
|
||||
|
||||
@ -1871,7 +1871,7 @@
|
||||
var gotoCutImg = (imgPath) => {
|
||||
|
||||
uni.navigateTo({
|
||||
url: "/pages/6155/ImgCrop",
|
||||
url: "/pages/ImgCrop/ImgCrop",
|
||||
events: {
|
||||
ImgCutOver: function(data) {
|
||||
// console.log("我收到裁剪后的图片了,感谢老铁," + data)
|
||||
|
||||
@ -783,7 +783,7 @@
|
||||
sourceType: ['album'],
|
||||
success: function(res) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/6155/ImgCrop",
|
||||
url: "/pages/ImgCrop/ImgCrop",
|
||||
events: {
|
||||
ImgCutOver: function(data) {
|
||||
//将8位的二进制数组转换成16进制数据
|
||||
|
||||
100
pages/common/ImgCrop/ImgCrop.vue
Normal file
100
pages/common/ImgCrop/ImgCrop.vue
Normal file
@ -0,0 +1,100 @@
|
||||
<template>
|
||||
<view>
|
||||
<canvas id="splashCanvas" canvas-id="splashCanvas" :style="{'width':width+'px','height':height+'px'}" style=" z-index: 9999;position: fixed; visibility: hidden;"></canvas>
|
||||
|
||||
|
||||
<qf-image-cropper :src="src" :showAngle="false" :width="cropWidth" :height="cropHeight" fileType="jpg"
|
||||
@crop="handleCrop" :areaScale="0.1" :minScale="0.1" :gpu="true">
|
||||
</qf-image-cropper>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import QfImageCropper from '@/uni_modules/qf-image-cropper/components/qf-image-cropper/qf-image-cropper.vue';
|
||||
export default {
|
||||
components: {
|
||||
QfImageCropper
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
src: "",
|
||||
Statu: false,
|
||||
width:160,
|
||||
height:80,
|
||||
times:10
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
cropWidth(){
|
||||
return this.width*this.times;
|
||||
}
|
||||
,
|
||||
cropHeight(){
|
||||
return this.height*this.times;
|
||||
}
|
||||
},
|
||||
onLoad: function(option) {
|
||||
const eventChannel = this.getOpenerEventChannel();
|
||||
var these = this;
|
||||
eventChannel.on('checkImg', (rec)=> {
|
||||
console.log("我收到你的消息了,消息内容是:" + JSON.stringify(rec));
|
||||
this.src = rec.data;
|
||||
this.width=rec.width?rec.width:160;
|
||||
this.height=rec.height?rec.height:80;
|
||||
this.times=rec.times?rec.times:10;
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
handleCrop(e) {
|
||||
|
||||
var these = this;
|
||||
const eventChannel = these.getOpenerEventChannel();
|
||||
this.Statu = true;
|
||||
console.log("裁剪完成");
|
||||
console.log(e.tempFilePath);
|
||||
eventChannel.emit('ImgCutOver_Path',e.tempFilePath);
|
||||
const ctx = uni.createCanvasContext('splashCanvas', this);
|
||||
ctx.drawImage(
|
||||
e.tempFilePath,
|
||||
0,0,these.width,these.height
|
||||
);
|
||||
setTimeout(() => {
|
||||
ctx.draw(false, ()=>{
|
||||
console.log("abcdefg")
|
||||
uni.canvasGetImageData({
|
||||
canvasId: 'splashCanvas',
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: these.width,
|
||||
height: these.height,
|
||||
success: (res) => {
|
||||
// 处理像素数据并发送
|
||||
|
||||
console.log("res.data.length="+res.data.length);
|
||||
eventChannel.emit('ImgCutOverPath', {
|
||||
picPath: e.tempFilePath
|
||||
});
|
||||
|
||||
eventChannel.emit('ImgCutOver',{piexls:res.data,picPath:e.tempFilePath});
|
||||
|
||||
uni.navigateBack();
|
||||
},
|
||||
fail: (err) => {
|
||||
reject(`获取canvas数据失败: ${err.errMsg}`);
|
||||
}
|
||||
});
|
||||
});
|
||||
}, 500);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.canvas {
|
||||
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
</style>
|
||||
@ -2,11 +2,12 @@
|
||||
<view class="container">
|
||||
<!-- 设备列表 -->
|
||||
<view class="allSelect" @click="selectAll"> 全选</view>
|
||||
<scroll-view class="device-list" scroll-y>
|
||||
<view class="device-card" v-for="(item, index) in deviceList" :key="index"
|
||||
@click="item.onlineStatus === 1 ? toggleSelect(index) : null">
|
||||
<mescroll-uni class="device-list" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption"
|
||||
:down="downOption" :fixed="false" :style="{ height: mescrollHeight + 'px' }">
|
||||
|
||||
<view class="device-card" v-for="(item, index) in deviceList" :key="index" @click="toggleSelect(index)">
|
||||
<!-- 复选框 -->
|
||||
<view class="checkbox" :class="{ checked: item.checked, disabled: item.onlineStatus !== 1 }">
|
||||
<view class="checkbox" :class="{ checked: item.checked }">
|
||||
<uni-icons v-if="item.checked" type="checkmarkempty" size="18" color="rgb(0, 0, 0)"></uni-icons>
|
||||
</view>
|
||||
<!-- 设备信息 -->
|
||||
@ -28,11 +29,12 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</mescroll-uni>
|
||||
<view class="editInfmation">
|
||||
<button class="login-btn qz" @click="forceAlarm">强制报警</button>
|
||||
<button class="login-btn jc" @click="cancelAlarm">解除报警</button>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 强制报警提示弹框 -->
|
||||
<CustomPopup v-if="popupType === 'force'" :show="showPopupFlag" popupBorder="1rpx solid rgba(224, 52, 52, 0.3)"
|
||||
:message="popupMessage" icon="/static/images/6170/bj.png" :confirm-text="popupConfirmText"
|
||||
@ -68,9 +70,14 @@
|
||||
deviceRealTimeStatus //设备状态
|
||||
} from '@/api/6170/deviceControl.js'
|
||||
|
||||
import MescrollUni from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-uni.vue';
|
||||
|
||||
var timeout = null;
|
||||
var these = null;
|
||||
export default {
|
||||
components: {
|
||||
CustomPopup
|
||||
CustomPopup,
|
||||
MescrollUni
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -83,18 +90,38 @@
|
||||
pendingAlarmAction: '',
|
||||
sendInfo: '',
|
||||
// 2. 核心:typeName 与接口的映射表
|
||||
alarmApiMapping: {
|
||||
'HBY100-J': { //100J类型
|
||||
dic: {
|
||||
alarmApiMapping: [{
|
||||
type: ['HBY100-J'],
|
||||
sendApi: deviceForceAlarmActivation,
|
||||
statusTypeName: 'FunctionAccessBatchStatusRule_BJQ100J'
|
||||
},
|
||||
'BJQ6170': { //6170类型
|
||||
{
|
||||
type: ['BJQ6170'],
|
||||
sendApi: deviceSendAlarmMessage,
|
||||
statusTypeName: 'FunctionAccessBatchStatusRule_BJQ200J'
|
||||
}
|
||||
},
|
||||
]
|
||||
},
|
||||
loading: false,
|
||||
total: 0
|
||||
total: 0,
|
||||
mescroll: null,
|
||||
downOption: {
|
||||
auto: true,
|
||||
autoShowLoading: false,
|
||||
},
|
||||
upOption: {
|
||||
auto: false,
|
||||
noMoreSize: 0,
|
||||
offset: 50,
|
||||
isLock: false,
|
||||
empty: {
|
||||
tip: '暂无数据',
|
||||
hideScroll: false
|
||||
},
|
||||
textNoMore: '没有更多数据了'
|
||||
},
|
||||
mescrollHeight: 0
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -105,13 +132,52 @@
|
||||
currentApiConfig() {
|
||||
const currentTypeName = this.sendInfo.typeName || '';
|
||||
// 匹配到则用对应配置,匹配不到用默认配置
|
||||
return this.alarmApiMapping[currentTypeName] || {
|
||||
let f= this.dic.alarmApiMapping.find(v=>{
|
||||
return v.type.indexOf(currentTypeName)>-1;
|
||||
});
|
||||
if(f){
|
||||
return f;
|
||||
}else{
|
||||
return {
|
||||
sendApi: deviceDefaultAlarm,
|
||||
statusTypeName: 'FunctionAccessBatchStatusRule_Default'
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getSystemInfoSyncH() {
|
||||
|
||||
let sysInfo = uni.getSystemInfoSync();
|
||||
|
||||
// 底部 footer 高度约 220rpx + 120rpx = 340rpx,转换为 px(1rpx = sysInfo.pixelRatio / 750 * 屏幕宽度?不,直接用 rpx 转 px 公式)
|
||||
let footerHeight = 340 * (sysInfo.screenWidth / 750); // rpx 转 px
|
||||
|
||||
// console.log("footerHeight=", footerHeight);
|
||||
this.mescrollHeight = sysInfo.screenHeight - footerHeight;
|
||||
// console.log("mescrollHeight=", this.mescrollHeight);
|
||||
},
|
||||
mescrollInit(mescroll) {
|
||||
this.mescroll = mescroll;
|
||||
},
|
||||
// 下拉刷新
|
||||
downCallback() {
|
||||
|
||||
|
||||
if (this.mescroll) {
|
||||
this.mescroll.resetUpScroll(false);
|
||||
this.mescroll.scrollTo(0, 0);
|
||||
}
|
||||
this.getData(this.sendInfo.id);
|
||||
|
||||
|
||||
},
|
||||
// 上拉加载
|
||||
upCallback() {
|
||||
this.getData(this.sendInfo.id);
|
||||
},
|
||||
onclosePopup() {
|
||||
this.showPopupFlag = false
|
||||
},
|
||||
@ -123,17 +189,19 @@
|
||||
selectAll() {
|
||||
console.log('123');
|
||||
// 仅对在线设备进行全选/取消
|
||||
const allSelected = this.deviceList.every(item => item.onlineStatus === 1 && item.checked);
|
||||
const allSelected = this.deviceList.every(item => item.checked);
|
||||
this.deviceList.forEach(item => {
|
||||
// 离线设备不修改checked状态
|
||||
if (item.onlineStatus === 1) {
|
||||
|
||||
item.checked = !allSelected;
|
||||
}
|
||||
|
||||
});
|
||||
this.$forceUpdate();
|
||||
},
|
||||
// 获取设备列表
|
||||
getData(deviceType) {
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(() => {
|
||||
console.log(deviceType, 'deviceTypedeviceType');
|
||||
this.loading = true;
|
||||
let data = {
|
||||
@ -149,11 +217,28 @@
|
||||
checked: false
|
||||
}));
|
||||
this.total = res.total;
|
||||
this.deviceList = newDevices
|
||||
this.deviceList = newDevices;
|
||||
|
||||
let hasNext = true;
|
||||
if (res.rows.length < this.size || this.deviceList.length >= this
|
||||
.total) {
|
||||
hasNext = false;
|
||||
} else {
|
||||
hasNext = true;
|
||||
}
|
||||
this.mescroll.endSuccess(res.rows.length, hasNext);
|
||||
|
||||
} else {
|
||||
this.mescroll.endSuccess(0, false);
|
||||
}
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
}).catch(ex => {
|
||||
this.mescroll.endSuccess(0, false);
|
||||
});
|
||||
|
||||
}, 200);
|
||||
|
||||
},
|
||||
// 强制报警
|
||||
forceAlarm() {
|
||||
@ -252,13 +337,15 @@
|
||||
},
|
||||
},
|
||||
onLoad(options) {
|
||||
these = this;
|
||||
const eventChannel = this.getOpenerEventChannel();
|
||||
// 监听 'deviceSend' 事件,获取传过来的数据
|
||||
eventChannel.on('devicePolice', (data) => {
|
||||
this.getData(data.data.id)
|
||||
this.sendInfo = data.data
|
||||
});
|
||||
eventChannel.emit('ack', {})
|
||||
eventChannel.emit('ack', {});
|
||||
this.getSystemInfoSyncH();
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@ -18,12 +18,15 @@
|
||||
<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;"> -->
|
||||
<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">
|
||||
@ -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">
|
||||
@ -156,7 +159,24 @@ import BleReceive from '@/utils/BleReceive';
|
||||
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: {
|
||||
@ -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) {}
|
||||
},
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<!-- 设备列表 -->
|
||||
<scroll-view class="device-list" scroll-y>
|
||||
<view class="device-card" v-for="(item, index) in deviceList" :key="index"
|
||||
@click="item.onlineStatus === 1 ? toggleSelect(index) : null">
|
||||
<!-- <scroll-view class="device-list" scroll-y> -->
|
||||
<mescroll-uni class="device-list" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption"
|
||||
:down="downOption" :fixed="false" :style="{ height: mescrollHeight + 'px' }">
|
||||
<view class="device-card" v-for="(item, index) in deviceList" :key="index" @click="toggleSelect(index)">
|
||||
<!-- 复选框 -->
|
||||
<view class="checkbox" :class="{ checked: item.checked, disabled: item.onlineStatus !== 1 }">
|
||||
<view class="checkbox" :class="{ checked: item.checked }">
|
||||
<uni-icons v-if="item.checked" type="checkmarkempty" size="18" color="rgb(0, 0, 0)"></uni-icons>
|
||||
</view>
|
||||
<!-- 设备信息 -->
|
||||
@ -27,6 +28,9 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</mescroll-uni>
|
||||
<!-- </scroll-view> -->
|
||||
|
||||
<view class="editInfmation">
|
||||
<view class="ql-editor">编辑信息</view>
|
||||
<view class="ql-input">
|
||||
@ -35,7 +39,6 @@
|
||||
</view>
|
||||
<button class="login-btn" @click.stop="sendTextMessage">发送</button>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<!-- 成功提示弹框 -->
|
||||
<CustomPopup :show="showPopupFlag" :title="popupTitle" :message="popupMessage"
|
||||
icon="/static/images/common/sendSucc.png" :confirm-text="popupConfirmText" :show-cancel="false"
|
||||
@ -56,9 +59,14 @@ import {
|
||||
generateShortId,
|
||||
getdeviceSTatus
|
||||
} from '@/utils/function.js';
|
||||
import MescrollUni from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-uni.vue';
|
||||
|
||||
var timer=null;
|
||||
var these=null;
|
||||
export default {
|
||||
components: {
|
||||
CustomPopup
|
||||
CustomPopup,
|
||||
MescrollUni
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -69,23 +77,76 @@ export default {
|
||||
popupMessage: '信息发送成功!',
|
||||
popupConfirmText: '确认',
|
||||
isSending: false,
|
||||
sendInfo: {}
|
||||
sendInfo: {},
|
||||
mescroll: null,
|
||||
downOption: {
|
||||
auto: true,
|
||||
autoShowLoading: false,
|
||||
},
|
||||
upOption: {
|
||||
auto: false,
|
||||
noMoreSize: 0,
|
||||
offset: 50,
|
||||
isLock: false,
|
||||
empty: {
|
||||
tip: '暂无数据',
|
||||
hideScroll: false
|
||||
},
|
||||
textNoMore: '没有更多数据了'
|
||||
},
|
||||
mescrollHeight: 0,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onPullDownRefresh() {
|
||||
// 执行下拉刷新时的操作,比如重新获取数据
|
||||
this.getData();
|
||||
getSystemInfoSyncH() {
|
||||
|
||||
let sysInfo = uni.getSystemInfoSync();
|
||||
|
||||
// 底部 footer 高度约 220rpx + 120rpx = 340rpx,转换为 px(1rpx = sysInfo.pixelRatio / 750 * 屏幕宽度?不,直接用 rpx 转 px 公式)
|
||||
let footerHeight = 500 * (sysInfo.screenWidth / 750); // rpx 转 px
|
||||
|
||||
// console.log("footerHeight=", footerHeight);
|
||||
this.mescrollHeight = sysInfo.screenHeight - footerHeight;
|
||||
// console.log("mescrollHeight=", this.mescrollHeight);
|
||||
},
|
||||
mescrollInit(mescroll) {
|
||||
this.mescroll = mescroll;
|
||||
},
|
||||
// 下拉刷新
|
||||
downCallback() {
|
||||
|
||||
console.log("触发下拉刷新");
|
||||
if (this.mescroll) {
|
||||
this.mescroll.resetUpScroll(false);
|
||||
this.mescroll.scrollTo(0, 0);
|
||||
}
|
||||
this.getData(this.sendInfo.id);
|
||||
|
||||
|
||||
},
|
||||
// 上拉加载
|
||||
upCallback() {
|
||||
console.log("触发上拉加载");
|
||||
|
||||
|
||||
this.getData(this.sendInfo.id);
|
||||
},
|
||||
// onPullDownRefresh() {
|
||||
// // 执行下拉刷新时的操作,比如重新获取数据
|
||||
// this.getData();
|
||||
// },
|
||||
toggleSelect(index) {
|
||||
this.deviceList[index].checked = !this.deviceList[index].checked
|
||||
this.$forceUpdate()
|
||||
},
|
||||
// 获取设备列表
|
||||
getData(deviceType) {
|
||||
clearTimeout(timer);
|
||||
timer=setTimeout(()=>{
|
||||
console.log("开始加载第"+(this.mescroll? this.mescroll.num:1)+'页数据')
|
||||
this.loading = true;
|
||||
let data = {
|
||||
pageNum: 1,
|
||||
pageNum:this.mescroll? this.mescroll.num:1,
|
||||
pageSize: 50,
|
||||
deviceType: deviceType
|
||||
}
|
||||
@ -98,13 +159,33 @@ export default {
|
||||
}));
|
||||
this.total = res.total;
|
||||
this.deviceList = newDevices
|
||||
|
||||
this.total = res.total;
|
||||
// 判断是否加载完成
|
||||
let hasNext = true;
|
||||
if (res.rows.length < this.size || this.deviceList.length >= this
|
||||
.total) {
|
||||
hasNext = false;
|
||||
} else {
|
||||
hasNext = true;
|
||||
}
|
||||
this.mescroll.endSuccess(res.rows.length, hasNext);
|
||||
}else {
|
||||
this.mescroll.endSuccess(0, false);
|
||||
}
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
}).catch(ex=>{
|
||||
|
||||
this.mescroll.endSuccess(0, false);
|
||||
|
||||
});
|
||||
|
||||
},200);
|
||||
|
||||
},
|
||||
// 发送文本消息
|
||||
async sendTextMessage() {
|
||||
sendTextMessage() {
|
||||
// 防重复提交
|
||||
if (this.isSending) return;
|
||||
const selectedDevices = this.deviceList.filter(item => item.checked)
|
||||
@ -125,13 +206,16 @@ export default {
|
||||
return;
|
||||
}
|
||||
this.isSending = true;
|
||||
let loadingShown = false;
|
||||
//FYS的方法
|
||||
let FYSSend =async () => {
|
||||
|
||||
|
||||
try {
|
||||
uni.showLoading({
|
||||
title: '发送中...',
|
||||
mask: true
|
||||
});
|
||||
loadingShown = true;
|
||||
|
||||
// 2. 准备请求数据
|
||||
const batchId = generateShortId();
|
||||
const data = {
|
||||
@ -176,6 +260,71 @@ export default {
|
||||
uni.hideLoading();
|
||||
this.isSending = false;
|
||||
}
|
||||
}
|
||||
//XS的方法
|
||||
let XSSend=() => {
|
||||
|
||||
|
||||
try {
|
||||
|
||||
|
||||
|
||||
this.showPopupFlag=true;
|
||||
} catch (error) {
|
||||
|
||||
} finally {
|
||||
|
||||
this.isSending = false;
|
||||
}
|
||||
}
|
||||
//FS的方法
|
||||
let FSSend = () => {
|
||||
|
||||
|
||||
try {
|
||||
|
||||
|
||||
|
||||
this.showPopupFlag = true
|
||||
|
||||
} catch (error) {
|
||||
|
||||
} finally {
|
||||
|
||||
this.isSending = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let device = selectedDevices[0];
|
||||
let sendDic = [{
|
||||
urls: ['/pages/6170/deviceControl/index', '/pages/210/HBY210', '/pages/6075/BJQ6075',
|
||||
'/pages/100J/HBY100-J'
|
||||
],
|
||||
send: FYSSend,
|
||||
},
|
||||
{
|
||||
urls: ['/pages/670/HBY670'],
|
||||
send: XSSend
|
||||
},
|
||||
{
|
||||
urls: ['/pages/6075J/BJQ6075J'],
|
||||
send: FSSend
|
||||
}
|
||||
|
||||
|
||||
];
|
||||
|
||||
let f = sendDic.find(v => {
|
||||
return v.urls.indexOf(device.detailPageUrl)>-1;
|
||||
});
|
||||
|
||||
if (f) {
|
||||
f.send();
|
||||
} else {
|
||||
FYSSend();
|
||||
}
|
||||
|
||||
},
|
||||
onPopupConfirm() {
|
||||
this.showPopupFlag = false
|
||||
@ -185,16 +334,23 @@ export default {
|
||||
},
|
||||
},
|
||||
onLoad(options) {
|
||||
these=this;
|
||||
const eventChannel = this.getOpenerEventChannel();
|
||||
// 监听 'deviceSend' 事件,获取传过来的数据
|
||||
eventChannel.on('deviceSend', (data) => {
|
||||
console.log('Received detail data:', data);
|
||||
this.getData(data.data.id)
|
||||
|
||||
this.sendInfo = data.data
|
||||
this.downCallback();
|
||||
});
|
||||
// 如果需要向调用页面返回数据,可以触发 'ack' 事件
|
||||
eventChannel.emit('ack', {})
|
||||
eventChannel.emit('ack', {});
|
||||
|
||||
this.getSystemInfoSyncH();
|
||||
},
|
||||
onUnload() {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -366,7 +522,7 @@ export default {
|
||||
height: 200rpx;
|
||||
margin-top: 30rpx;
|
||||
box-sizing: border-box;
|
||||
padding: 30rpx;
|
||||
padding: 20rpx;
|
||||
border-radius: 16rpx;
|
||||
background: rgb(26, 26, 26);
|
||||
}
|
||||
@ -377,6 +533,7 @@ export default {
|
||||
border-radius: 16rpx;
|
||||
padding: 10rpx;
|
||||
height: 150rpx;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.editInfmation {
|
||||
@ -384,8 +541,9 @@ export default {
|
||||
border-radius: 40rpx 40rpx 0px 0px;
|
||||
background: rgba(28, 28, 28, 1);
|
||||
position: fixed;
|
||||
bottom: 50rpx;
|
||||
bottom: 20rpx;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.login-btn {
|
||||
|
||||
Reference in New Issue
Block a user