<template>
  <div class="container-box">
    <div class="search-box">
      <el-form
        :inline="true"
        ref="searchForm"
        :model="searchForm"
        class="demo-form-inline"
        label-width="auto"
        size="mini"
      >
        <el-form-item label="标记编号" style="margin-bottom: 10px">
          <el-input
            v-model="searchForm.a"
            placeholder="请输入标记编号"
          ></el-input>
        </el-form-item>
        <el-form-item label="标记名称">
          <el-input
            v-model="searchForm.b"
            placeholder="请输入标记名称"
          ></el-input>
        </el-form-item>
        <el-form-item label="Panel">
          <el-input v-model="searchForm.c" placeholder="请输入Panel"></el-input>
        </el-form-item>
        <el-form-item label="染色体">
          <el-input
            v-model="searchForm.d"
            placeholder="请输入染色体"
          ></el-input>
        </el-form-item>
        <el-form-item label="开始位置">
          <el-input
            v-model="searchForm.e"
            placeholder="请输入开始位置"
          ></el-input>
        </el-form-item>
        <el-form-item label="结束位置">
          <el-input
            v-model="searchForm.f"
            placeholder="请输入结束位置"
          ></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="success" icon="el-icon-search" @click="searchClick"
            >搜索</el-button
          >
          <el-button type="warning" icon="el-icon-refresh" @click="resetClick"
            >重置</el-button
          >
        </el-form-item>
      </el-form>
    </div>
    <div class="list-box">
      <el-table :data="tableData" style="width: 100%" size="mini" border>
        <el-table-column prop="a" label="标记编号"></el-table-column>
        <el-table-column prop="b" label="标记名称"></el-table-column>
        <el-table-column prop="c" label="基因版本"></el-table-column>
        <el-table-column prop="d" label="染色体号"></el-table-column>
        <el-table-column prop="e" label="位置"></el-table-column>
        <el-table-column prop="f" label="参考基因"></el-table-column>
        <el-table-column prop="g" label="等位基因"></el-table-column>
        <el-table-column prop="h" label="备注"></el-table-column>
      </el-table>
      <div class="page-box">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :page-sizes="[20, 50, 100]"
          layout="total, sizes, prev, pager, next, jumper"
          :current-page="form.page"
          :page-size="form.pagesize"
          :total="total"
        >
        </el-pagination>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      searchForm: {
        a: '',
        b: '',
        c: '',
        d: '',
        e: '',
        f: ''
      },
      tableData: [
        {
          id: 1,
          a: '82010000990',
          b: '--',
          c: 'ARS-UCD1.2',
          d: '10',
          e: '10011101',
          f: 'T',
          g: 'G',
          h: '--'
        },
        {
          id: 2,
          a: '82010000991',
          b: '--',
          c: 'ARS-UCD1.2',
          d: '10',
          e: '10011102',
          f: 'G',
          g: 'C',
          h: '--'
        },
        {
          id: 3,
          a: '82010000992',
          b: '--',
          c: 'ARS-UCD1.2',
          d: '10',
          e: '10011103',
          f: 'A',
          g: 'G',
          h: '--'
        },
        {
          id: 4,
          a: '82010000993',
          b: '--',
          c: 'ARS-UCD1.2',
          d: '10',
          e: '1001457',
          f: 'C',
          g: 'G',
          h: '--'
        },
        {
          id: 5,
          a: '82010000994',
          b: '--',
          c: 'ARS-UCD1.2',
          d: '10',
          e: '100118',
          f: 'A',
          g: 'T',
          h: '--'
        },
        {
          id: 6,
          a: '82010000995',
          b: '--',
          c: 'ARS-UCD1.2',
          d: '10',
          e: '10011109',
          f: 'G',
          g: 'C',
          h: '--'
        },
        {
          id: 7,
          a: '82010000996',
          b: '--',
          c: 'ARS-UCD1.2',
          d: '10',
          e: '10011105',
          f: 'G',
          g: 'C',
          h: '--'
        },
        {
          id: 8,
          a: '82010000997',
          b: '--',
          c: 'ARS-UCD1.2',
          d: '10',
          e: '100111023',
          f: 'A',
          g: 'G',
          h: '--'
        }
      ],
      form: {
        page: 1,
        pagesize: 20
      },
      total: 8
    }
  },
  methods: {
    // 搜索
    searchClick() {},
    // 重置
    resetClick() {
      for (const key in this.searchForm) {
        this.searchForm[key] = ''
      }
    },
    // 条
    handleSizeChange(val) {
      this.form.pagesize = parseInt(val)
    },
    // 页
    handleCurrentChange(val) {
      this.form.page = parseInt(val)
    },
    // 当监测结果为 已携带 的状态，加上背景色,字体颜色
    cellStyle({ row, column, rowIndex, columnIndex }) {
      // 注意，这里返回的是一个对象
      if (row.result == '携带' && column.label == '监测结果') {
        return 'background:#d9001b;textAlign: center;color:#fff;'
      } else {
        return 'textAlign: center'
      }
    }
  }
}
</script>

<style lang="less" scoped>
.container-box {
  min-height: calc(100vh - 84px);
  padding: 15px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  .search-box {
    background: #fff;
    border-radius: 6px;
    padding: 10px 15px;
    margin-bottom: 25px;
  }
  .list-box {
    flex: 1;
    background: #fff;
    border-radius: 6px;
    padding: 10px 15px;
    .detail-btn {
      color: #67c23a;
    }
    .page-box {
      margin-top: 10px;
    }
  }
}
.el-form-item {
  margin-bottom: 0px;
  margin-right: 20px;
}
// table
/deep/.el-table th.el-table__cell {
  background-color: #f5f7fa;
}
/deep/ .cell {
  font-weight: normal;
}
</style>
