<template>
  <div class="app-container">
    <div class="filter-container">

      <el-input v-model="search.keyWord" placeholder="关键字" style="width: 200px;" class="filter-item" />
      <el-button class="filter-item" type="primary" icon="el-icon-search" @click="searchData">
        搜索
      </el-button>
    </div>
    <div class="table-con">
      <el-table
        :data="tableData"
        v-loading="listLoading"
        style="width: 100%;margin-bottom: 20px;"
        row-key="id"
        border
      >
        <el-table-column
          label="#"
          align="center"
          type="index"
          :index="indexMethod">
        </el-table-column>
        <el-table-column label="操作" align="left" width="230" class-name="small-padding fixed-width">
          <template slot-scope="{row}">
            <el-button @click="handleUpdate(row.id)" type="primary" size="mini">
              编辑
            </el-button>


          </template>
        </el-table-column>
        <el-table-column
          label="创建时间"
        >
          <template slot-scope="scope">
            <span v-if="scope.row.createTime">{{scope.row.createTime | getTime}}</span>
          </template>
        </el-table-column>
        <el-table-column
          prop="payMode"
          label="付款方式名称">
        </el-table-column>
      </el-table>
      <pagination v-show="listData.total>0" :total="listData.total" :page.sync="listData.page" :limit.sync="listData.pageSize" @pagination="getTableInfo" />
    </div>
  </div>
</template>

<script>
import {
  getPrintBreedList,
  lockPreOutPrintBreed,
  unlockPreOutPrintBreed,
  completePreOutStockV2,
  preOutPurchaseRequestV2
} from '@/api/outPrintBreed/outPrintBreed.js'
export default {
  name: "outPrintBreed",
  data() {
    return {
      listLoading: false,
      tableData: [],
      search: {
        keyWord:''
      },
      listData:{
        total:0,
        page: 1,
        pageSize:10
      }
    }
  },
  mounted() {
    this.getTableInfo();
  },
  methods: {
    //获取表格数据
    getTableInfo(){
      const _that = this
      _that.listLoading = true
      var params = _that.search;
      var page = {
        pageIndex:_that.listData.page,
        pageSize: _that.listData.pageSize,
      }
      var data = {
        "params": JSON.stringify(params),
        "page": JSON.stringify(page),
        "orderBy": "",
      }
      // console.log(data);
      getPrintBreedList(data).then(response => {
        // console.log("tableData",response)
        const data = response.data
        // //  组合表单数据
        _that.tableData = data
        _that.listData.total = response.total
        // console.log(_that.tableData)
        _that.listLoading = false
      }).catch(err => {
        _that.listLoading = false
      })
    },
    //搜索
    searchData(){
      this.listData.page = 1;
      this.getTableInfo()
    },
    //序号
    indexMethod(index) {
      return index+1;
    }
  }
}
</script>

<style lang="scss" scoped>
.app-container {
  background-color: #f0f2f5;
  padding: 30px;
  min-height: calc(100vh - 84px);
}
.filter-container {
  margin-bottom: 15px;
}
</style>

