history record

master
冯凯 2023-11-26 15:28:22 +08:00
parent 243e5057db
commit 393f5de05d
4 changed files with 149 additions and 72 deletions

View File

@ -49,6 +49,7 @@ import AMapLoader from '@amap/amap-jsapi-loader';
console.log(e); console.log(e);
}); });
}, },
drawPolygon() { drawPolygon() {
this.mouseTool.polygon({ this.mouseTool.polygon({
strokeColor: "#FF33FF", strokeColor: "#FF33FF",

View File

@ -0,0 +1,14 @@
<script setup>
</script>
<template>
<div>
<el-button type="warning">按钮</el-button>
<img src="https://ts1.cn.mm.bing.net/th/id/R-C.66d7b796377883a92aad65b283ef1f84?rik=sQ%2fKoYAcr%2bOwsw&riu=http%3a%2f%2fwww.quazero.com%2fuploads%2fallimg%2f140305%2f1-140305131415.jpg&ehk=Hxl%2fQ9pbEiuuybrGWTEPJOhvrFK9C3vyCcWicooXfNE%3d&risl=&pid=ImgRaw&r=0">
</div>
</template>
<style scoped lang="scss">
</style>

View File

@ -1,11 +0,0 @@
<script setup>
</script>
<template>
</template>
<style scoped lang="scss">
</style>

View File

@ -1,14 +1,13 @@
<script > <script >
import path from "path"; import path from "path";
import AMapLoader from '@amap/amap-jsapi-loader'; import AMapLoader from '@amap/amap-jsapi-loader';
window._AMapSecurityConfig = {
securityJsCode:'6dc027fe91257ed0b06af9924201212c'
}
export default { export default {
components: {}, components: {},
props: {}, props: {},
data() { data() {
return{ return{
multiple: true,
duration:2000,
AMap: null, AMap: null,
map: null, map: null,
mouseTool: null, mouseTool: null,
@ -17,6 +16,16 @@ export default {
carVin:"VIN123465798", carVin:"VIN123465798",
startTime:"2023-01-01 12:01:59", startTime:"2023-01-01 12:01:59",
endTime:"2023-01-01 12:10:21" endTime:"2023-01-01 12:10:21"
},
{
carVin:"VIN66666666",
startTime:"2022-01-01 12:01:59",
endTime:"2022-01-01 12:10:21"
},
{
carVin:"VIN88888888",
startTime:"2021-01-01 12:01:59",
endTime:"2021-01-01 12:10:21"
} }
], ],
lineArr: [ lineArr: [
@ -44,32 +53,74 @@ export default {
mounted() { mounted() {
}, },
created() { created() {
this.initAMap()
}, },
methods: { methods: {
doDo(){ doDo(){
// this.$router.push('/cmpany/firm') // this.$router.push('/cmpany/firm')
this.initAMap() this.initMap()
this.startAnimation()
}, },
initAMap() { initMap() {
AMapLoader.load({ AMapLoader.load({
key: 'e31845f75485d475ad64b1946691f717', key: "0b5f26b194361cbc9571101bc2856962", // WebKey load
version: '2.0', version: "2.0", // JSAPI 1.4.15
plugins: ['AMap.MouseTool','AMap.LngLat', 'AMap.Scale', 'AMap.ToolBar', 'AMap.ControlBar', 'AMap.Geocoder', 'AMap.Marker', plugins: [
'AMap.CitySearch', 'AMap.Geolocation', 'AMap.AutoComplete', 'AMap.InfoWindow', 'AMap.PolyEditor','AMap.MouseTool','AMap.PlaceSearch'], "AMap.Scale",
"AMap.HawkEye",
"AMap.ToolBar",
"AMap.AutoComplete",
"AMap.PlaceSearch",
"AMap.ControlBar",
"AMap.MouseTool",
"AMap.DragRoute",
"AMap.MoveAnimation"], // 使'AMap.Scale'
}).then((AMap) => { }).then((AMap) => {
this.map = new AMap.Map('container', { // DOM
this.map = new AMap.Map("container", { //id
resizeEnable: true, resizeEnable: true,
viewMode: '2D', viewMode: "2D", // 使3D
zoomEnable: true, zoomEnable: true, // true
dragEnable: true, dragEnable: true, // true
doubleClickZoom: true, doubleClickZoom: true, // true
zoom: 17, zoom: 13, //
showBuildingBlock: true, center: this.lineArr[0], //
pitch: 55, // mapStyle: "amap://styles/darkblue", //
}) })
}).catch(e => {
console.log(e) this.marker = new AMap.Marker({
position: this.lineArr[0],
icon: "https://a.amap.com/jsapi_demos/static/demo-center-v2/car.png",
offset: new AMap.Pixel(-13, -26),
});
this.map.add(this.marker)
//
this.polyline = new AMap.Polyline({
path: this.lineArr,
showDir: true,
strokeColor: "#28F", //线
// strokeOpacity: 1, //线
strokeWeight: 6, //线
// strokeStyle: "solid" //线
});
this.map.add(this.polyline)
//
this.passedPolyline = new AMap.Polyline({
strokeColor: "#AF5", //线
strokeWeight: 6, //线
});
this.map.add(this.passedPolyline)
// marker
this.marker.on('moving', (e) => {
console.log('marker动了', e)
this.passedPolyline.setPath(e.passedPath); //
this.map.setCenter(e.target.getPosition(), true) //
});
this.map.setFitView(); //
}) })
}, },
startAnimation () { startAnimation () {
@ -90,48 +141,70 @@ export default {
</script> </script>
<template> <template>
<div> <div>
<div id="container"></div> <div>
<el-form>
<table style="width: 100% "> <el-form>
<tr> <table style="width: 100% ">
<td>VIN</td> <tr>
<td><el-input placeholder="请输入车辆VIN"></el-input></td> <td>VIN</td>
<td>开始时间</td> <td><el-input placeholder="请输入车辆VIN"></el-input></td>
<td><el-input placeholder="请输入开始时间"></el-input></td> <td>开始时间</td>
<td>结束时间</td> <td><el-input placeholder="请输入开始时间"></el-input></td>
<td><el-input placeholder="请输入结束时间"></el-input></td> <td>结束时间</td>
<td> <td><el-input placeholder="请输入结束时间"></el-input></td>
<el-button type="primary">搜索</el-button> <td>
<el-button type="danger">重置</el-button> <el-button type="primary">搜索</el-button>
</td> <el-button type="danger">重置</el-button>
</tr> </td>
</table> </tr>
</el-form> </table>
<el-table :data="historyList"> </el-form>
<el-table-column label="VIN"> <el-button
<template slot-scope="scope"> type="primary"
{{scope.row.carVin}} plain
</template> icon="el-icon-plus"
</el-table-column> size="mini"
<el-table-column label="开始时间"> v-hasPermi="['vehicle:record:add']"
<template slot-scope="scope"> >新增</el-button>
{{scope.row.startTime}} <el-button
</template> type="danger"
</el-table-column> plain
<el-table-column label="结束时间"> icon="el-icon-delete"
<template slot-scope="scope"> size="mini"
{{scope.row.endTime}} :disabled="multiple"
</template> v-hasPermi="['vehicle:record:remove']"
</el-table-column> >删除</el-button>
<el-table-column label="操作"> <el-table :data="historyList">
<el-button @click="doDo" type="text">历史轨迹</el-button> <el-table-column label="VIN">
<el-button type="warning">删除</el-button> <template slot-scope="scope">
</el-table-column> {{scope.row.carVin}}
</el-table> </template>
</div> </el-table-column>
<el-table-column label="开始时间">
<template slot-scope="scope">
{{scope.row.startTime}}
</template>
</el-table-column>
<el-table-column label="结束时间">
<template slot-scope="scope">
{{scope.row.endTime}}
</template>
</el-table-column>
<el-table-column label="操作">
<el-button @click="doDo" type="text">历史轨迹</el-button>
<el-button type="warning">删除</el-button>
</el-table-column>
</el-table>
</div>
<div id="container"></div>
</div>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
#container{
width: 50%;
height: 400px;
}
</style> </style>