647556386
2026-01-08 e7dac9ecb16aa627f0603beec9930c75ee6aa3f7
ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/views/Home.vue
@@ -363,7 +363,6 @@
// åˆå§‹åŒ–è¿‘7日出入库趋势图(关联后端数据)
const initStockTrend = () => {
  debugger
  if (!stockTrendRef.value) return;
  if (stockTrendChart) {
@@ -374,6 +373,12 @@
  // ä¼˜å…ˆä½¿ç”¨åŽç«¯æ•°æ®
  const trendData = bigscreendata.value.dailyInOutBoundList;
  console.log('出入库趋势数据', trendData);
  // è®¡ç®—数据中的最大值,用于设置Y轴范围
  const maxInbound = Math.max(...trendData.map(item => item.dailyInboundQuantity || 0));
  const maxOutbound = Math.max(...trendData.map(item => item.dailyOutboundQuantity || 0));
  const maxValue = Math.max(maxInbound, maxOutbound);
  console.log('最大值计算结果:', { maxInbound, maxOutbound, maxValue });
  const option = {
    tooltip: {
@@ -400,23 +405,31 @@
    },
    yAxis: {
      type: 'value',
      name: '数量(千件)',
      max: 25
      name: '数量',
      min: 0,
      // æ ¹æ®æ•°æ®åŠ¨æ€è®¾ç½®æœ€å¤§å€¼ï¼Œç•™å‡ºä¸€äº›ç©ºé—´
      max: maxValue > 0 ? Math.ceil(maxValue * 1.2) : 10
    },
    series: [
      {
        name: '入库量',
        type: 'bar',
        barWidth: '30%',
        data: trendData.map(item => item.inNum),
        itemStyle: { color: '#52c41a' }
        data: trendData.map(item => item.dailyInboundQuantity),
        itemStyle: {
          color: '#52c41a',
          borderRadius: [4, 4, 0, 0]
        }
      },
      {
        name: '出库量',
        type: 'bar',
        barWidth: '30%',
        data: trendData.map(item => item.outNum),
        itemStyle: { color: '#1890ff' }
        data: trendData.map(item => item.dailyOutboundQuantity),
        itemStyle: {
          color: '#1890ff',
          borderRadius: [4, 4, 0, 0]
        }
      }
    ]
  };