<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div>
        <el-select v-model="searchParam._mineIndex" placeholder="所属矿山" clearable size="small" class="filter-item" style="width: 200px;">
          <el-option v-for="mine in mineList" :key="mine.index" :label="mine.name" :value="mine.index" />
        </el-select>
        <el-input clearable size="small" placeholder="设备名称" style="width: 200px;" class="filter-item" />
        <el-select v-model="value" placeholder="监测类型？" style="width: 200px;" class="filter-item">
          <el-option label="选择类型？" value="1" />
        </el-select>
        <el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="$message('等待硬件对接中')">搜索</el-button>
        <el-button class="filter-item" size="mini" type="warning" icon="el-icon-refresh-left">重置</el-button>
      </div>
    </div>
    <!--表格-->
    <el-table ref="table" v-loading="searching" :data="tableData" row-key="id">
      <el-table-column :show-overflow-tooltip="true" prop="id" label="编号" width="100px" align="center" />
      <el-table-column :show-overflow-tooltip="true" prop="mineName" label="设备名称" align="center" />
      <el-table-column :show-overflow-tooltip="true" prop="name" label="设备编号" align="center" />
      <el-table-column :show-overflow-tooltip="true" prop="code" label="监测类型" align="center" />
      <el-table-column :show-overflow-tooltip="true" prop="code" label="监测值" align="center" />
      <el-table-column :show-overflow-tooltip="true" prop="monitoringType" label="监测时间" align="center" />
      <el-table-column :show-overflow-tooltip="true" prop="unit" label="报警状态" align="center" />
    </el-table>
    <el-pagination
      :page-sizes="[10, 20, 50, 100]"
      :current-page.sync="searchParam.page"
      :page-size.sync="searchParam.count"
      :total="searchResult.total"
      layout="total, sizes, prev, pager, next, jumper"
      @size-change="searchSubmit"
      @current-change="searchSubmit"
    />
  </div>
</template>

<script>
import mineApi from '@/api/kd/mine'
export default {
  name: 'CIotGroundPressureData', // 本页面名
  data() {
    return {
      mineList: [],
      searching: false,
      searchParam: {},
      searchResult: {
        results: []
      }
    }
  },
  computed: {
    tableData() {
      // 此处对返回值进行算法重组
      return this.searchResult.results
    }
  },
  mounted() {
    // 矿山选项卡
    mineApi.getEnableMine().then(response => {
      let i = 1
      response.results.forEach(x => { x.index = i++ })
      this.mineList = response.results
    })
  },
  methods: {
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  ::v-deep .el-input-number .el-input__inner {
    text-align: left;
  }
  ::v-deep .vue-treeselect__control,::v-deep .vue-treeselect__placeholder,::v-deep .vue-treeselect__single-value {
    height: 30px;
    line-height: 30px;
  }
</style>
