Commit 6bf5f2d1 authored by 赵啸非's avatar 赵啸非

站点地图修改

parent 90490eb8
...@@ -74,16 +74,22 @@ export default { ...@@ -74,16 +74,22 @@ export default {
}, },
}, },
methods: { methods: {
refresh(data){ refresh(data) {
console.log("刷新数据",data) console.log("刷新数据", data);
this.markersData=data this.markersData = data;
this.markersData.map((item) => { this.markersData.map((item) => {
this.setMarker(item.lng, item.lat, item.address,item.siteId); this.setMarker(item.lng, item.lat, item.address, item.siteId);
}); });
},
relocate(center){
this.center = [center.lng, center.lat];
this.zoom=12
//重新定位中心点
}, },
setMarker(lng, lat, address,siteId) {
setMarker(lng, lat, address, siteId) {
if (!lng && !lat) return; if (!lng && !lat) return;
const size = (address || "").length * 5; const size = (address || "").length * 5;
...@@ -91,11 +97,10 @@ export default { ...@@ -91,11 +97,10 @@ export default {
label: { content: address, offset: [30, 70] }, label: { content: address, offset: [30, 70] },
position: [lng, lat], position: [lng, lat],
icon: require("@/assets/images/ego_box_img_normal.png"), icon: require("@/assets/images/ego_box_img_normal.png"),
extData: { siteId: siteId}, extData: { siteId: siteId },
}; };
this.markers.push(markerLabel) this.markers.push(markerLabel);
}, },
// 处理搜索结果,定位到中心点 // 处理搜索结果,定位到中心点
onSearchResult(pois) { onSearchResult(pois) {
...@@ -120,7 +125,7 @@ export default { ...@@ -120,7 +125,7 @@ export default {
}, },
}, },
data() { data() {
let self = this let self = this;
return { return {
searchEvents: { searchEvents: {
init: (e) => {}, init: (e) => {},
...@@ -139,11 +144,10 @@ export default { ...@@ -139,11 +144,10 @@ export default {
// this.markersData.map((item) => { // this.markersData.map((item) => {
// this.setMarker(item.lng, item.lat, item.address); // this.setMarker(item.lng, item.lat, item.address);
// }); // });
}, },
click: (e) => { click: (e) => {
alert(e.target.getExtData().siteId) //alert(e.target.getExtData().siteId);
this.$emit("choose", e.target.getExtData().siteId);
// const { lat, lng } = e.lnglat; // const { lat, lng } = e.lnglat;
// this.geocoder.getAddress([lng, lat], (status, result) => { // this.geocoder.getAddress([lng, lat], (status, result) => {
// if (status === "complete" && result.info === "OK") { // if (status === "complete" && result.info === "OK") {
...@@ -157,75 +161,75 @@ export default { ...@@ -157,75 +161,75 @@ export default {
// 一些工具插件 // 一些工具插件
plugin: [ plugin: [
{ {
pName: 'Geocoder', pName: "Geocoder",
events: { events: {
init (o) { init(o) {
//console.log("一些工具插件--地址"+o.getAddress()) //console.log("一些工具插件--地址"+o.getAddress())
} },
} },
}, },
{ {
// 定位 // 定位
pName: 'Geolocation', pName: "Geolocation",
events: { events: {
init(o) { init(o) {
// o是高德地图定位插件实例 // o是高德地图定位插件实例
o.getCurrentPosition((status, result) => { o.getCurrentPosition((status, result) => {
if (result && result.position) { if (result && result.position) {
// 设置经度 // 设置经度
self.lng = result.position.lng self.lng = result.position.lng;
// 设置维度 // 设置维度
self.lat = result.position.lat self.lat = result.position.lat;
// 设置坐标 // 设置坐标
self.center = [self.lng, self.lat] self.center = [self.lng, self.lat];
self.markers.push([self.lng, self.lat]) self.markers.push([self.lng, self.lat]);
// load // load
self.loaded = true self.loaded = true;
// 页面渲染好后 // 页面渲染好后
self.$nextTick() self.$nextTick();
}
})
}
} }
});
},
},
}, },
{ {
// 工具栏 // 工具栏
pName: 'ToolBar', pName: "ToolBar",
events: { events: {
init(instance) { init(instance) {
//console.log("工具栏:"+instance); //console.log("工具栏:"+instance);
} },
} },
}, },
{ {
// 鹰眼 // 鹰眼
pName: 'OverView', pName: "OverView",
events: { events: {
init(instance) { init(instance) {
//console.log("鹰眼:"+instance); //console.log("鹰眼:"+instance);
} },
} },
}, },
{ {
// 地图类型 // 地图类型
pName: 'MapType', pName: "MapType",
defaultType: 0, defaultType: 0,
events: { events: {
init(instance) { init(instance) {
//console.log("地图类型:"+instance); //console.log("地图类型:"+instance);
} },
} },
}, },
{ {
// 搜索 // 搜索
pName: 'PlaceSearch', pName: "PlaceSearch",
events: { events: {
init(instance) { init(instance) {
//console.log("搜索:"+instance) //console.log("搜索:"+instance)
} },
} },
} },
] ],
}; };
}, },
}; };
......
...@@ -35,12 +35,12 @@ ...@@ -35,12 +35,12 @@
</el-col> </el-col>
<el-col :span="18" :xs="12"> <el-col :span="18" :xs="12">
<Map ref="map" :markersData="originData" @choose="getDetailData" />
<Map ref="map" :markersData="originData" />
</el-col> </el-col>
</el-row> </el-row>
<dialog-show ref="dialogform" @ok="getData" /> <dialog-show ref="dialogform" @ok="getData" />
</div> </div>
</template> </template>
...@@ -52,26 +52,26 @@ import tree from "@/assets/mixins/tree"; ...@@ -52,26 +52,26 @@ import tree from "@/assets/mixins/tree";
import Map from "@/components/Map"; import Map from "@/components/Map";
export default { export default {
name: "Sitestat", name: "Sitestat",
components: { dialogShow ,Map}, components: { dialogShow, Map },
mixins: [table, tree], mixins: [table, tree],
mounted() { mounted() {
console.log(this.pageInfo) console.log(this.pageInfo);
// console.log(2222222,this.$route.path) // console.log(2222222,this.$route.path)
//this.$route.path='/sitestat/list' //this.$route.path='/sitestat/list'
this.pageInfo.list='/sitestat/list' this.pageInfo.list = "/sitestat/list";
}, },
created() { created() {
this.pageInfo.list='/sitestat/list' this.pageInfo.list = "/sitestat/list";
this.$get("/sitestat/maplist", {}).then(({ data }) => { this.$get("/sitestat/maplist", {}).then(({ data }) => {
this.originData= data.data.map(i=>{ this.originData = data.data.map((i) => {
let obj={} let obj = {};
obj.lng=i.longitude obj.lng = i.longitude;
obj.lat=i.latitude obj.lat = i.latitude;
obj.address=i.siteName obj.address = i.siteName;
obj.siteId=i.id obj.siteId = i.id;
return obj return obj;
}) });
this.$refs.map.refresh(this.originData); this.$refs.map.refresh(this.originData);
}); });
...@@ -109,6 +109,14 @@ export default { ...@@ -109,6 +109,14 @@ export default {
}); });
}, },
getDetailData(siteId) {
// console.log("111");
//关闭弹窗
// this.$refs.popoverRef.doClose()
//this.$refs.popoverRef.doShow() //开启弹窗
},
/** 重写新增方法 */ /** 重写新增方法 */
toAdd(row) { toAdd(row) {
this.$refs.dialogform.add(row); this.$refs.dialogform.add(row);
...@@ -131,7 +139,7 @@ export default { ...@@ -131,7 +139,7 @@ export default {
switchStat() { switchStat() {
console.log("切换列表页面"); console.log("切换列表页面");
this.$router.push({ this.$router.push({
path: "/sitestat/list" path: "/sitestat/list",
}); });
}, },
...@@ -139,18 +147,17 @@ export default { ...@@ -139,18 +147,17 @@ export default {
console.log("click node", node); console.log("click node", node);
this.currentNode = node; this.currentNode = node;
if (node.type === "site") { if (node.type === "site") {
//分页查询站点业务列表 todo let obj = {};
// this.siteMatterTable.siteId = node.id; obj.lng = node.longitude;
//this.getSiteMatterTableData(); obj.lat = node.latitude;
// this.query = { siteId: node.id }; this.$refs.map.relocate(obj);
// this.getData();
} }
}, },
}, },
data() { data() {
return { return {
isExport: false, isExport: false,
originData:[], originData: [],
config: { config: {
search: [ search: [
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment