diff --git a/src/views/sponeScreen/gisMF/legendKF.vue b/src/views/sponeScreen/gisMF/legendKF.vue index 8176b6d..fd171ce 100644 --- a/src/views/sponeScreen/gisMF/legendKF.vue +++ b/src/views/sponeScreen/gisMF/legendKF.vue @@ -231,25 +231,25 @@ timeType: 'month', }); let datas = res.data || []; - datas.forEach(item => { - item.name = item.stName + '/' + item.rainCumulative + 'mm'; - }); console.log('雨量站历史数据---', datas, localStorage.getItem('setRainDateKF')); item.rainData = newfiberMapBoxVectorLayer.getGeojsonData(datas); + // 渲染文字和降雨量 + item.rainData.features.forEach(feature => { + feature.properties.name = feature.properties.stName + '/' + feature.properties.rainCumulative + 'mm'; + }); + console.log('雨量站历史数据---', item.rainData); item.dataArea = newfiberMapBoxVectorLayer.getPolygonGeojson(datas); newfiberMapBoxVectorLayer.addGeojsonSymbol(item.layername, item.rainData, rainStation_icon); item.dataArea.features.forEach(feature => { - console.log(Number(feature.properties.rainCumulative)); // 实时降雨量范围不同颜色 小-中-大 - if (Number(feature.properties.rainCumulative) <= 0.3) { - feature.properties.fillcolor = 'rgba(41, 184, 219,0.7)'; - } else if (Number(feature.properties.rainCumulative) > 0.3 && Number(feature.properties.rainCumulative) <= 0.8) { - feature.properties.fillcolor = 'rgba(255, 237, 82,0.7)'; - } else if (Number(feature.properties.rainCumulative) > 0.8) { - feature.properties.fillcolor = 'rgba(255, 69, 69,0.7)'; + if (Number(feature.properties.rainCumulative) <= 10) { + feature.properties.fillcolor = 'rgba(41, 184, 219,0.4)'; + } else if (Number(feature.properties.rainCumulative) > 10 && Number(feature.properties.rainCumulative) <= 25) { + feature.properties.fillcolor = 'rgba(255, 237, 82,0.4)'; + } else if (Number(feature.properties.rainCumulative) > 25) { + feature.properties.fillcolor = 'rgba(255, 69, 69,0.4)'; } }); - console.log('item.dataArea---', item.dataArea); newfiberMapBoxVectorLayer.addGeojsonPolygon(item.layername + '_area', item.dataArea); } else { // 实时降雨数据