|
@@ -45,8 +45,83 @@
|
|
|
})
|
|
|
}
|
|
|
const funStationPos = async () => {
|
|
|
+ const res = await httpRequest.get('/base/location', {
|
|
|
+ params: {
|
|
|
+ ids: props.ids.join(","),
|
|
|
+ },
|
|
|
+ })
|
|
|
+ if (res.code === 200) {
|
|
|
+ if (res.data && res.data.length) {
|
|
|
+ map.value.clearMap()
|
|
|
+ res.data.forEach(item => {
|
|
|
+ const marker = new aMap.value.Marker({
|
|
|
+ icon: "https://webapi.amap.com/theme/v1.3/markers/n/mark_r.png",
|
|
|
+ // icon: "./static/run_Icon.gif",
|
|
|
+ position: [Number(item.longitude), Number(item.latitude)],
|
|
|
+ anchor: 'bottom-center'
|
|
|
+ });
|
|
|
+ // 设置label标签
|
|
|
+ // label默认蓝框白底左上角显示,样式className为:amap-marker-label
|
|
|
+ marker.setLabel({
|
|
|
+ direction: 'right',
|
|
|
+ offset: new aMap.value.Pixel(10, 0), //设置文本标注偏移量
|
|
|
+ content: `${item.aname}`, //设置文本标注内容
|
|
|
+ });
|
|
|
+ map.value.add(marker)
|
|
|
+ // marker.setTitle(item.name);
|
|
|
+
|
|
|
+ //创建右键菜单
|
|
|
+ const contextMenu = new aMap.value.ContextMenu();
|
|
|
+ /**右键菜单可根据props中传参定义 */
|
|
|
+ //右键1
|
|
|
+ contextMenu.addItem("功率曲线拟合", (e) => {
|
|
|
+ console.log('rightObj====>>>>', rightObj.value)
|
|
|
+ // funCombineGet(rightObj.value)
|
|
|
+ emits('rightClick', {
|
|
|
+ menuIndex: 0,
|
|
|
+ current: rightObj.value,
|
|
|
+ })
|
|
|
+ }, 0);
|
|
|
+
|
|
|
+ //右键2
|
|
|
+ contextMenu.addItem("对风偏差分析", () => {
|
|
|
+ emits('rightClick', {
|
|
|
+ menuIndex: 1,
|
|
|
+ current: rightObj.value,
|
|
|
+ })
|
|
|
+ }, 1);
|
|
|
+
|
|
|
+ // //右键2
|
|
|
+ // contextMenu.addItem("温度与功率分析", () => {
|
|
|
+ // emits('rightClick', {
|
|
|
+ // menuIndex: 2,
|
|
|
+ // current: rightObj.value
|
|
|
+ // })
|
|
|
+ // }, 2);
|
|
|
+ map.value.add(marker)
|
|
|
+ // marker.setTitle(item.name);
|
|
|
+ // 设置label标签
|
|
|
+ // label默认蓝框白底左上角显示,样式className为:amap-marker-label
|
|
|
+ marker.setLabel({
|
|
|
+ direction: 'right',
|
|
|
+ offset: new aMap.value.Pixel(10, 0), //设置文本标注偏移量
|
|
|
+ content: `${item.name}`, //设置文本标注内容
|
|
|
+ });
|
|
|
+ //绑定鼠标右击事件——弹出右键菜单
|
|
|
+ marker.on('rightclick', function (e) {
|
|
|
+ rightObj.value = item
|
|
|
+ contextMenu.open(map.value, e.lnglat);
|
|
|
+ });
|
|
|
+
|
|
|
+ })
|
|
|
+ map.value.setFitView()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const funStationPosvs = async () => {
|
|
|
const res = await httpRequest.get('/base/station', {
|
|
|
- params: {}
|
|
|
+ params: {},
|
|
|
})
|
|
|
if (res.code === 200) {
|
|
|
if (res.data && res.data.length) {
|
|
@@ -54,6 +129,7 @@
|
|
|
res.data.forEach(item => {
|
|
|
const marker = new aMap.value.Marker({
|
|
|
icon: "https://webapi.amap.com/theme/v1.3/markers/n/mark_r.png",
|
|
|
+ // icon: "./static/run_Icon.gif",
|
|
|
position: [Number(item.longitude), Number(item.latitude)],
|
|
|
anchor: 'bottom-center'
|
|
|
});
|
|
@@ -66,6 +142,7 @@
|
|
|
});
|
|
|
map.value.add(marker)
|
|
|
// marker.setTitle(item.name);
|
|
|
+
|
|
|
})
|
|
|
map.value.setFitView()
|
|
|
}
|
|
@@ -73,6 +150,10 @@
|
|
|
}
|
|
|
|
|
|
const props = defineProps({
|
|
|
+ ids: {
|
|
|
+ type: Array,
|
|
|
+ default: () => [],
|
|
|
+ },
|
|
|
windList: {
|
|
|
type: Array,
|
|
|
default: () => []
|
|
@@ -85,70 +166,24 @@
|
|
|
/** 右键后对象数据的接收 */
|
|
|
const rightObj = ref(null)
|
|
|
/**监听windList */
|
|
|
- // watch(() => props.windList, (val) => {
|
|
|
- // if (val && val.length) {
|
|
|
- // map.value.clearMap()
|
|
|
- // val.forEach(item => {
|
|
|
- // const marker = new aMap.value.Marker({
|
|
|
- // icon: "https://webapi.amap.com/theme/v1.3/markers/n/mark_r.png",
|
|
|
- // position: [Number(item.longitude), Number(item.latitude)],
|
|
|
- // anchor: 'bottom-center'
|
|
|
- // });
|
|
|
- // //创建右键菜单
|
|
|
- // const contextMenu = new aMap.value.ContextMenu();
|
|
|
- // /**右键菜单可根据props中传参定义 */
|
|
|
- // //右键1
|
|
|
- // contextMenu.addItem("功率曲线拟合", (e) => {
|
|
|
- // console.log(rightObj.value)
|
|
|
- // // funCombineGet(rightObj.value)
|
|
|
- // emits('rightClick', {
|
|
|
- // menuIndex: 0,
|
|
|
- // current: rightObj.value,
|
|
|
- // })
|
|
|
- // }, 0);
|
|
|
-
|
|
|
- // //右键2
|
|
|
- // contextMenu.addItem("对风偏差分析", () => {
|
|
|
- // emits('rightClick', {
|
|
|
- // menuIndex: 1,
|
|
|
- // current: rightObj.value,
|
|
|
- // })
|
|
|
- // }, 1);
|
|
|
-
|
|
|
- // // //右键2
|
|
|
- // // contextMenu.addItem("温度与功率分析", () => {
|
|
|
- // // emits('rightClick', {
|
|
|
- // // menuIndex: 2,
|
|
|
- // // current: rightObj.value
|
|
|
- // // })
|
|
|
- // // }, 2);
|
|
|
- // map.value.add(marker)
|
|
|
- // // marker.setTitle(item.name);
|
|
|
- // // 设置label标签
|
|
|
- // // label默认蓝框白底左上角显示,样式className为:amap-marker-label
|
|
|
- // marker.setLabel({
|
|
|
- // direction: 'right',
|
|
|
- // offset: new aMap.value.Pixel(10, 0), //设置文本标注偏移量
|
|
|
- // content: `${item.name}`, //设置文本标注内容
|
|
|
- // });
|
|
|
- // //绑定鼠标右击事件——弹出右键菜单
|
|
|
- // marker.on('rightclick', function (e) {
|
|
|
- // rightObj.value = item
|
|
|
- // contextMenu.open(map.value, e.lnglat);
|
|
|
- // });
|
|
|
- // })
|
|
|
- // map.value.setFitView()
|
|
|
- // setTimeout(() => {
|
|
|
- // let zoom = map.value.getZoom()
|
|
|
- // if (zoom > 16) {
|
|
|
- // zoom = 16
|
|
|
- // map.value.setZoom(zoom)
|
|
|
- // }
|
|
|
- // }, 1000)
|
|
|
- // } else {
|
|
|
- // funStationPos()
|
|
|
- // }
|
|
|
- // })
|
|
|
+ watch(() => props.ids, (val) => {
|
|
|
+ if (val.length > 0) {
|
|
|
+ funStationPos()
|
|
|
+ } else {
|
|
|
+ funStationPosvs()
|
|
|
+ }
|
|
|
+ // httpRequest
|
|
|
+ // .get("/base/location", {
|
|
|
+ // params: {
|
|
|
+ // ids: value.join(","),
|
|
|
+ // },
|
|
|
+ // })
|
|
|
+ // .then((res) => {
|
|
|
+ // this.searchId = value || [];
|
|
|
+ // this.wtList = res.data || [];
|
|
|
+ // this.getWpList();
|
|
|
+ // });
|
|
|
+ })
|
|
|
//created
|
|
|
onMounted(() => {
|
|
|
funMapSet(mapStatus => {
|