|
|
|
@ -12,6 +12,9 @@
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="jscC-center">
|
|
|
|
<div class="jscC-center">
|
|
|
|
<div class="jscC-center-left" >
|
|
|
|
<div class="jscC-center-left" >
|
|
|
|
|
|
|
|
<div class="jscC-center-top">
|
|
|
|
|
|
|
|
<WarehouseTable></WarehouseTable>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<!-- <Pie3DChart :data="upList"></Pie3DChart> -->
|
|
|
|
<!-- <Pie3DChart :data="upList"></Pie3DChart> -->
|
|
|
|
<div class="jscC-center-left-title">重要防汛物资</div>
|
|
|
|
<div class="jscC-center-left-title">重要防汛物资</div>
|
|
|
|
<div class="jscC-center-left-content">
|
|
|
|
<div class="jscC-center-left-content">
|
|
|
|
@ -58,16 +61,20 @@ import Bar3DChart from '../jsc/components/barChart.vue'
|
|
|
|
import fenleiChart from '../jsc/components/fenleiChart.vue'
|
|
|
|
import fenleiChart from '../jsc/components/fenleiChart.vue'
|
|
|
|
import Pie3DChart from '../jsc/components/pieChart.vue'
|
|
|
|
import Pie3DChart from '../jsc/components/pieChart.vue'
|
|
|
|
import echartsMap from './components/mapChart.vue'
|
|
|
|
import echartsMap from './components/mapChart.vue'
|
|
|
|
|
|
|
|
import WarehouseTable from './components/WarehouseTable.vue'
|
|
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
fenleiCharts,
|
|
|
|
fenleiCharts,
|
|
|
|
homeCharts
|
|
|
|
homeCharts,
|
|
|
|
|
|
|
|
|
|
|
|
} from '@/api/charts.js'
|
|
|
|
} from '@/api/charts.js'
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
components: {
|
|
|
|
Bar3DChart,
|
|
|
|
Bar3DChart,
|
|
|
|
Pie3DChart,
|
|
|
|
Pie3DChart,
|
|
|
|
echartsMap,
|
|
|
|
echartsMap,
|
|
|
|
fenleiChart
|
|
|
|
fenleiChart,
|
|
|
|
|
|
|
|
WarehouseTable
|
|
|
|
},
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
@ -169,7 +176,7 @@ export default {
|
|
|
|
'移动泵车':require('@/assets/bengche.jpg'),
|
|
|
|
'移动泵车':require('@/assets/bengche.jpg'),
|
|
|
|
'桩类':require('@/assets/zhuanglei.jpg'),
|
|
|
|
'桩类':require('@/assets/zhuanglei.jpg'),
|
|
|
|
'砂石类':require('@/assets/shashi.jpg'),
|
|
|
|
'砂石类':require('@/assets/shashi.jpg'),
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
computed: {
|
|
|
|
@ -190,7 +197,6 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
this.calculateScreenSize()
|
|
|
|
this.calculateScreenSize()
|
|
|
|
window.addEventListener('resize', this.calculateScreenSize)
|
|
|
|
window.addEventListener('resize', this.calculateScreenSize)
|
|
|
|
this.startAutoSwitch()
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
beforeRouteLeave(to, from, next) {
|
|
|
|
beforeRouteLeave(to, from, next) {
|
|
|
|
this.$store.dispatch('app/toggleSideBar')
|
|
|
|
this.$store.dispatch('app/toggleSideBar')
|
|
|
|
@ -219,17 +225,6 @@ export default {
|
|
|
|
this.yData.push(home.rate[item.id])
|
|
|
|
this.yData.push(home.rate[item.id])
|
|
|
|
})
|
|
|
|
})
|
|
|
|
console.log(this.xData, this.yData)
|
|
|
|
console.log(this.xData, this.yData)
|
|
|
|
//
|
|
|
|
|
|
|
|
// this.apiData = res.fenleiLevel1
|
|
|
|
|
|
|
|
// this.chartDataMap = this.convertFenleiToChartDataMap(this.apiData)
|
|
|
|
|
|
|
|
// let arr = []
|
|
|
|
|
|
|
|
// res.upList.map(item=>{
|
|
|
|
|
|
|
|
// arr.push({
|
|
|
|
|
|
|
|
// name:item.name,
|
|
|
|
|
|
|
|
// value:item.total,
|
|
|
|
|
|
|
|
// unit:item.unit
|
|
|
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
res.upList.map(item=>{
|
|
|
|
res.upList.map(item=>{
|
|
|
|
item.img = this.imgList[item.name]
|
|
|
|
item.img = this.imgList[item.name]
|
|
|
|
})
|
|
|
|
})
|
|
|
|
@ -278,79 +273,7 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
return Array.from(resultMap.values());
|
|
|
|
return Array.from(resultMap.values());
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 处理分类数据
|
|
|
|
|
|
|
|
convertFenleiToChartDataMap(fenleiLevel1) {
|
|
|
|
|
|
|
|
const chartDataMap = {}
|
|
|
|
|
|
|
|
this.typeList = []
|
|
|
|
|
|
|
|
fenleiLevel1.forEach(level1 => {
|
|
|
|
|
|
|
|
const level1Name = level1.value
|
|
|
|
|
|
|
|
// 一级
|
|
|
|
|
|
|
|
this.typeList.push(level1Name)
|
|
|
|
|
|
|
|
const level1Arr = [{
|
|
|
|
|
|
|
|
value: level1.details.reduce((sum, d) => sum + (d.total_count || 0), 0), // 或自定义总数
|
|
|
|
|
|
|
|
name: level1Name
|
|
|
|
|
|
|
|
}]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 二级
|
|
|
|
|
|
|
|
const level2Arr = []
|
|
|
|
|
|
|
|
// 三级
|
|
|
|
|
|
|
|
const level3Arr = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(level1.details || []).forEach(level2 => {
|
|
|
|
|
|
|
|
// 二级 value 为其所有 inventorys 的 total_count 之和
|
|
|
|
|
|
|
|
let level2Value = 0;
|
|
|
|
|
|
|
|
(level2.inventorys || []).forEach(inv => {
|
|
|
|
|
|
|
|
level2Value += Number(inv.total_count) || 0
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
// 如果没有三级,直接用 total_count 字段
|
|
|
|
|
|
|
|
if (level2Value === 0) level2Value = level2.total_count || 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
level2Arr.push({
|
|
|
|
|
|
|
|
value: level2Value,
|
|
|
|
|
|
|
|
name: level2.value
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 三级
|
|
|
|
|
|
|
|
(level2.inventorys || []).forEach(inv => {
|
|
|
|
|
|
|
|
level3Arr.push({
|
|
|
|
|
|
|
|
value: inv.total_count,
|
|
|
|
|
|
|
|
name: inv.jiliangdanwei,
|
|
|
|
|
|
|
|
parent: level2.value
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
chartDataMap[level1Name] = {
|
|
|
|
|
|
|
|
level1: level1Arr,
|
|
|
|
|
|
|
|
level2: level2Arr,
|
|
|
|
|
|
|
|
level3: level3Arr
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return chartDataMap
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
// 启动自动切换
|
|
|
|
|
|
|
|
startAutoSwitch() {
|
|
|
|
|
|
|
|
clearInterval(this.autoTimer)
|
|
|
|
|
|
|
|
let idx = this.typeList.indexOf(this.activeType)
|
|
|
|
|
|
|
|
this.autoTimer = setInterval(() => {
|
|
|
|
|
|
|
|
idx = (idx + 1) % this.typeList.length
|
|
|
|
|
|
|
|
this.activeType = this.typeList[idx]
|
|
|
|
|
|
|
|
}, 5000) // 10秒
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
// 停止自动切换,并在20秒后恢复
|
|
|
|
|
|
|
|
stopAutoSwitchAndResumeLater() {
|
|
|
|
|
|
|
|
clearInterval(this.autoTimer)
|
|
|
|
|
|
|
|
clearTimeout(this.resumeTimer)
|
|
|
|
|
|
|
|
this.resumeTimer = setTimeout(() => {
|
|
|
|
|
|
|
|
this.startAutoSwitch()
|
|
|
|
|
|
|
|
}, 10000) // 20秒
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
// 按钮点击事件
|
|
|
|
|
|
|
|
handleTypeClick(type) {
|
|
|
|
|
|
|
|
this.activeType = type
|
|
|
|
|
|
|
|
this.stopAutoSwitchAndResumeLater()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
setRem() {
|
|
|
|
setRem() {
|
|
|
|
// 默认使用100px作为基准大小
|
|
|
|
// 默认使用100px作为基准大小
|
|
|
|
const baseSize = 100
|
|
|
|
const baseSize = 100
|
|
|
|
@ -444,7 +367,7 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
// flex-wrap: wrap;
|
|
|
|
// flex-wrap: wrap;
|
|
|
|
&-left {
|
|
|
|
&-left {
|
|
|
|
height: 400px;
|
|
|
|
// height: 400px;
|
|
|
|
&-title {
|
|
|
|
&-title {
|
|
|
|
color: #6dcde6;
|
|
|
|
color: #6dcde6;
|
|
|
|
text-align: center;
|
|
|
|
text-align: center;
|
|
|
|
|