<template>
  <div class="app-container">
    <el-card style="margin-top: 2px">
       <el-tabs v-model="activeName" type="card"  >
    <el-tab-pane label="总览" name="1" >
 

    </el-tab-pane>
    <el-tab-pane label="待检成品" name="2">
      <el-table
           
            :data="wproductList.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.number }}</template>
            </el-table-column>
            <el-table-column label="检测状态">
              <template slot-scope="scope">
                {{ actstate_[scope.row.act_state] }}
              </template>
            </el-table-column>

            <el-table-column label="所在子工序">
              <template slot-scope="scope">{{ scope.row.step_.name }}</template>
            </el-table-column>

            <el-table-column align="center" label="操作" width="220px">
              <template slot-scope="scope">
                <el-link
                  v-if="checkPermission(['warehouse_update'])&&scope.row.test===null"
                  @click="handleInspection(scope)"
                >检验
                </el-link>
                <el-link
                  v-if="scope.row.test!==null"
                  @click="checkRecord(scope)"
                >检验记录
                </el-link>
              </template>
            </el-table-column>
          </el-table>
          <pagination
            v-show="wproductList.count > 0"
            :total="wproductList.count"
            :page.sync="listQuery.page"
            :limit.sync="listQuery.page_size"
            @pagination="getList"
          />
    </el-tab-pane>
    <el-tab-pane label="合格成品" name="3">
  
    </el-tab-pane>
    <el-tab-pane label="不合格成品" name="4">
      
    </el-tab-pane>
  </el-tabs>
     
    </el-card>

  

    
  </div>
</template>
<script>
import { getfifodetailList } from "@/api/inm";
import checkPermission from "@/utils/permission";
import { createTestrecord } from "@/api/inm";

  import {getwproductList, wproductTest, wproductPutin, createputins} from "@/api/wpm";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination

export default {
  components: { Pagination },
  data() {
    return {
         wproductList: {
          count: 0,
        },
    
      listQuery: {
        page: 1,
        page_size: 20,
      },
     
    activeName:"1"
    };
  },
  computed: {},
  watch: {},
  created() {
    this.getList();
  },
  methods: {
    checkPermission,

   
   
     //待检成品列表
      getList() {
       
        this.listQuery.act_state = 60;
        this.listQuery.material__type = 1;
        getwproductList(this.listQuery).then((response) => {
          if (response.data) {
            this.wproductList = response.data;
          }
         
        });
      },
     
  },
};
</script>
