Browse Source

修复通讯录无法保存坐标的bug

jly/task002
dai 3 years ago
committed by tianq
parent
commit
0862040d29
  1. 81
      src/views/modules/base/organization/organization.vue

81
src/views/modules/base/organization/organization.vue

@ -1513,7 +1513,7 @@ export default {
modifyGridPop(val) {
if (val) {
setTimeout(() => {
this.createMap();
this.createMap("modifyGridFrom");
}, 1000);
}
},
@ -2892,6 +2892,8 @@ export default {
this.modifyGridFrom.manageDistrict = data.manageDistrict;
this.modifyGridFrom.griId = data.grid;
this.modifyGridFrom.gridSort = data.gridSort;
this.modifyGridFrom.latitude = data.latitude;
this.modifyGridFrom.longitude = data.longitude;
} else {
this.$message.error(msg);
}
@ -2908,8 +2910,8 @@ export default {
mobile: this.OrgDetailsForm.mobile,
code: this.OrgDetailsForm.code,
latitude: this.latitude,
remark: this.OrgDetailsForm.remark,
longitude: this.longitude,
remark: this.OrgDetailsForm.remark,
};
const { data, code, msg } = await requestPost(url, params);
@ -2964,6 +2966,8 @@ export default {
code: this.modifyGridFrom.code,
gridType: this.modifyGridFrom.gridType,
sort: this.modifyGridFrom.gridSort,
latitude: this.modifyGridFrom.latitude,
longitude: this.modifyGridFrom.longitude,
};
const { data, code, msg } = await requestPost(url, params);
@ -2981,8 +2985,8 @@ export default {
},
/** 地图初始化 */
createMap() {
let { latitude, longitude } = this;
createMap(type) {
let { latitude, longitude } = this[type] || this;
if (
latitude === null ||
latitude === "" ||
@ -2999,7 +3003,6 @@ export default {
longitude = longitude2;
}
}
// var center = new window.TMap.LatLng(latitude, longitude); //
var map = new daiMap(
document.getElementById("con"),
{ latitude, longitude },
@ -3009,72 +3012,22 @@ export default {
rotation: 45, //
}
);
// //
// var map = new window.TMap.Map("con", {
// center: center,
// zoom: 13, //
// pitch: 43.5, //
// rotation: 45, //
// });
// //
// let markers = new window.TMap.MultiMarker({
// map: map,
// geometries: [],
// });
// map.on("panend", (e) => {
// handleMoveCenter(e);
// });
//
map.on("dragend", (e) => {
handleMoveCenter(e);
});
// map.setCenter(latitude, longitude);
map.setMarker(latitude, longitude);
// setMarker(latitude, longitude);
// function setMarker(lat, lng) {
// console.log("setMarker", lat, lng);
// markers.setGeometries([]);
// markers.add([
// {
// id: "4",
// styleId: "marker",
// position: new window.TMap.LatLng(lat, lng),
// properties: {
// title: "marker4",
// },
// },
// ]);
// }
function handleMoveCenter(e) {
//
const { lat, lng } = map.getCenter();
// const lat = lat;
// const lng = lng;
map.setMarker(lat, lng);
if (type) {
this[type].latitude = lat;
this[type].longitude = lng;
} else {
this.latitude = lat;
this.longitude = lng;
}
});
// let { msg, data } = await map.getAddress(lat, lng);
// if (msg == "success") {
// this.formData.address = data.address
// this.searchValue = data.address
// this.searchOptions = []
// }
//
// const center = map.getCenter();
// const lat = center.getLat();
// const lng = center.getLng();
// setMarker(lat, lng);
}
map.setMarker(latitude, longitude);
},
},
};

Loading…
Cancel
Save