lion 5 hours ago
parent ba3d5d7890
commit 40b31a06b5

@ -211,7 +211,7 @@ export default {
methods: {
//
async getChartData() {
const res = await fenleiCharts()
await fenleiCharts() // 使
const home = await homeCharts()
//
this.topObj.map(item => {
@ -226,15 +226,6 @@ export default {
// this.yData.push(home.rate[item.id])
// })
console.log(this.xData, this.yData)
res.upList.map(item => {
item.img = this.imgList[item.name]
})
this.upList = this.mergeAndRename(res.upList)
// res.upListByFloodMaterials.map(item => {
// item.img = this.imgList[item.name]
// })
// this.upListByFloodMaterials = this.mergeAndRename(res.upListByFloodMaterials)
//
if (home.teamArea && Array.isArray(home.teamArea)) {
@ -252,6 +243,36 @@ export default {
floodMaterials: item.floodMaterials || []
}))
//
//
const materialMap = new Map()
home.teamArea.forEach(area => {
if (area.floodMaterials && Array.isArray(area.floodMaterials)) {
area.floodMaterials.forEach(material => {
const materialName = material.value
const materialTotal = material.flood_materials_total || 0
const materialUnit = material.remark || ''
if (materialMap.has(materialName)) {
//
materialMap.get(materialName).value += materialTotal
} else {
//
const imgKey = this.getImgKey(materialName)
materialMap.set(materialName, {
name: materialName,
value: materialTotal,
unit: materialUnit,
img: this.imgList[imgKey] || this.imgList['动力及照明类']
})
}
})
}
})
//
this.upList = Array.from(materialMap.values())
//
if (this.areaList.length > 0) {
this.currentArea = this.areaList[0].id

Loading…
Cancel
Save