1
This commit is contained in:
		@@ -7,8 +7,16 @@
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="chip-rate">
 | 
			
		||||
    <ChipRateItem :cities="['成都', '邯郸', '株洲', '瑞昌']" :color="1" />
 | 
			
		||||
    <ChipRateItem :cities="['佳木斯', '凯盛光伏', '蚌埠兴科']" :color="2" />
 | 
			
		||||
    <ChipRateItem
 | 
			
		||||
      :period="period"
 | 
			
		||||
      :cities="['成都', '邯郸', '株洲', '瑞昌']"
 | 
			
		||||
      :color="1"
 | 
			
		||||
    />
 | 
			
		||||
    <ChipRateItem
 | 
			
		||||
      :period="period"
 | 
			
		||||
      :cities="['佳木斯', '凯盛光伏', '蚌埠兴科']"
 | 
			
		||||
      :color="2"
 | 
			
		||||
    />
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
@@ -17,7 +25,12 @@ import ChipRateItemVue from "./sub/chip/ChipRateItem.vue";
 | 
			
		||||
export default {
 | 
			
		||||
  name: "ChipRate",
 | 
			
		||||
  components: { ChipRateItem: ChipRateItemVue },
 | 
			
		||||
  props: {},
 | 
			
		||||
  props: {
 | 
			
		||||
    period: {
 | 
			
		||||
      type: String,
 | 
			
		||||
      default: "日",
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {};
 | 
			
		||||
  },
 | 
			
		||||
 
 | 
			
		||||
@@ -11,14 +11,10 @@
 | 
			
		||||
      <CopilotButtons :options="cities" @update:active="handleCityUpdate" />
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="chart" ref="chart"></div>
 | 
			
		||||
    <div class="legend" v-if="1">
 | 
			
		||||
      <div class="legend-item">
 | 
			
		||||
        <span class="legend-item__value">20%</span>
 | 
			
		||||
        <span class="legend-item__label">2023年累计</span>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="legend-item">
 | 
			
		||||
        <span class="legend-item__value">20%</span>
 | 
			
		||||
        <span class="legend-item__label">2024年累计</span>
 | 
			
		||||
    <div class="legend" v-if="period == '月' || period == '年'">
 | 
			
		||||
      <div class="legend-item" v-for="lgd in legend" :key="lgd.label">
 | 
			
		||||
        <span class="legend-item__value">{{ lgd.value }}</span>
 | 
			
		||||
        <span class="legend-item__label">{{ lgd.label }}</span>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
@@ -29,6 +25,7 @@ import CopilotButtons from "@/views/copilot/components/select.vue";
 | 
			
		||||
import chartMixin from "@/mixins/chart.js";
 | 
			
		||||
import fullscreenMixin from "@/mixins/fullscreen.js";
 | 
			
		||||
import getOptions from "../../../options/chipOptions.js";
 | 
			
		||||
import { mapGetters } from "vuex";
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  name: "ChipRateItem",
 | 
			
		||||
@@ -43,44 +40,102 @@ export default {
 | 
			
		||||
      type: Number,
 | 
			
		||||
      default: 1,
 | 
			
		||||
    },
 | 
			
		||||
    period: {
 | 
			
		||||
      type: String,
 | 
			
		||||
      default: "日",
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      period: "月",
 | 
			
		||||
      valueTuple: [100, 100, 200],
 | 
			
		||||
      factoryId: 0,
 | 
			
		||||
      count: 1,
 | 
			
		||||
    };
 | 
			
		||||
  },
 | 
			
		||||
  computed: {
 | 
			
		||||
    chipRate() {
 | 
			
		||||
      return this.$store.getters.copilot.efficiency.chipRate;
 | 
			
		||||
    },
 | 
			
		||||
    valueTuple() {
 | 
			
		||||
      const getter = this.chipRate;
 | 
			
		||||
      if (this.period === "日" || this.period === "周") {
 | 
			
		||||
        return [
 | 
			
		||||
          getter.previous[this.factoryId],
 | 
			
		||||
          getter.current[this.factoryId],
 | 
			
		||||
          0,
 | 
			
		||||
        ];
 | 
			
		||||
      }
 | 
			
		||||
      // [100, 200, 200]
 | 
			
		||||
      return [
 | 
			
		||||
        getter.previous[this.factoryId],
 | 
			
		||||
        getter.current[this.factoryId],
 | 
			
		||||
        getter.target[this.factoryId],
 | 
			
		||||
      ];
 | 
			
		||||
    },
 | 
			
		||||
    options() {
 | 
			
		||||
      const single = this.period === "日" || this.period === "周";
 | 
			
		||||
      const year = new Date().getFullYear();
 | 
			
		||||
      const month = new Date().getMonth() + 1;
 | 
			
		||||
      const vt = this.valueTuple;
 | 
			
		||||
      let titleValue =
 | 
			
		||||
          vt[0] != null && vt[2] != null && vt[2] !== 0
 | 
			
		||||
            ? `${((vt[1] / vt[2]) * 100).toFixed(0)}%`
 | 
			
		||||
            : "0%",
 | 
			
		||||
        subtitle =
 | 
			
		||||
          this.period == "月" ? `${month}月累计产出` : `${year}年累计产出`;
 | 
			
		||||
      let titleValue = single
 | 
			
		||||
          ? (vt[1] != null && `${vt[1] * 100}%`) || "0%"
 | 
			
		||||
          : vt[0] != null && vt[2] != null && vt[2] !== 0
 | 
			
		||||
          ? `${((vt[1] / vt[2]) * 100).toFixed(0)}%`
 | 
			
		||||
          : "0%",
 | 
			
		||||
        subtitle = {
 | 
			
		||||
          日: "本日良率",
 | 
			
		||||
          周: "本周良率",
 | 
			
		||||
          月: `${month}月良率`,
 | 
			
		||||
          年: `${year}良率`,
 | 
			
		||||
        }[this.period];
 | 
			
		||||
 | 
			
		||||
      return getOptions({
 | 
			
		||||
        single: true,
 | 
			
		||||
      const t = getOptions({
 | 
			
		||||
        single,
 | 
			
		||||
        color: this.color == 1 ? "#4CF0E8" : "#1065ff",
 | 
			
		||||
        titleValue,
 | 
			
		||||
        subtitle,
 | 
			
		||||
        previousSum: this.valueTuple[0],
 | 
			
		||||
        currentSum: this.valueTuple[1],
 | 
			
		||||
        targetSum: this.valueTuple[2],
 | 
			
		||||
        previousSum: vt[0],
 | 
			
		||||
        currentSum: vt[1],
 | 
			
		||||
        targetSum: vt[2],
 | 
			
		||||
      });
 | 
			
		||||
      return t;
 | 
			
		||||
    },
 | 
			
		||||
    legend() {
 | 
			
		||||
      const year = new Date().getFullYear();
 | 
			
		||||
      const month = new Date().getMonth() + 1;
 | 
			
		||||
      return [
 | 
			
		||||
        {
 | 
			
		||||
          label:
 | 
			
		||||
            this.period == "月"
 | 
			
		||||
              ? `${year - 1}年${month}月良率`
 | 
			
		||||
              : `${year - 1}年良率`,
 | 
			
		||||
          value: (this.valueTuple[0] * 100).toFixed(0) + "%",
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          label: this.period == "月" ? `${month}月良率` : `${year}年良率`,
 | 
			
		||||
          value:  (this.valueTuple[1] * 100).toFixed(0) + "%",
 | 
			
		||||
        },
 | 
			
		||||
      ];
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  mounted() {
 | 
			
		||||
    this.initOptions(this.options);
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    handleCityUpdate() {},
 | 
			
		||||
    fullscreenCallback(isFullscreen) {
 | 
			
		||||
      console.log("isFullscreen--->", isFullscreen);
 | 
			
		||||
  watch: {
 | 
			
		||||
    period() {
 | 
			
		||||
      this.initOptions(this.options);
 | 
			
		||||
    },
 | 
			
		||||
    factoryId() {
 | 
			
		||||
      this.initOptions(this.options);
 | 
			
		||||
    },
 | 
			
		||||
    chipRate() {
 | 
			
		||||
      this.initOptions(this.options);
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    handleCityUpdate(id) {
 | 
			
		||||
      this.factoryId = id;
 | 
			
		||||
    },
 | 
			
		||||
    fullscreenCallback(isFullscreen) {},
 | 
			
		||||
  },
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 
 | 
			
		||||
@@ -8,10 +8,10 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="efficiency-copilot">
 | 
			
		||||
    <Container title="芯片良率" icon="chip2">
 | 
			
		||||
      <ChipRate />
 | 
			
		||||
      <ChipRate :period="period" />
 | 
			
		||||
    </Container>
 | 
			
		||||
    <Container title="标准组件良率" icon="std">
 | 
			
		||||
      <StdRate />
 | 
			
		||||
      <StdRate :period="period" />
 | 
			
		||||
    </Container>
 | 
			
		||||
    <Container title="芯片OEE" icon="chip">
 | 
			
		||||
      <ChipOee :period="period" />
 | 
			
		||||
 
 | 
			
		||||
@@ -15,7 +15,11 @@ export default function ({
 | 
			
		||||
      top: 0,
 | 
			
		||||
      containLabel: true,
 | 
			
		||||
    },
 | 
			
		||||
    tooltip: {},
 | 
			
		||||
    tooltip: {
 | 
			
		||||
      // formatter(params) {
 | 
			
		||||
      //   return `${params.name}: ${(params.value * 100).toFixed(0)}%`;
 | 
			
		||||
      // }
 | 
			
		||||
    },
 | 
			
		||||
    title: {
 | 
			
		||||
      text: titleValue,
 | 
			
		||||
      left: "49%",
 | 
			
		||||
@@ -60,7 +64,7 @@ export default function ({
 | 
			
		||||
        data: [
 | 
			
		||||
          {
 | 
			
		||||
            value: currentSum,
 | 
			
		||||
            name: "当前累计产出",
 | 
			
		||||
            name: "当前良率",
 | 
			
		||||
            selected: false,
 | 
			
		||||
            itemStyle: {
 | 
			
		||||
              borderJoin: "round",
 | 
			
		||||
@@ -93,9 +97,9 @@ export default function ({
 | 
			
		||||
                ? currentSum == 0
 | 
			
		||||
                  ? 1
 | 
			
		||||
                  : 0
 | 
			
		||||
                : 0,
 | 
			
		||||
                : targetSum,
 | 
			
		||||
 | 
			
		||||
            name: "未达成累计",
 | 
			
		||||
            name: "未达成",
 | 
			
		||||
            itemStyle: { color: "transparent" },
 | 
			
		||||
            label: { show: false },
 | 
			
		||||
          },
 | 
			
		||||
@@ -118,7 +122,7 @@ export default function ({
 | 
			
		||||
            data: [
 | 
			
		||||
              {
 | 
			
		||||
                value: previousSum,
 | 
			
		||||
                name: "上期累计产出",
 | 
			
		||||
                name: "上期良率",
 | 
			
		||||
                selected: false,
 | 
			
		||||
                itemStyle: {
 | 
			
		||||
                  borderJoin: "round",
 | 
			
		||||
@@ -146,6 +150,9 @@ export default function ({
 | 
			
		||||
                    ? 1
 | 
			
		||||
                    : 0,
 | 
			
		||||
                name: "-",
 | 
			
		||||
                formatter: {
 | 
			
		||||
                  show: false
 | 
			
		||||
                },
 | 
			
		||||
                itemStyle: { color: "transparent" },
 | 
			
		||||
                label: { show: false },
 | 
			
		||||
              },
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user