<template>
  <div>
    <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 label="操作">
            <template slot-scope="scope">
              <!-- <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button> -->
              <el-button type="text" size="small" @click="edit(scope.row)">编辑</el-button>
            </template>
          </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>
    <wohWarnFrom ref="wohWarnFromRef" @close="loadData" />
  </div>
</template>

<script>
import realTimeLogApi from '@/api/warningThreshold/wohWarnValueApi'
import wohWarnFrom from './forms/wohWarnForm.vue'
import vue from 'vue'
export default {
  name: 'wohWarnTable',
  components: { wohWarnFrom },
  data() {
    return {
      loading: false,
      total: 0,
      params: {
        jh: '',
        pageNo: 1,
        pageSize: 15
      },
      loading: false,
      data: [],
    }
  },
  created() {
    console.log("钩载")
  },
  mounted() {
    this.loadData()
  },
  methods: {
    open() {
      this.loadData()
    },
    loadData() {
      this.loading = true
      this.params.jh = vue.ls.get('TOPLEFT_JH_SELECTED').JH
      // this.params.jh = this.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
        this.loading = false
      })
    },
    showSizeChange(val) {
      this.params.pageSize = val
      this.params.pageNo = 1
      this.loadData()
    },
    change(val) {
      this.params.pageNo = val
      this.loadData()
    },
    edit(row) {
      console.log(row)
      this.$refs.wohWarnFromRef.open(row)
    },
    handleClose() {
      this.params = {
        jh: '',
        pageNo: 1,
        pageSize: 15
      }
    },
    goBack() {
      this.$router.go(-1)
    }
  }
}
</script>

<style>
</style>