index.vue 2.42 KB
<template>
  <div class="dashboard-editor-container">
    <panel-group :chart-data="panelData" />

    <el-row style="background: #fff; padding: 16px 16px 0; margin-bottom: 32px">
      <line-chart :last-data="lastData" />
    </el-row>

    <el-row :gutter="32">
      <el-col :xs="24" :sm="24" :lg="8">
        <div class="chart-wrapper">
          <pie-location-chart :location-data="locationData" />
        </div>
      </el-col>
      <el-col :xs="24" :sm="24" :lg="8">
        <div class="chart-wrapper">
          <pie-status-chart :status-data="statusData" />
        </div>
      </el-col>
      <el-col :xs="24" :sm="24" :lg="8">
        <div class="chart-wrapper">
          <pie-inventory-chart :prop-data="propData" />
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { getCommonData } from "@/api/dashboard";
import { getShipmentsLast7Days } from "@/api/task/taskHeader";
import { getLocationProp } from "@/api/config/InventoryInfo/location";
import {
  getInventoryStatus,
  getInventoryProp,
} from "@/api/inventory/inventoryHeader/header";
import PanelGroup from "./dashboard/PanelGroup";
import LineChart from "./dashboard/LineChart";
import PieLocationChart from "./dashboard/PieLocationChart";
import PieStatusChart from "./dashboard/PieStatusChart";
import PieInventoryChart from "./dashboard/PieInventoryChart";

export default {
  name: "Index",
  components: {
    PanelGroup,
    LineChart,
    PieLocationChart,
    PieStatusChart,
    PieInventoryChart,
  },
  data() {
    return {
      panelData: {},
      locationData: [],
      statusData: [],
      propData: [],
      lastData: {},
    };
  },
  created() {
    getCommonData().then((response) => {
      this.panelData = response.data;
    });
    getShipmentsLast7Days().then((response) => {
      this.lastData = response.data;
    });
    getLocationProp().then((response) => {
      this.locationData = response.data;
    });
    getInventoryStatus().then((response) => {
      this.statusData = response.data;
    });
    getInventoryProp().then((response) => {
      this.propData = response.data.list;
    });
  }
};
</script>

<style lang="scss" scoped>
.dashboard-editor-container {
  padding: 32px;
  background-color: rgb(240, 242, 245);
  position: relative;

  .chart-wrapper {
    background: #fff;
    padding: 16px 16px 0;
    margin-bottom: 32px;
  }
}

@media (max-width: 1024px) {
  .chart-wrapper {
    padding: 8px;
  }
}
</style>