1
This commit is contained in:
		@@ -5,27 +5,23 @@
 | 
			
		||||
      :companyId="companyId"
 | 
			
		||||
      :period="period"
 | 
			
		||||
      @updateCompany="updateCompany"
 | 
			
		||||
      @update:period="period = $event"
 | 
			
		||||
      @update:period="updatePeriod"
 | 
			
		||||
    />
 | 
			
		||||
    <div class="factory-section">
 | 
			
		||||
      <section class="top flex">
 | 
			
		||||
        <db-container title="生产监控" icon="prod">
 | 
			
		||||
          <prod-monitor />
 | 
			
		||||
          <prod-monitor :prodOutPut="prodOutPut" :prodFto="prodFto" />
 | 
			
		||||
        </db-container>
 | 
			
		||||
        <db-container title="仓库监控.当前" icon="store">
 | 
			
		||||
          <store :series="series" :xAxis="xAxis" />
 | 
			
		||||
          <store :stock="stock" />
 | 
			
		||||
        </db-container>
 | 
			
		||||
      </section>
 | 
			
		||||
      <section class="bottom flex">
 | 
			
		||||
        <db-container title="能源监控" icon="energy">
 | 
			
		||||
          <energy
 | 
			
		||||
            :legend="energyLegend"
 | 
			
		||||
            :series="energySeries"
 | 
			
		||||
            :xAxis="energyxAxis"
 | 
			
		||||
          />
 | 
			
		||||
          <energy :legend="energyLegend" :energyCockpits="energyCockpits" />
 | 
			
		||||
        </db-container>
 | 
			
		||||
        <db-container title="订单监控" icon="order">
 | 
			
		||||
          <order />
 | 
			
		||||
          <order :prodOrder="prodOrder" />
 | 
			
		||||
        </db-container>
 | 
			
		||||
      </section>
 | 
			
		||||
    </div>
 | 
			
		||||
@@ -41,7 +37,7 @@ import Energy from "./components/Energy.vue";
 | 
			
		||||
import Order from "./components/Order.vue";
 | 
			
		||||
import { cockpitDataMonitor } from "@/api/produceData";
 | 
			
		||||
export default {
 | 
			
		||||
  name: "FactoryData",
 | 
			
		||||
  name: "factoryData",
 | 
			
		||||
  components: {
 | 
			
		||||
    FactoryDataHeader,
 | 
			
		||||
    DbContainer: Container,
 | 
			
		||||
@@ -51,89 +47,47 @@ export default {
 | 
			
		||||
    Order,
 | 
			
		||||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    const year = new Date().getFullYear();
 | 
			
		||||
    const cities = ["瑞昌", "邯郸", "株洲", "佳木斯", "成都", "凯盛", "蚌埠"];
 | 
			
		||||
    return {
 | 
			
		||||
      companyId: "1",
 | 
			
		||||
      companyId: 0,
 | 
			
		||||
      companyName: "瑞昌中建材光电材料有限公司",
 | 
			
		||||
      period: "日",
 | 
			
		||||
 | 
			
		||||
      period: 1,
 | 
			
		||||
      // 接口获取的数据
 | 
			
		||||
      prodOutPut: [], //生产
 | 
			
		||||
      prodFto: [], //生产
 | 
			
		||||
      stock: {}, //仓库
 | 
			
		||||
      energyCockpits: [], //能源
 | 
			
		||||
      prodOrder: [], //订单
 | 
			
		||||
      energyLegend: [
 | 
			
		||||
        { label: "电", color: "#FFD160" },
 | 
			
		||||
        { label: "水", color: "#2760FF" },
 | 
			
		||||
        { label: "气", color: "#12FFF5" },
 | 
			
		||||
      ],
 | 
			
		||||
      energyxAxis: [3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7],
 | 
			
		||||
 | 
			
		||||
      legend: [
 | 
			
		||||
        { label: `${year - 1}年`, color: "#12f7f1" },
 | 
			
		||||
        // { label: `${year}年`, color: "#58adfa" },
 | 
			
		||||
      ],
 | 
			
		||||
      xAxis: cities,
 | 
			
		||||
    };
 | 
			
		||||
  },
 | 
			
		||||
  computed: {
 | 
			
		||||
    energySeries() {
 | 
			
		||||
      return [
 | 
			
		||||
        {
 | 
			
		||||
          name: "电",
 | 
			
		||||
          data: Array.from({ length: 7 }, () =>
 | 
			
		||||
            Math.floor(Math.random() * 1000)
 | 
			
		||||
          ),
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          name: "水",
 | 
			
		||||
          data: Array.from({ length: 7 }, () =>
 | 
			
		||||
            Math.floor(Math.random() * 1000)
 | 
			
		||||
          ),
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          name: "气",
 | 
			
		||||
          data: Array.from({ length: 7 }, () =>
 | 
			
		||||
            Math.floor(Math.random() * 1000)
 | 
			
		||||
          ),
 | 
			
		||||
        },
 | 
			
		||||
      ];
 | 
			
		||||
    },
 | 
			
		||||
    series() {
 | 
			
		||||
      // 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)
 | 
			
		||||
          ),
 | 
			
		||||
        },
 | 
			
		||||
      ];
 | 
			
		||||
      // }
 | 
			
		||||
 | 
			
		||||
      // return [
 | 
			
		||||
      //   {
 | 
			
		||||
      //     name: `${new Date().getFullYear() - 1}年`,
 | 
			
		||||
      //     data: ftoInvest.previous,
 | 
			
		||||
      //   },
 | 
			
		||||
      //   {
 | 
			
		||||
      //     name: `${new Date().getFullYear()}年`,
 | 
			
		||||
      //     data: ftoInvest.current,
 | 
			
		||||
      //   },
 | 
			
		||||
      // ];
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  mounted() {
 | 
			
		||||
    this.getMes1();
 | 
			
		||||
    this.getMes();
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    updateCompany(obj) {
 | 
			
		||||
      this.companyId = obj.companyId;
 | 
			
		||||
      this.companyName = obj.companyName;
 | 
			
		||||
      this.getMes();
 | 
			
		||||
    },
 | 
			
		||||
    getMes1() {
 | 
			
		||||
    updatePeriod(val) {
 | 
			
		||||
      this.period = val;
 | 
			
		||||
      this.getMes();
 | 
			
		||||
    },
 | 
			
		||||
    getMes() {
 | 
			
		||||
      cockpitDataMonitor({
 | 
			
		||||
        factorys: [1],
 | 
			
		||||
        date: 4,
 | 
			
		||||
        factorys: [this.companyId],
 | 
			
		||||
        date: this.period,
 | 
			
		||||
      }).then((res) => {
 | 
			
		||||
        console.log(res);
 | 
			
		||||
        this.prodOutPut = res.data.prodOutputMonitorShDO || [];
 | 
			
		||||
        this.prodFto = res.data.prodOutputFtoDO || [];
 | 
			
		||||
        this.stock = res.data.stockDO || {};
 | 
			
		||||
        this.energyCockpits = res.data.energyCockpitsDO || [];
 | 
			
		||||
        this.prodOrder = res.data.prodOrderMonitorDO || [];
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user