|
@@ -84,10 +84,10 @@
|
|
|
<el-form-item label="详细地址">
|
|
|
<el-input v-model="company.detailAddress"></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="经度(°)">
|
|
|
+ <el-form-item label="经度(°)" prop="longitude">
|
|
|
<el-input placeholder="" style="width: 80%;" size="samll" v-model.number="company.longitude"></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="维度(°)">
|
|
|
+ <el-form-item label="维度(°)" prop="latitude">
|
|
|
<el-input v-model="company.latitude"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
@@ -123,6 +123,7 @@
|
|
|
import {createCompany, getCompany, updateCompany} from '@/api/company'
|
|
|
import SingleUpload from '@/components/Upload/singleUpload'
|
|
|
import MultiUpload from '@/components/Upload/multiUpload'
|
|
|
+ import {bMapTransQQMap,qqMapTransBMap} from '@/utils/index';
|
|
|
import {BaiduMap,BmNavigation,BmView,BmGeolocation,BmCityList} from 'vue-baidu-map'
|
|
|
const defaultCompany={
|
|
|
cityId: "",
|
|
@@ -194,6 +195,12 @@
|
|
|
sort: [
|
|
|
{type: 'number', message: '排序必须为数字'}
|
|
|
],
|
|
|
+ longitude: [
|
|
|
+ {required: true, message: '请选择经纬度', trigger: 'blur'}
|
|
|
+ ],
|
|
|
+ latitude : [
|
|
|
+ {required: true, message: '请选择经纬度', trigger: 'blur'}
|
|
|
+ ],
|
|
|
},
|
|
|
center: {lng: 106.632713, lat: 26.653157},
|
|
|
zoom: 12,
|
|
@@ -335,6 +342,14 @@
|
|
|
geolocation.getCurrentPosition(function(r){
|
|
|
// console.log(r);
|
|
|
_this.center = {lng: r.longitude, lat: r.latitude}; // 设置center属性值
|
|
|
+ if(_this.company.latitude&&_this.company.longitude){
|
|
|
+ let transqq = qqMapTransBMap(_this.company.longitude,_this.company.latitude);
|
|
|
+ console.log('transqq',transqq);
|
|
|
+ _this.center = {lng:transqq.lng, lat: transqq.lat};
|
|
|
+ };
|
|
|
+ let Icon_0 = new BMap.Icon("static/zuobiao.gif", new BMap.Size(64, 64), {anchor: new BMap.Size(18, 32),imageSize: new BMap.Size(36, 36)});
|
|
|
+ let myMarker = new BMap.Marker(new BMap.Point(_this.company.longitude, _this.company.latitude),{icon: Icon_0});
|
|
|
+ map.addOverlay(myMarker);
|
|
|
_this.autoLocationPoint = {lng: r.longitude, lat: r.latitude}; // 自定义覆盖物
|
|
|
_this.initLocation = true;
|
|
|
},{enableHighAccuracy: true})
|
|
@@ -358,17 +373,23 @@
|
|
|
_this.company.countyId = rs.addressComponents.district;
|
|
|
_this.company.detailAddress = rs.address;
|
|
|
});
|
|
|
- this.company.longitude = e.point.lng;
|
|
|
- this.company.latitude = e.point.lat;
|
|
|
+ //转为高德坐标
|
|
|
+ let transGaode = bMapTransQQMap(e.point.lng,e.point.lat);
|
|
|
+ this.company.longitude = transGaode.lng;
|
|
|
+ this.company.latitude = transGaode.lat;
|
|
|
+ // this.company.longitude = e.point.lng;
|
|
|
+ // this.company.latitude = e.point.lat;
|
|
|
},
|
|
|
//定位成功回调
|
|
|
getLoctionSuccess(point, AddressComponent, marker){
|
|
|
- map.clearOverlays();
|
|
|
- let Icon_0 = new BMap.Icon("/static/zuobiao.gif", new BMap.Size(64, 64), {anchor: new BMap.Size(18, 32),imageSize: new BMap.Size(36, 36)});
|
|
|
- var myMarker = new BMap.Marker(new BMap.Point(point.point.lng, point.point.lat),{icon: Icon_0});
|
|
|
- map.addOverlay(myMarker);
|
|
|
- this.company.longitude = point.point.lng;
|
|
|
- this.company.latitude = point.point.lat;
|
|
|
+ // map.clearOverlays();
|
|
|
+ // let transqq = qqMapTransBMap(point.point.lng,point.point.lat);
|
|
|
+ // let Icon_0 = new BMap.Icon("/static/zuobiao.gif", new BMap.Size(64, 64), {anchor: new BMap.Size(18, 32),imageSize: new BMap.Size(36, 36)});
|
|
|
+ // var myMarker = new BMap.Marker(new BMap.Point(transqq.lng, transqq.lat),{icon: Icon_0});
|
|
|
+ // console.log('transqq',transqq);
|
|
|
+ // map.addOverlay(myMarker);
|
|
|
+ // this.company.longitude = point.point.lng;
|
|
|
+ // this.company.latitude = point.point.lat;
|
|
|
},
|
|
|
findlocation(){
|
|
|
this.$emit("findlocdata",this.company)
|