<template>
  <!-- 完成情况 -->
  <div class="app-container scroll-auto">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
      <el-form-item label="时间" prop="reportYear">
        <el-date-picker
          v-model="queryParams.reportYear"
          type="year"
          format="yyyy"
          value-format="yyyy"
          placeholder="选择年"
          :clearable="false"
        >
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
      </el-form-item>
    </el-form>
    <el-tabs v-model="activeTab">
      <el-tab-pane label="总目标">
        <TableCmponent
          :dataList="dataList"
          :loading="loading"
          :dataType="1"
        ></TableCmponent>
      </el-tab-pane>
      <el-tab-pane label="计划停电目标">
        <TableCmponent
          :dataList="dataList"
          :loading="loading"
          :dataType="2"
        ></TableCmponent>
      </el-tab-pane>
      <el-tab-pane label="故障停电目标">
        <TableCmponent
          :dataList="dataList"
          :loading="loading"
          :dataType="3"
        ></TableCmponent>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import TableCmponent from "./components/TableCmponent.vue";
import { stopActualList } from "@/api/powerdistribution/power-outage-control";
export default {
  components: { TableCmponent },
  data() {
    return {
      //当前选中的tab
      activeTab: "",
      dataList: [],
      // 遮罩层
      loading: true,
      total: 0,
      queryParams: {
        reportYear: `${new Date().getFullYear()}`,
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询列表 */
    getList() {
      this.loading = true;
      stopActualList({
        ...this.queryParams,
      }).then((response) => {
        this.dataList = response.rows;
        this.loading = false;
      });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
  },
};
</script>

<style></style>
