<template>
  <div class="mainContentBox">
    <el-row :gutter="20">
      <el-col :span="6" class="elColClasss">
        <Orders :ordersSum="ordersSum" @getindex="setSelectOrderIndex" />
      </el-col>
      <el-col :span="6" class="elColClasss">
        <div class="grid-content ep-bg-purple">
          <Info />
        </div>
      </el-col>
      <el-col :span="12" class="elColClasss">
        <div class="grid-content ep-bg-purple">
          <CurrentProduction />
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script lang="ts" setup>
import Orders from "@/views/repair/main/components/orders.vue";
import Info from "@/views/repair/components/info.vue";
import CurrentProduction from "@/views/repair/main/components/currentProduction.vue";
import { getEscalationFaultList, getWorkOrderCode } from "@/api/repair";
import { useRepairStore } from "@/store";


defineOptions({ name: "RepairMain" });
const store = useRepairStore();
const ordersDataArray = ref([]);
const ordersSum = ref(0);
const selectOrderIndex = ref(NaN);
const setSelectOrderIndex = (value: number) => {
  selectOrderIndex.value = value;
};
provide("ordersDataArray", ordersDataArray);
provide("selectOrderIndex", selectOrderIndex);
const ordersQuery = ref({
  orders: [],
  pageNo: 1,
  pageSize: 9999,
  state: "1", //'1'待处理'2'已处理
});

//获取待处理Data
const getOrdersData = async () => {
  const { code, data } = await getEscalationFaultList(ordersQuery.value);
  if (code == "200") {
    ordersDataArray.value = data.records;
    ordersSum.value = data.totalCount;
  }
};
onMounted(() => {
  getOrdersData();
});
</script>

<style lang="scss" scoped>
.elColClasss {
  height: calc(100vh - 130px);
}
</style>
