<template>
  <div class="app-container">
    <Com-table :tableFormat="tableFormat" :tableData="tableData"> </Com-table>
    <pagination
      :total="pages.total"
      :page.sync="pages.pageNum"
      :limit.sync="pages.pageSize"
      @pagination="findMassPage"
    />
  </div>
</template>

<script>
import { findMassPage } from "@/api/home";
export default {
  data() {
    return {
      tableFormat: [
        {
          label: "序号",
          prop: "index",
          maxWidth: 80,
        },
        {
          prop: "qxbh",
          label: "缺陷编号",
          labelWidth: "120px",
        },
        {
          prop: "dzorxlmc",
          label: "电站/线路名称",
        },
        {
          prop: "qxzsbmc",
          label: "缺陷主设备名称",
        },
        {
          prop: "qxms",
          label: "缺陷描述",
        },
        {
          prop: "qxnr",
          label: "缺陷内容",
        },
        {
          prop: "fxrq",
          label: "发现日期",
        },
        {
          prop: "fxbz",
          label: "发现班组",
        },
        {
          prop: "fxr",
          label: "发现人",
        },
        {
          prop: "std_org_nm",
          label: "县单位",
        },
      ],
      tableData: [],
      pages: {
        pageNo: 1,
        pageSize: 50,
        total: 0,
      },
    };
  },
  mounted() {
    this.findMassPage();
  },
  methods: {
    findMassPage() {
      let params = {
        ...this.pages,
      };
      findMassPage(params).then((res) => {
        if (res && res.code === 200) {
          this.tableData = res.rows || [];
          this.pages.total = res.total;
        } else {
          this.$message.warning(res.msg || "加载失败");
        }
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.app-container {
  position: absolute;
  width: 100%;
  height: calc(100% - 60px);
}
</style>
