驾驶舱对接
This commit is contained in:
@@ -1,25 +1,29 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2024-05-07 10:25:10
|
||||
* @LastEditTime: 2024-05-13 15:48:10
|
||||
* @LastEditTime: 2024-05-16 15:31:20
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div class="energy-copilot">
|
||||
<Container title="仓库监控·当前" icon="ware">
|
||||
<StockMonitorVue :period="period" />
|
||||
</Container>
|
||||
<Container title="天然气能耗" icon="gas">
|
||||
<NatGasVue :period="period" />
|
||||
</Container>
|
||||
<Container title="电能耗" icon="flash">
|
||||
<ElecCostVue :period="period" />
|
||||
</Container>
|
||||
<Container title="水能耗" icon="water">
|
||||
<WaterCostVue :period="period" />
|
||||
</Container>
|
||||
<section class="top flex">
|
||||
<Container title="仓库监控·当前" icon="ware">
|
||||
<StockMonitorVue :stockDOData="stockDOData" :period="period" />
|
||||
</Container>
|
||||
<Container title="天然气能耗" icon="gas">
|
||||
<NatGasVue :period="period" />
|
||||
</Container>
|
||||
</section>
|
||||
<section class="bottom flex">
|
||||
<Container title="电能耗" icon="flash">
|
||||
<ElecCostVue :period="period" />
|
||||
</Container>
|
||||
<Container title="水能耗" icon="water">
|
||||
<WaterCostVue :period="period" />
|
||||
</Container>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -29,7 +33,7 @@ import StockMonitorVue from "./components/StockMonitor.vue";
|
||||
import ElecCostVue from "./components/ElecCost.vue";
|
||||
import NatGasVue from "./components/NatGas.vue";
|
||||
import WaterCostVue from "./components/WaterCost.vue";
|
||||
|
||||
import { getEnergySumPage } from '@/api/energy'
|
||||
export default {
|
||||
name: "EnergyCopilot",
|
||||
components: {
|
||||
@@ -46,7 +50,9 @@ export default {
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
return {
|
||||
stockDOData:[],
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
period: {
|
||||
@@ -61,12 +67,122 @@ export default {
|
||||
fetchData(period = "日") {
|
||||
// console.log(this.width);
|
||||
// console.log('sidebar', this.$store.getters.sidebar);
|
||||
console.log(`效率驾驶舱,获取${period}数据`);
|
||||
console.log(`综合驾驶舱,获取${period}数据`);
|
||||
// this.getData(this.period)
|
||||
this.$store.dispatch("copilot/initCopilot", {
|
||||
period,
|
||||
source: "comprehensive",
|
||||
source: "energy",
|
||||
});
|
||||
// this.$store.dispatch("copilot/initCopilot", {
|
||||
// period,
|
||||
// source: "comprehensive",
|
||||
// });
|
||||
},
|
||||
dedupe(array){
|
||||
return Array.from(new Set(array));
|
||||
},
|
||||
async getData(period) {
|
||||
let date = null
|
||||
switch (period) {
|
||||
case "日":
|
||||
date = 1;
|
||||
break;
|
||||
case "周":
|
||||
date = 2;
|
||||
break;
|
||||
case "月":
|
||||
date = 3;
|
||||
break;
|
||||
case "年":
|
||||
date = 4;
|
||||
break;
|
||||
default:
|
||||
date = 1;
|
||||
break;
|
||||
}
|
||||
const res = await getEnergySumPage({
|
||||
// factorys:[],
|
||||
date
|
||||
})
|
||||
let factoryArr = [
|
||||
{
|
||||
id: 0,
|
||||
name: '瑞昌中建材光电材料有限公司',
|
||||
stockData: [],
|
||||
waterData: [],
|
||||
elsData: [],
|
||||
gasData: [],
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
name: '邯郸中建材光电材料有限公司',
|
||||
stockData: [],
|
||||
waterData: [],
|
||||
elsData: [],
|
||||
gasData: [],
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '中建材株洲光电材料有限公司',
|
||||
stockData: [],
|
||||
waterData: [],
|
||||
elsData: [],
|
||||
gasData: [],
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: '佳木斯中建材光电材料有限公司',
|
||||
stockData: [],
|
||||
waterData: [],
|
||||
elsData: [],
|
||||
gasData: [],
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: '成都中建材光电材料有限公司',
|
||||
stockData: [],
|
||||
waterData: [],
|
||||
elsData: [],
|
||||
gasData: [],
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: '凯盛光伏材料有限公司',
|
||||
stockData: [],
|
||||
waterData: [],
|
||||
elsData: [],
|
||||
gasData: [],
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: '蚌埠兴科玻璃有限公司',
|
||||
stockData: [],
|
||||
waterData: [],
|
||||
elsData: [],
|
||||
gasData: [],
|
||||
},
|
||||
]
|
||||
for (let i in res.data.stockDO) {
|
||||
const index = factoryArr.findIndex(item => item.id == res.data.stockDO[i].factory)
|
||||
if (index != -1) {
|
||||
res.data.stockDO[i].stockInfo.forEach(ele => {
|
||||
factoryArr[index].stockData.push(ele)
|
||||
});
|
||||
}
|
||||
}
|
||||
let stockDOData = []
|
||||
factoryArr.forEach((ele, index) => [
|
||||
stockDOData[index]= [],
|
||||
ele.stockData.forEach((item) => {
|
||||
let obj = {}
|
||||
obj.name = item.glassType == 0 ? '玻璃芯片' : item.glassType == 1 ? '标准组件' : item.glassType == 2 ? 'BIPV' : '定制组件'
|
||||
obj.value = item.stockNumber
|
||||
stockDOData[index].push(obj)
|
||||
}),
|
||||
])
|
||||
this.stockDOData = stockDOData
|
||||
this.$store.commit('home/updateEnergyData', stockDOData)
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -74,13 +190,19 @@ export default {
|
||||
<style scoped>
|
||||
.energy-copilot {
|
||||
flex: 1;
|
||||
display: grid;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-template-rows: 1fr 1fr;
|
||||
}
|
||||
|
||||
.energy-copilot > div {
|
||||
.flex {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.top>div,
|
||||
.bottom>div {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user