内网开发
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
VUE_APP_MAP_URL='http://82.157.23.170:8600/geoserver'
|
||||
VUE_APP_MAP_AUTHKEY='9b488ac6-5309-4ef4-ab99-2180d2da161d'
|
||||
VUE_APP_API="http://work.ii999.live:19002/znzq"
|
||||
|
||||
VUE_APP_STATIC_FILE_Prefix='https://119.45.242.222/static_file/'
|
||||
|
||||
VUE_APP_STATIC_FILE_Prefix='//119.45.242.222/static_file'
|
||||
VUE_APP_SRS_URL='webrtc://119.45.242.222/'
|
||||
|
||||
VUE_APP_IM_API_URL='https://dev.shudong.xyz/im_api/v1'
|
||||
|
||||
7
hd-glasses-app/.env.hd
Normal file
7
hd-glasses-app/.env.hd
Normal file
@@ -0,0 +1,7 @@
|
||||
VUE_APP_MAP_URL='https://172.16.3.19/geoserver'
|
||||
VUE_APP_MAP_AUTHKEY='30efbafe-d218-4d77-8200-0207246924be'
|
||||
VUE_APP_API="https://172.16.3.19/znzq"
|
||||
VUE_APP_STATIC_FILE_Prefix='//172.16.3.19/static_file'
|
||||
VUE_APP_SRS_URL='webrtc://172.16.3.19/'
|
||||
|
||||
VUE_APP_IM_API_URL='https://172.16.3.19/im_api/v1'
|
||||
@@ -1,7 +1,7 @@
|
||||
VUE_APP_MAP_URL='http://172.16.2.2:8600/geoserver'
|
||||
VUE_APP_MAP_URL='https://172.16.3.19/geoserver'
|
||||
VUE_APP_MAP_AUTHKEY='30efbafe-d218-4d77-8200-0207246924be'
|
||||
VUE_APP_API="http://172.16.2.3:19000/znzq"
|
||||
VUE_APP_STATIC_FILE_Prefix='https://172.16.3.19/static_file'
|
||||
VUE_APP_API="https://172.16.3.19/znzq"
|
||||
VUE_APP_STATIC_FILE_Prefix='//172.16.3.19/static_file'
|
||||
VUE_APP_SRS_URL='webrtc://172.16.3.19/'
|
||||
|
||||
VUE_APP_IM_API_URL='https://172.16.3.19/im_api/v1'
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
"scripts": {
|
||||
"local-server": "vue-cli-service serve --mode local",
|
||||
"serve": "vue-cli-service serve --mode dev",
|
||||
"prod-serve": "vue-cli-service serve --mode prod",
|
||||
"build": "vue-cli-service build --mode prod",
|
||||
"prod-serve": "vue-cli-service serve --mode hd",
|
||||
"build:hd": "vue-cli-service build --mode hd",
|
||||
"build:online": "vue-cli-service build --mode dev",
|
||||
"lint": "vue-cli-service lint"
|
||||
},
|
||||
|
||||
@@ -124,8 +124,8 @@ function SrsRtcPublisherAsync() {
|
||||
|
||||
// @see https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/addStream#Migrating_to_addTrack
|
||||
stream.getTracks().forEach(function (track) {
|
||||
console.log("获取到一个流")
|
||||
console.log(track.kind);
|
||||
// console.log("获取到一个流")
|
||||
// console.log(track.kind);
|
||||
self.pc.addTrack(track);
|
||||
|
||||
// Notify about local track when stream is ok.
|
||||
|
||||
BIN
hd-glasses-app/src/assets/map/hongqi.png
Normal file
BIN
hd-glasses-app/src/assets/map/hongqi.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
@@ -6,7 +6,8 @@
|
||||
<div class="swiper-wrapper">
|
||||
<template v-for="(item,index) in videoRoomSteamList">
|
||||
<div :key="item.webrtcUrl" class="swiper-slide">
|
||||
<video class="remoteVideo" :ref="'videoStream'+item.publishId" width="100%" autoplay @click="videoClickAction(item.publishId)"></video>
|
||||
<video class="remoteVideo" :ref="'videoStream'+item.publishId" width="100%" autoplay
|
||||
@click="videoClickAction(item.publishId)"></video>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
@@ -27,11 +28,11 @@
|
||||
<img :src="switchCameraImg">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="callDownBox">
|
||||
<div @click="videoDownAction">
|
||||
<div @click="videoDownAction">
|
||||
<div class="actionBtn callDownBox">
|
||||
<img :src="callDwonImg">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <video ref="localVideo" id="rtc_media_local_player" width="310" autoplay muted controls></video>-->
|
||||
@@ -82,18 +83,24 @@ export default {
|
||||
cameraImg: "",
|
||||
switchCameraImg: "",
|
||||
callDwonImg: "",
|
||||
showConfirmDialog:0,
|
||||
inviteName:0,
|
||||
showConfirmDialog: 0,
|
||||
inviteName: 0,
|
||||
showInviteConfirmDialog: 0,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
console.log(location.href)
|
||||
console.log(location.href)
|
||||
console.log(location.href)
|
||||
|
||||
this.isPublish = this.$route.query.isPublish;
|
||||
this.isPlayer = this.$route.query.isPlayer;
|
||||
this.uid = this.$route.query.uid;
|
||||
this.roomId = this.$route.query.room;
|
||||
this.inviteName = this.$route.query.inviteName||'';
|
||||
this.inviteName = this.$route.query.inviteName || '';
|
||||
this.topVideo = this.uid;
|
||||
this.showConfirmDialog = this.$route.query.showConfirmDialog;
|
||||
this.showInviteConfirmDialog = this.$route.query.showInviteConfirmDialog;
|
||||
|
||||
|
||||
this.voiceImg = getStatisFileUrl("/media/voice_open.png")
|
||||
@@ -101,7 +108,12 @@ export default {
|
||||
this.switchCameraImg = getStatisFileUrl("/media/switch.png")
|
||||
this.callDwonImg = getStatisFileUrl("/media/call_down.png")
|
||||
|
||||
if(this.showConfirmDialog==1){
|
||||
this.token = this.$route.query.token || "";
|
||||
if (this.token > 10) {
|
||||
localStorage.setItem("hd_token", this.token)
|
||||
}
|
||||
|
||||
if (this.showConfirmDialog == 1) {
|
||||
Dialog.confirm({
|
||||
title: '是否接受?',
|
||||
message: `${this.inviteName}邀请你加入视频聊天`,
|
||||
@@ -114,7 +126,20 @@ export default {
|
||||
location.href = "uniwebview://action?function=refuseVideoInvite";
|
||||
// on cancel
|
||||
});
|
||||
}else {
|
||||
} else if (this.showInviteConfirmDialog == 1) {
|
||||
Dialog.confirm({
|
||||
title: '提示',
|
||||
message: `确认是否发起视频聊天?`,
|
||||
})
|
||||
.then(() => {
|
||||
this.init();
|
||||
// on confirm
|
||||
})
|
||||
.catch(() => {
|
||||
window.history.go(-1);
|
||||
// on cancel
|
||||
});
|
||||
} else {
|
||||
this.init();
|
||||
}
|
||||
|
||||
@@ -126,11 +151,18 @@ export default {
|
||||
this.leaveRoom();
|
||||
},
|
||||
methods: {
|
||||
init(){
|
||||
init() {
|
||||
Notify({
|
||||
message: '如视频不能播放,请点击视频列表中对应的用户上方的小视频',
|
||||
duration: 10000,
|
||||
type: 'primary'
|
||||
});
|
||||
|
||||
if (this.isPublish == 1) {
|
||||
this.beginPublish()
|
||||
}
|
||||
if (this.isPlayer == 1) {
|
||||
this.getRoomVideoList();
|
||||
this.roomTimer = setInterval(() => {
|
||||
this.getRoomVideoList();
|
||||
}, 2000)
|
||||
@@ -147,33 +179,31 @@ export default {
|
||||
//如果声音是开启状态
|
||||
if (!this.isCloseVoice) {
|
||||
// 关闭声音
|
||||
this.isCloseVoice=true
|
||||
this.isCloseVoice = true
|
||||
this.voiceImg = getStatisFileUrl("/media/voice_close.png")
|
||||
}else {
|
||||
} else {
|
||||
// 打开声音
|
||||
this.isCloseVoice=false;
|
||||
this.isCloseVoice = false;
|
||||
this.constraints.audio = true
|
||||
this.voiceImg = getStatisFileUrl("/media/voice_open.png")
|
||||
}
|
||||
console.log(this.isCloseVoice)
|
||||
console.log(this.voiceImg)
|
||||
this.beginPublish()
|
||||
},
|
||||
closeCamera() {
|
||||
this.constraints.video = false;
|
||||
//如果视频是开启状态
|
||||
if (!this.isCloseCamera) {
|
||||
this.constraints.video=false
|
||||
this.isCloseCamera=true
|
||||
this.constraints.video = false
|
||||
this.isCloseCamera = true
|
||||
this.cameraImg = getStatisFileUrl("/media/camera_close.png")
|
||||
}else {
|
||||
} else {
|
||||
let deviceId = {
|
||||
exact: ""
|
||||
}
|
||||
deviceId.exact = this.cameraDevices[this.cameraIndex].deviceId
|
||||
this.constraints.video = {}
|
||||
this.constraints.video.deviceId = deviceId
|
||||
this.isCloseCamera=false
|
||||
this.isCloseCamera = false
|
||||
this.cameraImg = getStatisFileUrl("/media/camera_open.png")
|
||||
}
|
||||
this.beginPublish()
|
||||
@@ -257,6 +287,7 @@ export default {
|
||||
|
||||
},
|
||||
playVideo(publishId = "", url = "") {
|
||||
let _this = this;
|
||||
let sdk = null;
|
||||
let video = null;
|
||||
// const _key=`${}`
|
||||
@@ -286,6 +317,7 @@ export default {
|
||||
const topVideo = this.$refs.videoStreamtopVideo
|
||||
topVideo.srcObject = sdk.stream;
|
||||
topVideo.onloadedmetadata = function (e) {
|
||||
topVideo.volume = 0
|
||||
topVideo.play();
|
||||
};
|
||||
}
|
||||
@@ -293,7 +325,9 @@ export default {
|
||||
|
||||
video.srcObject = sdk.stream;
|
||||
video.onloadedmetadata = function (e) {
|
||||
video.play();
|
||||
if (publishId == _this.uid)
|
||||
video.volume = 0
|
||||
video.play();
|
||||
};
|
||||
|
||||
// $('#rtc_media_player').prop('srcObject', sdk.stream);
|
||||
@@ -393,6 +427,8 @@ export default {
|
||||
videoClickAction(publishId) {
|
||||
this.topVideo = publishId;
|
||||
var video = eval('this.$refs.videoStream' + publishId)[0]
|
||||
video.play();
|
||||
|
||||
console.log(video.srcObject)
|
||||
this.$refs.videoStreamtopVideo.srcObject = video.srcObject;
|
||||
},
|
||||
@@ -407,13 +443,15 @@ export default {
|
||||
}
|
||||
|
||||
},
|
||||
videoDownAction(){
|
||||
videoDownAction() {
|
||||
location.href = "uniwebview://action?function=restartCamera";
|
||||
if(this.showConfirmDialog==1){
|
||||
location.href = "uniwebview://action?function=restartCamera";
|
||||
}else {
|
||||
|
||||
}
|
||||
this.publishSdk.close();
|
||||
if (this.showConfirmDialog == 1) {
|
||||
console.log("挂断视频")
|
||||
location.href = "uniwebview://action?function=refuseVideoInvite";
|
||||
} else {
|
||||
window.history.go(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -421,8 +459,8 @@ export default {
|
||||
|
||||
<style lang="less">
|
||||
|
||||
.videoRoomContainer{
|
||||
width:100vw;
|
||||
.videoRoomContainer {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background-color: #333030;
|
||||
}
|
||||
@@ -459,37 +497,20 @@ export default {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border-radius: 100%;
|
||||
background:#000000;
|
||||
background: #000000;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
img{
|
||||
img {
|
||||
width: 50%;
|
||||
height: 50%;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
.callDownBox{
|
||||
margin-top: 150px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-around;
|
||||
font-size: 16px;
|
||||
div{
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border-radius: 100%;
|
||||
background:#DA4C4B;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
img{
|
||||
width: 50%;
|
||||
height: 50%;
|
||||
}
|
||||
}
|
||||
.callDownBox {
|
||||
background: #DA4C4B !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -61,6 +61,7 @@ import GeoJSON from 'ol/format/GeoJSON'
|
||||
import service from "@/utils/service";
|
||||
import {appInit, getStatisFileUrl} from "../utils/publicFun";
|
||||
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -125,9 +126,17 @@ export default {
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
console.log(location.href)
|
||||
|
||||
this.page = this.$route.query.page;
|
||||
this.pageType = this.$route.query.type;
|
||||
|
||||
this.token = this.$route.query.token || "";
|
||||
if (this.token > 10) {
|
||||
localStorage.setItem("hd_token", this.token)
|
||||
}
|
||||
|
||||
|
||||
setInterval(() => {
|
||||
let hd_gps_location = localStorage.getItem("hd_gps_location")
|
||||
if (hd_gps_location) {
|
||||
@@ -342,7 +351,7 @@ export default {
|
||||
type: "featureMove",
|
||||
geometry: geometryMove,
|
||||
});
|
||||
this.planningVectorLayer.set('id', 'planningVectorLayer');
|
||||
// this.planningVectorLayer.set('id', 'planningVectorLayer');
|
||||
//先清空 再清除
|
||||
this.map.removeLayer(this.planningVectorLayer)
|
||||
this.planningVectorLayer = new VectorLayer({
|
||||
@@ -375,7 +384,7 @@ export default {
|
||||
* 根据经纬度坐标添加摄像头要素
|
||||
*/
|
||||
addPoints(coordinate) {
|
||||
|
||||
console.log("点击触发addPoints")
|
||||
if (this.selectPoint.length > 0) {
|
||||
this.coordinate = []
|
||||
this.map.removeLayer(this.pointLayer);
|
||||
@@ -591,9 +600,12 @@ export default {
|
||||
|
||||
service.get(`/api/alarm/list`, {
|
||||
params: {
|
||||
sendStatus: 1,
|
||||
sendStatus: "1",
|
||||
disposition: "0",
|
||||
pageNo: 1,
|
||||
pageSize: 50
|
||||
pageSize: 50,
|
||||
column: "createTime",
|
||||
order: "desc",
|
||||
}
|
||||
}).then((res) => {
|
||||
if (res.status == 200) {
|
||||
@@ -601,11 +613,11 @@ export default {
|
||||
this.alarmAnimation = null
|
||||
this.map.removeLayer(this.alarmLayer)
|
||||
this.alarmLayer = {};
|
||||
res.data.result.records.map(record => {
|
||||
res.data.result.records.map((record, index) => {
|
||||
|
||||
try {
|
||||
if (record.location != null) {
|
||||
this.addPointWidthCoordinate(record.location, "alarm", record)
|
||||
this.addPointWidthCoordinate(record.location, "alarm", record, index + 1)
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
@@ -618,14 +630,14 @@ export default {
|
||||
switchFullScreen() {
|
||||
location.href = "uniwebview://action?function=switchBigScreen"
|
||||
},
|
||||
addPointWidthCoordinate(coordinate, type, record) {
|
||||
addPointWidthCoordinate(coordinate, type, record, _index = 0) {
|
||||
|
||||
coordinate = coordinate.split(",")
|
||||
|
||||
coordinate = ol.proj.transform(coordinate, 'EPSG:4326', 'EPSG:3857');
|
||||
|
||||
// console.log("================addPointWidthCoordinate",coordinate)
|
||||
|
||||
// 告警相关
|
||||
if (type == 'alarm') {
|
||||
if (Object.keys(this.alarmLayer).length == 0) {
|
||||
// 创建图层
|
||||
@@ -641,61 +653,83 @@ export default {
|
||||
}, 900);
|
||||
}
|
||||
|
||||
|
||||
const feature = new Feature({
|
||||
geometry: new Point(coordinate),
|
||||
data: record,
|
||||
type: 'alarm'
|
||||
});
|
||||
// 设置要素的图标
|
||||
feature.setStyle(
|
||||
new Style({
|
||||
// 设置图片效果
|
||||
image: new Icon({
|
||||
src: getStatisFileUrl("/map/icon_paishuibeng_h.png"),
|
||||
// anchor: [0.5, 0.5],
|
||||
scale: 0.4,
|
||||
}),
|
||||
})
|
||||
);
|
||||
// 要素添加到地图图层上
|
||||
this.alarmLayer.getSource().addFeature(feature);
|
||||
|
||||
}
|
||||
if (type == 'equipment') {
|
||||
if (Object.keys(this.equipmentLayer).length == 0) {
|
||||
// 创建图层
|
||||
this.equipmentLayer = new VectorLayer({
|
||||
source: new VectorSource(),
|
||||
});
|
||||
// 图层添加到地图上
|
||||
this.map.addLayer(this.equipmentLayer);
|
||||
}
|
||||
if (record.isOnline == "true") {
|
||||
const feature = new Feature({
|
||||
geometry: new Point(coordinate),
|
||||
data: record,
|
||||
type: 'equipment'
|
||||
});
|
||||
const alarmCategory_dictText=record.alarmCategory_dictText||"未知类型"
|
||||
//临时智慧所,小红旗
|
||||
if (record.alarmCategory == "1706273001850601474") {
|
||||
// 设置要素的图标
|
||||
feature.setStyle(
|
||||
new Style({
|
||||
// 设置图片效果
|
||||
image: new Icon({
|
||||
src: getStatisFileUrl("/map/Group_29@2x.png"),
|
||||
// anchor: [0.5, 0.5],
|
||||
scale: 0.4,
|
||||
src: getStatisFileUrl("/map/hongqi.png"),
|
||||
anchor: [0.5, 0.5],
|
||||
scale: 0.3,
|
||||
}),
|
||||
text: new Text({
|
||||
testAlign: 'center',
|
||||
text: [_index.toString(), 'bold 16px sans-serif', '\n','',alarmCategory_dictText, 'italic 16px sans-serif'],
|
||||
font: 'bold 20px 微软雅黑',
|
||||
fill: new Fill({
|
||||
color: '#ffa502',
|
||||
}),
|
||||
offsetY: -2
|
||||
})
|
||||
})
|
||||
);
|
||||
} else {
|
||||
// 设置要素的图标
|
||||
feature.setStyle(
|
||||
new Style({
|
||||
// 设置图片效果
|
||||
image: new Icon({
|
||||
src: getStatisFileUrl("/map/icon_paishuibeng_h.png"),
|
||||
anchor: [0.5, 0.5],
|
||||
scale: 0.4,
|
||||
}),
|
||||
text: new Text({
|
||||
testAlign: 'center',
|
||||
text: [_index.toString(), 'bold 16px sans-serif', '\n','',alarmCategory_dictText, 'italic 16px sans-serif'],
|
||||
font: 'bold 20px 微软雅黑',
|
||||
fill: new Fill({
|
||||
color: '#ffa502',
|
||||
})
|
||||
})
|
||||
})
|
||||
);
|
||||
// 要素添加到地图图层上
|
||||
this.equipmentLayer.getSource().addFeature(feature);
|
||||
}
|
||||
if (record.isOnline == "false") {
|
||||
const feature = new Feature({
|
||||
geometry: new Point(coordinate),
|
||||
data: record,
|
||||
type: 'equipment'
|
||||
|
||||
// 要素添加到地图图层上
|
||||
this.alarmLayer.getSource().addFeature(feature);
|
||||
console.log("===============结束告警点位添加")
|
||||
|
||||
}
|
||||
//设备相关
|
||||
if (type == 'equipment') {
|
||||
let alarmNum=record.alarmNum||0;
|
||||
// 模拟数据
|
||||
// record.isOnline="true";
|
||||
// alarmNum=0;
|
||||
|
||||
const feature = new Feature({
|
||||
geometry: new Point(coordinate),
|
||||
data: record,
|
||||
type: 'equipment'
|
||||
});
|
||||
if (Object.keys(this.equipmentLayer).length == 0) {
|
||||
// 创建图层
|
||||
this.equipmentLayer = new VectorLayer({
|
||||
source: new VectorSource(),
|
||||
});
|
||||
this.map.addLayer(this.equipmentLayer);
|
||||
}
|
||||
// 设备离线 设置样式
|
||||
if (record.isOnline == "false") {
|
||||
// 设置要素的图标
|
||||
feature.setStyle(
|
||||
new Style({
|
||||
@@ -707,33 +741,48 @@ export default {
|
||||
}),
|
||||
})
|
||||
);
|
||||
// 要素添加到地图图层上
|
||||
this.equipmentLayer.getSource().addFeature(feature);
|
||||
}
|
||||
if (record.isAlarm == false) {
|
||||
const feature = new Feature({
|
||||
geometry: new Point(coordinate),
|
||||
data: record,
|
||||
type: 'equipment'
|
||||
});
|
||||
// 设置要素的图标
|
||||
feature.setStyle(
|
||||
new Style({
|
||||
// 设置图片效果
|
||||
image: new Icon({
|
||||
src: getStatisFileUrl("/map/Group_190514@2x.png"),
|
||||
// anchor: [0.5, 0.5],
|
||||
scale: 0.4,
|
||||
}),
|
||||
})
|
||||
);
|
||||
feature.on("click", (event) => {
|
||||
console.log("告警图标被点击")
|
||||
console.log(event)
|
||||
})
|
||||
// 要素添加到地图图层上
|
||||
this.equipmentLayer.getSource().addFeature(feature);
|
||||
|
||||
|
||||
if (record.isOnline == "true") {
|
||||
// 未接受告警数量为0,全部都接受 绿色
|
||||
if(alarmNum==0){
|
||||
feature.setStyle(
|
||||
new Style({
|
||||
// 设置图片效果
|
||||
image: new Icon({
|
||||
src: getStatisFileUrl("/map/Group_190514@2x.png"),
|
||||
// anchor: [0.5, 0.5],
|
||||
scale: 0.4,
|
||||
}),
|
||||
})
|
||||
);
|
||||
}
|
||||
if(alarmNum>0){
|
||||
feature.setStyle(
|
||||
new Style({
|
||||
// 设置图片效果
|
||||
image: new Icon({
|
||||
src: getStatisFileUrl("/map/Group_29@2x.png"),
|
||||
// anchor: [0.5, 0.5],
|
||||
scale: 0.4,
|
||||
}),
|
||||
text:new Text({
|
||||
testAlign: 'center',
|
||||
text: `${alarmNum}条告警未接受`,
|
||||
font: 'bold 16px 微软雅黑',
|
||||
fill: new Fill({
|
||||
color: '#369FFF',
|
||||
}),
|
||||
// offsetX: 40,
|
||||
offsetY: 26
|
||||
})
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
this.equipmentLayer.getSource().addFeature(feature);
|
||||
}
|
||||
|
||||
|
||||
@@ -810,23 +859,21 @@ export default {
|
||||
|
||||
this.map.addLayer(this.drawPlanningPathLayer);
|
||||
|
||||
service.get(`/api/patrol/area/list`, {
|
||||
|
||||
}).then((res) => {
|
||||
service.get(`/api/patrol/area/list`, {}).then((res) => {
|
||||
if (res.status == 200) {
|
||||
console.log(res.data.result.records)
|
||||
res.data.result.records.map((record) =>{
|
||||
res.data.result.records.map((record) => {
|
||||
console.log(record)
|
||||
this.drawAreaLayer(record.areaName,JSON.parse(record.area))
|
||||
this.drawAreaLayer(record.areaName, JSON.parse(record.area))
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
},
|
||||
drawAreaLayer(title,areaList) {
|
||||
drawAreaLayer(title, areaList) {
|
||||
console.log(title)
|
||||
areaList=areaList[0]
|
||||
areaList = areaList[0]
|
||||
console.log(areaList)
|
||||
|
||||
const tempGeometryList = []
|
||||
@@ -837,7 +884,7 @@ export default {
|
||||
|
||||
tempGeometryList.push(tempGeometryList[0])
|
||||
|
||||
const _list=[tempGeometryList]
|
||||
const _list = [tempGeometryList]
|
||||
|
||||
console.log(_list)
|
||||
|
||||
@@ -847,7 +894,7 @@ export default {
|
||||
|
||||
const polygonFeature = new Feature({
|
||||
geometry: polygonGeometry,
|
||||
name:title
|
||||
name: title
|
||||
})
|
||||
|
||||
polygonFeature.setStyle(new Style({
|
||||
@@ -859,10 +906,10 @@ export default {
|
||||
color: 'rgba(255,255,0,0.1)'
|
||||
}),
|
||||
text: new Text({
|
||||
testAlign:'center',
|
||||
text:title,
|
||||
font:'bold 20px 微软雅黑',
|
||||
fill:new Fill({
|
||||
testAlign: 'center',
|
||||
text: title,
|
||||
font: 'bold 20px 微软雅黑',
|
||||
fill: new Fill({
|
||||
color: '#ffa502',
|
||||
})
|
||||
})
|
||||
@@ -992,7 +1039,7 @@ export default {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-end;
|
||||
font-size: 14px;
|
||||
font-size: 18px !important;
|
||||
padding-top: 50px;
|
||||
|
||||
.alarmDetailsBox {
|
||||
|
||||
@@ -59,7 +59,7 @@ import * as interaction from 'ol/interaction'; // 交互
|
||||
import {OL as ol} from "plot-ol/plottingol";
|
||||
import GeoJSON from 'ol/format/GeoJSON'
|
||||
import service from "@/utils/service";
|
||||
import {appInit, getStatisFileUrl} from "../utils/publicFun";
|
||||
import {appInit, getStatisFileUrl,getUrlParam} from "../utils/publicFun";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -125,8 +125,12 @@ export default {
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.page = this.$route.query.page;
|
||||
this.pageType = this.$route.query.type;
|
||||
this.page = this.$route.query.page||getUrlParam("page");
|
||||
this.pageType = this.$route.query.type||getUrlParam("type");
|
||||
|
||||
this.token = this.$route.query.token ||getUrlParam("token");
|
||||
localStorage.setItem("hd_token", this.token)
|
||||
|
||||
|
||||
setInterval(() => {
|
||||
let hd_gps_location = localStorage.getItem("hd_gps_location")
|
||||
|
||||
@@ -85,7 +85,9 @@ import * as interaction from 'ol/interaction'; // 交互
|
||||
import {OL as ol} from "plot-ol/plottingol";
|
||||
import GeoJSON from 'ol/format/GeoJSON'
|
||||
import service from "@/utils/service";
|
||||
import {appInit, getStatisFileUrl} from "../utils/publicFun";
|
||||
import {appInit, getStatisFileUrl,getUrlParam} from "../utils/publicFun";
|
||||
|
||||
|
||||
import dayjs from "dayjs"
|
||||
|
||||
export default {
|
||||
@@ -99,6 +101,7 @@ export default {
|
||||
pointLayer: {},
|
||||
canAddPoints: false,
|
||||
coordinate: [],
|
||||
routeOriginList: [],
|
||||
route: new LineString([[12496610.1929, 2476571.7426], [12496623.829, 2476586.2505]]),
|
||||
route1: new LineString([[113.95113841271974, 22.568523240293505], [113.94452944970705, 22.563351941312792], [113.95188943124391, 22.559317898954394], [113.94467965341188, 22.555326771940233]]),
|
||||
geometryMove: {},
|
||||
@@ -117,6 +120,26 @@ export default {
|
||||
scale: 1, //设置大小
|
||||
}),
|
||||
}),
|
||||
startPoint: new Style({
|
||||
text: new Text({
|
||||
testAlign: 'center',
|
||||
text: "起点",
|
||||
font: 'bold 20px 微软雅黑',
|
||||
fill: new Fill({
|
||||
color: '#ffa502',
|
||||
})
|
||||
})
|
||||
}),
|
||||
endPoint: new Style({
|
||||
text: new Text({
|
||||
testAlign: 'center',
|
||||
text: "终点",
|
||||
font: 'bold 20px 微软雅黑',
|
||||
fill: new Fill({
|
||||
color: '#ffa502',
|
||||
})
|
||||
})
|
||||
}),
|
||||
featureMove: new Style({
|
||||
image: new Circle({
|
||||
radius: 7,
|
||||
@@ -126,6 +149,12 @@ export default {
|
||||
width: 2,
|
||||
}),
|
||||
}),
|
||||
text: new Text({
|
||||
font: '16px Arial',
|
||||
testAlign: 'left',
|
||||
offsetX: 90,
|
||||
offsetY: 1,
|
||||
})
|
||||
}),
|
||||
},
|
||||
vectorLayer: {},
|
||||
@@ -153,14 +182,22 @@ export default {
|
||||
planningVectorLayer: {},
|
||||
parentPostMessageData: [],
|
||||
isCanDraw: true,
|
||||
moveUserId: ""
|
||||
moveUserId: "",
|
||||
moveIndex: 0,
|
||||
pointMoveTimer:null,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.page = this.$route.query.page;
|
||||
this.pageType = this.$route.query.type;
|
||||
this.equipmentId = this.$route.query.equipmentId;
|
||||
this.moveUserId = this.$route.query.uerId;
|
||||
console.log(location.href)
|
||||
this.page = this.$route.query.page||getUrlParam("page");
|
||||
this.pageType = this.$route.query.type||getUrlParam("type");
|
||||
this.equipmentId = this.$route.query.equipmentId||getUrlParam("equipmentId");
|
||||
this.moveUserId = this.$route.query.uerId||getUrlParam("uerId");
|
||||
|
||||
|
||||
this.token = this.$route.query.token ||getUrlParam("token");
|
||||
localStorage.setItem("hd_token", this.token)
|
||||
|
||||
|
||||
setInterval(() => {
|
||||
let hd_gps_location = localStorage.getItem("hd_gps_location")
|
||||
@@ -344,8 +381,7 @@ export default {
|
||||
|
||||
const startPoint = ol.proj.transform(this.navigationStartPoint, 'EPSG:4326', 'EPSG:3857');
|
||||
const endPoint = ol.proj.transform(this.navigationEndPoint, 'EPSG:4326', 'EPSG:3857');
|
||||
console.log(startPoint)
|
||||
console.log(endPoint)
|
||||
|
||||
|
||||
const _points = `${startPoint[0]}#${startPoint[1]}@${endPoint[0]}#${endPoint[1]}`
|
||||
|
||||
@@ -380,7 +416,8 @@ export default {
|
||||
type: "featureMove",
|
||||
geometry: geometryMove,
|
||||
});
|
||||
this.planningVectorLayer.set('id', 'planningVectorLayer');
|
||||
|
||||
// this.planningVectorLayer.set('id', 'planningVectorLayer');
|
||||
//先清空 再清除
|
||||
this.map.removeLayer(this.planningVectorLayer)
|
||||
this.planningVectorLayer = new VectorLayer({
|
||||
@@ -488,19 +525,71 @@ export default {
|
||||
);
|
||||
this.geometryMove.setCoordinates(currentCoordinate);
|
||||
const vectorContext = getVectorContext(e);
|
||||
|
||||
this.styles.featureMove.getText().setText("13123")
|
||||
|
||||
vectorContext.setStyle(this.styles.featureMove);
|
||||
|
||||
vectorContext.drawGeometry(this.geometryMove);
|
||||
this.map.render();
|
||||
},
|
||||
moveFeatureByCoordinate(e) {
|
||||
|
||||
// console.warn(this.routeOriginList);
|
||||
|
||||
this.moveIndex = this.moveIndex + 1
|
||||
|
||||
if(this.moveIndex>=this.routeOriginList.length){
|
||||
return false;
|
||||
}
|
||||
|
||||
const currentCoordinate = this.routeOriginList[this.moveIndex]
|
||||
|
||||
|
||||
this.geometryMove.setCoordinates(currentCoordinate);
|
||||
|
||||
const vectorContext = getVectorContext(e);
|
||||
|
||||
this.styles.featureMove.getText().setText("13123")
|
||||
|
||||
vectorContext.setStyle(this.styles.featureMove);
|
||||
|
||||
vectorContext.drawGeometry(this.geometryMove);
|
||||
this.map.render();
|
||||
|
||||
|
||||
},
|
||||
startAnimation() {
|
||||
this.lastTime = Date.now();
|
||||
this.vectorLayer.on("postrender", this.moveFeature);
|
||||
this.featureMove.setGeometry(null); //必须用null,不能用{}
|
||||
this.pointMoveTimer=setInterval(()=>{
|
||||
this.moveIndex = this.moveIndex + 30
|
||||
|
||||
if(this.moveIndex>=this.routeOriginList.length){
|
||||
this.moveIndex=0;
|
||||
return false;
|
||||
}
|
||||
|
||||
const currentCoordinate = this.routeOriginList[this.moveIndex]
|
||||
|
||||
|
||||
console.log(currentCoordinate);
|
||||
|
||||
this.geometryMove.setCoordinates(currentCoordinate.location);
|
||||
|
||||
|
||||
this.styles.featureMove.getText().setText(currentCoordinate.createTime)
|
||||
this.featureMove.setStyle(this.styles.featureMove)
|
||||
// this.featureMove.drawGeometry(this.geometryMove);
|
||||
|
||||
this.map.render();
|
||||
},2000)
|
||||
|
||||
|
||||
|
||||
},
|
||||
|
||||
stopAnimation() {
|
||||
this.featureMove.setGeometry(this.geometryMove);
|
||||
this.vectorLayer.un("postrender", this.moveFeature);
|
||||
this.vectorLayer.un("postrender", this.moveFeatureByCoordinate);
|
||||
},
|
||||
addAlarmPointNextAction() {
|
||||
if (this.selectPoint.length == 0) {
|
||||
@@ -809,7 +898,7 @@ export default {
|
||||
const tempGeometryList = []
|
||||
|
||||
this.parentPostMessageData.map(item => {
|
||||
tempGeometryList.push(ol.proj.transform(item,'EPSG:4326','EPSG:3857'))
|
||||
tempGeometryList.push(ol.proj.transform(item, 'EPSG:4326', 'EPSG:3857'))
|
||||
})
|
||||
|
||||
console.log(tempGeometryList)
|
||||
@@ -910,56 +999,106 @@ export default {
|
||||
this.drawPlanningPathLayer.getSource().addFeature(polygonFeature)
|
||||
},
|
||||
showMoveHistory() {
|
||||
// 矢量地图源
|
||||
let vectorSource = new VectorSource();
|
||||
// 矢量地图
|
||||
this.drawPlanningPathLayer = new VectorLayer({
|
||||
source: vectorSource,
|
||||
style: new Style({
|
||||
stroke: new Stroke({
|
||||
width: 6,
|
||||
color: [237, 212, 0, 0.8],
|
||||
}),
|
||||
})
|
||||
});
|
||||
// console.log("================================================================showMoveHistory")
|
||||
// console.log(this.startDate)
|
||||
// console.log(dayjs(this.startDate).format('YYYY-MM-DD HH:mm'))
|
||||
// console.log(this.endTime)
|
||||
// console.log(dayjs(this.endTime).format('YYYY-MM-DD HH:mm'))
|
||||
if(this.pointMoveTimer!=null){
|
||||
clearTimeout(this.pointMoveTimer)
|
||||
this.pointMoveTimer=null;
|
||||
}
|
||||
|
||||
service.get(`/sys/equipment/trajectory`, {
|
||||
params: {
|
||||
uerId: this.moveUserId,
|
||||
equipmentId: this.equipmentId,
|
||||
startTime:dayjs(this.startDate).format('YYYY-MM-DD HH:mm'),
|
||||
endTime:dayjs(this.endDate).format('YYYY-MM-DD HH:mm'),
|
||||
pageSize:1000
|
||||
startTime: dayjs(this.startDate).format('YYYY-MM-DD HH:mm'),
|
||||
endTime: dayjs(this.endDate).format('YYYY-MM-DD HH:mm'),
|
||||
pageSize: 2000,
|
||||
// column: "createTime",
|
||||
// order: "asc"
|
||||
}
|
||||
}).then((res) => {
|
||||
if (res.status == 200) {
|
||||
this.showendDate=false
|
||||
this.showstartDate=false
|
||||
const _list=[]
|
||||
res.data.result.records.map((record,index) => {
|
||||
if(index==0){
|
||||
const startPoint = ol.proj.transform(record.location.split(","),'EPSG:4326','EPSG:3857')
|
||||
this.map.getView().animate({
|
||||
center:startPoint,
|
||||
duration:1000,
|
||||
zoom:18
|
||||
})
|
||||
|
||||
this.showendDate = false
|
||||
this.showstartDate = false
|
||||
const _list = []
|
||||
|
||||
let records = res.data.result.records;
|
||||
records.reverse();
|
||||
|
||||
records.map((record, index) => {
|
||||
if (index == 0) {
|
||||
const startPoint = ol.proj.transform(record.location.split(","), 'EPSG:4326', 'EPSG:3857')
|
||||
this.map.getView().animate({
|
||||
center: startPoint,
|
||||
duration: 1000,
|
||||
zoom: 18
|
||||
})
|
||||
}
|
||||
_list.push(record.location.split(","))
|
||||
let _location = record.location.split(",");
|
||||
_location = ol.proj.transform(_location, 'EPSG:4326', 'EPSG:3857')
|
||||
_list.push(_location)
|
||||
record.location = _location;
|
||||
})
|
||||
this.parentPostMessageData=_list
|
||||
this.drawPcPostMessageDataLayer()
|
||||
|
||||
|
||||
|
||||
this.routeOriginList = records;
|
||||
|
||||
console.log(this.routeOriginList.length);
|
||||
|
||||
|
||||
this.map.removeInteraction(this.draw)
|
||||
this.map.removeInteraction(this.snap)
|
||||
|
||||
this.route = new LineString(_list)
|
||||
|
||||
setTimeout(() => {
|
||||
this.moveFromStartToEnd()
|
||||
}, 1000)
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
moveFromStartToEnd() {
|
||||
|
||||
this.geometryMove = new Point(this.route.getFirstCoordinate());
|
||||
|
||||
this.featureMove = new Feature({
|
||||
type: "featureMove",
|
||||
geometry: this.geometryMove,
|
||||
});
|
||||
|
||||
|
||||
this.vectorLayer = new VectorLayer({
|
||||
source: new VectorSource({
|
||||
features: [
|
||||
new Feature({
|
||||
type: "route",
|
||||
geometry: this.route,
|
||||
}),
|
||||
this.featureMove,
|
||||
new Feature({
|
||||
type: "startPoint",
|
||||
geometry: new Point(this.route.getFirstCoordinate()),
|
||||
}),
|
||||
new Feature({
|
||||
type: "endPoint",
|
||||
geometry: new Point(this.route.getLastCoordinate()),
|
||||
}),
|
||||
],
|
||||
}),
|
||||
style: (feature) => {
|
||||
return this.styles[feature.get("type")];
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
this.map.addLayer(this.vectorLayer);
|
||||
|
||||
|
||||
this.startAnimation();
|
||||
|
||||
|
||||
},
|
||||
endDateConfirm(value) {
|
||||
console.log(dayjs(value))
|
||||
@@ -967,15 +1106,15 @@ export default {
|
||||
console.log(this.startDate)
|
||||
if (dayjs(value).isBefore(dayjs(this.startDate))) {
|
||||
console.log("结束时间早于开始时间")
|
||||
Notify({ type: 'warning', message: '结束时间不可早于开始时间' });
|
||||
Notify({type: 'warning', message: '结束时间不可早于开始时间'});
|
||||
} else {
|
||||
console.log("开始时间早于结束时间")
|
||||
this.endDate = dayjs(value).toDate()
|
||||
console.log("打印结束时间")
|
||||
console.log(this.endDate)
|
||||
setTimeout(()=>{
|
||||
setTimeout(() => {
|
||||
this.showMoveHistory()
|
||||
},1000)
|
||||
}, 1000)
|
||||
|
||||
}
|
||||
},
|
||||
@@ -985,12 +1124,12 @@ export default {
|
||||
console.log(this.endDate)
|
||||
if (dayjs(value).isBefore(dayjs(this.endDate))) {
|
||||
this.startDate = dayjs(value).toDate()
|
||||
setTimeout(()=>{
|
||||
setTimeout(() => {
|
||||
this.showMoveHistory()
|
||||
},1000)
|
||||
}, 1000)
|
||||
console.log("开始时间早于结束时间")
|
||||
} else {
|
||||
Notify({ type: 'warning', message: '开始时间不可晚于结束时间' });
|
||||
Notify({type: 'warning', message: '开始时间不可晚于结束时间'});
|
||||
console.log("结束时间早于开始时间")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,9 +78,8 @@ import * as interaction from 'ol/interaction'; // 交互
|
||||
import {OL as ol} from "plot-ol/plottingol";
|
||||
import GeoJSON from 'ol/format/GeoJSON'
|
||||
import service from "@/utils/service";
|
||||
import {appInit, getStatisFileUrl} from "../utils/publicFun";
|
||||
import {appInit, getStatisFileUrl,getUrlParam} from "../utils/publicFun";
|
||||
import dayjs from "dayjs"
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -151,11 +150,17 @@ export default {
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.page = this.$route.query.page;
|
||||
this.pageType = this.$route.query.type;
|
||||
this.equipmentId = this.$route.query.equipmentId;
|
||||
this.moveUserId = this.$route.query.uerId;
|
||||
this.workOrderNo = this.$route.query.workOrderNo||'';
|
||||
console.log(location.href)
|
||||
|
||||
this.page = this.$route.query.page||getUrlParam("page");
|
||||
this.pageType = this.$route.query.type||getUrlParam("type");
|
||||
this.equipmentId = this.$route.query.equipmentId||getUrlParam("equipmentId");
|
||||
this.moveUserId = this.$route.query.uerId||getUrlParam("uerId");
|
||||
this.workOrderNo = this.$route.query.workOrderNo||getUrlParam("workOrderNo");
|
||||
|
||||
this.token = this.$route.query.token ||getUrlParam("page");
|
||||
localStorage.setItem("hd_token", this.token)
|
||||
|
||||
|
||||
setInterval(() => {
|
||||
let hd_gps_location = localStorage.getItem("hd_gps_location")
|
||||
|
||||
@@ -63,7 +63,7 @@ import * as interaction from 'ol/interaction'; // 交互
|
||||
import {OL as ol} from "plot-ol/plottingol";
|
||||
import GeoJSON from 'ol/format/GeoJSON'
|
||||
import service from "@/utils/service";
|
||||
import {appInit, getStatisFileUrl} from "../utils/publicFun";
|
||||
import {appInit, getStatisFileUrl,GetQueryString,getUrlParam} from "../utils/publicFun";
|
||||
import dayjs from "dayjs"
|
||||
|
||||
export default {
|
||||
@@ -77,6 +77,7 @@ export default {
|
||||
pointLayer: {},
|
||||
canAddPoints: false,
|
||||
coordinate: [],
|
||||
routeOriginList: [],
|
||||
route: new LineString([[12496610.1929, 2476571.7426], [12496623.829, 2476586.2505]]),
|
||||
route1: new LineString([[113.95113841271974, 22.568523240293505], [113.94452944970705, 22.563351941312792], [113.95188943124391, 22.559317898954394], [113.94467965341188, 22.555326771940233]]),
|
||||
geometryMove: {},
|
||||
@@ -85,7 +86,7 @@ export default {
|
||||
route: new Style({
|
||||
stroke: new Stroke({
|
||||
width: 6,
|
||||
color: [237, 212, 0, 0.8],
|
||||
color: "rgb(255, 77, 54)",
|
||||
}),
|
||||
}),
|
||||
icon: new Style({
|
||||
@@ -95,6 +96,26 @@ export default {
|
||||
scale: 1, //设置大小
|
||||
}),
|
||||
}),
|
||||
startPoint: new Style({
|
||||
text: new Text({
|
||||
testAlign: 'center',
|
||||
text: "起点",
|
||||
font: 'bold 20px 微软雅黑',
|
||||
fill: new Fill({
|
||||
color: '#ffa502',
|
||||
})
|
||||
})
|
||||
}),
|
||||
endPoint: new Style({
|
||||
text: new Text({
|
||||
testAlign: 'center',
|
||||
text: "终点",
|
||||
font: 'bold 20px 微软雅黑',
|
||||
fill: new Fill({
|
||||
color: '#ffa502',
|
||||
})
|
||||
})
|
||||
}),
|
||||
featureMove: new Style({
|
||||
image: new Circle({
|
||||
radius: 7,
|
||||
@@ -104,10 +125,17 @@ export default {
|
||||
width: 2,
|
||||
}),
|
||||
}),
|
||||
text: new Text({
|
||||
font: '16px Arial',
|
||||
testAlign: 'left',
|
||||
offsetX: 90,
|
||||
offsetY: 1,
|
||||
})
|
||||
}),
|
||||
},
|
||||
vectorLayer: {},
|
||||
distance: 0,
|
||||
onceDistance:5,
|
||||
lastTime: 0,
|
||||
speed: 0.1,
|
||||
page: null,
|
||||
@@ -132,15 +160,32 @@ export default {
|
||||
parentPostMessageData: [],
|
||||
isCanDraw: true,
|
||||
moveUserId: "",
|
||||
patrolInstanceId: ""
|
||||
patrolInstanceId: "",
|
||||
moveIndex: 0,
|
||||
pointMoveTimer:null,
|
||||
mapZoom:15
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.page = this.$route.query.page;
|
||||
this.pageType = this.$route.query.type;
|
||||
this.patrolInstanceId = this.$route.query.patrolInstanceId||'1717873511875563522';
|
||||
this.equipmentId = this.$route.query.equipmentId;
|
||||
this.moveUserId = this.$route.query.uerId;
|
||||
console.log(location.href)
|
||||
|
||||
this.page = this.$route.query.page||getUrlParam("page");
|
||||
this.pageType = this.$route.query.type||getUrlParam("type");
|
||||
this.patrolInstanceId = this.$route.query.patrolInstanceId||getUrlParam("patrolInstanceId");
|
||||
this.equipmentId = this.$route.query.equipmentId||getUrlParam("equipmentId");
|
||||
this.moveUserId = this.$route.query.uerId||getUrlParam("uerId");
|
||||
|
||||
this.token = getUrlParam("token")
|
||||
|
||||
if(this.token){
|
||||
if (this.token.length > 10) {
|
||||
console.log("获取到token")
|
||||
localStorage.setItem("hd_token", this.token)
|
||||
}else {
|
||||
console.log("未获取到token")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
setInterval(() => {
|
||||
let hd_gps_location = localStorage.getItem("hd_gps_location")
|
||||
@@ -289,7 +334,7 @@ export default {
|
||||
view: new View({
|
||||
projection: "EPSG:3857",
|
||||
center: [12497018.585823221, 2476783.2447665134],
|
||||
zoom: 15,
|
||||
zoom: this.mapZoom,
|
||||
}),
|
||||
});
|
||||
this.map.on('singleclick', e => {
|
||||
@@ -474,14 +519,48 @@ export default {
|
||||
this.map.render();
|
||||
},
|
||||
startAnimation() {
|
||||
this.lastTime = Date.now();
|
||||
this.vectorLayer.on("postrender", this.moveFeature);
|
||||
this.featureMove.setGeometry(null); //必须用null,不能用{}
|
||||
},
|
||||
this.pointMoveTimer=setInterval(()=>{
|
||||
|
||||
console.log("Start animation 2s 一次")
|
||||
|
||||
console.log("this.routeOriginList.length:",this.routeOriginList.length)
|
||||
|
||||
|
||||
this.moveIndex = this.moveIndex + this.onceDistance
|
||||
|
||||
console.log("this.moveIndex:"+this.moveIndex)
|
||||
|
||||
if(this.moveIndex>=this.routeOriginList.length){
|
||||
this.moveIndex=this.routeOriginList.length-1;
|
||||
}
|
||||
|
||||
const currentCoordinate = this.routeOriginList[this.moveIndex]
|
||||
|
||||
|
||||
console.log(currentCoordinate);
|
||||
|
||||
this.geometryMove.setCoordinates(currentCoordinate.location);
|
||||
|
||||
this.styles.featureMove.getText().setText(currentCoordinate.createTime)
|
||||
this.featureMove.setStyle(this.styles.featureMove)
|
||||
// this.featureMove.drawGeometry(this.geometryMove);
|
||||
|
||||
this.map.render();
|
||||
|
||||
// 如果跳到最后一个点下标就重置为 0
|
||||
if(this.moveIndex==this.routeOriginList.length-1){
|
||||
this.moveIndex=0;
|
||||
}
|
||||
|
||||
|
||||
},2000)
|
||||
|
||||
|
||||
|
||||
},
|
||||
stopAnimation() {
|
||||
this.featureMove.setGeometry(this.geometryMove);
|
||||
this.vectorLayer.un("postrender", this.moveFeature);
|
||||
this.vectorLayer.un("postrender", this.moveFeatureByCoordinate);
|
||||
},
|
||||
addAlarmPointNextAction() {
|
||||
if (this.selectPoint.length == 0) {
|
||||
@@ -914,7 +993,6 @@ export default {
|
||||
service.get(`/sys/equipment/trajectory`, {
|
||||
params: {
|
||||
uerId: this.moveUserId,
|
||||
equipmentId: this.equipmentId,
|
||||
startTime:dayjs(this.startDate).format('YYYY-MM-DD HH:mm'),
|
||||
endTime:dayjs(this.endDate).format('YYYY-MM-DD HH:mm'),
|
||||
pageSize:1000
|
||||
@@ -930,7 +1008,7 @@ export default {
|
||||
this.map.getView().animate({
|
||||
center:startPoint,
|
||||
duration:1000,
|
||||
zoom:18
|
||||
zoom:this.mapZoom
|
||||
})
|
||||
}
|
||||
_list.push(record.location.split(","))
|
||||
@@ -1006,7 +1084,7 @@ export default {
|
||||
this.map.getView().animate({
|
||||
center:startPoint,
|
||||
duration:1000,
|
||||
zoom:18
|
||||
zoom:this.mapZoom
|
||||
})
|
||||
|
||||
this.drawPcPostMessageDataLayer(longitudeLatitude,"planPathLine")
|
||||
@@ -1020,10 +1098,23 @@ export default {
|
||||
},
|
||||
getPatrolInstanceRealyPath(startTime,endTime){
|
||||
|
||||
if(this.pointMoveTimer!=null){
|
||||
clearTimeout(this.pointMoveTimer)
|
||||
this.pointMoveTimer=null;
|
||||
}
|
||||
|
||||
//TODO 如果开始时间和结束时间都相等,则不进行任何查询
|
||||
if(startTime==endTime){
|
||||
return false;
|
||||
}
|
||||
|
||||
if(endTime==null){
|
||||
endTime=dayjs().format('YYYY-MM-DD HH:mm')
|
||||
}
|
||||
|
||||
service.get(`/sys/equipment/trajectory`, {
|
||||
params: {
|
||||
uerId: this.moveUserId,
|
||||
equipmentId: this.equipmentId,
|
||||
startTime:startTime,
|
||||
endTime:endTime,
|
||||
pageSize:1000
|
||||
@@ -1033,24 +1124,84 @@ export default {
|
||||
this.showendDate=false
|
||||
this.showstartDate=false
|
||||
const _list=[]
|
||||
res.data.result.records.map((record,index) => {
|
||||
|
||||
let records = res.data.result.records;
|
||||
records.reverse();
|
||||
|
||||
records.map((record,index) => {
|
||||
if(index==0){
|
||||
const startPoint = ol.proj.transform(record.location.split(","),'EPSG:4326','EPSG:3857')
|
||||
this.map.getView().animate({
|
||||
center:startPoint,
|
||||
duration:1000,
|
||||
zoom:18
|
||||
zoom:this.mapZoom
|
||||
})
|
||||
}
|
||||
_list.push(record.location.split(","))
|
||||
let _location = record.location.split(",");
|
||||
_location = ol.proj.transform(_location, 'EPSG:4326', 'EPSG:3857')
|
||||
_list.push(_location)
|
||||
record.location = _location;
|
||||
})
|
||||
this.drawPcPostMessageDataLayer(_list,"realyPathLine")
|
||||
|
||||
this.onceDistance=Math.ceil(records.length/15)
|
||||
|
||||
this.routeOriginList = records;
|
||||
|
||||
this.route = new LineString(_list)
|
||||
|
||||
setTimeout(() => {
|
||||
this.moveFromStartToEnd()
|
||||
}, 1000)
|
||||
|
||||
|
||||
|
||||
// this.drawPcPostMessageDataLayer(_list,"realyPathLine")
|
||||
|
||||
this.map.removeInteraction(this.draw)
|
||||
this.map.removeInteraction(this.snap)
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
moveFromStartToEnd() {
|
||||
|
||||
this.geometryMove = new Point(this.route.getFirstCoordinate());
|
||||
|
||||
this.featureMove = new Feature({
|
||||
type: "featureMove",
|
||||
geometry: this.geometryMove,
|
||||
});
|
||||
|
||||
|
||||
this.vectorLayer = new VectorLayer({
|
||||
source: new VectorSource({
|
||||
features: [
|
||||
new Feature({
|
||||
type: "route",
|
||||
geometry: this.route,
|
||||
}),
|
||||
this.featureMove,
|
||||
new Feature({
|
||||
type: "startPoint",
|
||||
geometry: new Point(this.route.getFirstCoordinate()),
|
||||
}),
|
||||
new Feature({
|
||||
type: "endPoint",
|
||||
geometry: new Point(this.route.getLastCoordinate()),
|
||||
}),
|
||||
],
|
||||
}),
|
||||
style: (feature) => {
|
||||
return this.styles[feature.get("type")];
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
this.map.addLayer(this.vectorLayer);
|
||||
|
||||
|
||||
this.startAnimation();
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
@@ -120,7 +120,6 @@ export default {
|
||||
geometry: this.geometryMove,
|
||||
});
|
||||
|
||||
console.log(this.route)
|
||||
|
||||
this.vectorLayer = new VectorLayer({
|
||||
source: new VectorSource({
|
||||
@@ -163,7 +162,7 @@ export default {
|
||||
}),
|
||||
});
|
||||
|
||||
// this.map.addLayer(this.vectorLayer);
|
||||
this.map.addLayer(this.vectorLayer);
|
||||
},
|
||||
/**
|
||||
* 点击地图添加摄像头要素
|
||||
|
||||
1407
hd-glasses-app/src/pages/map_test.vue
Normal file
1407
hd-glasses-app/src/pages/map_test.vue
Normal file
File diff suppressed because it is too large
Load Diff
@@ -40,6 +40,10 @@ const router = new Router({
|
||||
path: '/hd_show_patrolTmp_history',
|
||||
name: 'hd_show_patrolTmp_history',
|
||||
component: () => import('../pages/hd_show_patrolTmp_history.vue')
|
||||
},{
|
||||
path: '/map_test',
|
||||
name: 'map_test',
|
||||
component: () => import('../pages/map_test.vue')
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
export function getStatisFileUrl(file){
|
||||
return process.env.VUE_APP_STATIC_FILE_Prefix+file
|
||||
}
|
||||
export function getStatisFileUrl(file) {
|
||||
var protocol = location.protocol
|
||||
const _url = protocol + process.env.VUE_APP_STATIC_FILE_Prefix + file
|
||||
return _url
|
||||
}
|
||||
|
||||
/**
|
||||
* getUrlKey 截取地址栏参数
|
||||
@@ -9,7 +11,7 @@
|
||||
*/
|
||||
export function getUrlParam(name) {
|
||||
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
|
||||
let url = window.location.href.split('#')[0];
|
||||
let url = window.location.href.split('#')[1];
|
||||
let search = url.split('?')[1];
|
||||
console.log(search);
|
||||
if (search) {
|
||||
@@ -22,14 +24,26 @@ export function getUrlParam(name) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
export function GetQueryString(name) {
|
||||
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
||||
console.log("window.location.search:",window.location.search);
|
||||
var r = window.location.search.substr(1).match(reg); //获取url中"?"符后的字符串并正则匹配
|
||||
var context = "";
|
||||
if (r != null)
|
||||
context = decodeURIComponent(r[2]);
|
||||
reg = null;
|
||||
r = null;
|
||||
return context == null || context == "" || context == "undefined" ? "" : context;
|
||||
}
|
||||
|
||||
export function appInit(ms) {
|
||||
return new Promise((resolve, reject) => {
|
||||
var i = 0;
|
||||
var i = 1000;
|
||||
let timer = setInterval(() => {
|
||||
var hd_token = localStorage.getItem("hd_token")
|
||||
// var im_userId = localStorage.getItem("im_userId")
|
||||
i = i + 1;
|
||||
if (i > 10) {
|
||||
if (i < 10) {
|
||||
reject("error")
|
||||
}
|
||||
if (hd_token) {
|
||||
|
||||
Reference in New Issue
Block a user