| | |
| | | <script> |
| | | // import { currentGET } from "api/modules"; |
| | | import { graphic } from "echarts"; |
| | | import {ProductionsOut} from "@/api/http.js" |
| | | import {Getproductionvolume} from "@/api/http.js" |
| | | import axios from 'axios' |
| | | export default { |
| | | data() { |
| | |
| | | "产量" + |
| | | " : " + |
| | | item.value + |
| | | "PCS</br>"; |
| | | "托</br>"; |
| | | } else { |
| | | result += item.marker + " " + item.seriesName + " : - </br>"; |
| | | } |
| | |
| | | }, |
| | | }, |
| | | legend: { |
| | | data: ["单位:PCS"], |
| | | data: ["单位:托"], |
| | | textStyle: { |
| | | color: "#B4B4B4", |
| | | }, |
| | |
| | | ], |
| | | series: [ |
| | | { |
| | | name: "单位:PCS", |
| | | name: "单位:托", |
| | | type: "bar", |
| | | barWidth: 20, |
| | | itemStyle: { |
| | |
| | | }, |
| | | ], |
| | | }, |
| | | xAxisDates: [], |
| | | }; |
| | | }, |
| | | props: {}, |
| | |
| | | }, 3000); |
| | | }, |
| | | async getData() { |
| | | // this.numberData.forEach((item, index) => { |
| | | // item.number.number[0] += ++index |
| | | // item.number = { ...item.number } |
| | | // }) |
| | | var rep = await ProductionsOut(); |
| | | console.log(rep); |
| | | //获取rep中对象的的today值整合成数组 |
| | | var todays= rep.map((item) => { |
| | | return item.today; |
| | | }); |
| | | //获取rep中对象的的pcsCounts值整合成数组 |
| | | var pcsCounts= rep.map((item) => { |
| | | return item.pcsCounts; |
| | | }); |
| | | console.log(todays); |
| | | const rep = await Getproductionvolume(); |
| | | var rep1=rep.filter(it=>it.taskType==100&&it.roadway.includes("CW")) |
| | | // 分组并排序 |
| | | const groupedData = rep1.reduce((acc, item) => { |
| | | const dateKey = item.createDate.split(' ')[0]; |
| | | acc[dateKey] = acc[dateKey] || { date: dateKey, tasks: [] }; |
| | | acc[dateKey].tasks.push(item); |
| | | return acc; |
| | | }, {}); |
| | | |
| | | const sortedGroups = Object.values(groupedData).sort( |
| | | (a, b) => new Date(b.date) - new Date(a.date) |
| | | ); |
| | | |
| | | this.xAxisDates= sortedGroups.map(group => { |
| | | const date = new Date(group.date); |
| | | return `${date.getMonth() + 1}/${date.getDate()}`; |
| | | }); |
| | | |
| | | const pcsCounts = sortedGroups.map(group => group.tasks.length); |
| | | this.options = { |
| | | tooltip: { |
| | | trigger: "axis", |
| | |
| | | "产量" + |
| | | " : " + |
| | | item.value + |
| | | "PCS</br>"; |
| | | "托</br>"; |
| | | } else { |
| | | result += item.marker + " " + item.seriesName + " : - </br>"; |
| | | } |
| | |
| | | }, |
| | | }, |
| | | legend: { |
| | | data: ["单位:PCS"], |
| | | data: ["单位:托"], |
| | | textStyle: { |
| | | color: "#B4B4B4", |
| | | }, |
| | |
| | | top: "20px", |
| | | }, |
| | | xAxis: { |
| | | data: todays.reverse(), |
| | | data:this.xAxisDates.reverse(), |
| | | axisLine: { |
| | | lineStyle: { |
| | | color: "#B4B4B4", |
| | |
| | | ], |
| | | series: [ |
| | | { |
| | | name: "单位:PCS", |
| | | name: "单位:托", |
| | | type: "bar", |
| | | barWidth: 20, |
| | | itemStyle: { |