<template>
  <div>
    <el-form :inline="true" :model="searchForm" class="demo-form-inline" label-width="60px" :label-position="'left'">
      <el-row :gutter="1">
        <el-col :span="1">
          <el-button type="primary" icon="el-icon-back" @click="goBack"></el-button>
        </el-col>
        <el-col :span="4">
          <el-form-item label="井号：">
            <el-input v-model="searchForm.jh" placeholder="井号"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-button type="primary" @click="loadData">查询</el-button>
        </el-col>
      </el-row>
    </el-form>
    <!-- </el-card> -->
    <el-row>
      <el-col :span="24">
        <el-table v-loading="loading" :data="data" row-key="deptId" default-expand-all height="80vh">
          <el-table-column prop="jh" label="井号"></el-table-column>
          <el-table-column prop="rodWeight" label="钻杆重量"></el-table-column>
          <el-table-column prop="sustainWoh" label="持续起下钻钩载阈值"></el-table-column>
          <el-table-column prop="activityOne" label="第一种活动钻具阈值"></el-table-column>
          <el-table-column prop="activityTwo" label="第二种活动钻具阈值"></el-table-column>
          <el-table-column prop="bitdepth" label="钻头监测阈值"></el-table-column>
          <!-- <el-table-column prop="createTime" label="创建时间" width="250" align="center"></el-table-column> -->
        </el-table>
      </el-col>
      <el-col :span="24">
        <el-pagination
          background
          style="padding: 19px 12px 0px 12px"
          @size-change="showSizeChange"
          @current-change="change"
          :current-page="params.pageNo"
          :page-sizes="[15, 20, 50, 100]"
          :page-size="params.pageSize"
          layout="->, total, sizes, prev, pager, next,jumper"
          :total="total"
        ></el-pagination>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import realTimeLogApi from '@/api/warningThreshold/wohWarnValueApi'
export default {
  name: 'wohWarnTable',
  data() {
    return {
      searchForm: {
        jh: '',
      },
      total: 0,
      params: {
        jh: '',
        pageNo: 1,
        pageSize: 15
      },
      loading: false,
      data: [],
    }
  },
  created() {
    console.log("钩载")
  },
  mounted() {
    this.loadData()
  },
  methods: {
    open() {
      this.loadData()
    },
    loadData() {
      this.params.jh = this.searchForm.jh
      realTimeLogApi.page(this.params).then(res => {
        console.log('获取的实时分页数据:', res)
        var result = res.result
        this.data = result.records
        this.params.pageNo = result.current
        this.params.pageSize = result.size
        this.total = result.total
      })
    },
    showSizeChange(val) {
      this.params.pageSize = val
      this.params.pageNo = 1
      this.loadData()
    },
    change(val) {
      this.params.pageNo = val
      this.loadData()
    },
    handleClose() {
      this.params = {
        jh: '',
        pageNo: 1,
        pageSize: 15
      }
    },
    goBack() {
      this.$router.go(-1)
    }
  }
}
</script>

<style>
</style>