diff --git a/src/main.js b/src/main.js index 9a24ed4bd..6d87163b5 100644 --- a/src/main.js +++ b/src/main.js @@ -73,6 +73,9 @@ Vue.prototype.$getElUploadHeaders = () => ({ }); // Vue.prototype.$getDictLabel = getDictLabel +//事件总线 +Vue.prototype.$EventBus = new Vue() + // 保存整站vuex本地储存初始状态 window.SITE_CONFIG["storeState"] = cloneDeep(store.state); diff --git a/src/views/modules/shequzhili/event/cpts/add.vue b/src/views/modules/shequzhili/event/cpts/add.vue index 35847976a..a92ca4eea 100644 --- a/src/views/modules/shequzhili/event/cpts/add.vue +++ b/src/views/modules/shequzhili/event/cpts/add.vue @@ -137,21 +137,26 @@ label-width="150px" style="display: block">
- - - - + + + + +
@@ -191,7 +196,7 @@ clearable> @@ -230,7 +235,6 @@ import { requestPost } from "@/js/dai/request"; import formVltHelper from "dai-js/tools/formVltHelper"; import daiMap from "@/utils/dai-map"; import { isCard } from "@/utils/validate"; - let loading; // 加载动画 var map; var search; @@ -575,12 +579,12 @@ export default { // 地图初始化函数,本例取名为init,开发者可根据实际情况定义 initMap (latitude, longitude) { - + this.$nextTick(()=>{ map = new daiMap( document.getElementById("app_event"), { latitude, longitude }, { - zoom: 16.2, // 设置地图缩放级别 + zoom: 17.2, // 设置地图缩放级别 pitch: 43.5, // 设置俯仰角 rotation: 45, // 设置地图旋转角度 } @@ -593,6 +597,7 @@ export default { map.setCenter(latitude, longitude); map.setMarker(latitude, longitude); + }) }, @@ -603,7 +608,7 @@ export default { this.formData.latitude = lat; this.formData.longitude = lng; map.setMarker(lat, lng); - + this.$EventBus.$emit('map',{lat,lng}) let { msg, data } = await map.getAddress(lat, lng); if (msg == "success") { this.formData.address = data.address @@ -614,34 +619,29 @@ export default { }, async remoteMethod (query) { - if (query !== '') { - this.loading = true; - - const { msg, data } = await map.searchNearby(query); - this.loading = false; - this.resultList = [] - - if (msg == "success" && data.resultList && data.resultList.length > 0) { - - if (data.resultList && data.resultList.length > 0) { - this.resultList = data.resultList - this.searchOptions = this.resultList.map(item => { - return { value: `${item.hotPointID}`, label: `${item.address + item.name}` }; - - }); - } - } else { - this.searchOptions = [ - { - value: '0', - label: '未检索到结果' - } - ] - } - } else { - this.searchOptions = []; - } + this.loading = true; + const { msg, data } = await map.searchNearby(query); + this.loading = false; + this.resultList = []; + if (msg == 'success' && data.resultList && data.resultList.length > 0) { + if (data.resultList && data.resultList.length > 0) { + this.resultList = data.resultList; + this.searchOptions = this.resultList.map(item => { + return { value: `${item.id}`, label: `${item.address + item.name}` }; + }); + } + } else { + this.searchOptions = [ + { + value: '0', + label: '未检索到结果' + } + ]; + } + } else { + this.searchOptions = []; + } }, handleClickKey (index) { diff --git a/src/views/modules/shequzhili/event/cpts/event-info.vue b/src/views/modules/shequzhili/event/cpts/event-info.vue index 7afc977a7..3ad7a4c57 100644 --- a/src/views/modules/shequzhili/event/cpts/event-info.vue +++ b/src/views/modules/shequzhili/event/cpts/event-info.vue @@ -18,6 +18,7 @@ { + map.setCenter(new TMap.LatLng(this.transferObj.latitude,this.transferObj.longitude)) + }) + }, + immediate: true // 页面加载立即执行 + }, + + demandUserId: function (val) { this.formData.demandUserId = val @@ -380,7 +395,7 @@ export default { this.formData.demandUserMobile = this.demandUserMobile this.formData.demandUserId = this.demandUserId } - + }, methods: { @@ -566,7 +581,7 @@ export default { // 地图初始化函数,本例取名为init,开发者可根据实际情况定义 initMap () { // 定义地图中心点坐标 - var center = new window.TMap.LatLng(36.0722275, 120.38945519) + var center = new window.TMap.LatLng(this.transferObj.latitude||36.0722275,this.transferObj.longitude|| 120.38945519) // 定义map变量,调用 TMap.Map() 构造函数创建地图 map = new window.TMap.Map(document.getElementById('app_map'), { center: center, // 设置地图中心点坐标 diff --git a/src/views/modules/shequzhili/event/cpts/process-form-replay.vue b/src/views/modules/shequzhili/event/cpts/process-form-replay.vue index 4715179b6..3489d7f39 100644 --- a/src/views/modules/shequzhili/event/cpts/process-form-replay.vue +++ b/src/views/modules/shequzhili/event/cpts/process-form-replay.vue @@ -1,3 +1,12 @@ +