<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="养殖场">
          <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>
          <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 label="详情">
          <el-button size="mini" type="text" class="detail-btn">
            <a
              href="https://smart-1259258654.cos.ap-guangzhou.myqcloud.com/pdf/82010000990%E8%BF%9B%E5%8C%96%E6%A0%91%E5%88%86%E6%9E%90%E6%8A%A5%E5%91%8A.pdf"
              target="_blank"
              rel="noopener noreferrer"
              >预览</a
            >
          </el-button>
        </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: ''
      },
      tableData: [
        {
          id: 1,
          a: '若尔盖',
          b: '82010000990',
          c: '45MB',
          d: '2024-03-06',
          e: 'PhyML'
        },
        {
          id: 2,
          a: '若尔盖',
          b: '82010000991',
          c: '46MB',
          d: '2024-03-06',
          e: 'PhyML'
        },
        {
          id: 3,
          a: '若尔盖',
          b: '82010000992',
          c: '56MB',
          d: '2024-03-06',
          e: 'PhyML'
        },
        {
          id: 4,
          a: '若尔盖',
          b: '82010000993',
          c: '34MB',
          d: '2024-03-06',
          e: 'PhyML'
        },
        {
          id: 5,
          a: '若尔盖',
          b: '82010000994',
          c: '29MB',
          d: '2024-03-06',
          e: 'PhyML'
        },
        {
          id: 6,
          a: '若尔盖',
          b: '82010000995',
          c: '45MB',
          d: '2024-03-06',
          e: 'PhyML'
        },
        {
          id: 7,
          a: '若尔盖',
          b: '82010000996',
          c: '68MB',
          d: '2024-03-06',
          e: 'PhyML'
        },
        {
          id: 8,
          a: '若尔盖',
          b: '82010000997',
          c: '45MB',
          d: '2024-03-06',
          e: 'PhyML'
        },
        {
          id: 9,
          a: '若尔盖',
          b: '82010000998',
          c: '47MB',
          d: '2024-03-06',
          e: 'PhyML'
        }
      ],
      form: {
        page: 1,
        pagesize: 20
      },
      total: 9
    }
  },
  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)
    },
    download(id) {
      this.$message({
        message: '下载成功',
        type: 'success'
      })
    }
  }
}
</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>
