diff --git a/src/assets/images/station-operation/date-item-bg.png b/src/assets/images/station-operation/data-item-bg.png similarity index 100% rename from src/assets/images/station-operation/date-item-bg.png rename to src/assets/images/station-operation/data-item-bg.png diff --git a/src/components/CustomTree/index.vue b/src/components/CustomTree/index.vue index 7b5d829..3753344 100644 --- a/src/components/CustomTree/index.vue +++ b/src/components/CustomTree/index.vue @@ -6,6 +6,7 @@ checkable :selectedKeys="[]" :tree-data="treeData" + :replace-fields="replaceFields" @select="onTreeSelect" > @@ -21,6 +22,16 @@ export default { }, value: { type: Array + }, + replaceFields: { + type: Object, + default: () => { + return { + children: 'children', + title: 'title', + key: 'key' + } + } } }, data() { @@ -41,8 +52,8 @@ export default { // 选中了 this.checkedKeys.push(selectedKey) - const parentNode = this.treeData.find(tree => tree.key == parentKey) // 找到树列表中的父节点 - const childrenKeys = parentNode.children.map(child => child.key) + const parentNode = this.treeData.find(tree => tree[this.replaceFields.key] == parentKey) // 找到树列表中的父节点 + const childrenKeys = parentNode.children.map(child => child[this.replaceFields.key]) if (childrenKeys.every(key => this.checkedKeys.includes(key))) { // 如果子列表每一个都能在选中的列表中找到,则是全选 this.checkedKeys.push(parentKey) @@ -58,8 +69,8 @@ export default { } } else { //选中的是父级节点 - const parentNode = this.treeData.find(tree => tree.key == selectedKey) - const childrenKeys = parentNode.children.map(child => child.key) + const parentNode = this.treeData.find(tree => tree[this.replaceFields.key] == selectedKey) + const childrenKeys = parentNode.children.map(child => child[this.replaceFields.key]) const findParent = this.checkedKeys.findIndex(key => key == selectedKey) if (-1 == findParent) { diff --git a/src/style.less b/src/style.less index 4aa6979..1b7e14e 100644 --- a/src/style.less +++ b/src/style.less @@ -363,20 +363,29 @@ body { border-left-width: 4px; border-right-width: 4px; border-bottom-color: #4b859e; - position: relative; - top: -1px; + position: absolute; + bottom: 2px; + right: 50%; + transform: translateX(4px); } &-down { border-top: none; &::after { - transform: rotate(180deg); - top: 1px; + transform: translateX(4px) rotate(180deg); + top: 2px; } } } } +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button { + -webkit-appearance: none; + appearance: none; + margin: 0; +} + // 单选样式 .ant-radio { &-wrapper { diff --git a/src/views/stationOperation/components/DataListItem.vue b/src/views/stationOperation/components/DataListItem.vue new file mode 100644 index 0000000..57ba3d9 --- /dev/null +++ b/src/views/stationOperation/components/DataListItem.vue @@ -0,0 +1,120 @@ + + + + + diff --git a/src/views/stationOperation/components/Map.vue b/src/views/stationOperation/components/Map.vue index ab36202..f4ef585 100644 --- a/src/views/stationOperation/components/Map.vue +++ b/src/views/stationOperation/components/Map.vue @@ -10,6 +10,7 @@ import TileLayer from 'ol/layer/Tile' import Map from 'ol/Map' import XYZ from 'ol/source/XYZ' import View from 'ol/View' +import { fromLonLat } from 'ol/proj' export default { props: { @@ -19,7 +20,7 @@ export default { }, zoom: { type: Number, - default: 3 + default: 1 }, maxZoom: { type: Number, @@ -27,7 +28,7 @@ export default { }, minZoom: { type: Number, - default: 3 + default: 1 }, center: { type: Object, @@ -61,8 +62,8 @@ export default { ] const view = new View({ - projection: 'EPSG:900913', // 使用这个坐标系 - center: [longitude, latitude], + projection: 'EPSG:3857', // 使用这个坐标系 + center: fromLonLat([longitude, latitude]), zoom: this.zoom, maxZoom: this.maxZoom, minZoom: this.minZoom @@ -107,7 +108,7 @@ export default { // 平移到某个位置 panTo(center, duration = 1000) { return this.map.getView().animate({ - center, + center: fromLonLat(center), duration }) } diff --git a/src/views/stationOperation/components/MapMarker.vue b/src/views/stationOperation/components/MapMarker.vue index 7c14bf0..1749b12 100644 --- a/src/views/stationOperation/components/MapMarker.vue +++ b/src/views/stationOperation/components/MapMarker.vue @@ -4,8 +4,15 @@ diff --git a/src/views/stationOperation/components/MapPane.vue b/src/views/stationOperation/components/MapPane.vue index 97c8e39..408a30d 100644 --- a/src/views/stationOperation/components/MapPane.vue +++ b/src/views/stationOperation/components/MapPane.vue @@ -18,11 +18,11 @@
- +
- +
@@ -71,7 +71,7 @@

Radius

{{ filterItem.title }}
- + @@ -221,36 +221,45 @@ import FilterImage from './filterImage' import CustomTree from '@/components/CustomTree/index.vue' import RealTimeDataChart from './RealTimeDataChart.vue' import { postAction } from '../../../api/manage' +import { MarkerType } from './markerEnum' + +import { Vector as VectorLayer } from 'ol/layer' // Filter中的筛选列表 const filterList = [ { title: 'IMS RN Station(P)', + type: MarkerType.ImsRnStationP, icon: FilterImage.ImsRnStation, checked: true }, { title: 'IMS RN Station(G)', + type: MarkerType.ImsRnStationG, icon: FilterImage.ImsRnStation, checked: true }, { title: 'Nuclear Facilities', + type: MarkerType.NuclearFacility, icon: FilterImage.NuclearFacility, checked: true }, { title: 'Groud monitoring station', + type: MarkerType.GroudMonitoringStation, icon: FilterImage.GroudMonitoringStation, checked: true }, { title: 'car', + type: MarkerType.Car, icon: FilterImage.Car, checked: true }, { title: 'ship', + type: MarkerType.Ship, icon: FilterImage.Ship, checked: true } @@ -280,17 +289,21 @@ const dataQualityList = [ const columns = [ { title: 'nuclearfaclity', - dataIndex: 'nuclearfaclity', + dataIndex: 'nuclearFacilityName', width: 100, ellipsis: true }, { title: 'station', - dataIndex: 'station' + dataIndex: 'stationName', + width: 70, + ellipsis: true }, { title: 'distance', - dataIndex: 'distance' + dataIndex: 'radius', + width: 80, + ellipsis: true } ] @@ -349,7 +362,7 @@ export default { data() { this.columns = columns return { - active: 1, + active: 2, isFullScreen: false, // 是否处于全屏状态 checkedKeys: [], // 选中的树节点 @@ -357,7 +370,7 @@ export default { filterList, // 筛选类型列表 dataQualityList, // 数据质量列表 - radius: 0, // 距离 + radius: 5000, // 距离 dataSource: [], // Infomation Radius 表格数据源 isGettingInfomationList: false, @@ -368,7 +381,9 @@ export default { legendList, // 图例列表 statusList, - showChart: true + showChart: true, + + markerList: [] // 要在地图上展示的marker列表 } }, created() { @@ -400,11 +415,37 @@ export default { this.isFullScreen = !!document.fullscreenElement }, + // 面板改变 + onPaneChange(active) { + this.active = active + switch (active) { + case 1: // 核设施查询面板 + this.emitStationChange() + break + case 2: // 筛选面板 + this.emitTypeFilter() + break + } + }, + + // 根据 Filter 筛选Marker + emitTypeFilter() { + this.$emit( + 'changeMarkerByType', + this.filterList.filter(item => item.checked).map(item => item.type) + ) + }, + + // 根据 Radius 筛选 Marker + emitStationChange() { + this.$emit('changeMarker', this.markerList) + }, + // 选中全部 handleSelectAll() { this.checkedKeys = this.treeData.reduce((prev, curr) => { - prev.push(curr.key) - prev.push(...curr.children.map(child => child.key)) + prev.push(curr.stationId) + prev.push(...curr.children.map(child => child.stationId)) return prev }, []) }, @@ -416,17 +457,61 @@ export default { // 根据半径查询台站列表 async handleSearchByRadius() { - if (this.radius == null || this.radius == undefined) { + if (!this.radius) { this.$message.warn('Please Input Radius To Search') return } + if (!this.checkedKeys.length) { + this.$message.warn('Please Select Stations That Related To') + return + } + + const stationIds = this.checkedKeys.filter(key => !this.treeData.find(leaf => leaf.stationId == key)) try { this.isGettingInfomationList = true - const res = await postAction('/jeecg-station-operation/stationOperation/getHitEquList', { + const { + success, + result: { GIS: markerList, table }, + message + } = await postAction('/jeecg-station-operation/stationOperation/getHitEquList', { radius: this.radius, - stationIds: [] + stationIds }) - console.log('%c [ ]-486', 'font-size:13px; background:pink; color:#bf2c9f;', res) + if (success) { + const data = table.flat() + data.forEach((item, index) => { + item.radius = parseFloat(item.radius).toFixed(3) + item.index = index + }) + this.dataSource = data // 设置Infomation表格内容 + + const stationList = [] // 台站列表 + markerList.forEach(markerItem => { // 返回的数据类型不符合要求,根据stationId判断是否是台站,增加台站类型和转换字段,以便进行marker的绘制 + if (markerItem.stationId) { + // 是台站 + markerItem.stationType = MarkerType.ImsRnStationG + stationList.push(markerItem) + } else { + // 是核设施 + markerItem.stationType = MarkerType.NuclearFacility + markerItem.lon = markerItem.longitude + markerItem.lat = markerItem.latitude + } + }) + + if (markerList.length) { + // 自动移动到搜出来的第一个台站那 + const firstMarker = markerList[0] + this.$parent.panTo([firstMarker.lon, firstMarker.lat]) + } + + this.markerList = markerList + this.emitStationChange() + + this.drawCircle(stationList) + } else { + this.$message.error(message) + } } catch (error) { console.error(error) } finally { @@ -434,6 +519,16 @@ export default { } }, + // 绘制圆圈 + drawCircle(stationList) { + this.circleLayer = new VectorLayer({ + source: new VectorSource({ + features: [] + }), + properties: { name: 'eventMarker' } + }) + }, + // 打开分析弹窗 handleOpenAnalyzeModal() { this.dataStatusModalVisible = true diff --git a/src/views/stationOperation/components/markerEnum.js b/src/views/stationOperation/components/markerEnum.js new file mode 100644 index 0000000..3f375d9 --- /dev/null +++ b/src/views/stationOperation/components/markerEnum.js @@ -0,0 +1,24 @@ +import Car from '@/assets/images/station-operation/car.png' +import GroudMonitoringStation from '@/assets/images/station-operation/groud-monitoring-station.png' +import ImsRnStation from '@/assets/images/station-operation/ims-rn-station.png' +import NuclearFacility from '@/assets/images/station-operation/nuclear-facility.png' +import Ship from '@/assets/images/station-operation/ship.png' + +export const MarkerType = { + Car: 'Car', + GroudMonitoringStation: 'Groud monitoring station', + ImsRnStationP: 'IMS STATION', + ImsRnStationG: 'IMS STATION', + NuclearFacility: 'Nuclear Facility', + Ship: 'Ship' + +} + +export const MarkerIcon = { + [MarkerType.Car]: Car, + [MarkerType.GroudMonitoringStation]: GroudMonitoringStation, + [MarkerType.ImsRnStationP]: ImsRnStation, + [MarkerType.ImsRnStationG]: ImsRnStation, + [MarkerType.NuclearFacility]: NuclearFacility, + [MarkerType.Ship]: Ship +} \ No newline at end of file diff --git a/src/views/stationOperation/components/markerImage.js b/src/views/stationOperation/components/markerImage.js deleted file mode 100644 index cd6c51d..0000000 --- a/src/views/stationOperation/components/markerImage.js +++ /dev/null @@ -1,13 +0,0 @@ -import Car from '@/assets/images/station-operation/car.png' -import GroudMonitoringStation from '@/assets/images/station-operation/groud-monitoring-station.png' -import ImsRnStation from '@/assets/images/station-operation/ims-rn-station.png' -import NuclearFacility from '@/assets/images/station-operation/nuclear-facility.png' -import Ship from '@/assets/images/station-operation/ship.png' - -export default { - Car, - GroudMonitoringStation, - ImsRnStation, - NuclearFacility, - Ship -} \ No newline at end of file diff --git a/src/views/stationOperation/index.vue b/src/views/stationOperation/index.vue index e739849..e814cee 100644 --- a/src/views/stationOperation/index.vue +++ b/src/views/stationOperation/index.vue @@ -1,16 +1,16 @@