| | |
| | | ```sh |
| | | npm run lint |
| | | ``` |
| | | |
| | | ``` |
| | | ff-ai-ep-underway-vue |
| | | ââ .env.development |
| | | ââ .env.development.jingan |
| | | ââ .env.production |
| | | ââ .env.production.jingan |
| | | ââ .eslintrc.cjs |
| | | ââ .prettierrc.json |
| | | ââ index.html |
| | | ââ jsconfig.json |
| | | ââ package-lock.json |
| | | ââ package.json |
| | | ââ public |
| | | â ââ favicon.ico |
| | | ââ README.md |
| | | ââ src |
| | | â ââ api |
| | | â â ââ deviceApi.js |
| | | â â ââ index.js |
| | | â â ââ missionApi.js |
| | | â â ââ monitorDataApi.js |
| | | â â ââ sceneInfoApi.js |
| | | â â ââ thirdPartyDataApi.js |
| | | â ââ App.vue |
| | | â ââ assets |
| | | â â ââ 3dmap.css |
| | | â â ââ base.css |
| | | â â ââ border.css |
| | | â â ââ common-style.css |
| | | â â ââ logo.svg |
| | | â â ââ main.css |
| | | â â ââ mipmap |
| | | â â ââ boat_driving.png |
| | | â â ââ border.png |
| | | â â ââ car_driving.png |
| | | â â ââ car_offline.png |
| | | â â ââ car_stop.png |
| | | â â ââ company.png |
| | | â â ââ c_level_0.png |
| | | â â ââ c_level_1.png |
| | | â â ââ c_level_2.png |
| | | â â ââ c_level_no.png |
| | | â â ââ data_chart.png |
| | | â â ââ device.png |
| | | â â ââ dust.png |
| | | â â ââ ic_down_white.png |
| | | â â ââ ic_up_white.png |
| | | â â ââ location.png |
| | | â â ââ oil_paint.png |
| | | â â ââ other_smell.png |
| | | â â ââ plastics.png |
| | | â â ââ pungent.png |
| | | â â ââ scene.png |
| | | â â ââ scene_1.png |
| | | â â ââ scene_15.png |
| | | â â ââ scene_16.png |
| | | â â ââ scene_17.png |
| | | â â ââ scene_18.png |
| | | â â ââ scene_19.png |
| | | â â ââ scene_20.png |
| | | â â ââ scene_4.png |
| | | â â ââ scene_5.png |
| | | â â ââ scene_6.png |
| | | â â ââ shrink_left.png |
| | | â â ââ shrink_right.png |
| | | â â ââ slider_handle.png |
| | | â â ââ stink.png |
| | | â â ââ title_bg.png |
| | | â â ââ underway-2.png |
| | | â â ââ underway-3.png |
| | | â â ââ underway.png |
| | | â â ââ 微信å¾ç_20210608110133.png |
| | | â â ââ 微信å¾ç_202106081101331.png |
| | | â â ââ 微信å¾ç_202106081101332.png |
| | | â ââ components |
| | | â â ââ animation |
| | | â â â ââ HistoricalTrajectory.vue |
| | | â â â ââ TrajectoryState.vue |
| | | â â ââ BaseCard.vue |
| | | â â ââ CardButton.vue |
| | | â â ââ CardDialog.vue |
| | | â â ââ chart |
| | | â â â ââ GaugeChart.vue |
| | | â â â ââ ProgressLineChart.vue |
| | | â â â ââ RealTimeLineChart.vue |
| | | â â ââ core |
| | | â â â ââ CoreHeader.vue |
| | | â â â ââ CoreMenu.vue |
| | | â â ââ device |
| | | â â â ââ DeviceCreate.vue |
| | | â â â ââ DeviceManage.vue |
| | | â â ââ map |
| | | â â â ââ BaseMap.vue |
| | | â â â ââ ConfigManage.vue |
| | | â â â ââ MapLocation.vue |
| | | â â â ââ MapScene.vue |
| | | â â â ââ MapToolbox.vue |
| | | â â ââ MessageBox.vue |
| | | â â ââ mission |
| | | â â â ââ MissionEdit.vue |
| | | â â â ââ MissionImport.vue |
| | | â â â ââ MissionManage.vue |
| | | â â ââ monitor |
| | | â â â ââ DataSummary.vue |
| | | â â â ââ DataTable.vue |
| | | â â â ââ FactorCheckbox.vue |
| | | â â â ââ FactorLegend.vue |
| | | â â â ââ FactorRadio.vue |
| | | â â â ââ FactorTrend.vue |
| | | â â â ââ VehicleData.vue |
| | | â â â ââ WeatherData-copy.vue |
| | | â â â ââ WeatherData.vue |
| | | â â ââ scene |
| | | â â â ââ SceneSearch.vue |
| | | â â ââ search |
| | | â â â ââ OptionDevice.vue |
| | | â â â ââ OptionLocation.vue |
| | | â â â ââ OptionLocation2.vue |
| | | â â â ââ OptionMission.vue |
| | | â â â ââ OptionTime.vue |
| | | â â â ââ OptionType.vue |
| | | â â â ââ SearchBar.vue |
| | | â â ââ SliderBar.vue |
| | | â ââ components.d.ts |
| | | â ââ composables |
| | | â â ââ defaultFactorType.js |
| | | â â ââ fetchData.js |
| | | â â ââ formConfirm.js |
| | | â â ââ messageBox.js |
| | | â ââ constant |
| | | â â ââ checkbox-options |
| | | â â â ââ options-jingan.js |
| | | â â â ââ options.js |
| | | â â ââ checkbox-options.js |
| | | â â ââ device-type.js |
| | | â â ââ factor-name.js |
| | | â â ââ factor-unit.js |
| | | â â ââ location.js |
| | | â â ââ radio-options |
| | | â â â ââ options-jingan.js |
| | | â â â ââ options.js |
| | | â â ââ radio-options.js |
| | | â â ââ scene-types |
| | | â â â ââ options-jingan.js |
| | | â â â ââ options.js |
| | | â â ââ scene-types.js |
| | | â â ââ wind-dir.js |
| | | â ââ lib |
| | | â â ââ jquery-3.5.1.min.js |
| | | â â ââ jquery.soap.js |
| | | â â ââ jquery.xml2json.js |
| | | â ââ main.js |
| | | â ââ model |
| | | â â ââ Factor.js |
| | | â â ââ FactorDatas.js |
| | | â â ââ FrameAnimation.js |
| | | â â ââ Legend.js |
| | | â ââ router |
| | | â â ââ index.js |
| | | â ââ stores |
| | | â â ââ device.js |
| | | â â ââ map-animation.js |
| | | â â ââ mission.js |
| | | â â ââ scene.js |
| | | â â ââ toolbox.js |
| | | â ââ styles |
| | | â â ââ base.scss |
| | | â â ââ elementUI.scss |
| | | â â ââ index.scss |
| | | â ââ test.xml |
| | | â ââ utils |
| | | â â ââ chart |
| | | â â â ââ chart-option.js |
| | | â â ââ color.js |
| | | â â ââ expand |
| | | â â â ââ expand.js |
| | | â â ââ factor |
| | | â â â ââ data.js |
| | | â â ââ file.js |
| | | â â ââ map |
| | | â â â ââ 3dLayer.js |
| | | â â â ââ animation.js |
| | | â â â ââ calculate.js |
| | | â â â ââ dialog.js |
| | | â â â ââ grid.js |
| | | â â â ââ index.js |
| | | â â â ââ index_old.js |
| | | â â â ââ line.js |
| | | â â â ââ marks.js |
| | | â â â ââ sector.js |
| | | â â â ââ security.js |
| | | â â â ââ toolbox.js |
| | | â â â ââ util.js |
| | | â â ââ number.js |
| | | â ââ views |
| | | â ââ electricitymode |
| | | â â ââ ElectricityMode.vue |
| | | â ââ gridmonitor |
| | | â â ââ GridMode.vue |
| | | â ââ historymode |
| | | â â ââ component |
| | | â â â ââ DataSheet.vue |
| | | â â â ââ TrendAnalysis.vue |
| | | â â ââ HistoryMode.vue |
| | | â â ââ HistoryMode2.vue |
| | | â ââ HomePage.vue |
| | | â ââ LoginPage.vue |
| | | â ââ LoginPage_Backup.vue |
| | | â ââ realtimemode |
| | | â â ââ component |
| | | â â â ââ DashBoard.vue |
| | | â â â ââ DeviceChange.vue |
| | | â â â ââ RealTimeTrend.vue |
| | | â â ââ RealtimeMode.vue |
| | | â ââ riskmodel |
| | | â â ââ RiskMode.vue |
| | | â ââ underwaymix |
| | | â ââ UnderwayMixMode.vue |
| | | ââ test |
| | | â ââ grid_test_data.js |
| | | ââ vite.config.js |
| | | ââ vitest.config.js |
| | | |
| | | ``` |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { $http } from './index'; |
| | | |
| | | import { Base64 } from 'js-base64'; |
| | | /** |
| | | * 嫿饿µç½æ ¼ç¸å
³æ¥å£API |
| | | */ |
| | | export default { |
| | | fetchGridGroup(area, type, page, perPage) { |
| | | return $http |
| | | .post(`air/satellite/grid/group`, area, { |
| | | params: { |
| | | type, |
| | | page: page, |
| | | per_page: perPage |
| | | } |
| | | }) |
| | | .then((res) => res.data); |
| | | }, |
| | | |
| | | fetchGridCell(groupId) { |
| | | return $http |
| | | .get(`air/satellite/grid/cell`, { |
| | | params: { |
| | | groupId |
| | | } |
| | | }) |
| | | .then((res) => res.data); |
| | | }, |
| | | |
| | | /** |
| | | * è·åç½æ ¼ç»ä¸ç饿µæ°æ® |
| | | * @param {*} groupId |
| | | * @param {*} dataTime |
| | | * @param {number} type 饿µæ°æ®ç±»åï¼0ï¼åå§å«ææ°æ®ï¼1ï¼èåæ°æ® |
| | | * @returns |
| | | */ |
| | | fetchGridData(groupId, dataTime, type) { |
| | | return $http |
| | | .get(`air/satellite/grid/data`, { |
| | | params: { |
| | | groupId, |
| | | dataTime, |
| | | type |
| | | } |
| | | }) |
| | | .then((res) => res.data); |
| | | }, |
| | | |
| | | // /** |
| | | // * è·åç½æ ¼ç»ä¸ç饿µaod |
| | | // * @param {*} groupId |
| | | // * @param {*} dataTime |
| | | // * @returns |
| | | // */ |
| | | // fetchGridAod(groupId, dataTime) { |
| | | // return $http |
| | | // .get(`air/satellite/grid/aod`, { |
| | | // params: { |
| | | // groupId, |
| | | // dataTime |
| | | // } |
| | | // }) |
| | | // .then((res) => res.data); |
| | | // }, |
| | | |
| | | fetchGridDataDetail(dataId, groupId, cellId) { |
| | | return $http |
| | | .get(`air/satellite/grid/data/detail`, { |
| | | params: { |
| | | dataId, |
| | | groupId, |
| | | cellId |
| | | } |
| | | }) |
| | | .then((res) => res.data); |
| | | }, |
| | | |
| | | createGridDataAndDataDetail(groupId, dataTime, dataDetailList) { |
| | | return $http |
| | | .post(`air/satellite/grid/data/create`, { |
| | | params: { |
| | | groupId, |
| | | dataTime |
| | | }, |
| | | data: dataDetailList |
| | | }) |
| | | .then((res) => res.data); |
| | | }, |
| | | |
| | | downloadTemplate() { |
| | | return $http |
| | | .get(`air/satellite/import/grid/data/download/template`, { |
| | | responseType: 'blob' |
| | | }) |
| | | .then((res) => { |
| | | const name = Base64.decode(res.headers.get('fileName')); |
| | | const blob = new Blob([res.data], { |
| | | type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' |
| | | }); |
| | | const url = window.URL.createObjectURL(blob); |
| | | const link = document.createElement('a'); |
| | | link.href = url; |
| | | link.download = name; |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | document.body.removeChild(link); |
| | | window.URL.revokeObjectURL(url); |
| | | }); |
| | | }, |
| | | importData(dataForm) { |
| | | return $http |
| | | .post(`air/satellite/import/grid/data`, dataForm) |
| | | .then((res) => res.data); |
| | | }, |
| | | downloadAODTemplate() { |
| | | return $http |
| | | .get(`air/satellite/import/grid/aod/download/template`, { |
| | | responseType: 'blob' |
| | | }) |
| | | .then((res) => { |
| | | const name = Base64.decode(res.headers.get('fileName')); |
| | | const blob = new Blob([res.data], { |
| | | type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' |
| | | }); |
| | | const url = window.URL.createObjectURL(blob); |
| | | const link = document.createElement('a'); |
| | | link.href = url; |
| | | link.download = name; |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | document.body.removeChild(link); |
| | | window.URL.revokeObjectURL(url); |
| | | }); |
| | | }, |
| | | importAOD(dataForm) { |
| | | return $http |
| | | .post(`air/satellite/import/grid/aod`, dataForm) |
| | | .then((res) => res.data); |
| | | }, |
| | | |
| | | mixGridData(dataIdList) { |
| | | return $http |
| | | .post(`air/satellite/grid/data/mix`, dataIdList) |
| | | .then((res) => res.data); |
| | | }, |
| | | |
| | | buildUnderwayProduct(missionCode, groupId) { |
| | | return $http.get(`air/satellite/import/grid/aod/download/template`, { |
| | | responseType: 'blob' |
| | | }); |
| | | } |
| | | }; |
| | |
| | | ElFormItem: typeof import('element-plus/es')['ElFormItem'] |
| | | ElIcon: typeof import('element-plus/es')['ElIcon'] |
| | | ElInput: typeof import('element-plus/es')['ElInput'] |
| | | ElInputNumber: typeof import('element-plus/es')['ElInputNumber'] |
| | | ElOption: typeof import('element-plus/es')['ElOption'] |
| | | ElPagination: typeof import('element-plus/es')['ElPagination'] |
| | | ElPopover: typeof import('element-plus/es')['ElPopover'] |
| | |
| | | ] |
| | | }, |
| | | |
| | | // _custom: [ |
| | | // [0.05, 0.9, 0.03, 0.75], |
| | | // [0.3, 0.65, 0.02, 0.75], |
| | | // [0.87, 0.92, 0.03, 0.75], |
| | | // [0.8, 0.67, 0.04, 0.75], |
| | | // [0.92, 0.28, 0.07, 0.75], |
| | | // [0.6, 0.05, 0.05, 0.75] |
| | | // ], |
| | | _custom: [ |
| | | [0, 0.89, 0, 0.75], |
| | | [1, 1, 0, 0.75], |
| | | [1, 0.49, 0, 0.75], |
| | | [1, 0, 0, 0.75], |
| | | [0.6, 0, 0.3, 0.75], |
| | | [0.49, 0, 0.14, 0.75] |
| | | [0.05, 0.9, 0.03, 0.75], |
| | | [0.3, 0.65, 0.02, 0.75], |
| | | [0.87, 0.92, 0.03, 0.75], |
| | | [0.8, 0.67, 0.04, 0.75], |
| | | [0.92, 0.28, 0.07, 0.75], |
| | | [0.96, 0.05, 0.05, 0.75] |
| | | ], |
| | | |
| | | getStandardRange: function (name) { |
| | |
| | | }, |
| | | |
| | | getColor: function (name, type, data, min, max) { |
| | | if (!data) { |
| | | return [0, 0, 0, 0]; |
| | | } |
| | | if (type == this.S_TYPE) { |
| | | return this.getStandardColor(name, data); |
| | | } else { |
| | |
| | | return colors[selected]; |
| | | }, |
| | | |
| | | getStandardColorAndNext: function (name, data) { |
| | | if (!data) { |
| | | return { |
| | | color: [0, 0, 0, 0], |
| | | nextColor: [0, 0, 0, 0], |
| | | range: 0, |
| | | nextRange: 0 |
| | | }; |
| | | } |
| | | let range = this._legend_r[name]; |
| | | let colors = this._legend_c[name]; |
| | | if (range == undefined) { |
| | | range = this._legend_r['PM25']; |
| | | colors = this._legend_c['PM25']; |
| | | } |
| | | |
| | | let selected = undefined; |
| | | for (let i = 0; i < range.length; i++) { |
| | | const d = range[i]; |
| | | let d1 = d; |
| | | if (name == 'CO') { |
| | | d1 *= 1000; |
| | | } |
| | | if (data >= d1) { |
| | | selected = i; |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | // é¿å
䏿 è¶ç |
| | | if (selected >= colors.length) { |
| | | selected = colors.length - 1; |
| | | } |
| | | |
| | | let nextIndex = selected + 1; |
| | | if (nextIndex >= colors.length) { |
| | | nextIndex = colors.length - 1; |
| | | } |
| | | |
| | | return { |
| | | color: colors[selected], |
| | | nextColor: colors[nextIndex], |
| | | range: range[selected], |
| | | nextRange: range[nextIndex] |
| | | }; |
| | | }, |
| | | |
| | | getCustomColor: function (data, min, max) { |
| | | var per = (max - min) / this._custom.length; |
| | | var i = parseInt((data - min) / per); |
| | |
| | | i = this._custom.length - 1; |
| | | } |
| | | return this._custom[i]; |
| | | }, |
| | | |
| | | getCustomColorAndNext: function (data, min, max) { |
| | | if (!data) { |
| | | return { |
| | | color: [0, 0, 0, 0], |
| | | nextColor: [0, 0, 0, 0], |
| | | range: 0, |
| | | nextRange: 0 |
| | | }; |
| | | } |
| | | |
| | | // å°æ°æ®æç
§é¢è²æ°éåéï¼æ±åºæ¯ä¸æ®µçæ°æ®åç§»é |
| | | var per = (max - min) / (this._custom.length - 1); |
| | | // 计ç®å½åæ°æ®æå¨çåæ®µèå´ |
| | | var i = parseInt((data - min) / per); |
| | | // å¦ææ¯æå¤§å¼ï¼åæ ·åå²å°æå䏿®µ |
| | | if (i == this._custom.length - 1) i--; |
| | | var range = min + i * per; |
| | | |
| | | let nextIndex = i + 1; |
| | | let nextRange = min + nextIndex * per; |
| | | |
| | | return { |
| | | color: this._custom[i], |
| | | nextColor: this._custom[nextIndex], |
| | | range, |
| | | nextRange |
| | | }; |
| | | } |
| | | }; |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import calculate from '@/utils/map/calculate'; |
| | | import gridMapUtil from '@/utils/map/grid'; |
| | | import { map, onMapMounted } from '@/utils/map/index_old'; |
| | | import { useCloned } from '@vueuse/core'; |
| | | |
| | | /** |
| | | * 嫿饿µç½æ ¼ç®¡ç |
| | | */ |
| | | export class SatelliteGrid { |
| | | constructor(name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | // å°å¾ç½æ ¼ç¸å
³å¯¹è±¡ |
| | | mapViews; |
| | | |
| | | mapViewsList = []; |
| | | |
| | | mapViewsMap = new Map(); |
| | | |
| | | districtPolygon; |
| | | |
| | | events = new Map(); |
| | | |
| | | // ç»å¶åºå¿è¾¹ç |
| | | drawDistrict(districtName, isNew) { |
| | | onMapMounted(() => { |
| | | if (this.districtPolygon && !isNew) { |
| | | map.remove(this.districtPolygon); |
| | | map.add(this.districtPolygon); |
| | | } else { |
| | | // eslint-disable-next-line no-undef |
| | | var district = new AMap.DistrictSearch({ |
| | | extensions: 'all', //è¿åè¡æ¿åºè¾¹çåæ çå
·ä½ä¿¡æ¯ |
| | | level: 'district' //设置æ¥è¯¢è¡æ¿åºçº§å«ä¸ºåº |
| | | }); |
| | | district.search(districtName, (status, result) => { |
| | | var bounds = result.districtList[0].boundaries; //è·åæé³åºçè¾¹çä¿¡æ¯ |
| | | if (bounds) { |
| | | for (var i = 0; i < bounds.length; i++) { |
| | | //çæè¡æ¿åºå polygon |
| | | // eslint-disable-next-line no-undef |
| | | this.districtPolygon = new AMap.Polygon({ |
| | | map: map, //æ¾ç¤ºè¯¥è¦çç©çå°å¾å¯¹è±¡ |
| | | strokeWeight: 2, //è½®å»çº¿å®½åº¦ |
| | | path: bounds[i], //å¤è¾¹å½¢è½®å»çº¿çèç¹åæ æ°ç» |
| | | fillOpacity: 0, //å¤è¾¹å½¢å¡«å
éæåº¦ |
| | | fillColor: '#CCF3FF', //å¤è¾¹å½¢å¡«å
é¢è² |
| | | // strokeColor: '#ffffff' //线æ¡é¢è² |
| | | strokeColor: '#0552f7', //线æ¡é¢è² |
| | | zIndex: 9 |
| | | }); |
| | | } |
| | | map.setFitView(); //å°è¦çç©è°æ´å°åéè§é |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | clearAll(mapViews) { |
| | | if (mapViews) { |
| | | if (typeof mapViews.gridViews === 'object') { |
| | | map.remove(mapViews.gridViews); |
| | | } |
| | | } |
| | | this.clearText(mapViews); |
| | | } |
| | | |
| | | clearText(mapViews) { |
| | | if (mapViews) { |
| | | if (typeof mapViews.dataTxt === 'object') { |
| | | map.remove(mapViews.dataTxt); |
| | | } |
| | | if (typeof mapViews.dataLayer === 'object') { |
| | | map.remove(mapViews.dataLayer); |
| | | } |
| | | if (typeof mapViews.rankTxt === 'object') { |
| | | map.remove(mapViews.rankTxt); |
| | | } |
| | | if (typeof mapViews.rankLayer === 'object') { |
| | | map.remove(mapViews.rankLayer); |
| | | } |
| | | } |
| | | } |
| | | |
| | | firstEvent; |
| | | |
| | | // ç»å¶ç½æ ¼çº¿ |
| | | drawPolyline(gridInfo, event) { |
| | | this.firstEvent = event; |
| | | // ç»å¶ç½æ ¼ |
| | | const points = gridInfo.map((v) => { |
| | | return calculate.wgs84_To_Gcj02(v.longitude, v.latitude); |
| | | // return [v.longitude, v.latitude]; |
| | | }); |
| | | // const gridPoints = gridMapUtil.parseGridPoint(points); |
| | | // console.log('gridPoints:', gridPoints); |
| | | |
| | | const gridPoints = gridInfo.map((v, i) => { |
| | | return { |
| | | path: [ |
| | | calculate.wgs84_To_Gcj02(v.point1Lon, v.point1Lat), |
| | | calculate.wgs84_To_Gcj02(v.point2Lon, v.point2Lat), |
| | | calculate.wgs84_To_Gcj02(v.point3Lon, v.point3Lat), |
| | | calculate.wgs84_To_Gcj02(v.point4Lon, v.point4Lat) |
| | | // [v.point1Lon, v.point1Lat], |
| | | // [v.point2Lon, v.point2Lat], |
| | | // [v.point3Lon, v.point3Lat], |
| | | // [v.point4Lon, v.point4Lat] |
| | | ] |
| | | // eslint-disable-next-line no-undef |
| | | .map((d) => new AMap.LngLat(d[0], d[1])), |
| | | extData: { |
| | | centerPoint: points[i], |
| | | // gridPoints, |
| | | gridCell: v |
| | | } |
| | | }; |
| | | }); |
| | | const gridViews = gridMapUtil.drawPolylines({ points: gridPoints, event }); |
| | | return { gridViews, gridPoints, points }; |
| | | } |
| | | |
| | | // ç»å¶çæµæ°æ®å¼ |
| | | drawDataText(points, gridDataDetail, textViews, isCustomColor, useColor) { |
| | | const data = gridDataDetail.map((v, i) => { |
| | | return { |
| | | lnglat_GD: points[i], |
| | | // data: v.pm25 ? (v.pm25 + 'μg/m³') : '' |
| | | data: v.pm25 ? v.pm25 : '' |
| | | }; |
| | | }); |
| | | // return gridMapUtil.drawGridTextLabel(data, textViews, labelsLayer, 'bottom'); |
| | | return gridMapUtil.drawGridText({ |
| | | points: data, |
| | | textViews, |
| | | anchor: 'top-center', |
| | | type: 'data', |
| | | isCustomColor, |
| | | useColor |
| | | }); |
| | | } |
| | | |
| | | // ç»å¶çæµæ°æ®æåææ¬ |
| | | drawRankText(points, gridDataDetail, textViews, labelsLayer) { |
| | | const data = gridDataDetail.map((v, i) => { |
| | | return { |
| | | lnglat_GD: points[i], |
| | | // data: v.pm25 ? ('æå: ' + v.rank) : '' |
| | | data: v.pm25 ? v.rank : '' |
| | | }; |
| | | }); |
| | | // return gridMapUtil.drawGridTextLabel(data, textViews, labelsLayer, 'top'); |
| | | return gridMapUtil.drawGridText({ |
| | | points: data, |
| | | textViews, |
| | | anchor: 'bottom-center', |
| | | type: 'rank' |
| | | }); |
| | | } |
| | | |
| | | // ç»å¶çæµæ°æ®å¼å¯¹åºç½æ ¼é¢è² |
| | | drawColor({ |
| | | gridViews, |
| | | points, |
| | | gridDataDetail, |
| | | lastGridViews, |
| | | opacity, |
| | | zIndex, |
| | | customColor |
| | | }) { |
| | | // æ ¹æ®æ°æ®çéææ°æ®çç½æ ¼ |
| | | const res = []; |
| | | // 以å对åºçä¸å¿ç¹åæ |
| | | const pointsRes = []; |
| | | gridDataDetail.forEach((d) => { |
| | | // æ ¹æ®æ°æ®å
³èçç½æ ¼ç¼å·ï¼æ¾å°å¯¹åºç½æ ¼ |
| | | const cellId = d.cellId; |
| | | if (cellId > gridViews.length) { |
| | | throw Error( |
| | | '饿µæ°æ®çç½æ ¼ç´¢å¼ç¼å·è¶
åºç½æ ¼ç»èå´ï¼æ°æ®åç½æ ¼ç»å¯è½ä¸å¯¹åº' |
| | | ); |
| | | } |
| | | res.push(gridViews[cellId - 1]); |
| | | pointsRes.push(points[cellId - 1]); |
| | | }); |
| | | |
| | | // æ ¹æ®ç»å¶é¢è²æ¹å¼ç»å¶ç½æ ¼ |
| | | let resGridViews; |
| | | if (customColor) { |
| | | resGridViews = gridMapUtil.drawGridColorCustom( |
| | | res, |
| | | gridDataDetail, |
| | | opacity, |
| | | zIndex |
| | | ); |
| | | } else { |
| | | resGridViews = gridMapUtil.drawGridColor( |
| | | res, |
| | | gridDataDetail, |
| | | 'PM25', |
| | | opacity, |
| | | zIndex |
| | | ); |
| | | } |
| | | |
| | | if (lastGridViews) { |
| | | map.remove(lastGridViews); |
| | | } |
| | | map.add(resGridViews); |
| | | // map.setFitView(resGridViews); |
| | | |
| | | return { resGridViews, pointsRes }; |
| | | } |
| | | |
| | | // å«æç½æ ¼é
ç½®åå¤ |
| | | gridPrepare(gridInfo, event) { |
| | | // clearText(mapViews); |
| | | this.clearAll(this.mapViews); |
| | | this.mapViews = this.drawPolyline(gridInfo, event); |
| | | } |
| | | |
| | | // ç»å¶ç½æ ¼é¥ææ°æ®å¼åç½æ ¼é¢è² |
| | | drawGrid({ |
| | | gridDataDetail, |
| | | useCustomColor, |
| | | opacity, |
| | | zIndex, |
| | | showDataTxt, |
| | | showRankTxt, |
| | | useDataTxtColor, |
| | | mapViews |
| | | }) { |
| | | const _mapViews = mapViews ? mapViews : this.mapViews; |
| | | // SatelliteProxy.clearText(mapViews); |
| | | const { resGridViews, pointsRes } = this.drawColor({ |
| | | gridViews: _mapViews.gridViews, |
| | | points: _mapViews.points, |
| | | gridDataDetail: gridDataDetail, |
| | | lastGridViews: _mapViews.lastGridViews, |
| | | customColor: useCustomColor, |
| | | opacity: opacity, |
| | | zIndex: zIndex |
| | | }); |
| | | _mapViews.lastGridViews = resGridViews; |
| | | _mapViews.lastPoints = pointsRes; |
| | | |
| | | // æ°æ®æ è®° |
| | | const { textViews: dataTxt, labelsLayer: dataLayer } = this.drawDataText( |
| | | _mapViews.lastPoints, |
| | | gridDataDetail, |
| | | _mapViews.dataTxt, |
| | | useCustomColor, |
| | | useDataTxtColor |
| | | ); |
| | | _mapViews.dataTxt = dataTxt; |
| | | _mapViews.dataLayer = dataLayer; |
| | | |
| | | const { textViews: rankTxt, labelsLayer: rankLayer } = this.drawRankText( |
| | | _mapViews.lastPoints, |
| | | gridDataDetail, |
| | | _mapViews.rankTxt, |
| | | _mapViews.rankLayer |
| | | ); |
| | | _mapViews.rankTxt = rankTxt; |
| | | _mapViews.rankLayer = rankLayer; |
| | | |
| | | if (showDataTxt) { |
| | | map.add(_mapViews.dataTxt); |
| | | } |
| | | |
| | | if (showRankTxt) { |
| | | map.add(_mapViews.rankTxt); |
| | | } |
| | | } |
| | | |
| | | // |
| | | drawGrids({ |
| | | gridDataDetailList, |
| | | useCustomColor, |
| | | opacity, |
| | | zIndex, |
| | | showDataTxt, |
| | | showRankTxt |
| | | }) { |
| | | if (this.mapViewsList.length < gridDataDetailList.length) { |
| | | let index = this.mapViewsList.length; |
| | | while (index < gridDataDetailList.length) { |
| | | const newMapViews = { |
| | | gridViews: gridMapUtil.drawPolylines({ |
| | | points: this.mapViews.gridPoints, |
| | | event: this.firstEvent |
| | | }), |
| | | gridPoints: JSON.parse(JSON.stringify(this.mapViews.gridPoints)), |
| | | points: JSON.parse(JSON.stringify(this.mapViews.points)) |
| | | }; |
| | | this.mapViewsList.push(newMapViews); |
| | | } |
| | | } |
| | | |
| | | this.mapViewsList.forEach((m, i) => { |
| | | this.drawGrid({ |
| | | gridDataDetail: gridDataDetailList[i], |
| | | useCustomColor, |
| | | opacity, |
| | | zIndex, |
| | | showDataTxt, |
| | | showRankTxt, |
| | | mapViews: m |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | drawNewGrid({ |
| | | gridDataDetail, |
| | | useCustomColor, |
| | | opacity, |
| | | zIndex, |
| | | showDataTxt, |
| | | showRankTxt |
| | | }) { |
| | | const newMapViews = { |
| | | gridViews: gridMapUtil.drawPolylines({ |
| | | points: this.mapViews.gridPoints, |
| | | event: this.firstEvent |
| | | }), |
| | | gridPoints: JSON.parse(JSON.stringify(this.mapViews.gridPoints)), |
| | | points: JSON.parse(JSON.stringify(this.mapViews.points)) |
| | | }; |
| | | this.mapViewsList.push(newMapViews); |
| | | this.drawGrid({ |
| | | gridDataDetail, |
| | | useCustomColor, |
| | | opacity, |
| | | zIndex, |
| | | showDataTxt, |
| | | showRankTxt, |
| | | mapViews: newMapViews |
| | | }); |
| | | } |
| | | drawTagGrid({ |
| | | tag, |
| | | gridDataDetail, |
| | | useCustomColor, |
| | | opacity, |
| | | zIndex, |
| | | showDataTxt, |
| | | showRankTxt |
| | | }) { |
| | | if (!this.mapViewsMap.has(tag)) { |
| | | const newMapViews = { |
| | | gridViews: gridMapUtil.drawPolylines({ |
| | | points: this.mapViews.gridPoints, |
| | | event: this.firstEvent |
| | | }), |
| | | gridPoints: JSON.parse(JSON.stringify(this.mapViews.gridPoints)), |
| | | points: JSON.parse(JSON.stringify(this.mapViews.points)) |
| | | }; |
| | | this.mapViewsMap.set(tag, newMapViews); |
| | | } |
| | | const _mapViews = this.mapViewsMap.get(tag); |
| | | this.drawGrid({ |
| | | gridDataDetail, |
| | | useCustomColor, |
| | | opacity, |
| | | zIndex, |
| | | showDataTxt, |
| | | showRankTxt, |
| | | mapViews: _mapViews |
| | | }); |
| | | } |
| | | |
| | | // è°æ´åç±»å°å¾è¦çç©çå¯è§æ§ |
| | | changeVisibility({ tag, showGridViews, showDataTxt, showRankTxt }) { |
| | | let _mapViewsList = []; |
| | | if (this.mapViews) { |
| | | _mapViewsList.push(this.mapViews); |
| | | } |
| | | if (tag && this.mapViewsMap.has(tag)) { |
| | | _mapViewsList.push(this.mapViewsMap.get(tag)); |
| | | } else { |
| | | this.mapViewsMap.forEach((v) => { |
| | | _mapViewsList.push(v); |
| | | }); |
| | | } |
| | | if (showGridViews != undefined) { |
| | | if (showGridViews) { |
| | | // map.add(this.mapViews.lastGridViews); |
| | | _mapViewsList.forEach((v) => { |
| | | if (v.lastGridViews) map.add(v.lastGridViews); |
| | | }); |
| | | } else { |
| | | // map.remove(this.mapViews.lastGridViews); |
| | | _mapViewsList.forEach((v) => { |
| | | if (v.lastGridViews) map.remove(v.lastGridViews); |
| | | }); |
| | | } |
| | | } |
| | | if (showDataTxt != undefined) { |
| | | if (showDataTxt) { |
| | | // map.add(this.mapViews.dataTxt); |
| | | _mapViewsList.forEach((v) => { |
| | | if (v.dataTxt) map.add(v.dataTxt); |
| | | }); |
| | | } else { |
| | | // map.remove(this.mapViews.dataTxt); |
| | | _mapViewsList.forEach((v) => { |
| | | if (v.dataTxt) map.remove(v.dataTxt); |
| | | }); |
| | | } |
| | | } |
| | | if (showRankTxt != undefined) { |
| | | if (showRankTxt) { |
| | | // map.add(this.mapViews.rankTxt); |
| | | _mapViewsList.forEach((v) => { |
| | | if (v.rankTxt) map.add(v.rankTxt); |
| | | }); |
| | | } else { |
| | | // map.remove(this.mapViews.rankTxt); |
| | | _mapViewsList.forEach((v) => { |
| | | if (v.rankTxt) map.remove(v.rankTxt); |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | |
| | | changeGridOpacity({ tag, isOpacity, opacityValue }) { |
| | | let _mapViewsList = []; |
| | | if (this.mapViews) { |
| | | _mapViewsList.push(this.mapViews); |
| | | } |
| | | if (tag && this.mapViewsMap.has(tag)) { |
| | | _mapViewsList.push(this.mapViewsMap.get(tag)); |
| | | } else { |
| | | this.mapViewsMap.forEach((v) => { |
| | | _mapViewsList.push(v); |
| | | }); |
| | | } |
| | | _mapViewsList.forEach((v) => { |
| | | if (v.lastGridViews) { |
| | | v.lastGridViews.forEach((e) => { |
| | | e.setOptions({ |
| | | fillOpacity: |
| | | typeof opacityValue === 'number' |
| | | ? opacityValue |
| | | : isOpacity |
| | | ? 0.1 |
| | | : 0.7 |
| | | }); |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | setGridEvent(name, event) { |
| | | if (!this.events.has(name)) { |
| | | this.events.set(name, []); |
| | | } |
| | | const list = this.events.get(name); |
| | | if (list.length > 0) { |
| | | const lastEvent = list[list.length - 1]; |
| | | this.mapViews.gridViews.forEach((polygon) => { |
| | | polygon.off(name, lastEvent); |
| | | }); |
| | | } |
| | | this.events.get(name).push(event); |
| | | this.mapViews.gridViews.forEach((polygon) => { |
| | | polygon.on(name, event); |
| | | }); |
| | | } |
| | | |
| | | goBackGridEvent(name) { |
| | | if (this.events.has(name)) { |
| | | const eventList = this.events.get(name); |
| | | //å
ç§»é¤åæçäºä»¶ |
| | | const lastEvent = eventList.pop(); |
| | | this.mapViews.gridViews.forEach((polygon) => { |
| | | polygon.off(name, lastEvent); |
| | | }); |
| | | //è·åä¸ä¸ä¸ªäºä»¶ |
| | | const event = eventList.pop(); |
| | | this.mapViews.gridViews.forEach((polygon) => { |
| | | polygon.on(name, event); |
| | | }); |
| | | } |
| | | } |
| | | } |
| | |
| | | default: var(--el-component-size-default), |
| | | large: var(--el-component-size-large) |
| | | ); |
| | | $ws: (20, 40, 50, 60, 80, 100, 120, 150, 300); |
| | | $ws: (20, 40, 50, 60, 80, 100, 120, 150, 200, 250, 300); |
| | | @each $name, $value in $csize { |
| | | .w-#{$name} { |
| | | width: #{$value}; |
| | |
| | | |
| | | export default { |
| | | clear() { |
| | | map.off('zoomend', onMapZoom); |
| | | if (_cylinder != undefined) { |
| | | object3Dlayer.remove(_cylinder); |
| | | } |
| | |
| | | }, |
| | | |
| | | /** |
| | | * è·å两个ç»çº¬åº¦ä¹é´çè§åº¦ï¼0度-360åº¦ï¼ |
| | | */ |
| | | getAngle(lng_a, lat_a, lng_b, lat_b) { |
| | | var a = ((90 - lat_b) * Math.PI) / 180; |
| | | var b = ((90 - lat_a) * Math.PI) / 180; |
| | | var AOC_BOC = ((lng_b - lng_a) * Math.PI) / 180; |
| | | var cosc = |
| | | Math.cos(a) * Math.cos(b) + Math.sin(a) * Math.sin(b) * Math.cos(AOC_BOC); |
| | | var sinc = Math.sqrt(1 - cosc * cosc); |
| | | var sinA = (Math.sin(a) * Math.sin(AOC_BOC)) / sinc; |
| | | var A = (Math.asin(sinA) * 180) / Math.PI; |
| | | var res = 0; |
| | | if (lng_b > lng_a && lat_b > lat_a) res = A; |
| | | else if (lng_b > lng_a && lat_b < lat_a) res = 180 - A; |
| | | else if (lng_b < lng_a && lat_b < lat_a) res = 180 - A; |
| | | else if (lng_b < lng_a && lat_b > lat_a) res = 360 + A; |
| | | else if (lng_b > lng_a && lat_b == lat_a) res = 90; |
| | | else if (lng_b < lng_a && lat_b == lat_a) res = 270; |
| | | else if (lng_b == lng_a && lat_b > lat_a) res = 0; |
| | | else if (lng_b == lng_a && lat_b < lat_a) res = 180; |
| | | return res; |
| | | }, |
| | | |
| | | /** |
| | | * è·å两ç»çº¬åº¦é´çè·ç¦» |
| | | */ |
| | | getDistance(lng1, lat1, lng2, lat2) { |
| | | lat1 = lat1 || 0; |
| | | lng1 = lng1 || 0; |
| | | lat2 = lat2 || 0; |
| | | lng2 = lng2 || 0; |
| | | |
| | | var rad1 = (lat1 * Math.PI) / 180.0; |
| | | var rad2 = (lat2 * Math.PI) / 180.0; |
| | | var a = rad1 - rad2; |
| | | var b = (lng1 * Math.PI) / 180.0 - (lng2 * Math.PI) / 180.0; |
| | | var r = 6378137; |
| | | var distance = |
| | | r * |
| | | 2 * |
| | | Math.asin( |
| | | Math.sqrt( |
| | | Math.pow(Math.sin(a / 2), 2) + |
| | | Math.cos(rad1) * Math.cos(rad2) * Math.pow(Math.sin(b / 2), 2) |
| | | ) |
| | | ); |
| | | |
| | | return distance; |
| | | }, |
| | | |
| | | /** |
| | | * å°äºç»´æ°ç»å½¢å¼çåæ ç¹æ°ç»è½¬æ¢ä¸ºé«å¾·å°å¾ä¸ LngLat ç±» |
| | | * @param {*} lnglats |
| | | * @returns |
| | |
| | | * ç½æ ¼ç»å¶ |
| | | */ |
| | | import { map } from './index_old'; |
| | | import calculate from './calculate'; |
| | | import { Legend } from '@/model/Legend'; |
| | | import { getHexColor, getColorBetweenTwoColors } from '../color'; |
| | | |
| | | /** |
| | | * è§åº¦å¢åï¼ç¡®ä¿è§åº¦å¤äº0 - 360度ä¹é´ |
| | | * @param {number} angle åè§åº¦ |
| | | * @param {number} offset åç§»é |
| | | */ |
| | | function plusAngle(angle, offset) { |
| | | const result = angle + offset; |
| | | if (result > 360) { |
| | | return result - 360; |
| | | } else if (result < 0) { |
| | | return result + 360; |
| | | } else { |
| | | return result; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®ç½æ ¼ä¸å¿ç¹ï¼çææ£æ¹å½¢ç½æ ¼4个顶ç¹çåæ |
| | | * @param {Array} points ç½æ ¼ä¸å¿ç¹ç»çº¬åº¦æ°ç» |
| | | */ |
| | | function parseGridPoint(points) { |
| | | if (points.length < 2) throw new Error('åæ ç¹æ°éå°äº2'); |
| | | const p1 = points[0]; |
| | | const p2 = points[1]; |
| | | // 两ä¸å¿ç¹é´çè§åº¦ |
| | | const angle = calculate.getAngle(p1[0], p1[1], p2[0], p2[1]); |
| | | // const angle = calculate.bearing( |
| | | // { latitude: p1[0], longitude: p1[1] }, |
| | | // { latitude: p2[0], longitude: p2[1] } |
| | | // ); |
| | | // 两ä¸å¿ç¹é´çè·ç¦» |
| | | const dis = calculate.getDistance(p1[0], p1[1], p2[0], p2[1]); |
| | | // ç½æ ¼æ£æ¹å½¢å¯¹è§çº¿çä¸åé¿åº¦ |
| | | const halfDiagonal = Math.sqrt((dis / 2) * (dis / 2) * 2); |
| | | // 计ç®é¦ä¸ªæ£æ¹å½¢åé¡¶ç¹ç¸å¯¹äºä¸å¿ç¹çè§åº¦ï¼å¾å°æ£æ¹å½¢åé¡¶ç¹çåæ |
| | | const angle1 = plusAngle(angle, 45); |
| | | const gp1 = calculate.getLatLon(p1, halfDiagonal, angle1); |
| | | const angle2 = plusAngle(angle1, 90); |
| | | const gp2 = calculate.getLatLon(p1, halfDiagonal, angle2); |
| | | const angle3 = plusAngle(angle2, 90); |
| | | const gp3 = calculate.getLatLon(p1, halfDiagonal, angle3); |
| | | const angle4 = plusAngle(angle3, 90); |
| | | const gp4 = calculate.getLatLon(p1, halfDiagonal, angle4); |
| | | // 计ç®4个顶ç¹åå«ä¸ä¸å¿ç¹çç»çº¬åº¦å·®å¼ |
| | | const diff = { |
| | | diff1: { |
| | | dx: gp1[0] - p1[0], |
| | | dy: gp1[1] - p1[1] |
| | | }, |
| | | diff2: { |
| | | dx: gp2[0] - p1[0], |
| | | dy: gp2[1] - p1[1] |
| | | }, |
| | | diff3: { |
| | | dx: gp3[0] - p1[0], |
| | | dy: gp3[1] - p1[1] |
| | | }, |
| | | diff4: { |
| | | dx: gp4[0] - p1[0], |
| | | dy: gp4[1] - p1[1] |
| | | } |
| | | }; |
| | | |
| | | // å¾å°æææ£æ¹å½¢ç½æ ¼ç4个顶ç¹ä¿¡æ¯ |
| | | return points.map((p) => { |
| | | return [ |
| | | [p[0] + diff.diff1.dx, p[1] + diff.diff1.dy], |
| | | [p[0] + diff.diff2.dx, p[1] + diff.diff2.dy], |
| | | [p[0] + diff.diff3.dx, p[1] + diff.diff3.dy], |
| | | [p[0] + diff.diff4.dx, p[1] + diff.diff4.dy] |
| | | ]; |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * ææ¬æ è®° |
| | | * å¯ä¿®æ¹position |
| | | */ |
| | | function textMaker({ position, text, anchor, type, color }) { |
| | | let style = {}; |
| | | if (type == 'data') { |
| | | style = { |
| | | 'font-size': '12px', |
| | | 'text-align': 'center', |
| | | 'font-weight': 600, |
| | | color: color ? color : 'white', |
| | | background: '#122b54a9', |
| | | // background: 'white', |
| | | 'text-shadow': 'black 1px 1px 1px', |
| | | border: '0px', |
| | | 'margin-top': '4px' |
| | | }; |
| | | } else if (type == 'rank') { |
| | | style = { |
| | | 'font-size': '14px', |
| | | 'text-align': 'center', |
| | | color: color ? color : 'white', |
| | | background: 'transparent', |
| | | 'text-shadow': 'black 2px 2px 2px', |
| | | 'border-radius': '2px', |
| | | border: '1px solid #122b54a9', |
| | | // border: '1px solid rgba(255, 255, 255, 0.62)', |
| | | 'margin-bottom': '4px' |
| | | }; |
| | | } |
| | | // eslint-disable-next-line no-undef |
| | | return new AMap.Text({ |
| | | text: text, |
| | | anchor, |
| | | position: position, |
| | | style: style |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * æµ·éææ¬æ 注 |
| | | */ |
| | | function textLabelMarker(position, text, direction, style) { |
| | | // eslint-disable-next-line no-undef |
| | | return new AMap.LabelMarker({ |
| | | position: position, |
| | | zooms: [10, 20], |
| | | opacity: 1, |
| | | zIndex: 2, |
| | | // icon: { |
| | | // image: 'https://a.amap.com/jsapi_demos/static/images/poi-marker.png', |
| | | // anchor: 'bottom-center', |
| | | // size: [25, 34], |
| | | // clipOrigin: [459, 92], |
| | | // clipSize: [50, 68] |
| | | // }, |
| | | text: { |
| | | // 注æå
å®¹æ ¼å¼å¿
é¡»æ¯string |
| | | content: text ? text + '' : '', |
| | | direction: direction ? direction : 'center', |
| | | style: { |
| | | 'border-radius': '.25rem', |
| | | fontSize: 12, |
| | | fillColor: '#fff', |
| | | strokeColor: 'rgba(0, 0, 0, 1)', |
| | | strokeWidth: 4, |
| | | // backgroundColor: '#122b54a9', |
| | | padding: [3, 10], |
| | | // backgroundColor: 'yellow', |
| | | borderColor: '#ccc', |
| | | borderWidth: 30 |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * è®¡ç®æ¯ä¸ªç½æ ¼é¢è² |
| | | */ |
| | | function calGridColor({ factorName, data, isCustomColor }) { |
| | | let _colorList = []; |
| | | if (isCustomColor) { |
| | | var max, min; |
| | | data.forEach((t) => { |
| | | if (!t) return; |
| | | if (!max || t > max) { |
| | | max = t; |
| | | } |
| | | if (!min || t < min) { |
| | | min = t; |
| | | } |
| | | }); |
| | | data.forEach((d) => { |
| | | if (d) { |
| | | // æ ¹æ®é¥æµæ°æ®è®¡ç®ç½æ ¼é¢è² |
| | | const { color, nextColor, range, nextRange } = |
| | | Legend.getCustomColorAndNext(d, min, max); |
| | | const ratio = (d - range) / (nextRange - range); |
| | | |
| | | const _color = getColorBetweenTwoColors( |
| | | color.map((v) => v * 255), |
| | | nextColor.map((v) => v * 255), |
| | | ratio |
| | | ); |
| | | _colorList.push(_color); |
| | | } else { |
| | | _colorList.push(undefined); |
| | | } |
| | | }); |
| | | } else { |
| | | data.forEach((d) => { |
| | | if (d) { |
| | | // æ ¹æ®é¥æµæ°æ®è®¡ç®ç½æ ¼é¢è² |
| | | const { color, nextColor, range, nextRange } = |
| | | Legend.getStandardColorAndNext(factorName, d); |
| | | const ratio = (d - range) / (nextRange - range); |
| | | const _color = getColorBetweenTwoColors( |
| | | color.map((v) => v * 255), |
| | | nextColor.map((v) => v * 255), |
| | | ratio |
| | | ); |
| | | _colorList.push(_color); |
| | | } else { |
| | | _colorList.push(undefined); |
| | | } |
| | | }); |
| | | } |
| | | return _colorList; |
| | | } |
| | | |
| | | export default { |
| | | parseGridPoint, |
| | | |
| | | /** |
| | | * ç»å¶ç½æ ¼é£é©å¾ |
| | | * @param {*} points |
| | | */ |
| | | drawRectangle: function (points) { |
| | | drawRectangle(points) { |
| | | const gridViews = []; |
| | | points.forEach((p) => { |
| | | const { lb, rt, c } = p; |
| | | |
| | | // eslint-disable-next-line no-undef |
| | | let pList = [lb, rt].map((v) => new AMap.LngLat(v[0], v[1])); |
| | | let pList = [lb, rt].map((v) => { |
| | | // eslint-disable-next-line no-undef |
| | | return new AMap.LngLat(v[0], v[1]); |
| | | }); |
| | | // eslint-disable-next-line no-undef |
| | | var bounds = new AMap.Bounds(...pList); |
| | | // eslint-disable-next-line no-undef |
| | | var rectangle = new AMap.Rectangle({ |
| | | bounds: bounds, |
| | | // strokeColor: '#ffffffff', |
| | | strokeWeight: 0, |
| | | strokeOpacity: 0, |
| | | strokeColor: '#ffffffff', |
| | | strokeWeight: 1, |
| | | strokeOpacity: 1, |
| | | // strokeStyleè¿æ¯æ solid |
| | | strokeStyle: 'solid', |
| | | fillColor: '990D0D', |
| | | fillColor: '#990D0D', |
| | | fillOpacity: 0.8, |
| | | cursor: 'pointer', |
| | | zIndex: 50 |
| | | }); |
| | | |
| | | // var text = new AMap.Text({ |
| | | // text: p.value, |
| | | // anchor: 'center', // è®¾ç½®ææ¬æ è®°éç¹ |
| | | // draggable: false, |
| | | // style: { |
| | | // 'background-color': 'transparent', |
| | | // 'border-width': 0, |
| | | // 'text-align': 'center', |
| | | // 'font-size': '12px', |
| | | // color: 'white' |
| | | // }, |
| | | // position: c |
| | | // }); |
| | | gridViews.push(rectangle); |
| | | // that.textView.push(text); |
| | | }); |
| | | map.add(gridViews); |
| | | map.setFitView(gridViews); |
| | | }, |
| | | |
| | | /** |
| | | * ç»å¶ä¸ç»å¤è¾¹å½¢ |
| | | * @param {Array} points ç½æ ¼åæ ç¹æ°ç» |
| | | * @param {Boolean} draw æ¯å¦åå»ºå®æååæ¶ç»å¶ |
| | | */ |
| | | drawPolylines({ points, draw, event }) { |
| | | const gridViews = []; |
| | | points.forEach((p) => { |
| | | //å建å¤è¾¹å½¢ Polygon å®ä¾ |
| | | // eslint-disable-next-line no-undef |
| | | var polygon = new AMap.Polygon({ |
| | | path: p.path, //è·¯å¾ |
| | | fillColor: '#fff', //å¤è¾¹å½¢å¡«å
é¢è² |
| | | strokeWeight: 1, //线æ¡å®½åº¦ï¼é»è®¤ä¸º 2 |
| | | strokeColor: 'white', //线æ¡é¢è² |
| | | fillOpacity: 0, |
| | | extData: p.extData |
| | | }); |
| | | |
| | | if (typeof event === 'function') { |
| | | event(polygon); |
| | | } |
| | | gridViews.push(polygon); |
| | | }); |
| | | if (draw) { |
| | | map.add(gridViews); |
| | | map.setFitView(gridViews); |
| | | } |
| | | return gridViews; |
| | | }, |
| | | |
| | | drawGridText({ points, textViews, anchor, type, isCustomColor, useColor }) { |
| | | let colorList = []; |
| | | if (useColor) { |
| | | colorList = calGridColor({ |
| | | factorName: 'PM25', |
| | | data: points.map((p) => p.data), |
| | | isCustomColor: isCustomColor |
| | | }); |
| | | } |
| | | if (textViews) { |
| | | map.remove(textViews); |
| | | } |
| | | const _textViews = []; |
| | | points.forEach((p, i) => { |
| | | const m = textMaker({ |
| | | position: p.lnglat_GD, |
| | | text: p.data, |
| | | anchor, |
| | | type, |
| | | color: useColor ? colorList[i] : 'white' |
| | | }); |
| | | _textViews.push(m); |
| | | }); |
| | | // map.add(_textViews); |
| | | return { textViews: _textViews }; |
| | | }, |
| | | |
| | | drawGridTextLabel(points, textViews, labelsLayer, direction) { |
| | | if (textViews) { |
| | | points.forEach((p, i) => { |
| | | textViews[i].setPosition(p.lnglat_GD); |
| | | textViews[i].setText({ |
| | | content: p.data ? p.data + '' : '' |
| | | }); |
| | | }); |
| | | return { textViews, labelsLayer }; |
| | | } else { |
| | | // å建ä¸ä¸ª LabelsLayer å®ä¾æ¥æ¿è½½ LabelMarkerï¼[LabelsLayer ææ¡£](https://lbs.amap.com/api/jsapi-v2/documentation#labelslayer) |
| | | // eslint-disable-next-line no-undef |
| | | const labelsLayer = new AMap.LabelsLayer({ |
| | | zooms: [12, 20], |
| | | zIndex: 1000, |
| | | // å¼å¯æ 注é¿è®©ï¼é»è®¤ä¸ºå¼å¯ï¼v1.4.15 æ°å¢å±æ§ |
| | | collision: false, |
| | | // å¼å¯æ 注淡å
¥å¨ç»ï¼é»è®¤ä¸ºå¼å¯ï¼v1.4.15 æ°å¢å±æ§ |
| | | animation: false |
| | | }); |
| | | const _textViews = []; |
| | | points.forEach((p) => { |
| | | const m = textLabelMarker(p.lnglat_GD, p.data, direction); |
| | | _textViews.push(m); |
| | | // å° LabelMarker å®ä¾æ·»å å° LabelsLayer ä¸ |
| | | labelsLayer.add(m); |
| | | }); |
| | | map.add(labelsLayer); |
| | | // map.on('zoomend', () => { |
| | | // console.log(map.getZoom()); |
| | | // }); |
| | | return { textViews: _textViews, labelsLayer }; |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * æ ¹æ®é¥æµæ°æ®ï¼è®¾ç½®å¯¹åºç½æ ¼çæ åè²ï¼è¿åææ°æ®çç½æ ¼ |
| | | * @param {Array} gridViews ç½æ ¼å¤è¾¹å½¢å¯¹è±¡æ°ç» |
| | | * @param {Array} gridDataDetail 嫿饿µæ°æ®æ°ç» |
| | | * @param {string} factorName çæµå ååç§° |
| | | * @param {number} opacity éæåº¦ |
| | | */ |
| | | drawGridColor(gridViews, gridDataDetail, factorName, opacity, zIndex) { |
| | | const res = []; |
| | | // éå嫿饿µæ°æ®æ°ç» |
| | | gridDataDetail.forEach((d, i) => { |
| | | if (d.pm25) { |
| | | const grid = gridViews[i]; |
| | | |
| | | // æ ¹æ®é¥æµæ°æ®è®¡ç®ç½æ ¼é¢è² |
| | | const data = d.pm25; |
| | | const { color, nextColor, range, nextRange } = |
| | | Legend.getStandardColorAndNext(factorName, data); |
| | | const ratio = (data - range) / (nextRange - range); |
| | | const _color = getColorBetweenTwoColors( |
| | | color.map((v) => v * 255), |
| | | nextColor.map((v) => v * 255), |
| | | ratio |
| | | ); |
| | | grid.setOptions({ |
| | | zIndex: zIndex ? zIndex : 10, |
| | | fillColor: _color, |
| | | fillOpacity: opacity ? opacity : color[3] == 0 ? 0 : 0.7 |
| | | }); |
| | | |
| | | res.push(grid); |
| | | } |
| | | }); |
| | | |
| | | return res; |
| | | }, |
| | | |
| | | drawGridColorCustom(gridViews, gridDataDetail, opacity) { |
| | | var max, min; |
| | | gridDataDetail.forEach((t) => { |
| | | if (!t.pm25) return; |
| | | if (!max || t.pm25 > max) { |
| | | max = t.pm25; |
| | | } |
| | | if (!min || t.pm25 < min) { |
| | | min = t.pm25; |
| | | } |
| | | }); |
| | | const res = []; |
| | | // éå嫿饿µæ°æ®æ°ç» |
| | | gridDataDetail.forEach((d, i) => { |
| | | if (d.pm25) { |
| | | const grid = gridViews[i]; |
| | | |
| | | // æ ¹æ®é¥æµæ°æ®è®¡ç®ç½æ ¼é¢è² |
| | | const data = d.pm25; |
| | | const { color, nextColor, range, nextRange } = |
| | | Legend.getCustomColorAndNext(data, min, max); |
| | | const ratio = (data - range) / (nextRange - range); |
| | | |
| | | const _color = getColorBetweenTwoColors( |
| | | color.map((v) => v * 255), |
| | | nextColor.map((v) => v * 255), |
| | | ratio |
| | | ); |
| | | grid.setOptions({ |
| | | fillColor: _color, |
| | | fillOpacity: opacity ? opacity : color[3] == 0 ? 0 : 0.7 |
| | | }); |
| | | |
| | | res.push(grid); |
| | | } |
| | | }); |
| | | |
| | | return res; |
| | | } |
| | | }; |
| | |
| | | import calculate from './calculate'; |
| | | import { getHexColor } from '../color'; |
| | | |
| | | var _polylineArr = []; |
| | | // var _polylineArr = []; |
| | | const lineMap = new Map(); |
| | | |
| | | function newPolyline(path, color) { |
| | | // eslint-disable-next-line no-undef |
| | |
| | | |
| | | export default { |
| | | drawLine(fDatas, factor) { |
| | | const _polylineArr = []; |
| | | const lnglats_GD = fDatas.lnglats_GD; |
| | | const colors = factor.colors; |
| | | |
| | | if (_polylineArr) { |
| | | map.remove(_polylineArr); |
| | | _polylineArr = []; |
| | | } |
| | | // this.hideLine(); |
| | | |
| | | var path = calculate.parse2LngLat(lnglats_GD); |
| | | |
| | | let sIndex = 0; |
| | |
| | | // å°æçº¿æ·»å è³å°å¾å®ä¾ |
| | | map.add(_polylineArr); |
| | | return _polylineArr; |
| | | }, |
| | | |
| | | drawTagLine(tag, fDatas, factor) { |
| | | if (lineMap.has(tag)) { |
| | | const _polylineArr = lineMap.get(tag); |
| | | map.add(_polylineArr); |
| | | } else { |
| | | const _polylineArr = this.drawLine(fDatas, factor); |
| | | lineMap.set(tag, _polylineArr); |
| | | } |
| | | }, |
| | | |
| | | hideLine(tag) { |
| | | if (tag && lineMap.has(tag)) { |
| | | const _polylineArr = lineMap.get(tag); |
| | | map.remove(_polylineArr); |
| | | } else { |
| | | lineMap.forEach((v) => { |
| | | map.remove(v); |
| | | }); |
| | | } |
| | | } |
| | | }; |
| | |
| | | |
| | | <script> |
| | | import moment from 'moment'; |
| | | import mapUtil from '@/utils/map/util'; |
| | | import { useFetchData } from '@/composables/fetchData'; |
| | | import { TYPE0 } from '@/constant/device-type'; |
| | | import { defaultOptions } from '@/constant/radio-options'; |
| | |
| | | unmounted() { |
| | | this.clearFetchingTask(); |
| | | realTimeMapAnimation.stop(); |
| | | mapUtil.clearMap(); |
| | | } |
| | | }; |
| | | </script> |
| | |
| | | <template> |
| | | <div class="p-events-none m-t-2"></div> |
| | | <div class="p-events-none m-t-2"> |
| | | <el-row justify="space-between"> |
| | | <el-row class="wrap"> |
| | | <el-col span="2"> |
| | | <el-row> |
| | | <BaseCard v-show="show" size="medium" direction="left"> |
| | | <template #content> |
| | | <el-row> |
| | | <el-form :inline="true"> |
| | | <el-form-item label="èµ°èªèå"> |
| | | <el-select |
| | | v-model="selectedfusionData" |
| | | multiple |
| | | clearable |
| | | @change="handleChange" |
| | | placeholder="鿩任å¡" |
| | | size="small" |
| | | class="w-250" |
| | | :loading="fusionLoading" |
| | | > |
| | | <el-option |
| | | v-for="(s, i) in fusionDataList" |
| | | :key="i" |
| | | :label="s.mixDataId" |
| | | :value="i" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button |
| | | type="primary" |
| | | class="el-button-custom" |
| | | size="small" |
| | | :disabled=" |
| | | !gridCellList || selectedfusionData.length == 0 |
| | | " |
| | | @click="handleFusionClick" |
| | | > |
| | | {{ 'å å èå' }} |
| | | </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-row> |
| | | <div class="m-t-8">ç½æ ¼è¦ç´ </div> |
| | | <el-row class="m-t-8"> |
| | | <el-button |
| | | type="primary" |
| | | class="el-button-custom" |
| | | size="small" |
| | | @click="handleGridClick" |
| | | > |
| | | {{ gridVisible ? 'éèèå' : 'æ¾ç¤ºèå' }} |
| | | </el-button> |
| | | <el-button |
| | | type="primary" |
| | | class="el-button-custom" |
| | | size="small" |
| | | @click="handleRankClick" |
| | | > |
| | | {{ rankVisible ? 'éèæå' : 'æ¾ç¤ºæå' }} |
| | | </el-button> |
| | | <el-button |
| | | type="primary" |
| | | class="el-button-custom" |
| | | size="small" |
| | | @click="handleDataClick" |
| | | > |
| | | {{ dataVisible ? 'éèæ°æ®' : 'æ¾ç¤ºæ°æ®' }} |
| | | </el-button> |
| | | </el-row> |
| | | <div class="m-t-8">ç½æ ¼æ ·å¼</div> |
| | | <el-row class="m-t-8"> |
| | | <el-button |
| | | type="primary" |
| | | class="el-button-custom" |
| | | size="small" |
| | | @click="handleOpacityClick" |
| | | > |
| | | {{ !isOpacity ? 'éæå' : 'åæ¶éæå' }} |
| | | </el-button> |
| | | <el-button |
| | | type="primary" |
| | | class="el-button-custom" |
| | | size="small" |
| | | @click="handleColorClick" |
| | | > |
| | | {{ isStandardColor ? 'ç»å¶å¯¹æ¯è²' : 'ç»å¶æ åè²' }} |
| | | </el-button> |
| | | </el-row> |
| | | <div class="m-t-8">èµ°èªè¦ç´ </div> |
| | | <el-row class="m-t-8"> |
| | | <!-- <el-divider content-position="left"></el-divider> --> |
| | | |
| | | <el-button |
| | | type="primary" |
| | | class="el-button-custom" |
| | | size="small" |
| | | :loading="missionLoading || loading" |
| | | @click="handleUnderwayClick" |
| | | > |
| | | {{ underwayVisible ? 'éèèµ°èªè·¯çº¿' : 'æ¾ç¤ºèµ°èªè·¯çº¿' }} |
| | | </el-button> |
| | | </el-row> |
| | | </template> |
| | | <template #footer> </template> |
| | | </BaseCard> |
| | | </el-row> |
| | | </el-col> |
| | | <el-col span="2"> |
| | | <el-row> |
| | | <CardButton |
| | | name="èµ°èªèå" |
| | | direction="right" |
| | | @click="() => (show = !show)" |
| | | ></CardButton> |
| | | </el-row> |
| | | </el-col> |
| | | </el-row> |
| | | </el-row> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup></script> |
| | | <script setup> |
| | | import { ref, onMounted, onUnmounted, watch } from 'vue'; |
| | | import moment from 'moment'; |
| | | import gridApi from '@/api/gridApi'; |
| | | import { SatelliteGrid } from '@/model/SatelliteGrid'; |
| | | |
| | | const satelliteGrid = new SatelliteGrid(); |
| | | |
| | | // åç¨å«æé¥æµæ¨¡åä¸ç100ç±³ç½æ ¼ |
| | | const props = defineProps({ |
| | | groupId: { |
| | | type: Number, |
| | | default: 3 |
| | | } |
| | | }); |
| | | const show = ref(true); |
| | | |
| | | const mission = ref(undefined); |
| | | |
| | | const gridCellList = ref(undefined); |
| | | const fusionData = ref(undefined); |
| | | // èµ°èªèåæ°æ® |
| | | const fusionLoading = ref(false); |
| | | const fusionDataList = ref([]); |
| | | const selectedfusionData = ref([]); |
| | | |
| | | const gridDataDetailMap = new Map(); |
| | | |
| | | const gridVisible = ref(true); |
| | | const underwayVisible = ref(false); |
| | | const rankVisible = ref(false); |
| | | const dataVisible = ref(false); |
| | | const isStandardColor = ref(true); |
| | | const isOpacity = ref(false); |
| | | |
| | | function timeFormatter(value) { |
| | | return moment(value).format('YYYY-MM-DD'); |
| | | } |
| | | |
| | | function fetchFusionData() { |
| | | fusionLoading.value = true; |
| | | gridApi |
| | | .fetchGridData(props.groupId, undefined, 3) |
| | | .then((res) => { |
| | | fusionDataList.value = res.data; |
| | | }) |
| | | .finally(() => (fusionLoading.value = false)); |
| | | } |
| | | |
| | | // æ£æ¥èµ°èªæ°æ®æ¯å¦å100ç±³ç½æ ¼å·²èå |
| | | // function checkUnderwayFusionResult() { |
| | | // const time = moment(mission.value.startTime).format('YYYY-MM-DD HH:mm:ss'); |
| | | // gridApi.fetchGridData(props.groupId, time, 3).then((res) => { |
| | | // if (res.data.length > 0) { |
| | | // fusionData.value = res.data[0]; |
| | | // } else { |
| | | // fusionData.value = undefined; |
| | | // } |
| | | // }); |
| | | // } |
| | | |
| | | function resetButton() { |
| | | gridVisible.value = true; |
| | | underwayVisible.value = false; |
| | | rankVisible.value = false; |
| | | dataVisible.value = false; |
| | | isStandardColor.value = true; |
| | | isOpacity.value = false; |
| | | } |
| | | |
| | | function prepareGrid(gridInfo) { |
| | | satelliteGrid.gridPrepare(gridInfo); |
| | | } |
| | | |
| | | // ç»å¶ç½æ ¼é¥ææ°æ®å¼åç½æ ¼é¢è² |
| | | function drawGrid(gridDataDetail) { |
| | | satelliteGrid.drawGrid({ gridDataDetail, opacity: 1, zIndex: 11 }); |
| | | } |
| | | |
| | | // watch(mission, (nV, oV) => { |
| | | // if (nV != oV) { |
| | | // checkUnderwayFusionResult(); |
| | | // search(nV); |
| | | // } |
| | | // }); |
| | | |
| | | watch( |
| | | () => props.groupId, |
| | | (nV, oV) => { |
| | | if (nV != oV) { |
| | | gridApi.fetchGridCell(nV).then((res) => { |
| | | gridCellList.value = res.data; |
| | | prepareGrid(gridCellList.value); |
| | | }); |
| | | fetchFusionData(); |
| | | } |
| | | }, |
| | | { |
| | | immediate: true |
| | | } |
| | | ); |
| | | |
| | | function handleFusionClick() { |
| | | // resetButton(); |
| | | satelliteGrid.changeVisibility({ showGridViews: false }); |
| | | selectedfusionData.value.forEach((i) => { |
| | | const d = fusionDataList.value[i]; |
| | | if (gridDataDetailMap.has(d.id)) { |
| | | // const gdd = gridDataDetailMap.get(d.id); |
| | | // satelliteGrid.drawTagGrid({ |
| | | // tag: d.id, |
| | | // gridDataDetail: gdd, |
| | | // opacity: 1, |
| | | // zIndex: 11 |
| | | // }); |
| | | satelliteGrid.changeVisibility({ tag: d.id, showGridViews: true }); |
| | | } else { |
| | | gridApi.fetchGridDataDetail(d.id, d.groupId).then((res) => { |
| | | gridDataDetailMap.set(d.id, res.data); |
| | | const gdd = res.data; |
| | | satelliteGrid.drawTagGrid({ |
| | | tag: d.id, |
| | | gridDataDetail: gdd, |
| | | opacity: 1, |
| | | zIndex: 11 |
| | | }); |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function handleGridClick() { |
| | | gridVisible.value = !gridVisible.value; |
| | | selectedfusionData.value.forEach((i) => { |
| | | const d = fusionDataList.value[i]; |
| | | satelliteGrid.changeVisibility({ |
| | | tag: d.id, |
| | | showGridViews: gridVisible.value |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | function handleUnderwayClick() { |
| | | underwayVisible.value = !underwayVisible.value; |
| | | underwayVisible.value ? draw() : mapLine.hideLine(); |
| | | } |
| | | |
| | | function handleRankClick() { |
| | | rankVisible.value = !rankVisible.value; |
| | | selectedfusionData.value.forEach((i) => { |
| | | const d = fusionDataList.value[i]; |
| | | satelliteGrid.changeVisibility({ |
| | | tag: d.id, |
| | | showRankTxt: rankVisible.value |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | function handleDataClick() { |
| | | dataVisible.value = !dataVisible.value; |
| | | selectedfusionData.value.forEach((i) => { |
| | | const d = fusionDataList.value[i]; |
| | | satelliteGrid.changeVisibility({ |
| | | tag: d.id, |
| | | showDataTxt: dataVisible.value |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | function handleColorClick() { |
| | | isStandardColor.value = !isStandardColor.value; |
| | | selectedfusionData.value.forEach((i) => { |
| | | const d = fusionDataList.value[i]; |
| | | if (gridDataDetailMap.has(d.id)) { |
| | | const gdd = gridDataDetailMap.get(d.id); |
| | | satelliteGrid.drawTagGrid({ |
| | | tag: d.id, |
| | | gridDataDetail: gdd, |
| | | useCustomColor: !isStandardColor.value, |
| | | opacity: 1, |
| | | zIndex: 11 |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function handleOpacityClick() { |
| | | isOpacity.value = !isOpacity.value; |
| | | satelliteGrid.changeGridOpacity({ opacityValue: isOpacity.value ? 0.1 : 1 }); |
| | | } |
| | | |
| | | /**èµ°èªè½¨è¿¹*******************************************************************/ |
| | | import { FactorDatas } from '@/model/FactorDatas'; |
| | | import sector from '@/utils/map/sector'; |
| | | import mapLine from '@/utils/map/line'; |
| | | import mapUtil from '@/utils/map/util'; |
| | | import { fetchHistoryData } from '@/utils/factor/data'; |
| | | import { useFetchData } from '@/composables/fetchData'; |
| | | import { useMissionStore } from '@/stores/mission'; |
| | | |
| | | onMounted(() => { |
| | | isUnmounted.value = false; |
| | | fetchMission(); |
| | | }); |
| | | onUnmounted(() => { |
| | | mapUtil.clearMap(); |
| | | isUnmounted.value = true; |
| | | }); |
| | | const { loading, fetchData } = useFetchData(10000); |
| | | |
| | | const missionStore = useMissionStore(); |
| | | const missionLoading = ref(false); |
| | | |
| | | const isUnmounted = ref(false); |
| | | |
| | | const drawMode = ref(0); |
| | | // çæµæ°æ® |
| | | const factorDataMap = new Map(); |
| | | // pm2.5 |
| | | const factorType = 6; |
| | | |
| | | function fetchMission() { |
| | | missionLoading.value = true; |
| | | missionStore.fetchMission().finally(() => (missionLoading.value = false)); |
| | | } |
| | | |
| | | function search(option) { |
| | | const { deviceType, deviceCode, startTime, endTime } = option; |
| | | const _startTime = moment(startTime).format('YYYY-MM-DD HH:mm:ss'); |
| | | const _endTime = moment(endTime).format('YYYY-MM-DD HH:mm:ss'); |
| | | return fetchData((page, pageSize) => { |
| | | return fetchHistoryData({ |
| | | deviceType, |
| | | deviceCode, |
| | | startTime: _startTime, |
| | | endTime: _endTime, |
| | | page, |
| | | perPage: pageSize |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | function draw() { |
| | | if (isUnmounted.value) return; |
| | | |
| | | selectedfusionData.value.forEach((i) => { |
| | | const d = fusionDataList.value[i]; |
| | | |
| | | const mission = missionStore.missionList.find((v) => { |
| | | return v.missionCode == d.mixDataId; |
| | | }); |
| | | |
| | | if (factorDataMap.has(mission.missionCode)) { |
| | | const fd = factorDataMap.get(mission.missionCode); |
| | | drawLine(mission.missionCode, fd); |
| | | } else { |
| | | search(mission).then((res) => { |
| | | const fd = new FactorDatas(); |
| | | fd.setData(res.data, drawMode.value, () => { |
| | | fd.refreshHeight(factorType.value); |
| | | factorDataMap.set(mission.missionCode, fd); |
| | | drawLine(mission.missionCode, fd); |
| | | }); |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function drawLine(missionCode, fd) { |
| | | // å·æ°å¾ä¾ |
| | | const factor = fd.factor[factorType]; |
| | | sector.clearSector(); |
| | | fd.refreshHeight(factorType); |
| | | mapLine.drawTagLine(missionCode, fd, factor); |
| | | } |
| | | </script> |
| | | <style scoped></style> |