zhangwencui
8 小时以前 08be158b36f2e49ab116eefe4db6e69e82e1c2e2
src/views/reportAnalysis/productionStatistics/index.vue
@@ -63,7 +63,12 @@
          </div>
          <div class="material-info-card">
            <div class="material-icon">
              <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
              <svg width="24"
                   height="24"
                   viewBox="0 0 24 24"
                   fill="none"
                   stroke="currentColor"
                   stroke-width="2">
                <path d="M20 7h-4V4c0-1.1-.9-2-2-2h-4c-1.1 0-2 .9-2 2v3H4c-1.1 0-2 .9-2 2v11c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V9c0-1.1-.9-2-2-2z" />
                <polyline points="22,7 12,13 2,7" />
              </svg>
@@ -158,7 +163,12 @@
          </div>
          <div class="material-info-card">
            <div class="material-icon">
              <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
              <svg width="24"
                   height="24"
                   viewBox="0 0 24 24"
                   fill="none"
                   stroke="currentColor"
                   stroke-width="2">
                <path d="M20 7h-4V4c0-1.1-.9-2-2-2h-4c-1.1 0-2 .9-2 2v3H4c-1.1 0-2 .9-2 2v11c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V9c0-1.1-.9-2-2-2z" />
                <polyline points="22,7 12,13 2,7" />
              </svg>
@@ -209,7 +219,7 @@
      <!-- 右下:销量排名分析 -->
      <div class="bi-panel bi-panel-bottom-right">
        <PanelHeader :isFullscreen="true"
                     title="物料生产量统计" />
                     title="能耗统计" />
        <div class="panel-tabs">
          <span class="tab-item"
                :class="{ active: salesTimeDimension === 'year' }"
@@ -219,15 +229,8 @@
                @click="handleSalesTimeDimensionChange('month')">月</span>
        </div>
        <div class="bi-panel-body">
          <!-- <div class="chart-filter-tabs">
            <span v-for="area in salesAreas"
                  :key="area"
                  class="cf-tab"
                  :class="{ active: selectedArea === area }"
                  @click="handleAreaChange(area)">{{ area }}</span>
          </div>
          <div ref="salesRankingChart"
               class="echart-fill"></div> -->
               class="echart-fill"></div>
        </div>
      </div>
    </div>
