huangxiaoqiang
2025-06-30 37b28e4f6b8c865c1df06543f124fd1c1ba244d9
CodeManagement/BigScreenVue/src/views/indexs/right-center.vue
@@ -13,7 +13,7 @@
<script>
import { currentGET } from "api/modules";
import { ProductionStock } from "@/api/http.js";
import { Getoutput } from "@/api/http.js";
import * as echarts from 'echarts';
let style = {
  fontSize: 24,
@@ -226,18 +226,60 @@
      //         this.$Message.warning(res.msg);
      //     }
      // });
      var rep = await ProductionStock();
      var rep1=await Getoutput();
      var rep=rep1.filter(it=>it.roadway.includes("CW"))
      console.log(rep)
// 获取今天零点的时间戳
const now = Date.now(); // 当前时间戳(毫秒)
const todayStart = new Date(now);
todayStart.setHours(0, 0, 0, 0); // 设置为本地时间的 00:00:00
const todayStartTimestamp = todayStart.getTime();
// 减去当天已过去的毫秒数
const timestamp = todayStartTimestamp;
const date = new Date(timestamp);
// 补零函数
const padZero = (num) => num.toString().padStart(2, '0');
// 格式化日期
const formattedDate = `${date.getFullYear()}-${
 padZero(date.getMonth() + 1)}-${
 padZero(date.getDate())} ${
 padZero(date.getHours())}:${
 padZero(date.getMinutes())}:${
 padZero(date.getSeconds())}`;
// 本地时区当月第一天的 00:00:00
const firstDayOfMonth = new Date(
 new Date().getFullYear(),
 new Date().getMonth(), // 月份从 0 开始(0=1月)
 1 // 日期设为 1 号
);
const date1 = new Date(firstDayOfMonth.getTime());
// 补零函数
const padZero1 = (num) => num.toString().padStart(2, '0');
// 格式化日期
const formattedDate1 = `${date.getFullYear()}-${
 padZero1(date1.getMonth() + 1)}-${
 padZero1(date1.getDate())} ${
 padZero1(date1.getHours())}:${
 padZero1(date1.getMinutes())}:${
 padZero1(date1.getSeconds())}`;
      var data1 = [{
          text: '成品库存(PCS)',
          value: rep.cpCount,
          text: '日产量',
          value:rep.filter(it => it.createDate>formattedDate ).length,
          color: '#5dd054'
      }, {
          text: '研发库存(PCS)',
          value: rep.yfCount,
          text: '月产量',
          value: rep.filter(it => it.createDate>formattedDate1).length,
          color: '#097ff9'
      }, {
          text: '尾数库存(PCS)',
          value: rep.wsCount,
          text: '年产量',
          value:rep.length,
          color: '#ff6804'
      }];