update 产量驾驶舱
This commit is contained in:
		@@ -34,6 +34,17 @@ async function getHomeTarget() {
 | 
			
		||||
  return null;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
async function getCopilotYield(params) {
 | 
			
		||||
  const { code, data } = await axios.post("/ip/prod-output/query-by-date", {
 | 
			
		||||
    ...params,
 | 
			
		||||
  });
 | 
			
		||||
  if (code == 0) {
 | 
			
		||||
    return data;
 | 
			
		||||
  }
 | 
			
		||||
  console.warn("getCopilotYield failed, code: ", code);
 | 
			
		||||
  return null;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* 状态 */
 | 
			
		||||
const state = {
 | 
			
		||||
  copilot: {
 | 
			
		||||
@@ -61,7 +72,19 @@ const mutations = {
 | 
			
		||||
    state.home.stdOutput = payload.stdOutput;
 | 
			
		||||
    state.home.bipvOutput = payload.bipvOutput;
 | 
			
		||||
  },
 | 
			
		||||
  SET_COPILOT_INFO: (state) => {},
 | 
			
		||||
  SET_COPILOT_INFO: (state, payload) => {
 | 
			
		||||
    switch (payload.type) {
 | 
			
		||||
      case "yield":
 | 
			
		||||
        state.copilot.yield = payload.data;
 | 
			
		||||
        break;
 | 
			
		||||
      case "energy":
 | 
			
		||||
        state.copilot.energy = payload.data;
 | 
			
		||||
        break;
 | 
			
		||||
      case "efficiency":
 | 
			
		||||
        state.copilot.efficiency = payload.data;
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const actions = {
 | 
			
		||||
@@ -104,7 +127,11 @@ const actions = {
 | 
			
		||||
          if (target) {
 | 
			
		||||
            chipOutput.target.splice(factoryId, 1, target.chipYield ?? 0);
 | 
			
		||||
            stdOutput.target.splice(factoryId, 1, target.componentYield ?? 0);
 | 
			
		||||
            bipvOutput.target.splice(factoryId, 1, target.bipvProductOutput ?? 0);
 | 
			
		||||
            bipvOutput.target.splice(
 | 
			
		||||
              factoryId,
 | 
			
		||||
              1,
 | 
			
		||||
              target.bipvProductOutput ?? 0
 | 
			
		||||
            );
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
        /* 收集芯片投入数据 */
 | 
			
		||||
@@ -184,7 +211,47 @@ const actions = {
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  /** 初始化驾驶舱数据 */
 | 
			
		||||
  async initCopilot({ commit }) {},
 | 
			
		||||
  async initCopilot({ commit }, payload) {
 | 
			
		||||
    const { period } = payload;
 | 
			
		||||
    let dummyData = null;
 | 
			
		||||
    let type = null;
 | 
			
		||||
    // 请求参数,直接一次性获取所有工厂
 | 
			
		||||
    let queryParams = {
 | 
			
		||||
      factorys: [],
 | 
			
		||||
      date: 4,
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    switch (period) {
 | 
			
		||||
      case "日":
 | 
			
		||||
        queryParams.date = 1;
 | 
			
		||||
        break;
 | 
			
		||||
      case "周":
 | 
			
		||||
        queryParams.date = 2;
 | 
			
		||||
        break;
 | 
			
		||||
      case "月":
 | 
			
		||||
        queryParams.date = 3;
 | 
			
		||||
        break;
 | 
			
		||||
      case "年":
 | 
			
		||||
        queryParams.date = 4;
 | 
			
		||||
        break;
 | 
			
		||||
      default:
 | 
			
		||||
        queryParams.date = 1;
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const data = await getCopilotYield(queryParams);
 | 
			
		||||
    if (data) {
 | 
			
		||||
      dummyData = data;
 | 
			
		||||
      type = "yield";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    console.log("[copilot yield data]: ", dummyData, type);
 | 
			
		||||
    // commit
 | 
			
		||||
    // commit('SET_COPILOT_INFO', {
 | 
			
		||||
    //   type,
 | 
			
		||||
    //   data: dummyData
 | 
			
		||||
    // })
 | 
			
		||||
  },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										121
									
								
								src/views/copilot/components/charts/FtoInvest.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										121
									
								
								src/views/copilot/components/charts/FtoInvest.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,121 @@
 | 
			
		||||
<!-- 
 | 
			
		||||
    filename: FtoInvest.vue
 | 
			
		||||
    author: liubin
 | 
			
		||||
    date: 2024-04-10 08:59:28
 | 
			
		||||
    description: 
 | 
			
		||||
-->
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
  <bar-chart-base
 | 
			
		||||
    :legend="legend"
 | 
			
		||||
    :series="series"
 | 
			
		||||
    :xAxis="xAxis"
 | 
			
		||||
    class="fto-chart"
 | 
			
		||||
  />
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import BarChartBase from "./base/BarChartBase.vue";
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  name: "FtoInvest",
 | 
			
		||||
  components: { BarChartBase },
 | 
			
		||||
  data() {
 | 
			
		||||
    // 城市数组的顺序必须是固定的
 | 
			
		||||
    const cities = ["瑞昌", "邯郸", "株洲", "佳木斯", "成都", "凯盛", "蚌埠"];
 | 
			
		||||
    return {
 | 
			
		||||
      xAxis: cities,
 | 
			
		||||
    };
 | 
			
		||||
  },
 | 
			
		||||
  props: {
 | 
			
		||||
    period: {
 | 
			
		||||
      type: String,
 | 
			
		||||
      default: "日",
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  computed: {
 | 
			
		||||
    legend() {
 | 
			
		||||
      switch (this.period) {
 | 
			
		||||
        case "日":
 | 
			
		||||
          return [{ label: "昨日", color: "#12f7f1" }];
 | 
			
		||||
        case "周":
 | 
			
		||||
          return [{ label: "本周", color: "#12f7f1" }];
 | 
			
		||||
        case "月": {
 | 
			
		||||
          const year = new Date().getFullYear();
 | 
			
		||||
          const month = new Date().getMonth() + 1;
 | 
			
		||||
          return [
 | 
			
		||||
            { label: `${year}年${month}月`, color: "#12f7f1" },
 | 
			
		||||
            { label: `${year - 1}年${month}月`, color: "#58adfa" },
 | 
			
		||||
          ];
 | 
			
		||||
        }
 | 
			
		||||
        case "年": {
 | 
			
		||||
          const year = new Date().getFullYear();
 | 
			
		||||
          return [
 | 
			
		||||
            { label: `${year - 1}年`, color: "#12f7f1" },
 | 
			
		||||
            { label: `${year}年`, color: "#58adfa" },
 | 
			
		||||
          ];
 | 
			
		||||
        }
 | 
			
		||||
        default:
 | 
			
		||||
          return [
 | 
			
		||||
            { label: `${year - 1}年`, color: "#12f7f1" },
 | 
			
		||||
            { label: `${year}年`, color: "#58adfa" },
 | 
			
		||||
          ];
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    series() {
 | 
			
		||||
      const template =
 | 
			
		||||
        this.period == "日" || this.period == "周"
 | 
			
		||||
          ? [
 | 
			
		||||
              {
 | 
			
		||||
                name: "样例数据--2023年",
 | 
			
		||||
                data: Array.from({ length: 7 }, () =>
 | 
			
		||||
                  Math.floor(Math.random() * 1000)
 | 
			
		||||
                ),
 | 
			
		||||
              },
 | 
			
		||||
            ]
 | 
			
		||||
          : [
 | 
			
		||||
              {
 | 
			
		||||
                name: "样例数据--2023年",
 | 
			
		||||
                data: Array.from({ length: 7 }, () =>
 | 
			
		||||
                  Math.floor(Math.random() * 1000)
 | 
			
		||||
                ),
 | 
			
		||||
              },
 | 
			
		||||
              {
 | 
			
		||||
                name: "样例数据--2024年",
 | 
			
		||||
                data: Array.from({ length: 7 }, () =>
 | 
			
		||||
                  Math.floor(Math.random() * 1000)
 | 
			
		||||
                ),
 | 
			
		||||
              },
 | 
			
		||||
            ];
 | 
			
		||||
      const ftoInvest = this.$store.getters.home.ftoInvest;
 | 
			
		||||
      if (!ftoInvest || !ftoInvest.current || !ftoInvest.previous) {
 | 
			
		||||
        return [
 | 
			
		||||
          {
 | 
			
		||||
            name: "样例数据--2023年",
 | 
			
		||||
            data: Array.from({ length: 7 }, () =>
 | 
			
		||||
              Math.floor(Math.random() * 1000)
 | 
			
		||||
            ),
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            name: "样例数据--2024年",
 | 
			
		||||
            data: Array.from({ length: 7 }, () =>
 | 
			
		||||
              Math.floor(Math.random() * 1000)
 | 
			
		||||
            ),
 | 
			
		||||
          },
 | 
			
		||||
        ];
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      return [
 | 
			
		||||
        {
 | 
			
		||||
          name: `${new Date().getFullYear() - 1}年`,
 | 
			
		||||
          data: ftoInvest.previous,
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          name: `${new Date().getFullYear()}年`,
 | 
			
		||||
          data: ftoInvest.current,
 | 
			
		||||
        },
 | 
			
		||||
      ];
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
@@ -6,7 +6,7 @@
 | 
			
		||||
-->
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
  <DoubleRingWrapperVue />
 | 
			
		||||
  <DoubleRingWrapperVue :data-source="dataBundle" :period="period" />
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
@@ -15,9 +15,14 @@ import DoubleRingWrapperVue from "./base/DoubleRingWrapper.vue";
 | 
			
		||||
export default {
 | 
			
		||||
  name: "StdOutput",
 | 
			
		||||
  components: { DoubleRingWrapperVue },
 | 
			
		||||
  props: {},
 | 
			
		||||
  props: {
 | 
			
		||||
    period: {
 | 
			
		||||
      type: String,
 | 
			
		||||
      default: "日",
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {};
 | 
			
		||||
    return { dataBundle: null };
 | 
			
		||||
  },
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										253
									
								
								src/views/copilot/components/charts/base/BarChartBase.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										253
									
								
								src/views/copilot/components/charts/base/BarChartBase.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,253 @@
 | 
			
		||||
<!-- 
 | 
			
		||||
    filename: BarChartBase.vue
 | 
			
		||||
    author: liubin
 | 
			
		||||
    date: 2024-04-10 08:59:28
 | 
			
		||||
    description: 
 | 
			
		||||
-->
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
  <chart-container class="bar-chart-base">
 | 
			
		||||
    <div class="legend">
 | 
			
		||||
      <span
 | 
			
		||||
        v-for="item in legend"
 | 
			
		||||
        :key="item.label"
 | 
			
		||||
        class="legend-item"
 | 
			
		||||
        :style="{ fontSize: isFullscreen ? '0.58vw' : '0.54vw' }"
 | 
			
		||||
        >{{ item.label }}</span
 | 
			
		||||
      >
 | 
			
		||||
    </div>
 | 
			
		||||
    <div
 | 
			
		||||
      ref="chart"
 | 
			
		||||
      style="max-width: 50vw"
 | 
			
		||||
      :style="{ height: vHeight + 'vh' }"
 | 
			
		||||
    ></div>
 | 
			
		||||
  </chart-container>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import screenfull from "screenfull";
 | 
			
		||||
import ChartContainerVue from "../../../../components/ChartContainer.vue";
 | 
			
		||||
import chartMixin from "@/mixins/chart.js";
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  name: "BarChartBase",
 | 
			
		||||
  components: {
 | 
			
		||||
    ChartContainer: ChartContainerVue,
 | 
			
		||||
  },
 | 
			
		||||
  mixins: [chartMixin],
 | 
			
		||||
  props: {
 | 
			
		||||
    vHeight: {
 | 
			
		||||
      type: Number,
 | 
			
		||||
      default: 34,
 | 
			
		||||
    },
 | 
			
		||||
    legend: {
 | 
			
		||||
      type: Array,
 | 
			
		||||
      required: true,
 | 
			
		||||
    },
 | 
			
		||||
    xAxis: {
 | 
			
		||||
      type: Array,
 | 
			
		||||
      required: true,
 | 
			
		||||
    },
 | 
			
		||||
    series: {
 | 
			
		||||
      type: Array,
 | 
			
		||||
      required: true,
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      isFullscreen: false,
 | 
			
		||||
      actualOptions: null,
 | 
			
		||||
      options: {
 | 
			
		||||
        grid: {
 | 
			
		||||
          left: "5%",
 | 
			
		||||
          right: "4%",
 | 
			
		||||
          bottom: "3%",
 | 
			
		||||
          top: "15%",
 | 
			
		||||
          containLabel: true,
 | 
			
		||||
        },
 | 
			
		||||
        tooltip: {},
 | 
			
		||||
        xAxis: {
 | 
			
		||||
          axisTick: {
 | 
			
		||||
            show: false,
 | 
			
		||||
          },
 | 
			
		||||
          axisLine: {
 | 
			
		||||
            lineStyle: {
 | 
			
		||||
              color: "#4561AE",
 | 
			
		||||
            },
 | 
			
		||||
          },
 | 
			
		||||
          axisLabel: {
 | 
			
		||||
            color: "#fff",
 | 
			
		||||
            fontSize: 12,
 | 
			
		||||
          },
 | 
			
		||||
          data: this.xAxis,
 | 
			
		||||
        },
 | 
			
		||||
        yAxis: {
 | 
			
		||||
          name: "单位/片",
 | 
			
		||||
          nameTextStyle: {
 | 
			
		||||
            color: "#fff",
 | 
			
		||||
            fontSize: 12,
 | 
			
		||||
          },
 | 
			
		||||
          axisTick: {
 | 
			
		||||
            show: false,
 | 
			
		||||
          },
 | 
			
		||||
          axisLabel: {
 | 
			
		||||
            color: "#fff",
 | 
			
		||||
            fontSize: 12,
 | 
			
		||||
          },
 | 
			
		||||
          axisLine: {
 | 
			
		||||
            show: true,
 | 
			
		||||
            lineStyle: {
 | 
			
		||||
              color: "#4561AE",
 | 
			
		||||
            },
 | 
			
		||||
          },
 | 
			
		||||
          splitLine: {
 | 
			
		||||
            lineStyle: {
 | 
			
		||||
              color: "#4561AE",
 | 
			
		||||
            },
 | 
			
		||||
          },
 | 
			
		||||
        },
 | 
			
		||||
        series: [
 | 
			
		||||
          {
 | 
			
		||||
            name: "", // this.series[0].name,
 | 
			
		||||
            type: "bar",
 | 
			
		||||
            barWidth: 12,
 | 
			
		||||
            itemStyle: {
 | 
			
		||||
              borderRadius: [10, 10, 0, 0],
 | 
			
		||||
              color: {
 | 
			
		||||
                type: "linear",
 | 
			
		||||
                x: 0,
 | 
			
		||||
                y: 0,
 | 
			
		||||
                x2: 0,
 | 
			
		||||
                y2: 1,
 | 
			
		||||
                colorStops: [
 | 
			
		||||
                  {
 | 
			
		||||
                    offset: 0,
 | 
			
		||||
                    color: "#12f7f1", // 0% 处的颜色
 | 
			
		||||
                  },
 | 
			
		||||
                  {
 | 
			
		||||
                    offset: 0.35,
 | 
			
		||||
                    color: "#12f7f177", // 100% 处的颜色
 | 
			
		||||
                  },
 | 
			
		||||
                  {
 | 
			
		||||
                    offset: 0.75,
 | 
			
		||||
                    color: "#12f7f133", // 100% 处的颜色
 | 
			
		||||
                  },
 | 
			
		||||
                  {
 | 
			
		||||
                    offset: 1,
 | 
			
		||||
                    color: "transparent", // 100% 处的颜色
 | 
			
		||||
                  },
 | 
			
		||||
                ],
 | 
			
		||||
                global: false, // 缺省为 false
 | 
			
		||||
              },
 | 
			
		||||
            },
 | 
			
		||||
            data: [], // this.series[0].data,
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            name: "", // this.series[1].name,
 | 
			
		||||
            type: "bar",
 | 
			
		||||
            barWidth: 12,
 | 
			
		||||
            // tooltip: {
 | 
			
		||||
            //   valueFormatter: function (value) {
 | 
			
		||||
            //     return value + " ml";
 | 
			
		||||
            //   },
 | 
			
		||||
            // },
 | 
			
		||||
            itemStyle: {
 | 
			
		||||
              borderRadius: [10, 10, 0, 0],
 | 
			
		||||
              color: {
 | 
			
		||||
                type: "linear",
 | 
			
		||||
                x: 0,
 | 
			
		||||
                y: 0,
 | 
			
		||||
                x2: 0,
 | 
			
		||||
                y2: 1,
 | 
			
		||||
                colorStops: [
 | 
			
		||||
                  {
 | 
			
		||||
                    offset: 0,
 | 
			
		||||
                    color: "#57abf8", // 0% 处的颜色
 | 
			
		||||
                  },
 | 
			
		||||
                  {
 | 
			
		||||
                    offset: 1,
 | 
			
		||||
                    color: "#364BFE66", // 100% 处的颜色
 | 
			
		||||
                  },
 | 
			
		||||
                ],
 | 
			
		||||
                global: false, // 缺省为 false
 | 
			
		||||
              },
 | 
			
		||||
            },
 | 
			
		||||
            data: [], // this.series[1].data,
 | 
			
		||||
          },
 | 
			
		||||
        ],
 | 
			
		||||
      },
 | 
			
		||||
    };
 | 
			
		||||
  },
 | 
			
		||||
  watch: {
 | 
			
		||||
    /** 全屏状态切换时,对柱子粗细和字体大小进行相应调整 */
 | 
			
		||||
    isFullscreen(val) {
 | 
			
		||||
      this.actualOptions.series.map((item) => {
 | 
			
		||||
        item.barWidth = val ? 18 : 12;
 | 
			
		||||
      });
 | 
			
		||||
      this.actualOptions.xAxis.axisLabel.fontSize = val ? 18 : 12;
 | 
			
		||||
      this.actualOptions.yAxis.axisLabel.fontSize = val ? 18 : 12;
 | 
			
		||||
      this.actualOptions.yAxis.nameTextStyle.fontSize = val ? 18 : 12;
 | 
			
		||||
      this.initOptions(this.actualOptions);
 | 
			
		||||
    },
 | 
			
		||||
    series(val) {
 | 
			
		||||
      if (!val) {
 | 
			
		||||
        this.initOptions(this.options);
 | 
			
		||||
        return;
 | 
			
		||||
      }
 | 
			
		||||
      const actualOptions = JSON.parse(JSON.stringify(this.options));
 | 
			
		||||
      actualOptions.series[0].data = val[0].data;
 | 
			
		||||
      actualOptions.series[0].name = val[0].name;
 | 
			
		||||
      actualOptions.series[1].data = val[1].data;
 | 
			
		||||
      actualOptions.series[1].name = val[1].name;
 | 
			
		||||
      this.actualOptions = actualOptions;
 | 
			
		||||
      this.initOptions(actualOptions);
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  mounted() {
 | 
			
		||||
    this.actualOptions = this.options;
 | 
			
		||||
    this.initOptions(this.options);
 | 
			
		||||
 | 
			
		||||
    if (screenfull.isEnabled) {
 | 
			
		||||
      screenfull.on("change", () => {
 | 
			
		||||
        this.isFullscreen = screenfull.isFullscreen;
 | 
			
		||||
      });
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style scoped lang="scss">
 | 
			
		||||
.bar-chart-base {
 | 
			
		||||
  // position: relative;
 | 
			
		||||
 | 
			
		||||
  .legend {
 | 
			
		||||
    position: absolute;
 | 
			
		||||
    top: 5.2vh;
 | 
			
		||||
    right: 1vw;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .legend-item {
 | 
			
		||||
    position: relative;
 | 
			
		||||
    // font-size: 12px;
 | 
			
		||||
    margin-right: 0.67vw;
 | 
			
		||||
 | 
			
		||||
    &::before {
 | 
			
		||||
      content: "";
 | 
			
		||||
      display: inline-block;
 | 
			
		||||
      width: 0.531vw;
 | 
			
		||||
      height: 0.531vw;
 | 
			
		||||
      background-color: #ccc;
 | 
			
		||||
      border-radius: 2px;
 | 
			
		||||
      margin-right: 0.22vw;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .legend-item:nth-child(1):before {
 | 
			
		||||
    background-color: #12f7f1;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .legend-item:nth-child(2):before {
 | 
			
		||||
    background-color: #58adfa;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
							
								
								
									
										96
									
								
								src/views/copilot/components/charts/base/CityData.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										96
									
								
								src/views/copilot/components/charts/base/CityData.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,96 @@
 | 
			
		||||
<!-- 
 | 
			
		||||
    filename: CityData.vue
 | 
			
		||||
    author: liubin
 | 
			
		||||
    date: 2024-04-17 09:55:12
 | 
			
		||||
    description: 
 | 
			
		||||
-->
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="city-data">
 | 
			
		||||
    <div class="headquarter">
 | 
			
		||||
      <div class="inner-shadow w-1"></div>
 | 
			
		||||
      <div class="inner-shadow flex-1">凯盛光伏</div>
 | 
			
		||||
      <div class="inner-shadow w-1"></div>
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
    <div class="city-item-container">
 | 
			
		||||
      <CityItem
 | 
			
		||||
        v-for="city in cities"
 | 
			
		||||
        :key="city.name"
 | 
			
		||||
        :location="city.name"
 | 
			
		||||
        :value="city.value"
 | 
			
		||||
        :period="period"
 | 
			
		||||
      />
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import CityItemVue from "./CityItem.vue";
 | 
			
		||||
export default {
 | 
			
		||||
  name: "CityData",
 | 
			
		||||
  components: { CityItem: CityItemVue },
 | 
			
		||||
  props: {
 | 
			
		||||
    dataSource: {
 | 
			
		||||
      type: Object,
 | 
			
		||||
      default: () => ({}),
 | 
			
		||||
    },
 | 
			
		||||
    period: {
 | 
			
		||||
      type: String,
 | 
			
		||||
      default: "日",
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      cities: [
 | 
			
		||||
        { name: "蚌埠兴科", value: 93111 },
 | 
			
		||||
        { name: "成都", value: 32212 },
 | 
			
		||||
        { name: "邯郸", value: 7732 },
 | 
			
		||||
        { name: "株洲", value: 71732 },
 | 
			
		||||
        { name: "瑞昌", value: 23421 },
 | 
			
		||||
        { name: "佳木斯", value: 340 },
 | 
			
		||||
      ],
 | 
			
		||||
    };
 | 
			
		||||
  },
 | 
			
		||||
  computed: {},
 | 
			
		||||
  mounted() {},
 | 
			
		||||
  methods: {},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style scoped lang="scss">
 | 
			
		||||
.city-data {
 | 
			
		||||
  width: 100%;
 | 
			
		||||
  flex: 1;
 | 
			
		||||
  display: flex;
 | 
			
		||||
  flex-direction: column;
 | 
			
		||||
  gap: 8px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.headquarter {
 | 
			
		||||
  flex: 1;
 | 
			
		||||
  display: flex;
 | 
			
		||||
  gap: 8px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.w-1 {
 | 
			
		||||
  width: 70px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.flex-1 {
 | 
			
		||||
  flex: 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.inner-shadow {
 | 
			
		||||
  box-shadow: inset 0 0 12px 2px #fff3;
 | 
			
		||||
  border-radius: 4px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.city-item-container {
 | 
			
		||||
  flex: 3;
 | 
			
		||||
  display: grid;
 | 
			
		||||
  grid-template-columns: repeat(2, 1fr);
 | 
			
		||||
  background: #ccc3;
 | 
			
		||||
  gap: 8px;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
							
								
								
									
										81
									
								
								src/views/copilot/components/charts/base/CityItem.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										81
									
								
								src/views/copilot/components/charts/base/CityItem.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,81 @@
 | 
			
		||||
<!-- 
 | 
			
		||||
    filename: CityItem.vue
 | 
			
		||||
    author: liubin
 | 
			
		||||
    date: 2024-04-17 09:55:12
 | 
			
		||||
    description: 
 | 
			
		||||
-->
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="city-item inner-shadow">
 | 
			
		||||
    <div class="item-location">
 | 
			
		||||
      <img src="#" alt="" />
 | 
			
		||||
      <span>{{ location }}</span>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="item-value" style="position: relative; flex: 1">
 | 
			
		||||
      <div
 | 
			
		||||
        class=""
 | 
			
		||||
        style="
 | 
			
		||||
          width: 100%;
 | 
			
		||||
          position: absolute;
 | 
			
		||||
          top: 12%;
 | 
			
		||||
          left: 50%;
 | 
			
		||||
          transform: translateX(-25%);
 | 
			
		||||
          overflow: hidden;
 | 
			
		||||
        "
 | 
			
		||||
      >
 | 
			
		||||
        <GradientTextVue :text="'' + value" />
 | 
			
		||||
      </div>
 | 
			
		||||
      <span
 | 
			
		||||
        style="
 | 
			
		||||
          width: 100%;
 | 
			
		||||
          font-size: 14px;
 | 
			
		||||
          line-height: 16px;
 | 
			
		||||
          position: absolute;
 | 
			
		||||
          top: 56%;
 | 
			
		||||
          left: 24%;
 | 
			
		||||
        "
 | 
			
		||||
        >{{ period == "日" ? "今日产出" : "本周产出" }}</span
 | 
			
		||||
      >
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import GradientTextVue from "./GradientText.vue";
 | 
			
		||||
export default {
 | 
			
		||||
  name: "CityItem",
 | 
			
		||||
  components: { GradientTextVue },
 | 
			
		||||
  props: {
 | 
			
		||||
    location: {
 | 
			
		||||
      type: String,
 | 
			
		||||
      default: "",
 | 
			
		||||
    },
 | 
			
		||||
    value: {
 | 
			
		||||
      type: Number,
 | 
			
		||||
      default: 0,
 | 
			
		||||
    },
 | 
			
		||||
    period: {
 | 
			
		||||
      type: String,
 | 
			
		||||
      default: "日",
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {};
 | 
			
		||||
  },
 | 
			
		||||
  computed: {},
 | 
			
		||||
  mounted() {},
 | 
			
		||||
  methods: {},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style scoped lang="scss">
 | 
			
		||||
.city-item {
 | 
			
		||||
  display: flex;
 | 
			
		||||
  gap: 8px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.inner-shadow {
 | 
			
		||||
  box-shadow: inset 0 0 12px 2px #fff3;
 | 
			
		||||
  border-radius: 4px;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
@@ -33,19 +33,19 @@ export default {
 | 
			
		||||
      type: Number,
 | 
			
		||||
      default: 24,
 | 
			
		||||
    },
 | 
			
		||||
    legendItems: {
 | 
			
		||||
      type: Array,
 | 
			
		||||
      default: () => [
 | 
			
		||||
        { label: "2023年累计", value: 88002 },
 | 
			
		||||
        { label: "2024年累计", value: 88002 },
 | 
			
		||||
        { label: "2025年累计", value: 88002 },
 | 
			
		||||
      ],
 | 
			
		||||
    period: {
 | 
			
		||||
      type: String,
 | 
			
		||||
      default: "日",
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {};
 | 
			
		||||
  },
 | 
			
		||||
  computed: {},
 | 
			
		||||
  computed: {
 | 
			
		||||
    legendItems() {
 | 
			
		||||
      return calculateItems(this.period);
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  mounted() {
 | 
			
		||||
    this.initOptions(options);
 | 
			
		||||
  },
 | 
			
		||||
@@ -56,6 +56,42 @@ export default {
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
function calculateItems(period) {
 | 
			
		||||
  let items = [];
 | 
			
		||||
  const today = new Date().getDate();
 | 
			
		||||
  const month = new Date().getMonth() + 1;
 | 
			
		||||
  const year = new Date().getFullYear();
 | 
			
		||||
  switch (period) {
 | 
			
		||||
    case "日":
 | 
			
		||||
      items = [
 | 
			
		||||
        { label: `${month}月${today}日累计`, value: 24 },
 | 
			
		||||
        { label: `去年${month}月${today}日累计`, value: 33 },
 | 
			
		||||
      ];
 | 
			
		||||
      break;
 | 
			
		||||
    case "周":
 | 
			
		||||
      items = [
 | 
			
		||||
        { label: `本周累计`, value: 32 },
 | 
			
		||||
        { label: `去年本周累计`, value: 12 },
 | 
			
		||||
      ];
 | 
			
		||||
      break;
 | 
			
		||||
    case "月":
 | 
			
		||||
      items = [
 | 
			
		||||
        { label: `${month}月累计`, value: 24 },
 | 
			
		||||
        { label: `去年${month}月累计`, value: 33 },
 | 
			
		||||
        { label: `${month}月目标`, value: 12334 },
 | 
			
		||||
      ];
 | 
			
		||||
      break;
 | 
			
		||||
    case "年":
 | 
			
		||||
      items = [
 | 
			
		||||
        { label: `${year - 1}年累计`, value: 23234 },
 | 
			
		||||
        { label: `${year}年累计`, value: 4324 },
 | 
			
		||||
        { label: `${year}年目标`, value: 12334 },
 | 
			
		||||
      ];
 | 
			
		||||
      break;
 | 
			
		||||
  }
 | 
			
		||||
  return items;
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style scoped>
 | 
			
		||||
 
 | 
			
		||||
@@ -7,10 +7,18 @@
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="double-ring-wrapper">
 | 
			
		||||
    <copilot-select :options="cityOptions" />
 | 
			
		||||
    <div class="flex-1 stretch">
 | 
			
		||||
      <DoubleRingChartVue />
 | 
			
		||||
    </div>
 | 
			
		||||
    <template v-if="period == '月' || period == '年'">
 | 
			
		||||
      <copilot-select
 | 
			
		||||
        @update:active="handleActiveUpdate"
 | 
			
		||||
        :options="cityOptions"
 | 
			
		||||
      />
 | 
			
		||||
      <div class="flex-1 stretch">
 | 
			
		||||
        <DoubleRingChartVue :period="period" />
 | 
			
		||||
      </div>
 | 
			
		||||
    </template>
 | 
			
		||||
    <template v-else>
 | 
			
		||||
      <CityData :data-source="dataSource" :period="period" />
 | 
			
		||||
    </template>
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
@@ -18,11 +26,21 @@
 | 
			
		||||
import CopilotSelect from "../../select.vue";
 | 
			
		||||
import fetcher from "./fetcherDoubleRing";
 | 
			
		||||
import DoubleRingChartVue from "./DoubleRingChart.vue";
 | 
			
		||||
import CityData from './CityData.vue';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  name: "DoubleRingWrapper",
 | 
			
		||||
  components: { CopilotSelect, DoubleRingChartVue },
 | 
			
		||||
  props: {},
 | 
			
		||||
  components: { CopilotSelect, DoubleRingChartVue, CityData },
 | 
			
		||||
  props: {
 | 
			
		||||
    dataSource: {
 | 
			
		||||
      type: Object,
 | 
			
		||||
      default: () => ({}),
 | 
			
		||||
    },
 | 
			
		||||
    period: {
 | 
			
		||||
      type: String,
 | 
			
		||||
      default: "日",
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      cityOptions: [
 | 
			
		||||
@@ -42,7 +60,11 @@ export default {
 | 
			
		||||
      console.log("getData--->", res);
 | 
			
		||||
    });
 | 
			
		||||
  },
 | 
			
		||||
  methods: {},
 | 
			
		||||
  methods: {
 | 
			
		||||
    handleActiveUpdate(val) {
 | 
			
		||||
      console.log("handleActiveUpdate--->", val);
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										56
									
								
								src/views/copilot/components/charts/base/GradientText.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								src/views/copilot/components/charts/base/GradientText.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,56 @@
 | 
			
		||||
<!-- 
 | 
			
		||||
    filename: GradientText.vue
 | 
			
		||||
    author: liubin
 | 
			
		||||
    date: 2024-04-24 16:33:25
 | 
			
		||||
    description: 
 | 
			
		||||
-->
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
  <svg height="32" width="100%">
 | 
			
		||||
    <defs>
 | 
			
		||||
      <linearGradient id="smoke-text" x1="0%" y1="0%" x2="0%" y2="100%">
 | 
			
		||||
        <stop offset="0%" style="stop-color: #00fff4; stop-opacity: 1" />
 | 
			
		||||
        <stop offset="100%" style="stop-color: #37bdfe; stop-opacity: 1" />
 | 
			
		||||
      </linearGradient>
 | 
			
		||||
    </defs>
 | 
			
		||||
    <text
 | 
			
		||||
      x="0"
 | 
			
		||||
      y="24"
 | 
			
		||||
      fill="url(#smoke-text)"
 | 
			
		||||
      :style="{ fontSize: '24px', letterSpacing: spacing || '2px' }"
 | 
			
		||||
    >
 | 
			
		||||
      {{ text | numberFilter }}
 | 
			
		||||
    </text>
 | 
			
		||||
  </svg>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
export default {
 | 
			
		||||
  name: "GradientText",
 | 
			
		||||
  components: {},
 | 
			
		||||
  props: {
 | 
			
		||||
    text: {
 | 
			
		||||
      type: String,
 | 
			
		||||
      default: "Test",
 | 
			
		||||
    },
 | 
			
		||||
    spacing: {
 | 
			
		||||
      type: String,
 | 
			
		||||
      default: "1px",
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  filters: {
 | 
			
		||||
    numberFilter(value) {
 | 
			
		||||
      if (value != null && !isNaN(parseInt(value))) {
 | 
			
		||||
        return parseInt(value).toLocaleString();
 | 
			
		||||
      } else {
 | 
			
		||||
        return value;
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {};
 | 
			
		||||
  },
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style scoped lang="scss"></style>
 | 
			
		||||
@@ -33,9 +33,17 @@ export default {
 | 
			
		||||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      currentActive: '',
 | 
			
		||||
      currentActive: this.options[0],
 | 
			
		||||
    };
 | 
			
		||||
  },
 | 
			
		||||
  watch: {
 | 
			
		||||
    currentActive: {
 | 
			
		||||
      handler(val) {
 | 
			
		||||
        this.$emit("update:active", val);
 | 
			
		||||
      },
 | 
			
		||||
      immediate: true,
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  computed: {},
 | 
			
		||||
  methods: {},
 | 
			
		||||
};
 | 
			
		||||
@@ -55,7 +63,7 @@ button {
 | 
			
		||||
  padding: 8px 12px;
 | 
			
		||||
  cursor: pointer;
 | 
			
		||||
  position: relative;
 | 
			
		||||
  transition: all .3s;
 | 
			
		||||
  transition: all 0.3s;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
button.active,
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@
 | 
			
		||||
  <div class="yield-copilot">
 | 
			
		||||
    <section class="top flex">
 | 
			
		||||
      <db-container class="std-yield" title="标准组件产出" icon="std">
 | 
			
		||||
        <std-output />
 | 
			
		||||
        <std-output :period="period" />
 | 
			
		||||
      </db-container>
 | 
			
		||||
      <db-container class="chip-yield" title="芯片产出" icon="chip2">
 | 
			
		||||
        <chip-output />
 | 
			
		||||
@@ -19,7 +19,9 @@
 | 
			
		||||
      </db-container>
 | 
			
		||||
    </section>
 | 
			
		||||
    <section class="bottom flex">
 | 
			
		||||
      <db-container class="fto-involve" title="FTO投入"></db-container>
 | 
			
		||||
      <db-container class="fto-involve" title="FTO投入">
 | 
			
		||||
        <fto-invest :period="period" />
 | 
			
		||||
      </db-container>
 | 
			
		||||
      <db-container
 | 
			
		||||
        class="chip-involve"
 | 
			
		||||
        title="芯片投入"
 | 
			
		||||
@@ -33,7 +35,7 @@
 | 
			
		||||
import Container from "../components/Container.vue";
 | 
			
		||||
import StdOutputVue from "../components/charts/StdOutput.vue";
 | 
			
		||||
import ChipOutputVue from "../components/charts/ChipOutput.vue";
 | 
			
		||||
 | 
			
		||||
import FtoInvestVue from "../components/charts/FtoInvest.vue";
 | 
			
		||||
import BipvOutputVue from "../components/charts/BipvOutput.vue";
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
@@ -43,13 +45,31 @@ export default {
 | 
			
		||||
    StdOutput: StdOutputVue,
 | 
			
		||||
    ChipOutput: ChipOutputVue,
 | 
			
		||||
    BipvOutput: BipvOutputVue,
 | 
			
		||||
    FtoInvest: FtoInvestVue
 | 
			
		||||
  },
 | 
			
		||||
  props: {
 | 
			
		||||
    period: {
 | 
			
		||||
      type: String,
 | 
			
		||||
      default: "日",
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  props: {},
 | 
			
		||||
  data() {
 | 
			
		||||
    return {};
 | 
			
		||||
  },
 | 
			
		||||
  computed: {},
 | 
			
		||||
  methods: {},
 | 
			
		||||
  watch: {
 | 
			
		||||
    period: {
 | 
			
		||||
      handler(val) {
 | 
			
		||||
        val && this.fetchData(val);
 | 
			
		||||
      },
 | 
			
		||||
      immediate: true,
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    fetchData(period = "日") {
 | 
			
		||||
      this.$store.dispatch("copilot/initCopilot", { period });
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user