<template>
  <div class="app-container">
   
    <el-card style="margin-top: 2px">
      <el-table
        v-loading="listLoading"
        :data="iproductData.results"
        border
        fit
        stripe
        highlight-current-row
         max-height="700"
         height="100"
        v-el-height-adaptive-table="{bottomOffset: 50}"
      >
        <el-table-column type="index" width="50" />
        <el-table-column label="半成品编号">
          <template slot-scope="scope">{{ scope.row.number }}</template>
        </el-table-column>

        <el-table-column label="半成品批次">
          <template slot-scope="scope">{{ scope.row.batch }}</template>
        </el-table-column>
          <el-table-column label="半成品名称">
          <template slot-scope="scope">{{ scope.row.material_.name }}</template>
        </el-table-column>
        
        <el-table-column label="所在仓库">
          <template slot-scope="scope">{{ scope.row.warehouse_.name }}</template>
        </el-table-column>

      
      </el-table>
      <pagination
        v-show="iproductData.count > 0"
        :total="iproductData.count"
        :page.sync="listQuery.page"
        :limit.sync="listQuery.page_size"
        @pagination="getList"
      />
    </el-card>
  
  </div>
</template>
<script>
import {
  getiproductList,
} from "@/api/inm";
import checkPermission from "@/utils/permission";

import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination

export default {
  components: { Pagination },
  data() {
    return {
     
      iproductData: {
        count: 0,
      },
       listQuery: {
        page: 1,
        page_size: 20,
      },
     
    };
  },
  computed: {},
  watch: {},
  created() {
    this.getList();
  },
  methods: {
    checkPermission,
    //半成品列表
    getList() {
      this.listLoading = true;
      getiproductList(this.listQuery).then((response) => {
        if (response.data) {
          this.iproductData= response.data;
        }
        this.listLoading = false;
      });
    },
    
  },
};
</script>
