master
吴普建 11 months ago
parent 8b636ab391
commit 3d628bd344

@ -23,9 +23,9 @@ export default defineComponent({
type: String,
default: '200px'
},
energyData : {
type : Object,
default () {
energyData: {
type: Object,
default() {
return {}
}
}
@ -35,7 +35,7 @@ export default defineComponent({
loading: true,
dataForCount: [],
dataForWeight: [],
chartOptions : {}
chartOptions: {}
};
},
async mounted() {
@ -43,15 +43,17 @@ export default defineComponent({
this.chartOptions = JSON.parse(JSON.stringify(option))
this.initChart()
},
watch : {
energyData : {
handler (newValue) {
watch: {
energyData: {
handler(newValue) {
this.chartOptions.xAxis.data = newValue.xAxisData;
this.chartOptions.series[0].name = newValue.location1
this.chartOptions.series[1].name = newValue.location2
this.chartOptions.series[0].data = newValue.LSSeriesData
this.chartOptions.series[1].data = newValue.QBSeriesData
this.initChart();
},
deep : true
deep: true
},
},
beforeUnmount() {

@ -586,7 +586,9 @@ export default defineComponent({
QBYear: 0,
xAxisData: [],
LSSeriesData: [],
QBSeriesData: []
QBSeriesData: [],
location1: '',
location2: '',
},
productionData: {},
totalTransport: 0,
@ -687,14 +689,16 @@ export default defineComponent({
if (res.code === 200) {
this.location.location1 = res.data.yearElectricQuantity.find(item => item.workshopType.indexOf("一楼") > -1).workshopType
this.location.location2 = res.data.yearElectricQuantity.find(item => item.workshopType.indexOf("二楼") > -1).workshopType
this.energyData.location1 = this.location.location1
this.energyData.location2 = this.location.location2
this.loading6 = false;
this.energyData.LSYear = Number(res.data.yearElectricQuantity.find(item => item.workshopType.indexOf("一楼") > -1).electricQuantity / 1000)?.toFixed(0);
this.energyData.QBYear = Number(res.data.yearElectricQuantity.find(item => item.workshopType.indexOf("二楼") > -1).electricQuantity / 1000)?.toFixed(0);
this.energyData.LSMonth = Number(res.data.monthElectricQuantity[0].electricQuantity / 1000)?.toFixed(0);
this.energyData.QBMoth = Number(res.data.monthElectricQuantity[1].electricQuantity / 1000)?.toFixed(0);
const lsData = res.data.weeksElectricQuantity.filter(item => item.workshopType === '拉丝车间');
const qbData = res.data.weeksElectricQuantity.filter(item => item.workshopType === '漆包车间');
const lsData = res.data.weeksElectricQuantity.filter(item => item.workshopType === this.location.location1);
const qbData = res.data.weeksElectricQuantity.filter(item => item.workshopType === this.location.location2);
lsData.forEach(item => {
this.energyData.xAxisData.push(item.week);
this.energyData.LSSeriesData.push(Number(item.totalUsage / 1000).toFixed(0));

Loading…
Cancel
Save