gjy 3 éve
szülő
commit
58890d400a

+ 0 - 1
src/components/mapdrag/indexMap.vue

@@ -157,7 +157,6 @@
         this.listData = val1
         var that = this
         this.makeJsonData()
-        AMapLoader.reset();
         AMapLoader.load({
           "key": "211dd6f989e719022aaf47ddb0659c47", // 申请好的Web端开发者Key,首次调用 load 时必填
           "version": "2.0", // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15

+ 26 - 45
src/components/mapdrag/mapdrag.vue

@@ -126,6 +126,7 @@
     TextToCode
   } from 'element-china-area-data'
   import image from '../../../public/img/ic_locationmarker.jpg'
+  import AMapLoader from '@amap/amap-jsapi-loader';
   export default {
     data() {
       return {
@@ -168,17 +169,26 @@
       }
     },
     async created() {
+      
+        
+    },
+    mounted() {
       // AMapLoader.reset();
       // 已载入高德地图API,则直接初始化地图
       if (window.AMap && window.AMapUI) {
         // 未载入高德地图API,则先载入API再初始化
       } else {
-        await remoteLoad(`http://webapi.amap.com/maps?v=1.3&key=${MapKey}&plugin=AMap.AutoComplete`)
-        await remoteLoad('http://webapi.amap.com/ui/1.0/main.js')
-      }
-    },
-    mounted() {
-      // console.log(this)
+        // await remoteLoad(`http://webapi.amap.com/maps?v=1.3&key=${MapKey}&plugin=AMap.AutoComplete`)
+        // await remoteLoad('http://webapi.amap.com/ui/1.0/main.js')
+        //  AMapLoader.reset();
+        AMapLoader.load({
+          "key": "211dd6f989e719022aaf47ddb0659c47", // 申请好的Web端开发者Key,首次调用 load 时必填
+          "version": "2.0", // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
+          "plugins": ['plugin=AMap.Scale', 'AMap.ToolBar','AMap.AutoComplete', 'AMap.PlaceSearch', 'AMap.Geocoder', 'AMap.DistrictSearch'],
+          "Loca": { // 是否加载 Loca, 缺省不加载
+            "version": '2.0.0' // Loca 版本,缺省 1.3.2
+          },
+        }).then((AMap) => {
       setTimeout(() => {
         var that = this
         this.map = new AMap.Map('mapContainer', {
@@ -208,19 +218,11 @@
           map: that.map,
         })
         AMap.plugin(
-          ['AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.Geocoder', 'AMap.DistrictSearch'],
+          ['AMap.AutoComplete', 'AMap.PlaceSearch', 'AMap.Geocoder', 'AMap.DistrictSearch'],
           function() {
-            var autocomplete
-            if(AMap.Autocomplete){
-               autocomplete = new AMap.Autocomplete({
+            var autocomplete = new AMap.AutoComplete({
               input: 'searchValue',
             })
-            }else{
-              autocomplete = new AMap.AutoComplete({
-              input: 'searchValue',
-            })
-            }
-            
             var placeSearch = new AMap.PlaceSearch({
               city: that.acode,
               citylimit: true,
@@ -233,8 +235,7 @@
               level: 'city',
               showbiz: false,
             });
-            console.log(autocomplete)
-            AMap.event.addListener(autocomplete, 'select', function(e) {
+            autocomplete.on( 'select', function(e) {
               that.marker.setMap(that.map)
               if (e.poi.location) {
                 placeSearch.search() // 关键字查询查询
@@ -291,10 +292,9 @@
             that.map.on('moveend', function(e) {
               //地图变动之后需要重新赋值省市区,未完成
               that.center = that.map.getCenter(); //获取当前地图中心位置
+              console.log(that.center)
               that.center.lat = Number(that.center.lat.toFixed(3))
               that.center.lng = Number(that.center.lng.toFixed(3))
-              that.center.Q = Number(that.center.Q.toFixed(3))
-              that.center.R = Number(that.center.R.toFixed(3))
               for (var i = 0, l = that.polygons.length; i < l; i++) {
                 that.polygons[i].setMap(null)
               }
@@ -321,10 +321,9 @@
               //地图变动之后需要重新赋值省市区,未完成
               // this.zoom = map.getZoom(); //获取当前地图级别
               that.center = that.map.getCenter(); //获取当前地图中心位置
+              console.log(that.center)
               that.center.lat = Number(that.center.lat.toFixed(3))
               that.center.lng = Number(that.center.lng.toFixed(3))
-              that.center.Q = Number(that.center.Q.toFixed(3))
-              that.center.R = Number(that.center.R.toFixed(3))
               for (var i = 0, l = that.polygons.length; i < l; i++) {
                 that.polygons[i].setMap(null)
               }
@@ -347,29 +346,6 @@
                 }
               })
             });
-            // that.map.on('click', function (e) {
-            //   for (var i = 0, l = that.polygons.length; i < l; i++) {
-            //     that.polygons[i].setMap(null)
-            //   }
-            //   that.marker.setMap(that.map)
-            //   that.marker.setPosition(e.lnglat)
-            //   geocoder.getAddress(e.lnglat, function (status, result) {
-            //     if (status === 'complete') {
-            //       var obj = {}
-            //       that.province = result.regeocode.addressComponent.province
-            //       that.city = result.regeocode.addressComponent.city
-            //       that.district = result.regeocode.addressComponent.district
-            //       obj.formattedAddress = result.regeocode.formattedAddress
-            //       obj.areacode = result.regeocode.addressComponent.adcode
-            //       that.address = result.regeocode.formattedAddress
-            //       obj.lat = e.lnglat.lat
-            //       obj.lng = e.lnglat.lng
-            //       that.$emit('pickedAddress', obj)
-            //     } else {
-            //       that.$emit('pickedAddress', '')
-            //     }
-            //   })
-            // })
             // 根据坐标点定位,获取地址的详细信息
             if (that.position) {
               that.marker.setMap(that.map)
@@ -394,6 +370,11 @@
         )
       }, 500)
       this.loadmap()
+        // this.loadmap()
+        }).catch(e => {
+          console.log(e);
+        })
+      }
     },
     methods: {
       positions() {

+ 9 - 9
src/main.js

@@ -15,8 +15,8 @@ window.$crudCommon = crudCommon;
 import vendors from '@/vendors'
 const { router, store } = vendors
 Vue.config.productionTip = false
-import AMap from 'vue-amap';
-Vue.use(AMap);
+// import AMap from 'vue-amap';
+// Vue.use(AMap);
 import imgPreview from '@/components/imgPreview'
 Vue.use(imgPreview)
 import echarts from "echarts";
@@ -27,13 +27,13 @@ import Warehouse from './common.js'
 Vue.prototype.WAREHOUSE = Warehouse.houseName
 Vue.prototype.common = Warehouse
 // 初始化vue-amap
-AMap.initAMapApiLoader({
-  // 高德key
-  key: 'd5486742b76ab0969e4c3ce26f46dfc6',
-  // 插件集合 (插件按需引入)
-  plugin: ['AMap.Geolocation', 'Geolocation', 'AMap.DistrictSearch', "AMap.PlaceSearch",'AMap.Autocomplete', 'AMap.Geocoder', 'AMap.DistrictSearch'],
-  v: '1.4.4'
-});
+// AMap.initAMapApiLoader({
+//   // 高德key
+//   key: 'd5486742b76ab0969e4c3ce26f46dfc6',
+//   // 插件集合 (插件按需引入)
+//   plugin: ['AMap.Geolocation', 'Geolocation', 'AMap.DistrictSearch', "AMap.PlaceSearch",'AMap.Autocomplete', 'AMap.Geocoder', 'AMap.DistrictSearch'],
+//   v: '1.4.4'
+// });
 // ------------ 通过域名判断起始的登陆页面 开始 --------------------
 //使用login的Url
 // const urls = [

+ 2 - 0
src/views/contractManagement/futuresPurchaseContractAdd.vue

@@ -1887,6 +1887,8 @@
   .address-btn {
     width: 100%;
     text-align: left;
+    color:#000;
+    border:1px solid #ccc;
   }
 
   .inline-input {

+ 2 - 0
src/views/contractManagement/futuresPurchaseContractEdit.vue

@@ -1971,6 +1971,8 @@ export default {
 .address-btn {
   width: 100%;
   text-align: left;
+  color:#000;
+    border:1px solid #ccc;
 }
   .typeselect{
     width: 100%;

+ 4 - 0
src/views/contractManagement/futuresSalesContractAdd.vue

@@ -531,12 +531,14 @@
           this.deptBudgetList.contractGoodsInfo.outputPrivate = data[0]
           this.deptBudgetList.contractGoodsInfo.outputCity = data[1]
           this.deptBudgetList.contractGoodsInfo.outputArea = data[2]
+          this.deptBudgetList.sourceLocation=data[5].lat+','+data[5].lng
         } else {
           this.newSelectedOptions1 = data[0] + '/' + data[1] + '/' + data[2]
           this.deptBudgetList.deliveryProvince = CodeToText[this.selectedOptions[0]]
           this.deptBudgetList.deliveryCity = data[1]
           this.deptBudgetList.deliveryArea = data[2]
           this.deptBudgetList.placeDelivery = data[3]
+          this.deptBudgetList.deliveryLocation=data[5].lat+','+data[5].lng
         }
       },
       mapInputClick(type) {
@@ -1841,6 +1843,8 @@
   .address-btn {
     width: 100%;
     text-align: left;
+    color:#000;
+    border:1px solid #ccc;
   }
    .inline-input {
       width: 100%;

+ 2 - 0
src/views/contractManagement/futuresSalesContractEdit.vue

@@ -1725,5 +1725,7 @@
   .address-btn {
     width: 100%;
     text-align: left;
+    color:#000;
+    border:1px solid #ccc;
   }
 </style>

+ 2 - 0
src/views/contractManagement/purchaseContractAdd.vue

@@ -1878,6 +1878,8 @@
   .address-btn {
     width: 100%;
     text-align: left;
+    color:#000;
+    border:1px solid #ccc;
   }
 
   .inline-input {

+ 2 - 0
src/views/contractManagement/purchaseContractEdit.vue

@@ -1569,5 +1569,7 @@
   .address-btn {
     width: 100%;
     text-align: left;
+    color:#000;
+    border:1px solid #ccc;
   }
 </style>

+ 2 - 0
src/views/contractManagement/salesContractAdd.vue

@@ -1895,6 +1895,8 @@
   .address-btn {
     width: 100%;
     text-align: left;
+    color:#000;
+    border:1px solid #ccc;
   }
 
   .inline-input {

+ 2 - 0
src/views/contractManagement/salesContractEdit.vue

@@ -1641,5 +1641,7 @@
   .address-btn {
     width: 100%;
     text-align: left;
+    color:#000;
+    border:1px solid #ccc;
   }
 </style>