@@ -426,7 +429,14 @@
  // 板材单耗图表配置
  const boardCostChartOption = computed(() => {
    const materials = ["消耗量"];
    const colors = ["#00A4ED", "#34D8F7", "#4A8BFF", "#8A6BFF", "#C8C447", "#FF6B6B"];
    const colors = [
      "#00A4ED",
      "#34D8F7",
      "#4A8BFF",
      "#8A6BFF",
      "#C8C447",
      "#FF6B6B",
    ];
    const year = 2024;
    const periodType = boardTimeDimension.value;
@@ -520,7 +530,14 @@
  // 产量分析图表配置
  const productionChartOption = computed(() => {
    const salesAreas = ["全部", "砌块", "板材"];
    const colors = ["#00A4ED", "#34D8F7", "#4A8BFF", "#8A6BFF", "#C8C447", "#FF6B6B"];
    const colors = [
      "#00A4ED",
      "#34D8F7",
      "#4A8BFF",
      "#8A6BFF",
      "#C8C447",
      "#FF6B6B",
    ];
    const year = 2024;
    const periodType = productionTimeDimension.value;
@@ -723,71 +740,179 @@
    };
  });
  // 销量排名分析图表配置
  // 能耗统计图表配置
  const salesRankingChartOption = computed(() => {
    const customers = ["客户BB", "客户AA", "客户CC", "客户DD", "客户DD", "客户DD"];
    const values = [130, 120, 102, 90, 90, 70];
    const barColors = [
      "#34D8F7",
      "#4A8BFF",
      "#8A6BFF",
      "#C8C447",
      "#C8C447",
      "#C8C447",
    const energyTypes = ["水", "电", "蒸汽"];
    const colors = ["#00A4ED", "#AC43C2", "#F5BC4A"];
    const year = 2024;
    const periodType = salesTimeDimension.value;
    // 生成时间段
    let periods = [];
    if (periodType === "year") {
      // 年度数据:6个月
      for (let month = 9; month <= 12; month++) {
        periods.push(`${month}/${year.toString().slice(2)}`);
      }
      for (let month = 1; month <= 3; month++) {
        periods.push(`${month}/${(year + 1).toString().slice(2)}`);
      }
    } else {
      // 月度数据:7天
      const month = 1;
      for (let day = 1; day <= 7; day++) {
        periods.push(`${month}/${day}`);
      }
    }
    // 为每种能源类型生成数据
    const waterData = periods.map(() => {
      return periodType === "year"
        ? Math.floor(Math.random() * 300) + 400
        : Math.floor(Math.random() * 30) + 40;
    });
    const steamData = periods.map(() => {
      return periodType === "year"
        ? Math.floor(Math.random() * 400) + 500
        : Math.floor(Math.random() * 40) + 50;
    });
    const electricityData = periods.map(() => {
      return periodType === "year"
        ? Math.floor(Math.random() * 200) + 300
        : Math.floor(Math.random() * 20) + 30;
    });
    const series = [
      {
        name: "水",
        type: "bar",
        data: waterData,
        itemStyle: {
          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
            { offset: 0, color: "#00A4ED" },
            { offset: 1, color: "#0F285A" },
          ]),
          borderRadius: [getResponsiveValue(4), getResponsiveValue(4), 0, 0],
        },
        barWidth: getResponsiveValue(6),
      },
      {
        name: "电",
        type: "line",
        data: electricityData,
        itemStyle: {
          color: "#AC43C2",
        },
        lineStyle: {
          width: getResponsiveValue(1),
          color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
            { offset: 0, color: "#AC43C2" },
            { offset: 1, color: "#AC43C2" },
          ]),
        },
        symbol: "circle",
        symbolSize: getResponsiveValue(8),
        areaStyle: {
          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
            { offset: 0, color: "#AC43C250" },
            { offset: 1, color: "#AC43C203" },
          ]),
        },
      },
      {
        name: "蒸汽",
        type: "bar",
        data: steamData,
        itemStyle: {
          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
            { offset: 0, color: "#F5BC4A" },
            { offset: 1, color: "#591C22" },
          ]),
          borderRadius: [getResponsiveValue(4), getResponsiveValue(4), 0, 0],
        },
        barWidth: getResponsiveValue(6),
      },
    ];
    return {
      backgroundColor: "transparent",
      tooltip: {
        trigger: "axis",
        axisPointer: { type: "shadow" },
        backgroundColor: "rgba(0,0,0,0.55)",
        borderColor: "rgba(64,158,255,0.25)",
        axisPointer: { type: "cross" },
        backgroundColor: "rgba(0,0,0,0.7)",
        borderColor: "rgba(64,158,255,0.5)",
        borderWidth: getResponsiveValue(1),
        textStyle: { color: "#B8C8E0", fontSize: getResponsiveValue(11) },
        formatter: "{b}: {c} 立方米",
        textStyle: { color: "#B8C8E0", fontSize: getResponsiveValue(12) },
        formatter: function (params) {
          let result = params[0].name + "<br/>";
          params.forEach(param => {
            const unit = param.seriesName === "电" ? "度" : "吨";
            result += `${param.marker}${param.seriesName}: ${param.value} ${unit}<br/>`;
          });
          return result;
        },
      },
      legend: {
        data: energyTypes,
        top: "5%",
        right: "1%",
        textStyle: {
          color: "#B8C8E0",
          fontSize: getResponsiveValue(10),
        },
        itemWidth: getResponsiveValue(12),
        itemHeight: getResponsiveValue(12),
        itemGap: getResponsiveValue(15),
      },
      grid: {
        left: "14%",
        right: "6%",
        top: "16%",
        bottom: "8%",
        left: "1%",
        right: "1%",
        top: "25%",
        bottom: "0%",
        containLabel: true,
      },
      xAxis: {
        type: "value",
        axisLine: { show: false },
        axisLabel: { color: "#B8C8E0", fontSize: getResponsiveValue(11) },
        splitLine: { lineStyle: { color: "rgba(184,200,224,0.12)" } },
        type: "category",
        data: periods,
        axisLabel: {
          fontSize: getResponsiveValue(11),
          color: "#93B9FF",
          interval: 0,
          rotate: periodType === "month" ? 45 : 0,
        },
        axisLine: {
          show: true,
          lineStyle: {
            width: getResponsiveValue(1),
            color: "#305B9A",
          },
        },
        axisTick: {
          show: false,
        },
      },
      yAxis: {
        type: "category",
        data: customers,
        axisTick: { show: false },
        axisLine: { show: false },
        type: "value",
        axisLabel: {
          color: "#B8C8E0",
          fontSize: getResponsiveValue(11),
          margin: getResponsiveValue(8),
          color: "#93B9FF",
          formatter: function (value) {
            return value;
        },
      },
      series: [
        {
          name: "销量(立方米)",
          type: "bar",
          barWidth: getResponsiveValue(14),
          data: values,
          itemStyle: {
            color: params => barColors[params.dataIndex] || "#00A4ED",
            borderRadius: [
              getResponsiveValue(6),
              getResponsiveValue(6),
              getResponsiveValue(6),
              getResponsiveValue(6),
            ],
        axisLine: {
          show: true,
          lineStyle: {
            color: "#305B9A",
          },
        },
      ],
        splitLine: {
          lineStyle: {
            color: "#0F2E60",
            type: "dashed",
          },
        },
      },
      series: series,
    };
  });
@@ -1357,7 +1482,6 @@
    height: 24vh;
  }
  .bi-panel-bottom-right .echart-fill {
    height: calc(100% - 2.8vh);
  }
@@ -1691,5 +1815,4 @@
    font-size: 1vh;
    opacity: 0.7;
  }
</style>