<script>
import {
  updateFangpaishuiPumpoperationrecordApi,
  deleteFangpaishuiPumpoperationrecordApi,
  findPumpoperationrecordByDetailApi,
  addFangpaishuiPumpoperationrecordApi,
  findFangpaishuiPumpoperationrecordByMonthApi,
} from "@@/apis/tables/drainageWorkshop/pumpOperationLog.ts";
import { getSpecificDate } from "@@/utils/datetime";
export default {
  data() {
    return {
      date: "",
      tableList: [
        {
          index: "1",
          unitsNum: "8", //台数
          totalTime: "5760", //总时间
          productionTime: "4560", //生产时间
          noproductionTimeCount: "1200", //计
          operatingRate: "", //作业率
          classAUnitsNum: "4", //台 数
          classAtotalTime: "2880", //总时间
          classAproductionTime: "1920", //生产时间
          classAcount: "960", //计
          classAoperatingRate: "", //作业率
          classBunitsNum: "4", //台 数
          classBtotalTime: "2880", //总时间
          classBproductionTime: "2640", //生产时间
          classBcount: "240", //计
          classBoperatingRate: "", //作业率
          classCunitsNum: "0", //台 数
          classCtotalTime: "0", //总时间
          classCproductionTime: "0", //生产时间
          classCcount: "0", //计
          classCoperatingRate: "", //作业率
        },
        {
          index: "2",
          unitsNum: "8", //台数
          totalTime: "5760", //总时间
          productionTime: "4560", //生产时间
          noproductionTimeCount: "1200", //计
          operatingRate: "", //作业率
          classAUnitsNum: "4", //台 数
          classAtotalTime: "2880", //总时间
          classAproductionTime: "2640", //生产时间
          classAcount: "240", //计
          classAoperatingRate: "", //作业率
          classBunitsNum: "0", //台 数
          classBtotalTime: "0", //总时间
          classBproductionTime: "0", //生产时间
          classBcount: "0", //计
          classBoperatingRate: "", //作业率
          classCunitsNum: "4", //台 数
          classCtotalTime: "2880", //总时间
          classCproductionTime: "1920", //生产时间
          classCcount: "960", //计
          classCoperatingRate: "", //作业率
        },
        {
          index: "3",
          unitsNum: "8", //台数
          totalTime: "5760", //总时间
          productionTime: "4560", //生产时间
          noproductionTimeCount: "1200", //计
          operatingRate: "", //作业率
          classAUnitsNum: "0", //台 数
          classAtotalTime: "0", //总时间
          classAproductionTime: "0", //生产时间
          classAcount: "0", //计
          classAoperatingRate: "", //作业率
          classBunitsNum: "4", //台 数
          classBtotalTime: "2880", //总时间
          classBproductionTime: "1920", //生产时间
          classBcount: "960", //计
          classBoperatingRate: "", //作业率
          classCunitsNum: "4", //台 数
          classCtotalTime: "2880", //总时间
          classCproductionTime: "1920", //生产时间
          classCcount: "960", //计
          classCoperatingRate: "", //作业率
        },
        {
          index: "4",
          unitsNum: "8", //台数
          totalTime: "5760", //总时间
          productionTime: "4560", //生产时间
          noproductionTimeCount: "1200", //计
          operatingRate: "", //作业率
          classAUnitsNum: "4", //台 数
          classAtotalTime: "2880", //总时间
          classAproductionTime: "1920", //生产时间
          classAcount: "960", //计
          classAoperatingRate: "", //作业率
          classBunitsNum: "4", //台 数
          classBtotalTime: "2880", //总时间
          classBproductionTime: "2640", //生产时间
          classBcount: "240", //计
          classBoperatingRate: "", //作业率
          classCunitsNum: "4", //台 数
          classCtotalTime: "2880", //总时间
          classCproductionTime: "1920", //生产时间
          classCcount: "960", //计
          classCoperatingRate: "", //作业率
        },
        {
          index: "5",
          unitsNum: "8", //台数
          totalTime: "5760", //总时间
          productionTime: "4620", //生产时间
          noproductionTimeCount: "1140", //计
          operatingRate: "", //作业率
          classAUnitsNum: "0", //台 数
          classAtotalTime: "0", //总时间
          classAproductionTime: "0", //生产时间
          classAcount: "0", //计
          classAoperatingRate: "", //作业率
          classBunitsNum: "4", //台 数
          classBtotalTime: "2880", //总时间
          classBproductionTime: "2160", //生产时间
          classBcount: "720", //计
          classBoperatingRate: "", //作业率
          classCunitsNum: "4", //台 数
          classCtotalTime: "2880", //总时间
          classCproductionTime: "2460", //生产时间
          classCcount: "420", //计
          classCoperatingRate: "", //作业率
        },
      ],
      classList: [
        {
          name: "甲班",
          unitsNum: "classAUnitsNum",
          totalTime: "classAtotalTime",
          productionTime: "classAproductionTime",
          count: "classAcount",
          operatingRate: "classAoperatingRate",
        },
        {
          name: "乙班",
          unitsNum: "classBUnitsNum",
          totalTime: "classBtotalTime",
          productionTime: "classBproductionTime",
          count: "classBcount",
          operatingRate: "classBoperatingRate",
        },
        {
          name: "丙班",
          unitsNum: "classCunitsNum",
          totalTime: "classCtotalTime",
          productionTime: "classCproductionTime",
          count: "classCcount",
          operatingRate: "classCoperatingRate",
        },
      ],
    };
  },
  created() {
    // 页面渲染之前执行，一般调用methods定义的方法
    this.getList();
  },
  methods: {
    //获取列表
    async getList() {
      const res = await findAllMiningglossApi();
      console.log(res);
    },
  },
};
</script>

<template>
  <div class="app-container">
    <div style="margin-bottom: 20px">
      <el-date-picker v-model="date" type="month" placeholder="选择年月">
      </el-date-picker>
      <el-button
        type="primary"
        size="mini"
        style="margin-left: 20px"
        @click="getMouthLoss"
        >查询</el-button
      >
    </div>
    <el-table
      :data="tableList"
      border
      style="width: 100%"
      :header-align="center"
      :cell-style="rowStyle"
    >
      <el-table-column fixed align="center" prop="index" label="项目" />
      <el-table-column align="center" label="计">
        <el-table-column align="center" prop="unitsNum" label="台数" />
        <el-table-column align="center" prop="totalTime" label="总时间" />
        <el-table-column
          align="center"
          prop="productionTime"
          label="生产时间"
        />
        <el-table-column align="center" label="非生产时间">
          <el-table-column
            align="center"
            prop="noproductionTimeCount"
            label="计"
          />
        </el-table-column>
        <el-table-column align="center" prop="operatingRate" label="作业率" />
      </el-table-column>
      <el-table-column align="center" label="各班电机车作业情况">
        <el-table-column
          align="center"
          :label="item.name"
          v-for="(item, index) in classList"
          :key="index"
        >
          <el-table-column align="center" :prop="item.unitsNum" label="台数" />
          <el-table-column
            align="center"
            :prop="item.totalTime"
            label="总时间"
          />
          <el-table-column
            align="center"
            :prop="item.productionTime"
            label="生产时间"
          />
          <el-table-column align="center" :prop="item.count" label="计" />
          <el-table-column
            align="center"
            :prop="item.classoperatingRate"
            label="作业率"
          /> </el-table-column
      ></el-table-column>
      <!-- 空数据时的显示 -->
      <template #empty>
        <div style="display: grid; place-items: center center">
          <el-empty :image-size="242" :description="暂无数据" />
        </div>
      </template>
    </el-table>
  </div>
</template>
