Browse Source

养护大屏各乡镇养护得分趋势模块数据显示错误

dev
巴林闲侠 2 years ago
parent
commit
cd50a4b7d5
  1. 28
      web/client/src/sections/quanju/containers/footer/conserve/left/left-center.js

28
web/client/src/sections/quanju/containers/footer/conserve/left/left-center.js

@ -27,27 +27,41 @@ const LeftCenter = (props) => {
dispatch(getNearestAssessData({ monthRange: 6 })).then(res => {
if (res.success) {
let nextChartSeries = []
let nextXAxis = new Set()
let nextXAxis = []
let data = res.payload.data
data.reverse()
for (let d of data) {
let corUnitSeries = nextChartSeries.find(item => item.name == d.unit)
let month = moment(d.month).format('YYYY-MM')
nextXAxis.add(month)
let curMonthIndex = nextXAxis.findIndex(item => item == month)
if (curMonthIndex < 0) {
nextXAxis.push(month)
curMonthIndex = nextXAxis.length - 1
}
if (corUnitSeries) {
corUnitSeries.data.push(d.totalPoints)
corUnitSeries.data[curMonthIndex] = d.totalPoints
} else {
nextChartSeries.push({
let nextnextChartSerie = {
type: 'line',
smooth: true,
data: [d.totalPoints],
data: [],
name: d.unit,
})
}
nextnextChartSerie.data[curMonthIndex] = d.totalPoints
nextChartSeries.push(nextnextChartSerie)
}
}
for (let s of nextChartSeries) {
for (let i = 0; i < nextXAxis.length; i++) {
if (!s.data[i] && s.data[i] != 0) {
s.data[i] = undefined
}
}
}
setChartData({
series: nextChartSeries,
xAxis: [...nextXAxis]
xAxis: nextXAxis
})
}
})

Loading…
Cancel
Save