驾驶舱
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2024-05-07 10:25:10
|
||||
* @LastEditTime: 2024-05-16 10:42:25
|
||||
* @LastEditTime: 2024-05-17 10:34:51
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
|
||||
@@ -10,16 +10,16 @@
|
||||
<div class="cities">
|
||||
<CopilotButtons :options="cities" @update:active="handleCityUpdate" />
|
||||
</div>
|
||||
<div style="padding: 0 40px;width: 90%;">
|
||||
<!-- <div style="width: 90%;"> -->
|
||||
<div class="chart" ref="chart"></div>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
<div class="legend" v-if="1">
|
||||
<div class="legend-item" v-for="(lgd,index) in legendList" :key="lgd.name">
|
||||
<div class="legend-item" v-for="(lgd, index) in legendList" :key="lgd.name">
|
||||
<div>
|
||||
<span :style="'backgroundColor:' + colors[index%5]" class="legend-item__chart"></span>
|
||||
<span :style="'color:' + colors[index%5]" class="legend-item__label">{{ lgd.name }}</span>
|
||||
<span :style="'backgroundColor:' + colors[index % 5]" class="legend-item__chart"></span>
|
||||
<span :style="'color:' + colors[index % 5]" class="legend-item__label">{{ lgd.name }}</span>
|
||||
</div>
|
||||
<div :style="'color:' + colors[index%5]" class="legend-item__value">{{ lgd.value }}</div>
|
||||
<div :style="'color:' + colors[index % 5]" class="legend-item__value">{{ lgd.value }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -54,7 +54,7 @@ export default {
|
||||
period: "月",
|
||||
factoryId: 0,
|
||||
// legendList:[],
|
||||
colors:['#2760FF', '#5996F7', '#8BC566', '#11FAF0', '#F3C000'],
|
||||
colors: ['#2760FF', '#5996F7', '#8BC566', '#11FAF0', '#F3C000'],
|
||||
// valueTuple: [100, 100, 200],
|
||||
};
|
||||
},
|
||||
@@ -69,13 +69,13 @@ export default {
|
||||
legendList() {
|
||||
// if (this.valueTuple) {
|
||||
// if (this.valueTuple.length == 0) {
|
||||
return this.valueTuple
|
||||
return this.valueTuple
|
||||
// } else {
|
||||
// return []
|
||||
// }
|
||||
// return []
|
||||
// }
|
||||
// console.log(this.valueTuple)
|
||||
// } else {
|
||||
// return []
|
||||
// return []
|
||||
// }
|
||||
},
|
||||
options() {
|
||||
@@ -88,7 +88,7 @@ export default {
|
||||
arr.push(ele.value)
|
||||
});
|
||||
let vt = arr
|
||||
titleValue = vt.reduce(function (prev, cur, index, arr) {
|
||||
titleValue = vt.reduce(function (prev, cur, index, arr) {
|
||||
return prev + cur
|
||||
})
|
||||
} else {
|
||||
@@ -119,13 +119,13 @@ export default {
|
||||
factoryId(newVal, oldVal) {
|
||||
console.log(newVal);
|
||||
// if (newVal) {
|
||||
// this.legendList = this.data[newVal]
|
||||
// if ( == 0) {
|
||||
// this.initOptions(this.options)
|
||||
// }
|
||||
// console.log(this.valueTuple.length)
|
||||
// console.log(this.options)
|
||||
this.initOptions(this.options)
|
||||
// this.legendList = this.data[newVal]
|
||||
// if ( == 0) {
|
||||
// this.initOptions(this.options)
|
||||
// }
|
||||
// console.log(this.valueTuple.length)
|
||||
// console.log(this.options)
|
||||
this.initOptions(this.options)
|
||||
// }
|
||||
},
|
||||
// chipRate() {
|
||||
@@ -164,9 +164,13 @@ export default {
|
||||
|
||||
.chart {
|
||||
// margin-left: 5%;
|
||||
width: 290px;
|
||||
// width: 290px;
|
||||
align-self: stretch;
|
||||
height: 150px;
|
||||
flex: 1 1 auto;
|
||||
// padding: 0 10%;
|
||||
/* margin: 10%; */
|
||||
/* min-width: 300px; */
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.legend {
|
||||
@@ -185,7 +189,8 @@ export default {
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 3px;
|
||||
.legend-item__chart{
|
||||
|
||||
.legend-item__chart {
|
||||
display: inline-block;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
@@ -193,9 +198,11 @@ export default {
|
||||
border-radius: 2px;
|
||||
// margin-right: 8px;
|
||||
}
|
||||
.legend-item__label {
|
||||
|
||||
.legend-item__label {
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -205,4 +212,3 @@ export default {
|
||||
}
|
||||
}
|
||||
</style>
|
||||
l
|
||||
|
||||
@@ -33,7 +33,6 @@ 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: {
|
||||
@@ -78,111 +77,6 @@ export default {
|
||||
// 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>
|
||||
|
||||
Reference in New Issue
Block a user