/** * 环境风险 */ // const EnvironmentRiskIndex = require('@components/BaseNav/').default // 请求接口数据 const mapApi = require('../../../api/mapApi').default // 使用封装方法 const AnimalService = require('../service/AnimalService').default // 引入echarts基本组件 const echarts = require('echarts/lib/echarts') module.exports = function () { /** * 返回marker对象数组 * @param L leaflet对象 */ this.init = async (layer, L) => { this.animalService = new AnimalService({ L: L, layer: layer }) const result = await mapApi.getRiskEnterprise() const features = result.features for (var i = 0; i < features.length; i++) { const feature = features[i] const geometry = feature.geometry const properties = feature.properties const qyId = properties.QY_ID // const qyJc = properties.QY_JC const distract = properties.DISTRACT const coordinates = geometry.coordinates if (distract !== '长江沿线') { continue } const bgMarker = L.marker([coordinates[1], coordinates[0]], { icon: L.divIcon({ className: '', iconAnchor: [15, 45], iconSize: [40, 40], html: '
' }) }) layer.addLayer(bgMarker) const chartMarker = L.marker([coordinates[1], coordinates[0]], { icon: L.divIcon({ className: '', iconAnchor: [30, 60], iconSize: [70, 70], html: '' }) }) layer.addLayer(chartMarker) chartRender(properties) } } /** * tips * @param layer * @returns {string} */ this.bindTooltip = (layer) => { } /** * 点击弹窗 * @param e */ this.clickListener = (e) => { } function chartRender (properties) { const qyId = properties.QY_ID const qyjc = properties.QY_JC // const qyQc = properties.QY_QC const num = properties.QY_NUM const oneLevel = properties.QY_ONELEVEL const twoLevel = properties.QY_TWOLEVEL const threeLevel = properties.QY_THREELEVEL const o = echarts.init(document.getElementById('qy_id_' + qyId)) const option = { tooltip: { trigger: 'item', formatter: function (e) { return '