track&line

This commit is contained in:
shijing 2022-09-23 17:12:19 +08:00
parent 72b5304b97
commit a0d2ca4068
4 changed files with 334 additions and 222 deletions

View File

@ -68,6 +68,15 @@ export default {
);
}
},
xunxiCommon:{
name: "寻息通用接口",
req: async function(data){
return await http.post(
`${config.API_URL}/third/xunxi/`,
data
);
}
},
all:{
name: "全部在线标签列表信息",
req: async function(data){

View File

@ -258,6 +258,7 @@
:areaId="areaId"
:areaName="areaName"
:areaPoints="areaPoints"
:areaFloorId="areaFloorId"
@success="handleSaveSuccess"
@closed="dialog.saveRail = false"
></save-rail-dialog>
@ -307,6 +308,7 @@ export default {
areaId: null,
areaName: "",
areaPoints:[],
areaFloorId:1,
cate_: { post: "岗位", org: "单位", people: "人员" },
};
},
@ -350,6 +352,7 @@ export default {
// console.log(row.third_info.xx_rail.detail.polygon.points);
if(row.third_info.xx_rail){
this.areaPoints = row.third_info.xx_rail.detail.polygon.points;
this.areaFloorId = row.third_info.xx_rail.detail.floorId;
}else{
}

View File

@ -33,7 +33,10 @@ export default {
},
areaPoints: {
type: Array,
}
},
areaFloorId:{
type: Number,
},
},
data() {
return {
@ -45,11 +48,12 @@ export default {
floorId: 1,
railName: '',
railType: 1,//1:0
mapType: 1,//2xy1
mapType: 2,//2xy1
color: '1',
polygon: {
points: []
}
},
remark:'围栏'
},
points: [],
areaMarkerLayer: null,
@ -105,7 +109,7 @@ export default {
console.log(feature.properties);//type:POLYGON;id:"";name:"";floorNo:"";floorId:""
console.log(feature.geometry);//feature.geometry.coordinates:[[],[]]
this.coordinates.floorId = feature.properties.floorId;
this.coordinates.floorNo = feature.properties.floorNo == '室外' ? 'Floor1' : feature.properties.floorNo;
this.coordinates.floorNo = feature.properties.floorNo == '室外' ? 'Floor1' : 'Floor'+feature.properties.floorId;
// this.coordinates.floorId = feature.properties.floorId;
that.points = feature.geometry.coordinates[0];
},
@ -155,18 +159,27 @@ export default {
},
//
areaMarkerLayers() {
debugger;
let that = this;
let areaPoints = [];
that.areaPoints.forEach(item => {
console.log(item)
let point = new jsmap.JSPoint(Number(item.x), Number(item.y), 0);
//console.log(item)
let point = null;
if(item.x){
point = new jsmap.JSPoint(Number(item.x), Number(item.y), 0);
}else{
point = new jsmap.JSPoint(Number(item.longitude), Number(item.latitude), 0);
}
areaPoints.push(point)
})
debugger;
console.log(that.areaId);
console.log(areaPoints);
console.log(that.areaFloorId);
console.log('00000');
var polygonMarker = new jsmap.JSPolygonMarker({
id: that.areaId,//id
position: areaPoints,//
floorId: 1,//id
floorId: that.areaFloorId,//id
color: 'rgba(0,0,255,.44)',//
strokeColor: 'rgba(0,0,255,.44)',//线
depthTest: false,//
@ -190,7 +203,7 @@ export default {
that.isSaveing = true;
that.coordinates.color = 'rgba(255,0,0,.4)';
points.forEach(item => {
let pixel = { x: parseFloat(item[0]), y: parseFloat(item[1]) };
let pixel = {longitude:parseFloat(item[0]),latitude:parseFloat(item[1])};
pointXY.push(pixel);
});
that.coordinates.polygon.points = pointXY;

View File

@ -51,7 +51,7 @@
</div>
<div class="drop-content" v-if="showUserSelect">
<el-tree ref="group" id="bigScreenTree" node-key="id" :data="postList" show-checkbox
:current-node-key="''" :highlight-current="true" :expand-on-click-node="false"
:current-node-key="''" :highlight-current="true" :expand-on-click-node="true"
@node-click="groupClick"></el-tree>
<el-button type="primary" @click="userFilter">查看</el-button>
@ -75,7 +75,7 @@
</div>
</div>
</div>
<!--人员统计-->
<!--人员统计/事件统计/部门统计-->
<div class="screen-cockpit">
<div class="cockpit-count">
<div class="divider"></div>
@ -268,8 +268,9 @@
<el-table-column label="唯一标识" prop="code"></el-table-column>
</el-table>
<el-table class="bigScreenTable" :data="areaUser" v-if="areaShowType==4">
<el-table-column label="人员姓名"></el-table-column>
<el-table-column label="定位卡号"></el-table-column>
<el-table-column label="人员姓名" prop="my_info.employee_.name"></el-table-column>
<el-table-column label="人员姓名" prop="my_info.employee_.type"></el-table-column>
<el-table-column label="定位卡号" prop="mac"></el-table-column>
</el-table>
</div>
</div>
@ -412,11 +413,14 @@
<span class="trackImg"></span>
<span>跟踪</span>
</div>
<div class="simple-btn-bg btn-item">
<div v-if="!lineTracking" class="simple-btn-bg btn-item" @click="userLineTrack">
<span class="viewImg"></span>
<span>轨迹</span>
</div>
<div v-else class="simple-btn-bg btn-item" @click="userLineTrackCancel">
<span class="viewImg"></span>
<span>取消轨迹</span>
</div>
</div>
<div class="screen-per-list">
<el-table :data="userList" style="width: 100%" :row-key="row => { return row.id }"
@ -736,6 +740,9 @@
</div>
</div>
<audio id="audio" :src="audioSrc" autoplay @ended="audioFinished" preload>
对不起您的浏览器不支持HTML5音频播放
</audio>
</div>
</template>
<script>
@ -744,8 +751,13 @@ import sysConfig from "@/config";
export default {
data() {
return {
line1:null,
music:null,
timerUser: null,
timerTime: null,
eventTimer:null,
eventAudioTimer:null,
trackMarker:null,
domMarkerLayer: null,
userMaskerLayer: null,
jobDomMarkerLayer: null,
@ -765,11 +777,12 @@ export default {
markList: [false, false, false, false, false, false],
autoRun: false,
tracking: false,
lineTracking:false,
areaDetail: false,
screenJob: false,
screenUser: false,
screenRisk: false,
speakerPlayStatus:false,
speakerPlayStatus:true,
screenWarning: false,
screenUserDetail: false,
warningTypeShow: false,
@ -801,10 +814,9 @@ export default {
deptList: [],//
postList: [
{id:0,name:'全部',label:'全部'},
{id:1,name:'正式员工',label:'正式员工'},
{id:2,name:'相关方',label:'相关方'},
{id:3,name:'访客',label:'访客'},
{id:4,name:'司机',label:'司机'}],//
{id:1,name:'曲阳金隅',label:'曲阳金隅'},
{id:2,name:'访客',label:'访客'},
{id:3,name:'司机',label:'司机'}],//
dangerList: [],//
areaList: [],///
areaOperation:[],
@ -866,6 +878,10 @@ export default {
40:'重大风险'
},
eventTypeName:'全部',
audioSrc:'',
audioIndex:0,
audioList:{},
}
},
created() {
@ -875,14 +891,11 @@ export default {
document.head.appendChild(scriptInfo)
},
mounted() {
debugger;
let timeeee= '2022-09-20 16:00:00';
console.log(new Date( timeeee ).getTime());
debugger;
let that = this;
let date = new Date();
that.timeNow = date.getDay();
that.todayDate = this.warningData.params.start_create = this.cateAggForm.start_create = this.$TOOL.dateFormat(new Date(), 'yyyy-MM-dd');
that.music = document.getElementById("audio");
that.showTime();
that.timerTime = setInterval(() => {
that.showTime();
@ -955,8 +968,6 @@ export default {
let areaId = item.properties.get("areaId");
console.log(areaId);
that.$API.am.area.item.req(areaId).then(res=>{
// debugger;
console.log(res);
that.areaItemDetail = res;
that.screenJob = false;
that.screenWarning = false;
@ -1035,7 +1046,7 @@ export default {
//
that.screenUserItem = item.properties.get("employee");
that.screenUser = true;
debugger;
// debugger;
window.map.flyToMarker(that.userMarker[that.screenUserItem.mac], {
duration: 1000
})
@ -1057,7 +1068,6 @@ export default {
this.getGroup();//$$
//
this.getDangers();//$$
// this.getAllPost();//
this.getWarningTotal();//
this.getWarningType();//
let pageHeight = document.getElementsByClassName('screen-cockpit')[0].clientHeight;
@ -1070,13 +1080,32 @@ export default {
document.getElementsByClassName('cockpit-info')[0].style.height = domHeight + 'px';
// document.getElementsByClassName('area-info-body')[0].style.height = simpleBodyHeight + 'px';
},
computed:{
bgmSrc:function(){
return this.audioList[this.audioIndex]
}
},
beforeUnmount(){
window.map.destroy();
window.map = null;
clearInterval(this.timerUser)
clearInterval(this.timerTime)
this.timerUser = null;
this.timerTime = null;
this.eventTimer = null;
this.eventAudioTimer = null;
window.map.destroy();
clearInterval(this.timerUser)//
clearInterval(this.timerTime)//
clearInterval(this.eventTimer)//
clearInterval(this.eventAudioTimer)//
},
methods: {
audioFinished(){
if(this.audioIndex<this.audioList.length){
this.audioIndex++;
}else{
this.audioIndex = 0;
}
},
showTime() {
this.currentTime = this.$TOOL.dateFormat(new Date(), 'hh:mm:ss');
this.currentWeek = this.$TOOL.dateFormat(new Date(), 'week');
@ -1099,7 +1128,20 @@ export default {
}
},
//
getWarningTotal() {
getWarningTotal() {
let that = this;
that.getEventTotal();
that.getNewEvent();
clearInterval(that.eventTimer);
that.eventTimer = setInterval(function () {
that.getEventTotal();
}, 60000)
clearInterval(that.eventAudioTimer);
that.eventAudioTimer = setInterval(function () {
that.getNewEvent();
}, 20000)
},
getEventTotal(){
let that = this;
that.$API.ecm.event.cateAgg.req(that.cateAggForm).then(res => {
if (res.err_msg) { } else {
@ -1107,29 +1149,92 @@ export default {
}
})
},
getNewEvent(){
let that = this;
that.$API.ecm.event.list.req({page_size:1}).then(res => {
if (res.err_msg) {
} else {
// debugger;
console.log('00000000000000');
console.log(res.results[0].id);
console.log(that.audioList.id);
let judge = res.results[0].id==that.audioList.id
console.log(judge);
console.log('11111111111111');
let item = res.results[0];
if(that.audioSrc!==''){
if(item.id==that.audioList.id){
// that.music.pause(); //
}else{
// debugger;
that.audioList = item;
that.audioSrc=item.voice_f;
// that.music.play();//
if(item.location){
window.map.flyToPosition(new jsmap.JSPoint(item.location.longitude, item.location.latitude), { duration: 1000 });
}
}
}else{
that.audioList = item;
that.audioSrc = item.voice_f;
that.music.play();//
}
}
})
},
//
getWarningType() {
let that = this;
that.$API.ecm.event_cate.list.req().then(res => {
if (res.err_msg) { } else {
that.warningTypes = res.results;
}
})
if (res.err_msg) { } else {
that.warningTypes = res.results;
}
})
},
warningTypeChange(){
this.warningTypeShow = !this.warningTypeShow
},
handleCurrentChange() {
this.getWarnings();
},
//
getWarnings() {
this.$API.ecm.event.list.req(this.warningData.params).then(res => {
if (res.err_msg) {
} else {
this.warningData.list = res.results;
this.warningData.total = res.count;
}
})
},
//
warningTypeSelected(id,name) {
// debugger;
let that = this;
this.warningTypeShow = false;
let params = new Object();
params = that.warningData.params;
if (id !== null) {
params.cates = id;
}
this.eventTypeName = name;
that.$API.ecm.event.list.req(params).then(res => {
if (res.err_msg) { } else {
that.warningData.list = res.results;
that.warningData.total = res.count;
}
})
//
},
//
areaRowClick(data) {
let that = this;
that.areaDetail = true;
that.areaDetailId = data.id;
this.getAreaOperation();
// debugger;
console.log(data);
let points = data.third_info.xx_rail.detail.polygon.points[0];
window.map.flyToPosition(new jsmap.JSPoint(points.x, points.y, points.z), { duration: 1000 });
},
//
getAreaOperation(){
@ -1160,10 +1265,11 @@ export default {
let that = this;
that.$API.third.blt.all.req({area:that.areaDetailId}).then(res=>{
console.log(res)
that.areaUser = res;
that.areaUser = res.filter(item=>{
return item.my_info.employee;
});
})
},
//
getGroup() {
let that = this;
@ -1173,33 +1279,27 @@ export default {
let rpartsList=[];
let arr = [];
let children = genTree(res);
// debugger;
// console.log(children)
for (let i = 0; i < 5; i++) {
let obj = new Object();
if (i === 0) {
obj.id = 0;
obj.name = '全部';
obj.label = '全部';
} else if (i === 1) {
obj.id = 1;
obj.name = '正式员工';
obj.label = '正式员工';
obj.children = children;
} else if (i === 2) {
obj.id = 2;
obj.name = '相关方';
obj.label = '相关方';
obj.children = rpartsList;
} else if (i === 3) {
obj.id = 3;
obj.name = '访客';
obj.label = '访客';
}else if (i === 4) {
obj.id = 4;
obj.name = '司机';
obj.label = '司机';
let obj = new Object();
if (i === 0) {
obj.id = 0;
obj.name = '全部';
obj.label = '全部';
} else if (i === 1) {
obj = children[0];
} else if (i === 2) {
obj.id = 2;
obj.name = '访客';
obj.label = '访客';
}else if (i === 3) {
obj.id = 3;
obj.name = '司机';
obj.label = '司机';
}
arr.push(obj)
}
arr.push(obj)
}
that.postList = arr;
}
});
@ -1283,8 +1383,6 @@ export default {
///
getAreas() {
let that = this;
// let areaList = that.$TOOL.data.get('qyjyAreaList');
that.$API.am.area.list.req({page:0}).then(res => {
if (res.err_msg) {
} else {
@ -1292,7 +1390,6 @@ export default {
that.showRiskMarkers(that.areaList);
}
})
},
//线
getAllMen() {
@ -1307,45 +1404,11 @@ export default {
}
})
},
handleCurrentChange() {
this.getWarnings();
},
//
getWarnings() {
this.$API.ecm.event.list.req(this.warningData.params).then(res => {
if (res.err_msg) {
} else {
// debugger;
this.warningData.list = res.results.filter(item => {
return item.handle_user === null;
});
this.warningData.total = res.count;
}
})
},
//
warningTypeSelected(id,name) {
// debugger;
let that = this;
this.warningTypeShow = false;
let params = new Object();
params = that.warningData.params;
if (id !== null) {
params.cates = id;
}
this.eventTypeName = name;
that.$API.ecm.event.list.req(params).then(res => {
if (res.err_msg) { } else {
that.warningData.list = res.results;
that.warningData.total = res.count;
}
})
//
},
//
groupClick(data) {
// console.log(data);
debugger;
console.log(data);
},
//
showUserDetail() {
@ -1430,20 +1493,6 @@ export default {
});
window.map.addLayer(that.userMaskerLayer);
//线
let points0 = [{x:114.63000343420656, y: 38.81372685720612, z: 0},
{x: 114.63016642812906, y: 38.81357460804729, z: 0.},
{x: 114.63072033314663,y: 38.813113546390916, z: 0},
{x: 114.63040619763623, y: 38.81281832964802, z: 0},
{x: 114.63014001753065, y:38.81279008573829, z: 0}];
let line1 = new jsmap.JSLineMarker({
position: points0,
floorId: 1,
lineType: jsmap.JSLineType.ARROW,
color: '#0000ff',
width: 5,
depthTest: true
});
window.map.addMarker(line1);
that.getAllMen();
},
//layer
@ -1554,7 +1603,7 @@ export default {
}
});
// debugger;
console.log(that.cameraMaskerLayer)
// console.log(that.cameraMaskerLayer)
that.cameraMaskerLayer.addMarker(cameraMarker);
}
})
@ -1596,85 +1645,8 @@ export default {
})
},
// model(){
// marker = new jsmap.JSModelMarker({
// id: '1',
// position: points0[0],
// url: 'http://mapdemo.joysuch.com/lib/LocalAssets/img/human_red.gltf',
// rotation: {
// rx: 0,
// ry: 0,
// rz: -90
// },
// text: '...',
// fontColor: '#0000ff',
// font: '14px ',
// backgroundColor: 'rgba(112,253,147,0.5)',
// backgroundRadius: 5,
// textOffsetInMeter: 1.6,
// backgroundStrokeColor: 'rgb(255,255,255)',
// modelAnimate: {
// multiplier: 2,
// },
// scale: 0.8,
// properties: {
// name: 'JSMap007'
// },
// callback: (marker) => {
// map.trackMarker(marker, {
// range: 40,
// tilt: 60,
// rotate: 310
// });
// for (let i = 1; i < points0.length; i++) {
// setTimeout(() => {
// map.updateMarkerPosition(marker, {
// position: points0[i],
// animate: {
// duration: 1000,
// begin: () => {
// marker.startModelAnimators();
// },
// complete: () => {
// marker.pauseModelAnimators();
// },
// update: (pos) => {
// line1.trace(pos)
// }
// }
// });
// }, i * 1000);
// }
// setTimeout(() => {
// marker.text = '...';
// }, (points0.length + 1) * 1000);
// setTimeout(() => {
// map.flyToMarker(marker, {
// offset: {
// range: 20,
// tilt: 20,
// rotate: 330
// },
// duration: 500
// });
// marker.text = '...';
// }, (points0.length + points1.length + points2.length + points3.length + 5) * 1000);
// }
// });
// map.addMarker(marker);
// },
//
showUserMarkers(userList) {
//线
let points0 = [{x:114.63000343420656, y: 38.81372685720612, z: 0},
{x: 114.63016642812906, y: 38.81357460804729, z: 0.},
{x: 114.63072033314663,y: 38.813113546390916, z: 0},
{x: 114.63040619763623, y: 38.81281832964802, z: 0},
{x: 114.63014001753065, y:38.81279008573829, z: 0}];
// debugger;
let that = this;
//
let userImage = '';
@ -1692,11 +1664,24 @@ export default {
}else {
userImage = "/img/visitor.png"
}
// debugger;
// console.log(item);
let floorId = 1;
if(item.floorNo=='Floor1'){
floorId = 1;
}else if(item.floorNo=='Floor2'){
floorId = 2;
}else if(item.floorNo=='Floor3'){
floorId = 3;
}else if(item.floorNo=='Floor4'){
floorId = 4;
}else if(item.floorNo=='Floor5'){
floorId = 5;
}
that.userMarker[item.mac] = new jsmap.JSIconTextMarker({
id: item.my_info.code,
position: { x:item.longitude, y: item.latitude, z: item.z }, //
floorId: 1, //id,1
floorId: floorId, //id,1
image: userImage,
text: employee_.name,
font: '10px sans-serif',
@ -1716,16 +1701,6 @@ export default {
employee: employee_
},
callback: (marker) => {
for (let i = 1; i < points0.length; i++) {
// setTimeout(() => {
// window.map.updateMarkerPosition(that.userMarker[item.mac], {
// position: points0[i],
// animate: {
// duration: 1000,
// }
// });
// }, i * 1000);
}
}
});
that.userMaskerLayer.addMarker(that.userMarker[item.mac]);
@ -1734,7 +1709,7 @@ export default {
clearInterval(that.timerUser);
that.timerUser = setInterval(function () {
that.refreshUserMarker();
}, 5000)
}, 10000)
},
//
refreshUserMarker() {
@ -1757,10 +1732,12 @@ export default {
//that.userMaskerLayer.removeMarker(sectorMarker)(addUser);//线
refreshList.forEach(item1 => {
// debugger;
console.log(item1)
that.userMaskerLayer.updateMarkerPosition(that.userMarker[item1.mac], {
// console.log(item1)
let item2 = {};
item2={...item1};
that.userMaskerLayer.updateMarkerPosition(that.userMarker[item2.mac], {
floorId: 1,
position: { x: item1.longitude, y: item1.latitude, z: item1.z },
position: { x: item2.longitude, y: item2.latitude, z: item2.z },
animate: { duration: 10000, }
});//,
})
@ -1792,7 +1769,7 @@ export default {
}
let arrList = [arr, list];
// debugger;
console.log(arrList);
// console.log(arrList);
return arrList;
},
//
@ -2042,23 +2019,126 @@ export default {
range: 150
})
},
//
userUnTrack() {
window.map.cancelTrack();
this.tracking = false;
},
//
userLineTrack(){
let that = this;
that.lineTracking = true;
that.userMaskerLayer.show = false;
let nowTime = new Date().getTime();
let preTime = nowTime-30*60 * 1000;
let params = {
url:"/api/datacenter/user/historypathV2",
method:"post",
json:{
mac: that.screenUserItem.mac,
startTime: preTime,
endTime: nowTime,
locationType: "real"
}
};
let points0 = [];
that.$API.third.blt.xunxiCommon.req(params).then(res => {
if (res.err_msg) { } else {
let points = [];
res.forEach(item=>{
item.points.forEach(poi=>{
points.push(poi)
})
})
points.forEach(item=>{
let obj=new Object();
obj.x=item.longitude;
obj.y=item.latitude;
obj.z=item.z;
points0.push(obj);
});
debugger;
console.log(points0)
if(points0.length>0){
that.line1 = null;
if (that.line1==null) {
that.line1 = new jsmap.JSLineMarker({
position: points0,
floorId: 1,
lineType: jsmap.JSLineType.ARROW,
color: '#0000ff',
width: 10,
depthTest: true
});
window.map.addMarker(that.line1);
}
that.trackMarker = new jsmap.JSIconTextMarker({
id: '1',
position: points0[0],
image: "/img/visitor.png",
rotation: {
rx: 0,
ry: 0,
rz: -90
},
text: that.screenUserItem.name,
fontColor: '#0000ff',
font: '14px 微软雅黑',
backgroundColor: 'rgba(112,253,147,0.5)',
backgroundRadius: 5,
textOffsetInMeter: 1.6,
backgroundStrokeColor: 'rgb(255,255,255)',
modelAnimate: {
multiplier: 2,
},
scale: 0.8,
properties: {
name: 'trackMarker'
},
callback: (marker) => {
window.map.trackMarker(marker, {
range: 40,
tilt: 60,
rotate: 310
});
for (let i = 1; i < points0.length; i++) {
setTimeout(() => {
window.map.updateMarkerPosition(marker, {
position: points0[i],
animate: {
duration: 1000,
update: (pos) => {
that.line1.trace(pos)
}
}
});
}, i * 1000);
}
}
});
window.map.addMarker(that.trackMarker);
}else{
that.$message.error('暂无运动痕迹');
}
}
})
},
userLineTrackCancel(){
let that = this;
that.lineTracking = false;
that.userMaskerLayer.show = true;
window.map.cancelTrack();
window.map.removeMarker(that.trackMarker);
window.map.removeAllPointMarker();
window.map.removeMarker(that.line1);
window.map.removeAllLineMarker();
that.trackMarker = null;
that.line1 = null;
},
///
cockpitChange(index) {
this.LBType = index;
},
/*pointMaskerLayers() {//
this.pointMarkerLayer = new jsmap.JSPointMarkerLayer({
minimumLevel: 3,
maxmumLevel: 22,
show: false
});
window.map.addLayer(this.pointMarkerLayer);
this.showPointMarkers();
},*/
//
changeDropIndex(index) {
let that = this;
@ -2072,9 +2152,12 @@ export default {
},
speakerPasue(){
this.speakerPlayStatus = false;
this.music.pause(); //
},
speakerPlay(){
this.speakerPlayStatus = true;
// this.music.src = this.warningData.list[0].voice_f;
this.music.play();//
},
},
unmounted() {
@ -3672,4 +3755,8 @@ export default {
.bigScreenTable.el-table .el-table__body tr.current-row>td.el-table__cell {
background-color: rgba(255, 255, 255, .1);
}
#audio{
position: fixed;
opacity: 0;
}
</style>