<template>
  <div class="app-container">
    <el-card>
      <div>
      <el-input
              v-model="listQuery.search"
              placeholder="仓库名称/仓库编号"
              style="width: 300px"
              class="filter-item"
              @keyup.enter.native="handleFilter"
            />
            <el-button
              class="filter-item"
              type="primary"
              icon="el-icon-search"
              @click="handleFilter"
              >搜索</el-button
            >
            <el-button
              class="filter-item"
              type="primary"
              icon="el-icon-refresh-left"
              @click="resetFilter"
              >重置</el-button
            >
    </div>
    </el-card>
    <el-card style="margin-top: 2px">
      
      <el-table
        v-loading="listLoading"
        :data="fifodetailList.results"
        border
        fit
        stripe
        highlight-current-row
        max-height="600"
      >
      
     
        <el-table-column type="index" width="50" />
        <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.batch }}</template>
        </el-table-column>
        <el-table-column label="物料编号">
          <template slot-scope="scope">{{ scope.row.material_.number }}</template>
        </el-table-column>
          <el-table-column label="物料单位">
          <template slot-scope="scope">{{ scope.row.material_.unit }}</template>
        </el-table-column>
           <el-table-column label="物料型号">
          <template slot-scope="scope">{{ scope.row.material_.specification }}</template>
        </el-table-column>
         <el-table-column label="入库数量">
          <template slot-scope="scope">{{ scope.row.count }}</template>
        </el-table-column>
  
   
      </el-table>
      <pagination
        v-show="fifodetailList.count > 0"
        :total="fifodetailList.count"
        :page.sync="listQuery.page"
        :limit.sync="listQuery.page_size"
        @pagination="getList"
      />
    </el-card>
  
  </div>
</template>
<script>
import { getfifodetailList } from "@/api/inm";
import checkPermission from "@/utils/permission";
import { getMaterialList} from "@/api/mtm";
 import { getUserList} from "@/api/user";
import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination

export default {
  components: { Pagination },
  data() {
    return {
      
     InventoryList: {
        count: 0,
      },
     
      listQuery: {
        page: 1,
        page_size: 20,
      },
     
      listLoading: true,
      dialogVisible: false,
      dialogType: "new",
      rule1: {
        name: [{ required: true, message: "请输入", trigger: "blur" }],
        
      },
    };
  },
  computed: {},
  watch: {},
  created() {
    this.getList();
  },
  methods: {
    checkPermission,
    
    getList() {
      this.listLoading = true;
     
        this.listQuery.fifo=this.$route.params.id;
        getfifodetailList(this.listQuery).then((response) => {
        if (response.data) {
          this.fifodetailList = response.data;
        }
        this.listLoading = false;
      });
     
      
      
    },
   
  },
};
</script>
