|
@@ -1,7 +1,16 @@
|
|
|
<template>
|
|
|
- <div class="devc-location-container pannel">
|
|
|
- <div class="pannel-header">轨迹查询</div>
|
|
|
- <div class="pannel-body">
|
|
|
+ <pannel class="devc-location-container">
|
|
|
+ <template v-slot:title>
|
|
|
+ 轨迹查询
|
|
|
+ </template>
|
|
|
+ <template v-slot:action>
|
|
|
+ <i
|
|
|
+ class="el-icon-delete-location"
|
|
|
+ title="清空所有轨迹"
|
|
|
+ @click="clearAll"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ <template v-slot:content>
|
|
|
<div class="location-list">
|
|
|
<div class="list-item">
|
|
|
<span class="over-flow-hidden" style="width: 40%">
|
|
@@ -16,7 +25,7 @@
|
|
|
:title="playItem[1]&&playItem[1].play ? '暂停': '开始播放' "
|
|
|
@click="()=>onLocationPlay({key:1})"
|
|
|
/>
|
|
|
- <i class="el-icon-circle-close" title="清空轨迹" @click="clearLocation" />
|
|
|
+ <i class="el-icon-circle-close" title="清空轨迹" @click="()=>clearLocation({key:1})" />
|
|
|
</span>
|
|
|
</div>
|
|
|
<div class="list-item">
|
|
@@ -32,23 +41,31 @@
|
|
|
:title="playItem[2]&&playItem[2].play ? '暂停': '开始播放' "
|
|
|
@click="()=>onLocationPlay({key:2})"
|
|
|
/>
|
|
|
- <i class="el-icon-circle-close" title="清空轨迹" @click="clearLocation" />
|
|
|
+ <i class="el-icon-refresh-left" title="重播" @click="()=>replayLocation({key:2})" />
|
|
|
+ <i class="el-icon-circle-close" title="清空轨迹" @click="()=>clearLocation({key:2})" />
|
|
|
</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ </template>
|
|
|
+ </pannel>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
|
|
|
+import Pannel from '@/views/bd/pannel/index.vue';
|
|
|
+
|
|
|
export default {
|
|
|
name: 'location',
|
|
|
+ components: { Pannel },
|
|
|
data() {
|
|
|
return {
|
|
|
playItem: {},
|
|
|
};
|
|
|
},
|
|
|
+ // 组件卸载前清空图层信息
|
|
|
+ beforeDestroy() {
|
|
|
+ this.clearAll();
|
|
|
+ },
|
|
|
created() {
|
|
|
},
|
|
|
methods: {
|
|
@@ -57,22 +74,152 @@ export default {
|
|
|
},
|
|
|
onLocationPlay({ key }) {
|
|
|
if (this.playItem[key]) {
|
|
|
+ if (this.playItem[key].play) {
|
|
|
+ bdmap.comp.Trajectory.trajectoryPause(this.playItem[key].line);
|
|
|
+ } else {
|
|
|
+ bdmap.comp.Trajectory.trajectoryPlay(this.playItem[key].line);
|
|
|
+ }
|
|
|
this.playItem = {
|
|
|
[key]: {
|
|
|
+ ...this.playItem[key],
|
|
|
play: !this.playItem[key].play,
|
|
|
},
|
|
|
};
|
|
|
} else {
|
|
|
+ this.clearAll();
|
|
|
this.playItem = {
|
|
|
[key]: {
|
|
|
play: true,
|
|
|
},
|
|
|
};
|
|
|
+
|
|
|
+ this.playItem[key].line = this.startPlay();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ startPlay() {
|
|
|
+ const coordinates = [
|
|
|
+ [118.510344073029572, 32.093731676821307],
|
|
|
+ [118.510374370940283, 32.093527573458772],
|
|
|
+ [118.510387650407282, 32.093425544068282],
|
|
|
+ [118.510400982227964, 32.09332669752061],
|
|
|
+ [118.510410732278714, 32.09323744409496],
|
|
|
+ [118.510428221966407, 32.093164015714144],
|
|
|
+ [118.510441867993563, 32.093084266230839],
|
|
|
+ [118.510448612429926, 32.093039617220981],
|
|
|
+ [118.510485058313833, 32.092981880106635],
|
|
|
+ [118.510517293848437, 32.09289554196976],
|
|
|
+ [118.510538155585763, 32.092799789067762],
|
|
|
+ [118.510585136919985, 32.092700541165151],
|
|
|
+ [118.510653765503889, 32.092553283001713],
|
|
|
+ [118.510696483876899, 32.092422251207211],
|
|
|
+ [118.510717502501578, 32.09233604681264],
|
|
|
+ [118.51072719979102, 32.092243610516697],
|
|
|
+ [118.510718674363204, 32.092180042810142],
|
|
|
+ [118.51072858119106, 32.092100337892759],
|
|
|
+ [118.510740969534041, 32.091944200094105],
|
|
|
+ [118.510764731477138, 32.091797477034682],
|
|
|
+ [118.510795499488424, 32.091622019166245],
|
|
|
+ [118.510779024971171, 32.091529895046364],
|
|
|
+ [118.510838861565105, 32.091189345833804],
|
|
|
+ [118.51087340381045, 32.090902421451432],
|
|
|
+ [118.51087812135782, 32.090848246178545],
|
|
|
+ [118.510876016211085, 32.090833945673786],
|
|
|
+ [118.510692239599265, 32.090801119629013],
|
|
|
+ [118.510366127552757, 32.090754073380161],
|
|
|
+ [118.51000060154216, 32.090697945771666],
|
|
|
+ [118.509934963475075, 32.090685994408759],
|
|
|
+ [118.509749422753075, 32.090659554955813],
|
|
|
+ [118.509625833684098, 32.090648294195802],
|
|
|
+ [118.509481838386677, 32.090646826930168],
|
|
|
+ [118.509253799073093, 32.090651136213971],
|
|
|
+ [118.509027812249769, 32.090666562784293],
|
|
|
+ [118.508799929784459, 32.090680419798431],
|
|
|
+ [118.508667360005134, 32.090691549387145],
|
|
|
+ [118.508486159867502, 32.09070166630147],
|
|
|
+ [118.508389082289696, 32.090710781144516],
|
|
|
+ [118.508232158009235, 32.09071901684954],
|
|
|
+ [118.508146087550671, 32.090715266544017],
|
|
|
+ [118.507979371809753, 32.090696559011214],
|
|
|
+ [118.507793883792232, 32.090673299526408],
|
|
|
+ [118.507657000016053, 32.090649461216543],
|
|
|
+ [118.507493997112689, 32.090629117108001],
|
|
|
+ [118.507282154936803, 32.090595028382964],
|
|
|
+ [118.507194110693021, 32.09058493397027],
|
|
|
+ [118.507085424792962, 32.09057030990261],
|
|
|
+ [118.506926239284013, 32.090554694844201],
|
|
|
+ [118.506794937915217, 32.090529197439537],
|
|
|
+ [118.506617084744747, 32.090515395808161],
|
|
|
+ [118.50649331329619, 32.090492991990665],
|
|
|
+ [118.506400000570864, 32.090503652264289],
|
|
|
+ [118.506291863284133, 32.090522447458177],
|
|
|
+ [118.506271075849355, 32.09062297409131],
|
|
|
+ [118.506279384788115, 32.090901429202418],
|
|
|
+ [118.506276335902569, 32.091057455655339],
|
|
|
+ [118.506275574271015, 32.091238922688987],
|
|
|
+ [118.506265256688522, 32.091407769471331],
|
|
|
+ [118.506269834544227, 32.091629762276384],
|
|
|
+ [118.50626926881327, 32.091823164988803],
|
|
|
+ [118.506270044714256, 32.091927414499395],
|
|
|
+ [118.50627274985375, 32.09197831789384],
|
|
|
+ [118.50626805356525, 32.092147893674429],
|
|
|
+ [118.506291184226299, 32.092247102107017],
|
|
|
+ [118.506348259438596, 32.092306909277831],
|
|
|
+ [118.506388235638639, 32.09235020656353],
|
|
|
+ [118.506454214078786, 32.09238284827272],
|
|
|
+ [118.506470221749083, 32.092389820684197],
|
|
|
+ [118.506749994247556, 32.092461304228593],
|
|
|
+ [118.506920765421185, 32.092499065902963],
|
|
|
+ [118.507102910091703, 32.092546242421875],
|
|
|
+ [118.50729442822707, 32.092594898857307],
|
|
|
+ [118.507504248793609, 32.092619461113586],
|
|
|
+ [118.507619120567171, 32.092669029325684],
|
|
|
+ [118.50787825251615, 32.092735980829012],
|
|
|
+ [118.508088648792068, 32.092795553437476],
|
|
|
+ [118.508205495121302, 32.092851464536842],
|
|
|
+ [118.508542138019706, 32.092970018886092],
|
|
|
+ [118.508674228089234, 32.093043257063009],
|
|
|
+ [118.508899947338264, 32.093124930063404],
|
|
|
+ [118.50902011479775, 32.09315533305918],
|
|
|
+ [118.509103364510494, 32.093214827069964],
|
|
|
+ [118.509204785389386, 32.093242269788632],
|
|
|
+ [118.50925201865843, 32.093271949905017],
|
|
|
+ ];
|
|
|
+ let playLine = bdmap.comp.Trajectory.loadTrajectory({
|
|
|
+ mapView: window.map,
|
|
|
+ latlons: coordinates,
|
|
|
+ unitTime: 500,
|
|
|
+ speedValue: 1,
|
|
|
+ mapToCenter: false,
|
|
|
+ });
|
|
|
+ bdmap.comp.Trajectory.trajectoryPlay(playLine);
|
|
|
+ return playLine;
|
|
|
+ },
|
|
|
+ replayLocation({ key }) {
|
|
|
+ if (this.playItem[key] && this.playItem[key].line) {
|
|
|
+ bdmap.comp.Trajectory.trajectoryCancel(this.playItem[key].line);
|
|
|
+ this.playItem[key].play = false;
|
|
|
}
|
|
|
+
|
|
|
},
|
|
|
- clearLocation() {
|
|
|
+ removeLine({ key }) {
|
|
|
+ if (this.playItem[key] && this.playItem[key].line) {
|
|
|
+ bdmap.comp.Trajectory.trajectoryRemove(this.playItem[key].line);
|
|
|
+ delete this.playItem[key];
|
|
|
+ }
|
|
|
|
|
|
},
|
|
|
+ clearAll() {
|
|
|
+ Object.keys(this.playItem).forEach(keyItem => {
|
|
|
+ if (this.playItem[keyItem] && this.playItem[keyItem].line) {
|
|
|
+ this.removeLine({ key: keyItem });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.playItem = {};
|
|
|
+ },
|
|
|
+ clearLocation({ key }) {
|
|
|
+ this.removeLine({ key });
|
|
|
+ this.playItem = {};
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|