huangxiaoqiang
2025-06-03 975ea3c28b1661b3b6eabee5277cc98d853736d3
CodeManagement/BigScreenVue/src/views/indexs/plan.vue
@@ -11,7 +11,7 @@
<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() {
@@ -35,7 +35,7 @@
                    "产量" +
                    " : " +
                    item.value +
                    "PCS</br>";
                    "托</br>";
              } else {
                result += item.marker + " " + item.seriesName + " :  - </br>";
              }
@@ -44,7 +44,7 @@
          },
        },
        legend: {
          data: ["单位:PCS"],
          data: ["单位:托"],
          textStyle: {
            color: "#B4B4B4",
          },
@@ -82,7 +82,7 @@
        ],
        series: [
          {
            name: "单位:PCS",
            name: "单位:托",
            type: "bar",
            barWidth: 20,
            itemStyle: {
@@ -106,6 +106,7 @@
          },
        ],
      },
      xAxisDates: [],
    };
  },
  props: {},
@@ -129,21 +130,26 @@
      }, 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",
@@ -163,7 +169,7 @@
                    "产量" +
                    " : " +
                    item.value +
                    "PCS</br>";
                    "托</br>";
              } else {
                result += item.marker + " " + item.seriesName + " :  - </br>";
              }
@@ -172,7 +178,7 @@
          },
        },
        legend: {
          data: ["单位:PCS"],
          data: ["单位:托"],
          textStyle: {
            color: "#B4B4B4",
          },
@@ -185,7 +191,7 @@
          top: "20px",
        },
        xAxis: {
          data: todays.reverse(),
          data:this.xAxisDates.reverse(),
          axisLine: {
            lineStyle: {
              color: "#B4B4B4",
@@ -210,7 +216,7 @@
        ],
        series: [
          {
            name: "单位:PCS",
            name: "单位:托",
            type: "bar",
            barWidth: 20,
            itemStyle: {