diff --git a/src/views/customer/map.vue b/src/views/customer/map.vue index 68a9f23..cdb9520 100644 --- a/src/views/customer/map.vue +++ b/src/views/customer/map.vue @@ -6,9 +6,9 @@
- + - + @@ -114,7 +114,9 @@ export default { async mounted() { await this.getCustomers() lazyAMapApiLoaderInstance.load().then(() => { - this.map = new AMap.Map('amapContainer') + this.map = new AMap.Map('amapContainer',{ + center:[Number(this.customers[0]?.lng || 119.58),Number(this.customers[0]?.lat || 31.47)] + }) this.markers() }) }, diff --git a/src/views/schedule/map.vue b/src/views/schedule/map.vue index 14487ef..b201b4c 100644 --- a/src/views/schedule/map.vue +++ b/src/views/schedule/map.vue @@ -17,7 +17,7 @@ style="width: 234px; margin-right: 10px" type="daterange" @change="e => { if(e){selected.start_date = e[0];selected.end_date = e[1]}else{selected.start_date = '';selected.end_date = ''} }"> - + @@ -95,6 +95,10 @@ export default { } }, methods: { + async search(){ + await this.getList() + this.markers() + }, async getList(){ let res = await scheduleIndex(this.selected) @@ -106,8 +110,6 @@ export default { } }) console.log(this.lists) - this.map.remove(this.marker) - this.markers() }, reset(){ @@ -128,6 +130,7 @@ export default { this.height = tableHeight ?? 600 }, markers(){ + this.map.remove(this.marker) this.marker = [] let map = new Map([ [0,require('../../assets/status0.png')], @@ -179,10 +182,14 @@ export default { this.initLoad() }, async mounted() { + await this.getList() lazyAMapApiLoaderInstance.load().then(() => { - this.map = new AMap.Map('amapContainer') + this.map = new AMap.Map('amapContainer',{ + center:[Number(this.lists[0]?.address?.lng || 119.58),Number(this.lists[0]?.address?.lat || 31.47)] + }) + this.markers() }) - await this.getList() + } }