|
@@ -6,6 +6,7 @@
|
|
|
:search-option="searchOption"
|
|
|
:on-search-result="onSearchResult"></el-amap-search-box> -->
|
|
|
<el-amap :zoom="zoom"
|
|
|
+ ref='map'
|
|
|
vid="amapDemo"
|
|
|
:amap-manager="amapManager"
|
|
|
:plugin="plugin"
|
|
@@ -45,27 +46,18 @@ import VueAMap from 'vue-amap'
|
|
|
// Vue.use(VueAMap)
|
|
|
VueAMap.initAMapApiLoader({
|
|
|
key: 'b1e6ac2eb28902ce91a490edf194e000',
|
|
|
- plugin: ['AMap.Geolocation', 'AMap.PlaceSearch', 'AMap.Geocoder'],
|
|
|
- v: '1.4.4'
|
|
|
+ plugin: ['Autocomplete', 'PlaceSearch', 'Scale', 'OverView', 'ToolBar', 'MapType', 'PolyEditor', 'AMap.CircleEditor'],
|
|
|
+ v: '1.4.4',
|
|
|
})
|
|
|
let amapManager = new VueAMap.AMapManager();
|
|
|
import { getTeacherPersonalAttendance } from '@/api/buildTeam'
|
|
|
export default {
|
|
|
- props: ['courseScheduleId'],
|
|
|
+ props: ['activeRow'],
|
|
|
data () {
|
|
|
return {
|
|
|
zoom: 20,
|
|
|
amapManager,
|
|
|
center: [114.34371, 30.55939],
|
|
|
- // events: {
|
|
|
- // init (o) {
|
|
|
- // let marker = new AMap.Marker({
|
|
|
- // position: [114.34371, 30.55939]
|
|
|
- // });
|
|
|
-
|
|
|
- // marker.setMap(o);
|
|
|
- // }
|
|
|
- // },
|
|
|
markers: [],
|
|
|
plugin: [],
|
|
|
distance: '-',
|
|
@@ -85,40 +77,73 @@ export default {
|
|
|
// searchOption () { },
|
|
|
// 重置
|
|
|
init () {
|
|
|
- getTeacherPersonalAttendance({ courseScheduleId: this.courseScheduleId }).then(res => {
|
|
|
- if (res.code == 200) {
|
|
|
- if (res.data && res.data.signInLongitudeLatitude) {
|
|
|
- let add = {
|
|
|
- title: '签到点',
|
|
|
- location: res.data.signInLongitudeLatitude.split(',')
|
|
|
- }
|
|
|
- this.center = res.data.signInLongitudeLatitude.split(',');
|
|
|
- this.signInLongitudeLatitude = res.data.signInLongitudeLatitude.split(',')
|
|
|
- this.markers.push(add)
|
|
|
- }
|
|
|
- if (res.data && res.data.signOutLongitudeLatitude) {
|
|
|
- let add = {
|
|
|
- title: '签退点',
|
|
|
- location: res.data.signOutLongitudeLatitude.split(',')
|
|
|
- }
|
|
|
- this.center = res.data.signOutLongitudeLatitude.split(',');
|
|
|
- this.signOutLongitudeLatitude = res.data.signOutLongitudeLatitude.split(',')
|
|
|
- this.markers.push(add)
|
|
|
- }
|
|
|
-
|
|
|
- if (res.data && res.data.schoolLongitudeLatitude) {
|
|
|
- let add = {
|
|
|
- title: '教学点',
|
|
|
- location: res.data.schoolLongitudeLatitude.split(',')
|
|
|
- }
|
|
|
- this.schoolLongitudeLatitude = res.data.schoolLongitudeLatitude.split(',')
|
|
|
- this.center = res.data.schoolLongitudeLatitude.split(',');
|
|
|
- this.markers.push(add)
|
|
|
- }
|
|
|
- this.getDistance(this.signInLongitudeLatitude, this.schoolLongitudeLatitude)
|
|
|
+ if (this.activeRow.schoolLongitudeLatitude) {
|
|
|
+ let add = {
|
|
|
+ title: '教学点',
|
|
|
+ location: this.activeRow.schoolLongitudeLatitude.split(',')
|
|
|
}
|
|
|
- })
|
|
|
- this.amapManager.setFitView();
|
|
|
+ this.center = this.activeRow.schoolLongitudeLatitude.split(',');
|
|
|
+ this.schoolLongitudeLatitude = this.activeRow.schoolLongitudeLatitude.split(',')
|
|
|
+ this.markers.push(add)
|
|
|
+ }
|
|
|
+ if (this.activeRow.signInLongitudeLatitude) {
|
|
|
+ let add = {
|
|
|
+ title: '签到点',
|
|
|
+ location: this.activeRow.signInLongitudeLatitude.split(',')
|
|
|
+ }
|
|
|
+ this.center = this.activeRow.signInLongitudeLatitude.split(',');
|
|
|
+ this.signInLongitudeLatitude = this.activeRow.signInLongitudeLatitude.split(',')
|
|
|
+ this.markers.push(add)
|
|
|
+ }
|
|
|
+ if (this.activeRow.signOutLongitudeLatitude) {
|
|
|
+ let add = {
|
|
|
+ title: '签退点',
|
|
|
+ location: this.activeRow.signOutLongitudeLatitude.split(',')
|
|
|
+ }
|
|
|
+ this.center = this.activeRow.signOutLongitudeLatitude.split(',');
|
|
|
+ this.signInLongitudeLatitude = this.activeRow.signOutLongitudeLatitude.split(',')
|
|
|
+ this.markers.push(add)
|
|
|
+ }
|
|
|
+ // this.$refs.map.$amap.setFitView(this.markers)
|
|
|
+ console.log(this.$refs.map)
|
|
|
+ this.getDistance(this.signInLongitudeLatitude, this.schoolLongitudeLatitude)
|
|
|
+
|
|
|
+ return
|
|
|
+ // getTeacherPersonalAttendance({ courseScheduleId: this.courseScheduleId }).then(res => {
|
|
|
+ // if (res.code == 200) {
|
|
|
+ // if (res.data && res.data.signInLongitudeLatitude) {
|
|
|
+ // let add = {
|
|
|
+ // title: '签到点',
|
|
|
+ // location: res.data.signInLongitudeLatitude.split(',')
|
|
|
+ // }
|
|
|
+ // this.center = res.data.signInLongitudeLatitude.split(',');
|
|
|
+ // this.signInLongitudeLatitude = res.data.signInLongitudeLatitude.split(',')
|
|
|
+ // this.markers.push(add)
|
|
|
+ // }
|
|
|
+ // if (res.data && res.data.signOutLongitudeLatitude) {
|
|
|
+ // let add = {
|
|
|
+ // title: '签退点',
|
|
|
+ // location: res.data.signOutLongitudeLatitude.split(',')
|
|
|
+ // }
|
|
|
+ // this.center = res.data.signOutLongitudeLatitude.split(',');
|
|
|
+ // this.signOutLongitudeLatitude = res.data.signOutLongitudeLatitude.split(',')
|
|
|
+ // this.markers.push(add)
|
|
|
+ // }
|
|
|
+
|
|
|
+ // if (res.data && res.data.schoolLongitudeLatitude) {
|
|
|
+ // let add = {
|
|
|
+ // title: '教学点',
|
|
|
+ // location: res.data.schoolLongitudeLatitude.split(',')
|
|
|
+ // }
|
|
|
+ // this.schoolLongitudeLatitude = res.data.schoolLongitudeLatitude.split(',')
|
|
|
+ // this.center = res.data.schoolLongitudeLatitude.split(',');
|
|
|
+ // this.markers.push(add)
|
|
|
+ // }
|
|
|
+ // this.getDistance(this.signInLongitudeLatitude, this.schoolLongitudeLatitude)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // ;
|
|
|
+ // console.log(this.amapManager.setFitView)
|
|
|
// this.getDistance()
|
|
|
},
|
|
|
onSearchResult () { },
|