<template>
  <div class="app-container">
    <el-card style="margin-top: 2px">
      <el-descriptions title="任务详情" :column="5" border>
  <el-descriptions-item label="任务编号">{{productionplan.number}}</el-descriptions-item>
  <el-descriptions-item label="产品名称">{{productionplan.product_.name}}</el-descriptions-item>
  <el-descriptions-item label="规格型号">{{productionplan.product_.specification}}</el-descriptions-item>
  <el-descriptions-item label="生产状态">生产状态没有</el-descriptions-item>
   <el-descriptions-item label="不合格品数量">不合格数没有</el-descriptions-item>
</el-descriptions>
     
      <el-tabs v-model="activeName" type="card"  >
    <el-tab-pane label="玻璃" name="1" >
        <el-table
                :data="wproduct"
                border
                fit
                stripe
                style="width: 100%"
               height="300"
              >
               
                <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.step_.name
                  }}</template>
                </el-table-column>
                  <el-table-column label="状态" >
                  <template slot-scope="scope">{{
                    actstate_[scope.row.act_state]
                  }}</template>
                </el-table-column>
               <el-table-column
          align="center"
          label="过程记录"
          width="220px"
        >
          <template slot-scope="scope">
          
            <el-link
              v-if="checkPermission(['material_delete'])"
              type="primary"
              @click="handleoption(scope)"
              >查看</el-link
            >
          </template>
        </el-table-column>
              
               
              </el-table>

    </el-tab-pane>
     <el-tab-pane label="工序" name="2" >
    </el-tab-pane>
      </el-tabs>
    </el-card>

  

    
  </div>
</template>
<script>

import { getProductionplan } from "@/api/pm";
import {  getwproductList} from "@/api/wpm";
import checkPermission from "@/utils/permission";

import {getTestRecord} from "@/api/qm";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination

export default {
  components: { Pagination },
  data() {
    return {
     productionplan:"",
     activeName:"1",
     wproduct:"",
       actstate_: {
        6: "待复检",
        10: "操作进行中",
        20: "待检验",
        30: "已合格",
        40: "库存中",
        50: "不合格",
        60: "待成品检验",
        8: "操作准备中",
        26: "待夹层检验",
        70: "报废",
      },
    };
  },
  computed: {},
  watch: {},
  created() {
     this.id = this.$route.params.id;
     this.getList();
     this.getwproductList();
  },
  methods: {
    checkPermission,

     getList() {
      getProductionplan(this.id).then((response) => {
        if (response.data) {
          this.productionplan = response.data;
        }
        
      });
    },
    getwproductList()
    {
      getwproductList({production_plan:this.id,page:0,}).then((response) => {
        if (response.data) {
          this.wproduct = response.data;
        }
        
      });
    },
    //查看该玻璃检验记录表
    handleoption(scope){

        this.$router.push({name: "taskrecordfrom", params: { id: scope.row.id }, })
    
    }
  },
};
</script>
