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

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

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

Loading…
Cancel
Save