diff --git a/public/config/config.json b/public/config/config.json index ea73122..258e633 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,4 +1,4 @@ { "rtspServer": "http://192.168.2.100:8000", - "baseUrl":"http://127.0.0.1:11306/pan-tilt" + "baseUrl":"http://111.198.10.15:11604/pan-tilt" } diff --git a/public/config/config.json b/public/config/config.json index ea73122..258e633 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,4 +1,4 @@ { "rtspServer": "http://192.168.2.100:8000", - "baseUrl":"http://127.0.0.1:11306/pan-tilt" + "baseUrl":"http://111.198.10.15:11604/pan-tilt" } diff --git a/src/api/ptz/alarm.ts b/src/api/ptz/alarm.ts index 7b8933c..96518f6 100644 --- a/src/api/ptz/alarm.ts +++ b/src/api/ptz/alarm.ts @@ -5,6 +5,10 @@ url: 'alarm/listPage', method: 'post', data, + params: { + offset: data.offset, + limit: data.limit, + }, }) } diff --git a/public/config/config.json b/public/config/config.json index ea73122..258e633 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,4 +1,4 @@ { "rtspServer": "http://192.168.2.100:8000", - "baseUrl":"http://127.0.0.1:11306/pan-tilt" + "baseUrl":"http://111.198.10.15:11604/pan-tilt" } diff --git a/src/api/ptz/alarm.ts b/src/api/ptz/alarm.ts index 7b8933c..96518f6 100644 --- a/src/api/ptz/alarm.ts +++ b/src/api/ptz/alarm.ts @@ -5,6 +5,10 @@ url: 'alarm/listPage', method: 'post', data, + params: { + offset: data.offset, + limit: data.limit, + }, }) } diff --git a/src/api/ptz/cruiselog.ts b/src/api/ptz/cruiselog.ts index 1252f31..cd4362d 100644 --- a/src/api/ptz/cruiselog.ts +++ b/src/api/ptz/cruiselog.ts @@ -7,6 +7,10 @@ url: `${prefix}/listPage`, method: 'post', data, + params: { + offset: data.offset, + limit: data.limit, + }, }) } diff --git a/public/config/config.json b/public/config/config.json index ea73122..258e633 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,4 +1,4 @@ { "rtspServer": "http://192.168.2.100:8000", - "baseUrl":"http://127.0.0.1:11306/pan-tilt" + "baseUrl":"http://111.198.10.15:11604/pan-tilt" } diff --git a/src/api/ptz/alarm.ts b/src/api/ptz/alarm.ts index 7b8933c..96518f6 100644 --- a/src/api/ptz/alarm.ts +++ b/src/api/ptz/alarm.ts @@ -5,6 +5,10 @@ url: 'alarm/listPage', method: 'post', data, + params: { + offset: data.offset, + limit: data.limit, + }, }) } diff --git a/src/api/ptz/cruiselog.ts b/src/api/ptz/cruiselog.ts index 1252f31..cd4362d 100644 --- a/src/api/ptz/cruiselog.ts +++ b/src/api/ptz/cruiselog.ts @@ -7,6 +7,10 @@ url: `${prefix}/listPage`, method: 'post', data, + params: { + offset: data.offset, + limit: data.limit, + }, }) } diff --git a/src/api/ptz/dev.ts b/src/api/ptz/dev.ts index f359c54..53950bd 100644 --- a/src/api/ptz/dev.ts +++ b/src/api/ptz/dev.ts @@ -4,7 +4,7 @@ return request({ url: 'monitor/listPage', method: 'post', - params:data, + params: data, data, }) } @@ -24,7 +24,7 @@ url: 'monitor/info', method: 'post', data: { - id: id, + id, }, }) } @@ -60,7 +60,7 @@ url: 'monitor/delete', method: 'post', data: { - id: id, + id, }, }) } @@ -71,7 +71,7 @@ url: 'monitor/overview', method: 'post', data: { - keyword: keyword, + keyword, }, }) } @@ -81,6 +81,6 @@ return request({ url: 'data/hisList', method: 'post', - data + data, }) } diff --git a/public/config/config.json b/public/config/config.json index ea73122..258e633 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,4 +1,4 @@ { "rtspServer": "http://192.168.2.100:8000", - "baseUrl":"http://127.0.0.1:11306/pan-tilt" + "baseUrl":"http://111.198.10.15:11604/pan-tilt" } diff --git a/src/api/ptz/alarm.ts b/src/api/ptz/alarm.ts index 7b8933c..96518f6 100644 --- a/src/api/ptz/alarm.ts +++ b/src/api/ptz/alarm.ts @@ -5,6 +5,10 @@ url: 'alarm/listPage', method: 'post', data, + params: { + offset: data.offset, + limit: data.limit, + }, }) } diff --git a/src/api/ptz/cruiselog.ts b/src/api/ptz/cruiselog.ts index 1252f31..cd4362d 100644 --- a/src/api/ptz/cruiselog.ts +++ b/src/api/ptz/cruiselog.ts @@ -7,6 +7,10 @@ url: `${prefix}/listPage`, method: 'post', data, + params: { + offset: data.offset, + limit: data.limit, + }, }) } diff --git a/src/api/ptz/dev.ts b/src/api/ptz/dev.ts index f359c54..53950bd 100644 --- a/src/api/ptz/dev.ts +++ b/src/api/ptz/dev.ts @@ -4,7 +4,7 @@ return request({ url: 'monitor/listPage', method: 'post', - params:data, + params: data, data, }) } @@ -24,7 +24,7 @@ url: 'monitor/info', method: 'post', data: { - id: id, + id, }, }) } @@ -60,7 +60,7 @@ url: 'monitor/delete', method: 'post', data: { - id: id, + id, }, }) } @@ -71,7 +71,7 @@ url: 'monitor/overview', method: 'post', data: { - keyword: keyword, + keyword, }, }) } @@ -81,6 +81,6 @@ return request({ url: 'data/hisList', method: 'post', - data + data, }) } diff --git a/src/api/ptz/line.ts b/src/api/ptz/line.ts index 9f43ea7..8a0ab38 100644 --- a/src/api/ptz/line.ts +++ b/src/api/ptz/line.ts @@ -16,6 +16,10 @@ url: 'observ/listPage', method: 'post', data, + params: { + offset: data.offset, + limit: data.limit, + }, }) } @@ -38,21 +42,20 @@ } // 定位视图 -export function ToPosition(params:object) { +export function ToPosition(params: object) { return request({ - url:'HCNet/toPosition', - method:'get', - params + url: 'HCNet/toPosition', + method: 'get', + params, }) } - // 开启巡航/关闭巡航 -export function handleCruise(params:object) { +export function handleCruise(params: object) { return request({ - url:'HCNet/cruise', - method:'get', - params + url: 'HCNet/cruise', + method: 'get', + params, }) } diff --git a/public/config/config.json b/public/config/config.json index ea73122..258e633 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,4 +1,4 @@ { "rtspServer": "http://192.168.2.100:8000", - "baseUrl":"http://127.0.0.1:11306/pan-tilt" + "baseUrl":"http://111.198.10.15:11604/pan-tilt" } diff --git a/src/api/ptz/alarm.ts b/src/api/ptz/alarm.ts index 7b8933c..96518f6 100644 --- a/src/api/ptz/alarm.ts +++ b/src/api/ptz/alarm.ts @@ -5,6 +5,10 @@ url: 'alarm/listPage', method: 'post', data, + params: { + offset: data.offset, + limit: data.limit, + }, }) } diff --git a/src/api/ptz/cruiselog.ts b/src/api/ptz/cruiselog.ts index 1252f31..cd4362d 100644 --- a/src/api/ptz/cruiselog.ts +++ b/src/api/ptz/cruiselog.ts @@ -7,6 +7,10 @@ url: `${prefix}/listPage`, method: 'post', data, + params: { + offset: data.offset, + limit: data.limit, + }, }) } diff --git a/src/api/ptz/dev.ts b/src/api/ptz/dev.ts index f359c54..53950bd 100644 --- a/src/api/ptz/dev.ts +++ b/src/api/ptz/dev.ts @@ -4,7 +4,7 @@ return request({ url: 'monitor/listPage', method: 'post', - params:data, + params: data, data, }) } @@ -24,7 +24,7 @@ url: 'monitor/info', method: 'post', data: { - id: id, + id, }, }) } @@ -60,7 +60,7 @@ url: 'monitor/delete', method: 'post', data: { - id: id, + id, }, }) } @@ -71,7 +71,7 @@ url: 'monitor/overview', method: 'post', data: { - keyword: keyword, + keyword, }, }) } @@ -81,6 +81,6 @@ return request({ url: 'data/hisList', method: 'post', - data + data, }) } diff --git a/src/api/ptz/line.ts b/src/api/ptz/line.ts index 9f43ea7..8a0ab38 100644 --- a/src/api/ptz/line.ts +++ b/src/api/ptz/line.ts @@ -16,6 +16,10 @@ url: 'observ/listPage', method: 'post', data, + params: { + offset: data.offset, + limit: data.limit, + }, }) } @@ -38,21 +42,20 @@ } // 定位视图 -export function ToPosition(params:object) { +export function ToPosition(params: object) { return request({ - url:'HCNet/toPosition', - method:'get', - params + url: 'HCNet/toPosition', + method: 'get', + params, }) } - // 开启巡航/关闭巡航 -export function handleCruise(params:object) { +export function handleCruise(params: object) { return request({ - url:'HCNet/cruise', - method:'get', - params + url: 'HCNet/cruise', + method: 'get', + params, }) } diff --git a/src/api/ptz/station.ts b/src/api/ptz/station.ts index f9c9825..f9250a8 100644 --- a/src/api/ptz/station.ts +++ b/src/api/ptz/station.ts @@ -7,6 +7,10 @@ url: `${prefix}/listPage`, method: 'post', data, + params: { + offset: data.offset, + limit: data.limit, + }, }) } diff --git a/public/config/config.json b/public/config/config.json index ea73122..258e633 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,4 +1,4 @@ { "rtspServer": "http://192.168.2.100:8000", - "baseUrl":"http://127.0.0.1:11306/pan-tilt" + "baseUrl":"http://111.198.10.15:11604/pan-tilt" } diff --git a/src/api/ptz/alarm.ts b/src/api/ptz/alarm.ts index 7b8933c..96518f6 100644 --- a/src/api/ptz/alarm.ts +++ b/src/api/ptz/alarm.ts @@ -5,6 +5,10 @@ url: 'alarm/listPage', method: 'post', data, + params: { + offset: data.offset, + limit: data.limit, + }, }) } diff --git a/src/api/ptz/cruiselog.ts b/src/api/ptz/cruiselog.ts index 1252f31..cd4362d 100644 --- a/src/api/ptz/cruiselog.ts +++ b/src/api/ptz/cruiselog.ts @@ -7,6 +7,10 @@ url: `${prefix}/listPage`, method: 'post', data, + params: { + offset: data.offset, + limit: data.limit, + }, }) } diff --git a/src/api/ptz/dev.ts b/src/api/ptz/dev.ts index f359c54..53950bd 100644 --- a/src/api/ptz/dev.ts +++ b/src/api/ptz/dev.ts @@ -4,7 +4,7 @@ return request({ url: 'monitor/listPage', method: 'post', - params:data, + params: data, data, }) } @@ -24,7 +24,7 @@ url: 'monitor/info', method: 'post', data: { - id: id, + id, }, }) } @@ -60,7 +60,7 @@ url: 'monitor/delete', method: 'post', data: { - id: id, + id, }, }) } @@ -71,7 +71,7 @@ url: 'monitor/overview', method: 'post', data: { - keyword: keyword, + keyword, }, }) } @@ -81,6 +81,6 @@ return request({ url: 'data/hisList', method: 'post', - data + data, }) } diff --git a/src/api/ptz/line.ts b/src/api/ptz/line.ts index 9f43ea7..8a0ab38 100644 --- a/src/api/ptz/line.ts +++ b/src/api/ptz/line.ts @@ -16,6 +16,10 @@ url: 'observ/listPage', method: 'post', data, + params: { + offset: data.offset, + limit: data.limit, + }, }) } @@ -38,21 +42,20 @@ } // 定位视图 -export function ToPosition(params:object) { +export function ToPosition(params: object) { return request({ - url:'HCNet/toPosition', - method:'get', - params + url: 'HCNet/toPosition', + method: 'get', + params, }) } - // 开启巡航/关闭巡航 -export function handleCruise(params:object) { +export function handleCruise(params: object) { return request({ - url:'HCNet/cruise', - method:'get', - params + url: 'HCNet/cruise', + method: 'get', + params, }) } diff --git a/src/api/ptz/station.ts b/src/api/ptz/station.ts index f9c9825..f9250a8 100644 --- a/src/api/ptz/station.ts +++ b/src/api/ptz/station.ts @@ -7,6 +7,10 @@ url: `${prefix}/listPage`, method: 'post', data, + params: { + offset: data.offset, + limit: data.limit, + }, }) } diff --git a/src/api/ptz/task.ts b/src/api/ptz/task.ts index f79f4e3..7baa017 100644 --- a/src/api/ptz/task.ts +++ b/src/api/ptz/task.ts @@ -7,6 +7,10 @@ url: `${prefix}/listPage`, method: 'post', data, + params: { + offset: data.offset, + limit: data.limit, + }, }) } diff --git a/public/config/config.json b/public/config/config.json index ea73122..258e633 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,4 +1,4 @@ { "rtspServer": "http://192.168.2.100:8000", - "baseUrl":"http://127.0.0.1:11306/pan-tilt" + "baseUrl":"http://111.198.10.15:11604/pan-tilt" } diff --git a/src/api/ptz/alarm.ts b/src/api/ptz/alarm.ts index 7b8933c..96518f6 100644 --- a/src/api/ptz/alarm.ts +++ b/src/api/ptz/alarm.ts @@ -5,6 +5,10 @@ url: 'alarm/listPage', method: 'post', data, + params: { + offset: data.offset, + limit: data.limit, + }, }) } diff --git a/src/api/ptz/cruiselog.ts b/src/api/ptz/cruiselog.ts index 1252f31..cd4362d 100644 --- a/src/api/ptz/cruiselog.ts +++ b/src/api/ptz/cruiselog.ts @@ -7,6 +7,10 @@ url: `${prefix}/listPage`, method: 'post', data, + params: { + offset: data.offset, + limit: data.limit, + }, }) } diff --git a/src/api/ptz/dev.ts b/src/api/ptz/dev.ts index f359c54..53950bd 100644 --- a/src/api/ptz/dev.ts +++ b/src/api/ptz/dev.ts @@ -4,7 +4,7 @@ return request({ url: 'monitor/listPage', method: 'post', - params:data, + params: data, data, }) } @@ -24,7 +24,7 @@ url: 'monitor/info', method: 'post', data: { - id: id, + id, }, }) } @@ -60,7 +60,7 @@ url: 'monitor/delete', method: 'post', data: { - id: id, + id, }, }) } @@ -71,7 +71,7 @@ url: 'monitor/overview', method: 'post', data: { - keyword: keyword, + keyword, }, }) } @@ -81,6 +81,6 @@ return request({ url: 'data/hisList', method: 'post', - data + data, }) } diff --git a/src/api/ptz/line.ts b/src/api/ptz/line.ts index 9f43ea7..8a0ab38 100644 --- a/src/api/ptz/line.ts +++ b/src/api/ptz/line.ts @@ -16,6 +16,10 @@ url: 'observ/listPage', method: 'post', data, + params: { + offset: data.offset, + limit: data.limit, + }, }) } @@ -38,21 +42,20 @@ } // 定位视图 -export function ToPosition(params:object) { +export function ToPosition(params: object) { return request({ - url:'HCNet/toPosition', - method:'get', - params + url: 'HCNet/toPosition', + method: 'get', + params, }) } - // 开启巡航/关闭巡航 -export function handleCruise(params:object) { +export function handleCruise(params: object) { return request({ - url:'HCNet/cruise', - method:'get', - params + url: 'HCNet/cruise', + method: 'get', + params, }) } diff --git a/src/api/ptz/station.ts b/src/api/ptz/station.ts index f9c9825..f9250a8 100644 --- a/src/api/ptz/station.ts +++ b/src/api/ptz/station.ts @@ -7,6 +7,10 @@ url: `${prefix}/listPage`, method: 'post', data, + params: { + offset: data.offset, + limit: data.limit, + }, }) } diff --git a/src/api/ptz/task.ts b/src/api/ptz/task.ts index f79f4e3..7baa017 100644 --- a/src/api/ptz/task.ts +++ b/src/api/ptz/task.ts @@ -7,6 +7,10 @@ url: `${prefix}/listPage`, method: 'post', data, + params: { + offset: data.offset, + limit: data.limit, + }, }) } diff --git a/src/store/modules/websocket.ts b/src/store/modules/websocket.ts index 2f4c0f0..c8e35dd 100644 --- a/src/store/modules/websocket.ts +++ b/src/store/modules/websocket.ts @@ -1,8 +1,7 @@ import { ElMessage, ElNotification } from 'element-plus' +import * as config from 'public/config/config.json' import useUserStore from './user' import { getDictByCode } from '@/api/system/dict' -import * as config from 'public/config/config.json' - const useWebsocketStore = defineStore( 'websocket', @@ -12,16 +11,16 @@ wsUrl: `ws://${config.baseUrl.split('://')[1]}/websocket/${useUserStore().id}`, websocket: null, // ws连接 wsStatus: false, // websocket连接状态 true为连接 - wsPingTimer: null, // 心跳定时器 + // wsPingTimer: null, // 心跳定时器 wsPingTime: 60000, // 心跳定时时长 wsReconnectCount: 0, // 重连次数 wsReconnectTimer: null, // 重连定时器 wsIsReconnect: true, // 是否重连 wsData: {}, // 默认提醒 wsImgData: {}, // 图片报警提醒 - lineData:{}, // 折线图添加数据 - videoData:{}, // 视频数据返回 - codeList:{} + lineData: {}, // 折线图添加数据 + videoData: {}, // 视频数据返回 + codeList: {}, }), getters: {}, actions: { @@ -44,103 +43,105 @@ // 监听socket打开 socket.onopen = () => { console.log('浏览器WebSocket已打开') - getDictByCode('alarmType').then(res =>{ - res.data.map(item =>{ + getDictByCode('alarmType').then((res) => { + res.data.map((item) => { this.codeList[item.value] = item.name }) }) this.wsStatus = true - const wsPingTimer = setInterval(() => { - // 发送心跳 - if (this.wsStatus) { - try { - socket.send(JSON.stringify({ - id: useUserStore().id, // 用户id - type: 'heartbeat', - })) - console.log(`ping websocket${new Date()}`) - } - catch (err) { - console.log('心跳发送失败,执行重连', err) - console.log(`正在尝试重新连接${this.wsReconnectCount}${1}次`) - // 调用重新链接 - this.reConnectWebsocket() - this.wsStatus = false - } - } - }, this.wsPingTime) - this.wsPingTimer = wsPingTimer + // const wsPingTimer = setInterval(() => { + // // 发送心跳 + // if (this.wsStatus) { + // try { + // socket.send(JSON.stringify({ + // id: useUserStore().id, // 用户id + // type: 'heartbeat', + // })) + // console.log(`ping websocket${new Date()}`) + // } + // catch (err) { + // console.log('心跳发送失败,执行重连', err) + // console.log(`正在尝试重新连接${this.wsReconnectCount}${1}次`) + // // 调用重新链接 + // this.reConnectWebsocket() + // this.wsStatus = false + // } + // } + // }, this.wsPingTime) + // this.wsPingTimer = wsPingTimer } // 监听socket消息接收 socket.onmessage = (msg) => { // 转换为json对象 const data = JSON.parse(msg.data) console.log(data, 'websocket 返回消息') - this.wsData = {}; - this.wsImgData = {}; - this.lineData = {}; - let observerData = data; - let type = observerData.type; + this.wsData = {} + this.wsImgData = {} + this.lineData = {} + const observerData = data + const type = observerData.type // 存在报警图片的时候展示图片 - this.wsData = observerData; - let str = ''; - let msgTypeName = ''; + this.wsData = observerData + let str = '' + let msgTypeName = '' // 甲烷浓度更新 if (type == 'gasAlarm') { this.videoData = { deviceIp: observerData.deviceIp, - concentration:observerData.concentration, - deviceStatusName:'报警' + concentration: observerData.concentration, + deviceStatusName: '报警', } msgTypeName = '甲烷浓度告警' str = `设备名称:${observerData.monitorName}
甲烷浓度:${observerData.concentration}ppm·m
水平角度:${observerData.alarmDirection}
垂直角度:${observerData.alarmPitch}
` // 预置点更新 - } else if (type == 'presetIndex') { + } + else if (type == 'presetIndex') { this.videoData = { - deviceIp:observerData.deviceIp, - stationName:observerData.name + deviceIp: observerData.deviceIp, + stationName: observerData.name, } // 图片报警 - } else if (type == 'AIAlarm') { + } + else if (type == 'AIAlarm') { this.wsImgData = observerData this.videoData = { - deviceIp:observerData.deviceIp, - deviceStatusName:'报警' + deviceIp: observerData.deviceIp, + deviceStatusName: '报警', } } else if (type == 'onLine') { this.videoData = { - deviceIp:observerData.deviceIp, - deviceStatusName:'在线' + deviceIp: observerData.deviceIp, + deviceStatusName: '在线', } } else if (type == 'offLine') { this.videoData = { - deviceIp:observerData.deviceIp, - deviceStatusName:'离线' + deviceIp: observerData.deviceIp, + deviceStatusName: '离线', } } else { - console.log('其他状态',data) - // 实时状态 折现告警 - // 获取实时状态甲烷浓度以及deviceIp更新到视频对应窗口 - // this.videoData = {deviceStatusName:observerData.gasData} - // this.videoData = { - // deviceIp:observerData.deviceIp, - // concentration:observerData.gasData - // } - this.videoData = { - deviceIp: observerData.deviceIp, - concentration: observerData.gasData, - // deviceStatusName:'报警' - } - this.lineData = { - deviceIp:observerData.deviceIp, // 获取返回deviceIp - gasData:observerData.gasData, - time:observerData.time - } + console.log('其他状态', data) + // 实时状态 折现告警 + // 获取实时状态甲烷浓度以及deviceIp更新到视频对应窗口 + // this.videoData = {deviceStatusName:observerData.gasData} + // this.videoData = { + // deviceIp:observerData.deviceIp, + // concentration:observerData.gasData + // } + this.videoData = { + deviceIp: observerData.deviceIp, + concentration: observerData.gasData, + // deviceStatusName:'报警' + } + this.lineData = { + deviceIp: observerData.deviceIp, // 获取返回deviceIp + gasData: observerData.gasData, + time: observerData.time, + } } - if(Object.values(this.wsData).length >= 2 && msgTypeName !== ''){ + if (Object.values(this.wsData).length >= 2 && msgTypeName !== '') { ElNotification({ dangerouslyUseHTMLString: true, title: msgTypeName, @@ -148,7 +149,6 @@ type: 'warning', }) } - } // 监听socket错误 socket.onerror = function () { @@ -162,11 +162,11 @@ socket.onclose = () => { console.log('WebSocket已关闭') this.wsStatus = false - if (this.wsPingTimer) { - console.log('停止定时器') - clearInterval(this.wsPingTimer) - this.wsPingTimer = null - } + // if (this.wsPingTimer) { + // console.log('停止定时器') + // clearInterval(this.wsPingTimer) + // this.wsPingTimer = null + // } if (this.wsReconnectTimer) { clearTimeout(this.wsReconnectTimer) this.wsReconnectTimer = null @@ -183,11 +183,11 @@ if (this.websocket) { this.websocket.close() } - if (this.wsPingTimer) { - console.log('停止定时器') - clearInterval(this.wsPingTimer) - this.wsPingTimer = null - } + // if (this.wsPingTimer) { + // console.log('停止定时器') + // clearInterval(this.wsPingTimer) + // this.wsPingTimer = null + // } if (this.wsReconnectTimer) { clearTimeout(this.wsReconnectTimer) this.wsReconnectTimer = null diff --git a/public/config/config.json b/public/config/config.json index ea73122..258e633 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,4 +1,4 @@ { "rtspServer": "http://192.168.2.100:8000", - "baseUrl":"http://127.0.0.1:11306/pan-tilt" + "baseUrl":"http://111.198.10.15:11604/pan-tilt" } diff --git a/src/api/ptz/alarm.ts b/src/api/ptz/alarm.ts index 7b8933c..96518f6 100644 --- a/src/api/ptz/alarm.ts +++ b/src/api/ptz/alarm.ts @@ -5,6 +5,10 @@ url: 'alarm/listPage', method: 'post', data, + params: { + offset: data.offset, + limit: data.limit, + }, }) } diff --git a/src/api/ptz/cruiselog.ts b/src/api/ptz/cruiselog.ts index 1252f31..cd4362d 100644 --- a/src/api/ptz/cruiselog.ts +++ b/src/api/ptz/cruiselog.ts @@ -7,6 +7,10 @@ url: `${prefix}/listPage`, method: 'post', data, + params: { + offset: data.offset, + limit: data.limit, + }, }) } diff --git a/src/api/ptz/dev.ts b/src/api/ptz/dev.ts index f359c54..53950bd 100644 --- a/src/api/ptz/dev.ts +++ b/src/api/ptz/dev.ts @@ -4,7 +4,7 @@ return request({ url: 'monitor/listPage', method: 'post', - params:data, + params: data, data, }) } @@ -24,7 +24,7 @@ url: 'monitor/info', method: 'post', data: { - id: id, + id, }, }) } @@ -60,7 +60,7 @@ url: 'monitor/delete', method: 'post', data: { - id: id, + id, }, }) } @@ -71,7 +71,7 @@ url: 'monitor/overview', method: 'post', data: { - keyword: keyword, + keyword, }, }) } @@ -81,6 +81,6 @@ return request({ url: 'data/hisList', method: 'post', - data + data, }) } diff --git a/src/api/ptz/line.ts b/src/api/ptz/line.ts index 9f43ea7..8a0ab38 100644 --- a/src/api/ptz/line.ts +++ b/src/api/ptz/line.ts @@ -16,6 +16,10 @@ url: 'observ/listPage', method: 'post', data, + params: { + offset: data.offset, + limit: data.limit, + }, }) } @@ -38,21 +42,20 @@ } // 定位视图 -export function ToPosition(params:object) { +export function ToPosition(params: object) { return request({ - url:'HCNet/toPosition', - method:'get', - params + url: 'HCNet/toPosition', + method: 'get', + params, }) } - // 开启巡航/关闭巡航 -export function handleCruise(params:object) { +export function handleCruise(params: object) { return request({ - url:'HCNet/cruise', - method:'get', - params + url: 'HCNet/cruise', + method: 'get', + params, }) } diff --git a/src/api/ptz/station.ts b/src/api/ptz/station.ts index f9c9825..f9250a8 100644 --- a/src/api/ptz/station.ts +++ b/src/api/ptz/station.ts @@ -7,6 +7,10 @@ url: `${prefix}/listPage`, method: 'post', data, + params: { + offset: data.offset, + limit: data.limit, + }, }) } diff --git a/src/api/ptz/task.ts b/src/api/ptz/task.ts index f79f4e3..7baa017 100644 --- a/src/api/ptz/task.ts +++ b/src/api/ptz/task.ts @@ -7,6 +7,10 @@ url: `${prefix}/listPage`, method: 'post', data, + params: { + offset: data.offset, + limit: data.limit, + }, }) } diff --git a/src/store/modules/websocket.ts b/src/store/modules/websocket.ts index 2f4c0f0..c8e35dd 100644 --- a/src/store/modules/websocket.ts +++ b/src/store/modules/websocket.ts @@ -1,8 +1,7 @@ import { ElMessage, ElNotification } from 'element-plus' +import * as config from 'public/config/config.json' import useUserStore from './user' import { getDictByCode } from '@/api/system/dict' -import * as config from 'public/config/config.json' - const useWebsocketStore = defineStore( 'websocket', @@ -12,16 +11,16 @@ wsUrl: `ws://${config.baseUrl.split('://')[1]}/websocket/${useUserStore().id}`, websocket: null, // ws连接 wsStatus: false, // websocket连接状态 true为连接 - wsPingTimer: null, // 心跳定时器 + // wsPingTimer: null, // 心跳定时器 wsPingTime: 60000, // 心跳定时时长 wsReconnectCount: 0, // 重连次数 wsReconnectTimer: null, // 重连定时器 wsIsReconnect: true, // 是否重连 wsData: {}, // 默认提醒 wsImgData: {}, // 图片报警提醒 - lineData:{}, // 折线图添加数据 - videoData:{}, // 视频数据返回 - codeList:{} + lineData: {}, // 折线图添加数据 + videoData: {}, // 视频数据返回 + codeList: {}, }), getters: {}, actions: { @@ -44,103 +43,105 @@ // 监听socket打开 socket.onopen = () => { console.log('浏览器WebSocket已打开') - getDictByCode('alarmType').then(res =>{ - res.data.map(item =>{ + getDictByCode('alarmType').then((res) => { + res.data.map((item) => { this.codeList[item.value] = item.name }) }) this.wsStatus = true - const wsPingTimer = setInterval(() => { - // 发送心跳 - if (this.wsStatus) { - try { - socket.send(JSON.stringify({ - id: useUserStore().id, // 用户id - type: 'heartbeat', - })) - console.log(`ping websocket${new Date()}`) - } - catch (err) { - console.log('心跳发送失败,执行重连', err) - console.log(`正在尝试重新连接${this.wsReconnectCount}${1}次`) - // 调用重新链接 - this.reConnectWebsocket() - this.wsStatus = false - } - } - }, this.wsPingTime) - this.wsPingTimer = wsPingTimer + // const wsPingTimer = setInterval(() => { + // // 发送心跳 + // if (this.wsStatus) { + // try { + // socket.send(JSON.stringify({ + // id: useUserStore().id, // 用户id + // type: 'heartbeat', + // })) + // console.log(`ping websocket${new Date()}`) + // } + // catch (err) { + // console.log('心跳发送失败,执行重连', err) + // console.log(`正在尝试重新连接${this.wsReconnectCount}${1}次`) + // // 调用重新链接 + // this.reConnectWebsocket() + // this.wsStatus = false + // } + // } + // }, this.wsPingTime) + // this.wsPingTimer = wsPingTimer } // 监听socket消息接收 socket.onmessage = (msg) => { // 转换为json对象 const data = JSON.parse(msg.data) console.log(data, 'websocket 返回消息') - this.wsData = {}; - this.wsImgData = {}; - this.lineData = {}; - let observerData = data; - let type = observerData.type; + this.wsData = {} + this.wsImgData = {} + this.lineData = {} + const observerData = data + const type = observerData.type // 存在报警图片的时候展示图片 - this.wsData = observerData; - let str = ''; - let msgTypeName = ''; + this.wsData = observerData + let str = '' + let msgTypeName = '' // 甲烷浓度更新 if (type == 'gasAlarm') { this.videoData = { deviceIp: observerData.deviceIp, - concentration:observerData.concentration, - deviceStatusName:'报警' + concentration: observerData.concentration, + deviceStatusName: '报警', } msgTypeName = '甲烷浓度告警' str = `设备名称:${observerData.monitorName}
甲烷浓度:${observerData.concentration}ppm·m
水平角度:${observerData.alarmDirection}
垂直角度:${observerData.alarmPitch}
` // 预置点更新 - } else if (type == 'presetIndex') { + } + else if (type == 'presetIndex') { this.videoData = { - deviceIp:observerData.deviceIp, - stationName:observerData.name + deviceIp: observerData.deviceIp, + stationName: observerData.name, } // 图片报警 - } else if (type == 'AIAlarm') { + } + else if (type == 'AIAlarm') { this.wsImgData = observerData this.videoData = { - deviceIp:observerData.deviceIp, - deviceStatusName:'报警' + deviceIp: observerData.deviceIp, + deviceStatusName: '报警', } } else if (type == 'onLine') { this.videoData = { - deviceIp:observerData.deviceIp, - deviceStatusName:'在线' + deviceIp: observerData.deviceIp, + deviceStatusName: '在线', } } else if (type == 'offLine') { this.videoData = { - deviceIp:observerData.deviceIp, - deviceStatusName:'离线' + deviceIp: observerData.deviceIp, + deviceStatusName: '离线', } } else { - console.log('其他状态',data) - // 实时状态 折现告警 - // 获取实时状态甲烷浓度以及deviceIp更新到视频对应窗口 - // this.videoData = {deviceStatusName:observerData.gasData} - // this.videoData = { - // deviceIp:observerData.deviceIp, - // concentration:observerData.gasData - // } - this.videoData = { - deviceIp: observerData.deviceIp, - concentration: observerData.gasData, - // deviceStatusName:'报警' - } - this.lineData = { - deviceIp:observerData.deviceIp, // 获取返回deviceIp - gasData:observerData.gasData, - time:observerData.time - } + console.log('其他状态', data) + // 实时状态 折现告警 + // 获取实时状态甲烷浓度以及deviceIp更新到视频对应窗口 + // this.videoData = {deviceStatusName:observerData.gasData} + // this.videoData = { + // deviceIp:observerData.deviceIp, + // concentration:observerData.gasData + // } + this.videoData = { + deviceIp: observerData.deviceIp, + concentration: observerData.gasData, + // deviceStatusName:'报警' + } + this.lineData = { + deviceIp: observerData.deviceIp, // 获取返回deviceIp + gasData: observerData.gasData, + time: observerData.time, + } } - if(Object.values(this.wsData).length >= 2 && msgTypeName !== ''){ + if (Object.values(this.wsData).length >= 2 && msgTypeName !== '') { ElNotification({ dangerouslyUseHTMLString: true, title: msgTypeName, @@ -148,7 +149,6 @@ type: 'warning', }) } - } // 监听socket错误 socket.onerror = function () { @@ -162,11 +162,11 @@ socket.onclose = () => { console.log('WebSocket已关闭') this.wsStatus = false - if (this.wsPingTimer) { - console.log('停止定时器') - clearInterval(this.wsPingTimer) - this.wsPingTimer = null - } + // if (this.wsPingTimer) { + // console.log('停止定时器') + // clearInterval(this.wsPingTimer) + // this.wsPingTimer = null + // } if (this.wsReconnectTimer) { clearTimeout(this.wsReconnectTimer) this.wsReconnectTimer = null @@ -183,11 +183,11 @@ if (this.websocket) { this.websocket.close() } - if (this.wsPingTimer) { - console.log('停止定时器') - clearInterval(this.wsPingTimer) - this.wsPingTimer = null - } + // if (this.wsPingTimer) { + // console.log('停止定时器') + // clearInterval(this.wsPingTimer) + // this.wsPingTimer = null + // } if (this.wsReconnectTimer) { clearTimeout(this.wsReconnectTimer) this.wsReconnectTimer = null diff --git a/src/views/line/listLine.vue b/src/views/line/listLine.vue index f845a49..056b875 100644 --- a/src/views/line/listLine.vue +++ b/src/views/line/listLine.vue @@ -5,7 +5,7 @@ import type { LineListInfo, MonitorListInfo, - SerialListInfo + SerialListInfo, } from './line-interface' import EditLine from './editLine.vue' import type { TableColumn } from '@/components/NormalTable/table_interface' @@ -14,7 +14,7 @@ HCPreset, getLineList, getSerialListPage, - handleCruise + handleCruise, } from '@/api/ptz/line' import { getDevList } from '@/api/ptz/dev' @@ -28,7 +28,7 @@ offset: 1, limit: 20, sort: '', - order: '' + order: '', } const listQuery = reactive({ ...defaultQuery }) const lineName = ref('') @@ -44,7 +44,7 @@ { text: '巡航速度', value: 'speed', align: 'center' }, { text: '停留时间', value: 'stopTime', align: 'center' }, { text: '报警阈值', value: 'alarmValue', align: 'center' }, - { text: '修改时间', value: 'updateTime', width: 180, align: 'center' } + { text: '修改时间', value: 'updateTime', width: 180, align: 'center' }, ] // 数据列表 const list: Ref = ref([]) @@ -54,7 +54,7 @@ const lineList: Ref = ref([]) function fetchDev() { - getDevList('').then(res => { + getDevList('').then((res) => { monitorList.value = res.data }) // getLineList('', '').then((res) => { @@ -63,9 +63,9 @@ } function changeMonitor() { - showAdd.value = false; + showAdd.value = false listQuery.lineNum = '' - getLineList('', listQuery.monitorId).then(res => { + getLineList('', listQuery.monitorId).then((res) => { lineList.value = res.data }) fetchData() @@ -93,7 +93,7 @@ list.value = res.data.rows total.value = res.data.total loading.value = false - } + }, ) } @@ -105,7 +105,7 @@ } editDialog.value.initDialog( 'create', - monitorList.value.filter(item => item.id === listQuery.monitorId)[0] + monitorList.value.filter(item => item.id === listQuery.monitorId)[0], ) } // 编辑 @@ -128,15 +128,15 @@ ElMessageBox.confirm(`确定要删除${row.serialName}吗?`, '确认删除', { confirmButtonText: '确定', cancelButtonText: '取消', - type: 'warning' + type: 'warning', }).then(() => { const params = { deviceIp: row.ip, command: 'presetDel', - presetIndex: row.id, + presetIndex: row.serialNum, cruiseRoute: row.lineNum, presetName: row.serialName, - cruiseName: row.lineName + cruiseName: row.lineName, } HCPreset(params).then(() => { ElMessage.success('删除成功') @@ -149,16 +149,17 @@ function startLine() { if (listQuery.monitorId === '' || listQuery.lineNum === '') { ElMessage.warning('请选择巡航路径进行开启!') - } else { - let params = { + } + else { + const params = { deviceIp: monitorList.value.filter( - item => item.id === listQuery.monitorId + item => item.id === listQuery.monitorId, )[0].ip, command: 'start', cruiseRoute: listQuery.lineNum, - interval: '750' + interval: '750', } - handleCruise(params).then(res => { + handleCruise(params).then((res) => { console.log(res) }) } @@ -168,15 +169,16 @@ function pauseLine() { if (listQuery.monitorId === '' || listQuery.lineNum === '') { ElMessage.warning('请选择巡航路径进行暂停!') - } else { - let params = { + } + else { + const params = { deviceIp: monitorList.value.filter( - item => item.id === listQuery.monitorId + item => item.id === listQuery.monitorId, )[0].ip, command: 'stop', - interval: '750' + interval: '750', } - handleCruise(params).then(res => { + handleCruise(params).then((res) => { console.log(res) }) } @@ -184,24 +186,25 @@ // 删除巡航线 function delLine() { - showAdd.value = false; + showAdd.value = false if (listQuery.monitorId === '' || listQuery.lineNum === '') { ElMessage.warning('请选择巡航路径进行删除!') - } else { + } + else { ElMessageBox.confirm('确定要删除所选巡航路径吗?', '确认删除', { confirmButtonText: '确定', cancelButtonText: '取消', - type: 'warning' + type: 'warning', }).then(() => { const param = { deviceIp: monitorList.value.filter( - item => item.id === listQuery.monitorId + item => item.id === listQuery.monitorId, )[0].ip, command: 'cruiseDelete', cruiseValue: listQuery.lineNum, cruiseName: monitorList.value.filter( - item => item.id === listQuery.monitorId - )[0].lineName + item => item.id === listQuery.monitorId, + )[0].lineName, } HCCruiseRoute(param).then(() => { ElMessage.success('删除成功') @@ -220,7 +223,7 @@ const width = Number( getComputedStyle(document.documentElement) .getPropertyValue('--g-sub-sidebar-width') - .replace('px', '') + .replace('px', ''), ) addLineDiv.style.left = `${ addLineBtn.getBoundingClientRect().left - width + 40 @@ -231,16 +234,18 @@ function addLine() { if (listQuery.monitorId === '') { ElMessage.warning('请选择设备') - } else if (lineName.value === '') { + } + else if (lineName.value === '') { ElMessage.warning('请填写巡航路径名称') - } else { + } + else { const param = { deviceIp: monitorList.value.filter( - item => item.id === listQuery.monitorId + item => item.id === listQuery.monitorId, )[0].ip, command: 'cruiseAdd', cruiseName: lineName.value, - cruiseValue: '' + cruiseValue: '', } HCCruiseRoute(param).then(() => { ElMessage.success('巡航路径添加成功') @@ -286,13 +291,11 @@
× @@ -385,8 +388,8 @@ @click="edit(scope.row)" />