diff --git a/src/assets/overview/pure-position-icon.png b/src/assets/overview/pure-position-icon.png
new file mode 100644
index 0000000..cbe9434
--- /dev/null
+++ b/src/assets/overview/pure-position-icon.png
Binary files differ
diff --git a/src/assets/overview/pure-position-icon.png b/src/assets/overview/pure-position-icon.png
new file mode 100644
index 0000000..cbe9434
--- /dev/null
+++ b/src/assets/overview/pure-position-icon.png
Binary files differ
diff --git a/src/components/Amap/AMapMarker.vue b/src/components/Amap/AMapMarker.vue
index 42be2b3..474442c 100644
--- a/src/components/Amap/AMapMarker.vue
+++ b/src/components/Amap/AMapMarker.vue
@@ -98,6 +98,7 @@
}).$mount()
},
destroyed() {
+ this.map.remove(this.$amapComponent)
this.tmpVM.$destroy()
if (this.$customContent && this.$customContent.$destroy) {
this.$customContent.$destroy()
diff --git a/src/assets/overview/pure-position-icon.png b/src/assets/overview/pure-position-icon.png
new file mode 100644
index 0000000..cbe9434
--- /dev/null
+++ b/src/assets/overview/pure-position-icon.png
Binary files differ
diff --git a/src/components/Amap/AMapMarker.vue b/src/components/Amap/AMapMarker.vue
index 42be2b3..474442c 100644
--- a/src/components/Amap/AMapMarker.vue
+++ b/src/components/Amap/AMapMarker.vue
@@ -98,6 +98,7 @@
}).$mount()
},
destroyed() {
+ this.map.remove(this.$amapComponent)
this.tmpVM.$destroy()
if (this.$customContent && this.$customContent.$destroy) {
this.$customContent.$destroy()
diff --git a/src/views/overview/components/mapSearchComp.vue b/src/views/overview/components/mapSearchComp.vue
new file mode 100644
index 0000000..22ef568
--- /dev/null
+++ b/src/views/overview/components/mapSearchComp.vue
@@ -0,0 +1,134 @@
+
+
+
+
+
+
+
+ 搜索
+
+
+
+
+
+
+ 共找到 {{ list.length }} 个符合条件的{{ name }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/assets/overview/pure-position-icon.png b/src/assets/overview/pure-position-icon.png
new file mode 100644
index 0000000..cbe9434
--- /dev/null
+++ b/src/assets/overview/pure-position-icon.png
Binary files differ
diff --git a/src/components/Amap/AMapMarker.vue b/src/components/Amap/AMapMarker.vue
index 42be2b3..474442c 100644
--- a/src/components/Amap/AMapMarker.vue
+++ b/src/components/Amap/AMapMarker.vue
@@ -98,6 +98,7 @@
}).$mount()
},
destroyed() {
+ this.map.remove(this.$amapComponent)
this.tmpVM.$destroy()
if (this.$customContent && this.$customContent.$destroy) {
this.$customContent.$destroy()
diff --git a/src/views/overview/components/mapSearchComp.vue b/src/views/overview/components/mapSearchComp.vue
new file mode 100644
index 0000000..22ef568
--- /dev/null
+++ b/src/views/overview/components/mapSearchComp.vue
@@ -0,0 +1,134 @@
+
+
+
+
+
+
+
+ 搜索
+
+
+
+
+
+
+ 共找到 {{ list.length }} 个符合条件的{{ name }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/overview/components/mapSearchItem.vue b/src/views/overview/components/mapSearchItem.vue
new file mode 100644
index 0000000..5cdce0d
--- /dev/null
+++ b/src/views/overview/components/mapSearchItem.vue
@@ -0,0 +1,89 @@
+
+
+
+
+ {{ index+1 }}
+
+
+
+ {{ data[props.label] }}-{{ data[props.name] }}
+
+
+ {{ data[props.detail] }}
+
+
+
+
+
+
+
+
diff --git a/src/assets/overview/pure-position-icon.png b/src/assets/overview/pure-position-icon.png
new file mode 100644
index 0000000..cbe9434
--- /dev/null
+++ b/src/assets/overview/pure-position-icon.png
Binary files differ
diff --git a/src/components/Amap/AMapMarker.vue b/src/components/Amap/AMapMarker.vue
index 42be2b3..474442c 100644
--- a/src/components/Amap/AMapMarker.vue
+++ b/src/components/Amap/AMapMarker.vue
@@ -98,6 +98,7 @@
}).$mount()
},
destroyed() {
+ this.map.remove(this.$amapComponent)
this.tmpVM.$destroy()
if (this.$customContent && this.$customContent.$destroy) {
this.$customContent.$destroy()
diff --git a/src/views/overview/components/mapSearchComp.vue b/src/views/overview/components/mapSearchComp.vue
new file mode 100644
index 0000000..22ef568
--- /dev/null
+++ b/src/views/overview/components/mapSearchComp.vue
@@ -0,0 +1,134 @@
+
+
+
+
+
+
+
+ 搜索
+
+
+
+
+
+
+ 共找到 {{ list.length }} 个符合条件的{{ name }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/overview/components/mapSearchItem.vue b/src/views/overview/components/mapSearchItem.vue
new file mode 100644
index 0000000..5cdce0d
--- /dev/null
+++ b/src/views/overview/components/mapSearchItem.vue
@@ -0,0 +1,89 @@
+
+
+
+
+ {{ index+1 }}
+
+
+
+ {{ data[props.label] }}-{{ data[props.name] }}
+
+
+ {{ data[props.detail] }}
+
+
+
+
+
+
+
+
diff --git a/src/views/overview/components/popupLocation.vue b/src/views/overview/components/popupLocation.vue
index 8a8e836..6ad655b 100644
--- a/src/views/overview/components/popupLocation.vue
+++ b/src/views/overview/components/popupLocation.vue
@@ -18,7 +18,7 @@
-
+
@@ -39,6 +39,10 @@
export default {
name: 'PopupLocation',
props: {
+ defaultPosition: {
+ type: Array,
+ default: () => []
+ },
show: {
type: Boolean,
default: true
@@ -53,6 +57,12 @@
} // 筛选条件
}
},
+ mounted() {
+ if (this.position && this.position.length > 1) {
+ this.query.lng = this.position[0]
+ this.query.lat = this.position[1]
+ }
+ },
methods: {
// 关闭窗口
close() {
diff --git a/src/assets/overview/pure-position-icon.png b/src/assets/overview/pure-position-icon.png
new file mode 100644
index 0000000..cbe9434
--- /dev/null
+++ b/src/assets/overview/pure-position-icon.png
Binary files differ
diff --git a/src/components/Amap/AMapMarker.vue b/src/components/Amap/AMapMarker.vue
index 42be2b3..474442c 100644
--- a/src/components/Amap/AMapMarker.vue
+++ b/src/components/Amap/AMapMarker.vue
@@ -98,6 +98,7 @@
}).$mount()
},
destroyed() {
+ this.map.remove(this.$amapComponent)
this.tmpVM.$destroy()
if (this.$customContent && this.$customContent.$destroy) {
this.$customContent.$destroy()
diff --git a/src/views/overview/components/mapSearchComp.vue b/src/views/overview/components/mapSearchComp.vue
new file mode 100644
index 0000000..22ef568
--- /dev/null
+++ b/src/views/overview/components/mapSearchComp.vue
@@ -0,0 +1,134 @@
+
+
+
+
+
+
+
+ 搜索
+
+
+
+
+
+
+ 共找到 {{ list.length }} 个符合条件的{{ name }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/overview/components/mapSearchItem.vue b/src/views/overview/components/mapSearchItem.vue
new file mode 100644
index 0000000..5cdce0d
--- /dev/null
+++ b/src/views/overview/components/mapSearchItem.vue
@@ -0,0 +1,89 @@
+
+
+
+
+ {{ index+1 }}
+
+
+
+ {{ data[props.label] }}-{{ data[props.name] }}
+
+
+ {{ data[props.detail] }}
+
+
+
+
+
+
+
+
diff --git a/src/views/overview/components/popupLocation.vue b/src/views/overview/components/popupLocation.vue
index 8a8e836..6ad655b 100644
--- a/src/views/overview/components/popupLocation.vue
+++ b/src/views/overview/components/popupLocation.vue
@@ -18,7 +18,7 @@
-
+
@@ -39,6 +39,10 @@
export default {
name: 'PopupLocation',
props: {
+ defaultPosition: {
+ type: Array,
+ default: () => []
+ },
show: {
type: Boolean,
default: true
@@ -53,6 +57,12 @@
} // 筛选条件
}
},
+ mounted() {
+ if (this.position && this.position.length > 1) {
+ this.query.lng = this.position[0]
+ this.query.lat = this.position[1]
+ }
+ },
methods: {
// 关闭窗口
close() {
diff --git a/src/views/overview/components/searchComp.vue b/src/views/overview/components/searchComp.vue
deleted file mode 100644
index d6f138a..0000000
--- a/src/views/overview/components/searchComp.vue
+++ /dev/null
@@ -1,109 +0,0 @@
-
-
-
-
-
-
-
- 搜索
-
-
-
-
-
-
- 共找到 {{ list.length }} 个符合条件的{{ name }}
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/assets/overview/pure-position-icon.png b/src/assets/overview/pure-position-icon.png
new file mode 100644
index 0000000..cbe9434
--- /dev/null
+++ b/src/assets/overview/pure-position-icon.png
Binary files differ
diff --git a/src/components/Amap/AMapMarker.vue b/src/components/Amap/AMapMarker.vue
index 42be2b3..474442c 100644
--- a/src/components/Amap/AMapMarker.vue
+++ b/src/components/Amap/AMapMarker.vue
@@ -98,6 +98,7 @@
}).$mount()
},
destroyed() {
+ this.map.remove(this.$amapComponent)
this.tmpVM.$destroy()
if (this.$customContent && this.$customContent.$destroy) {
this.$customContent.$destroy()
diff --git a/src/views/overview/components/mapSearchComp.vue b/src/views/overview/components/mapSearchComp.vue
new file mode 100644
index 0000000..22ef568
--- /dev/null
+++ b/src/views/overview/components/mapSearchComp.vue
@@ -0,0 +1,134 @@
+
+
+
+
+
+
+
+ 搜索
+
+
+
+
+
+
+ 共找到 {{ list.length }} 个符合条件的{{ name }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/overview/components/mapSearchItem.vue b/src/views/overview/components/mapSearchItem.vue
new file mode 100644
index 0000000..5cdce0d
--- /dev/null
+++ b/src/views/overview/components/mapSearchItem.vue
@@ -0,0 +1,89 @@
+
+
+
+
+ {{ index+1 }}
+
+
+
+ {{ data[props.label] }}-{{ data[props.name] }}
+
+
+ {{ data[props.detail] }}
+
+
+
+
+
+
+
+
diff --git a/src/views/overview/components/popupLocation.vue b/src/views/overview/components/popupLocation.vue
index 8a8e836..6ad655b 100644
--- a/src/views/overview/components/popupLocation.vue
+++ b/src/views/overview/components/popupLocation.vue
@@ -18,7 +18,7 @@
-
+
@@ -39,6 +39,10 @@
export default {
name: 'PopupLocation',
props: {
+ defaultPosition: {
+ type: Array,
+ default: () => []
+ },
show: {
type: Boolean,
default: true
@@ -53,6 +57,12 @@
} // 筛选条件
}
},
+ mounted() {
+ if (this.position && this.position.length > 1) {
+ this.query.lng = this.position[0]
+ this.query.lat = this.position[1]
+ }
+ },
methods: {
// 关闭窗口
close() {
diff --git a/src/views/overview/components/searchComp.vue b/src/views/overview/components/searchComp.vue
deleted file mode 100644
index d6f138a..0000000
--- a/src/views/overview/components/searchComp.vue
+++ /dev/null
@@ -1,109 +0,0 @@
-
-
-
-
-
-
-
- 搜索
-
-
-
-
-
-
- 共找到 {{ list.length }} 个符合条件的{{ name }}
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/views/overview/components/searchItem.vue b/src/views/overview/components/searchItem.vue
deleted file mode 100644
index eb1a0ce..0000000
--- a/src/views/overview/components/searchItem.vue
+++ /dev/null
@@ -1,80 +0,0 @@
-
-
-
-
- {{ index+1 }}
-
-
-
- {{ data[props.name] }}
-
-
- {{ data[props.detail] }}
-
-
-
-
-
-
-
-
diff --git a/src/assets/overview/pure-position-icon.png b/src/assets/overview/pure-position-icon.png
new file mode 100644
index 0000000..cbe9434
--- /dev/null
+++ b/src/assets/overview/pure-position-icon.png
Binary files differ
diff --git a/src/components/Amap/AMapMarker.vue b/src/components/Amap/AMapMarker.vue
index 42be2b3..474442c 100644
--- a/src/components/Amap/AMapMarker.vue
+++ b/src/components/Amap/AMapMarker.vue
@@ -98,6 +98,7 @@
}).$mount()
},
destroyed() {
+ this.map.remove(this.$amapComponent)
this.tmpVM.$destroy()
if (this.$customContent && this.$customContent.$destroy) {
this.$customContent.$destroy()
diff --git a/src/views/overview/components/mapSearchComp.vue b/src/views/overview/components/mapSearchComp.vue
new file mode 100644
index 0000000..22ef568
--- /dev/null
+++ b/src/views/overview/components/mapSearchComp.vue
@@ -0,0 +1,134 @@
+
+
+
+
+
+
+
+ 搜索
+
+
+
+
+
+
+ 共找到 {{ list.length }} 个符合条件的{{ name }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/overview/components/mapSearchItem.vue b/src/views/overview/components/mapSearchItem.vue
new file mode 100644
index 0000000..5cdce0d
--- /dev/null
+++ b/src/views/overview/components/mapSearchItem.vue
@@ -0,0 +1,89 @@
+
+
+
+
+ {{ index+1 }}
+
+
+
+ {{ data[props.label] }}-{{ data[props.name] }}
+
+
+ {{ data[props.detail] }}
+
+
+
+
+
+
+
+
diff --git a/src/views/overview/components/popupLocation.vue b/src/views/overview/components/popupLocation.vue
index 8a8e836..6ad655b 100644
--- a/src/views/overview/components/popupLocation.vue
+++ b/src/views/overview/components/popupLocation.vue
@@ -18,7 +18,7 @@
-
+
@@ -39,6 +39,10 @@
export default {
name: 'PopupLocation',
props: {
+ defaultPosition: {
+ type: Array,
+ default: () => []
+ },
show: {
type: Boolean,
default: true
@@ -53,6 +57,12 @@
} // 筛选条件
}
},
+ mounted() {
+ if (this.position && this.position.length > 1) {
+ this.query.lng = this.position[0]
+ this.query.lat = this.position[1]
+ }
+ },
methods: {
// 关闭窗口
close() {
diff --git a/src/views/overview/components/searchComp.vue b/src/views/overview/components/searchComp.vue
deleted file mode 100644
index d6f138a..0000000
--- a/src/views/overview/components/searchComp.vue
+++ /dev/null
@@ -1,109 +0,0 @@
-
-
-
-
-
-
-
- 搜索
-
-
-
-
-
-
- 共找到 {{ list.length }} 个符合条件的{{ name }}
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/views/overview/components/searchItem.vue b/src/views/overview/components/searchItem.vue
deleted file mode 100644
index eb1a0ce..0000000
--- a/src/views/overview/components/searchItem.vue
+++ /dev/null
@@ -1,80 +0,0 @@
-
-
-
-
- {{ index+1 }}
-
-
-
- {{ data[props.name] }}
-
-
- {{ data[props.detail] }}
-
-
-
-
-
-
-
-
diff --git a/src/views/overview/overviewAmap.vue b/src/views/overview/overviewAmap.vue
index 0ee8bfd..fa1f599 100644
--- a/src/views/overview/overviewAmap.vue
+++ b/src/views/overview/overviewAmap.vue
@@ -4,12 +4,22 @@
+
+
+
+
+
-
+
@@ -17,7 +27,7 @@
-
+
@@ -37,11 +47,11 @@
import ToolBox from '@/views/overview/components/toolBox'
import PopupDataFilter from '@/views/overview/components/popupDataFilter'
import PopupLocation from '@/views/overview/components/popupLocation'
-import SearchComp from '@/views/overview/components/searchComp'
+import MapSearchComp from '@/views/overview/components/mapSearchComp'
export default {
name: 'Overview',
- components: { SearchComp, PopupLocation, PopupDataFilter, ToolBox, AlarmList, AMapMarker, AMapContainer, DeptSelect },
+ components: { MapSearchComp, PopupLocation, PopupDataFilter, ToolBox, AlarmList, AMapMarker, AMapContainer, DeptSelect },
data() {
return {
map: null, // 地图对象
@@ -60,7 +70,10 @@
wellOffset: [-8, -16], // 井偏移量
massMarkerUrl: './static/overview/icon-location-small.png',
massMarkerSize: [15, 15],
- massMarkerOffset: [8, 8],
+ massMarkerOffset: [0, 8],
+ searchResultSize: [24, 30],
+ searchResultOffset: [-12, -30],
+ searchResultIcon: require('@/assets/overview/pure-position-icon.png'), // 报警图标
showAlarm: true, // 是否显示报警
toolShow: false, // 工具栏是否显示
menus: {
@@ -83,6 +96,7 @@
alarmList: [], // 显示报警列表
alarmWells: [], // 报警井列表
resultList: [], // 搜索结果列表
+ searchMarkers: [], // 当前搜索页展示marker集合
latestAlarmTime: '', // 列表中最新报警事件
alarmFirstAmount: true, // 是否初次加载报警
firstAmount: true, // 是否第一次加载井数据
@@ -91,6 +105,7 @@
massMarks: null, // 海量点对象
mapMarkers: [], // 查询结果列表
clusters: [], // 聚合
+ tempMarker: null,
showClearBtn: false // 是否显示清除查询按钮
}
},
@@ -103,11 +118,21 @@
watch: {
needRefresh(val) { // 需要刷新报警
if (val) this.refreshAlarm()
+ },
+ 'menus.locationWindowShow'(val) { // 打开弹窗设置默认中心,关闭弹窗清空屏幕
+ if (val) {
+ this.$refs.popupLocation.setQuery(this.center)
+ } else {
+ this.map.remove(this.tempMarker)
+ }
}
},
created() {
this.fetchWellType()
},
+ mounted() {
+ this.resultList = []
+ },
beforeDestroy() {
if (this.clock) {
clearInterval(this.clock)
@@ -184,22 +209,34 @@
this.filterAlarm(listQuery, showMessage)
}
},
+ // 清空查询
+ clearSearch() {
+ this.searchMarkers = []
+ this.resultList = []
+ },
// 数据查询
search(keywords) {
if (keywords === '') {
this.$message.warning('搜索条件不能为空')
} else {
- // todo: 待完善查询逻辑
- this.resultList = this.markers
+ this.resultList = this.markers.filter(item => {
+ if (item.wellCode.includes(keywords) || item.wellName.includes(keywords) || item.position.includes(keywords)) {
+ return true
+ } else {
+ return false
+ }
+ })
}
},
- // 清除查询
- clearSearch() {
- // this.listQuery.wellType = ''
- // this.listQuery.deptid = ''
- // this.listQuery.keywords = ''
- // this.filterIcon()
- // this.showClearBtn = false
+ // 搜索结果页面变化,触发地图展示列表中所有
+ searchPageChange(currentMarkers) {
+ // 增加查询展示图层
+ this.searchMarkers = currentMarkers
+ },
+ // 点击搜索结果项居中,弹窗
+ searchItemClick(marker) {
+ this.center = marker.lnglat
+ this.openInfoWindow(marker.wellId, marker.lnglat, this.searchResultOffset[1])
},
// 过滤海量点,给markers赋visible值
filterMassMarker(listQuery, showMessage = false) {
@@ -516,7 +553,7 @@
* @param coordinates 弹窗位置: [经度,纬度]
* @param offsetY 弹窗Y轴偏移,为负值
*/
- openInfoWindow(wellId, coordinates, offsetY = 0) {
+ openInfoWindow(wellId, coordinates, offsetY) {
this.clearInfoWindow()
// 首先获取井详情
getWellInfo(wellId).then(response => {
@@ -578,13 +615,43 @@
closePopupDataFilter() {
Object.assign(this.menus, { dataFilterWindowShow: false })
},
- // TODO: 坐标定位,居中,绘点
- setCenter() {
-
+ // 坐标定位,居中,绘点
+ setCenter(position) {
+ const { searchResultOffset, searchResultIcon, searchResultSize } = this
+ this.center = position
+ const icon = new window.AMap.Icon({
+ size: toSize(searchResultSize), // 图标尺寸
+ image: searchResultIcon, // Icon的图像
+ imageSize: toSize(searchResultSize) // 根据所设置的大小拉伸或压缩图片
+ })
+ const marker = new window.AMap.Marker({
+ icon: icon,
+ position: position,
+ offset: toPixel(searchResultOffset)
+ })
+ marker.setMap(this.map)
+ this.tempMarker = marker
},
- // TODO: 坐标拾取, 在地图上绘点
+ // 坐标拾取, 在地图上绘点
pickerPosition() {
-
+ const { searchResultOffset, searchResultIcon, searchResultSize, center } = this
+ const icon = new window.AMap.Icon({
+ size: toSize(searchResultSize), // 图标尺寸
+ image: searchResultIcon, // Icon的图像
+ imageSize: toSize(searchResultSize) // 根据所设置的大小拉伸或压缩图片
+ })
+ const marker = new window.AMap.Marker({
+ icon: icon,
+ position: center,
+ offset: toPixel(searchResultOffset),
+ draggable: true
+ })
+ marker.on('dragend', e => {
+ const position = [e.lnglat.lng, e.lnglat.lat]
+ this.$refs.popupLocation.setQuery(position)
+ })
+ marker.setMap(this.map)
+ this.tempMarker = marker
},
// TODO: 关闭坐标定位窗口, 清除地图上的标注
closePopupLocation() {
@@ -690,4 +757,21 @@
}
}
+.search-marker{
+ position: relative;
+ .search-marker-image{
+ width: 100%;
+ height: 100%;
+ }
+ .search-marker-label{
+ position:absolute;
+ font-size: 14px;
+ font-weight: 600;
+ color:#FFF;
+ z-index:50;
+ top: 4px;
+ left: 50%;
+ transform: translateX(-50%)
+ }
+}