<template>
  <div class="app-container">
    <el-card class="box-card">
     <div slot="header" class="clearfix">
    <span>生产任务列表</span>
  
  </div>
        
         <el-table
        :data="subproductionplanList.results"
       border
        fit
        stripe
        style="width: 100%"
        max-height="400"
      >
        <el-table-column type="index" width="50" />
        
      
        
         <el-table-column label="生产子计划名">
          <template slot-scope="scope">{{ scope.row.workshop_.name }}</template>
        </el-table-column>
         <el-table-column label="工序名">
          <template slot-scope="scope">{{ scope.row.process_.name }}</template>
        </el-table-column>
         <el-table-column label="工序编号">
          <template slot-scope="scope">{{ scope.row.process_.number }}</template>
        </el-table-column>
         <el-table-column label="子工序">
           <template slot-scope="scope" v-if="scope.row.steps">
            <el-tag v-for="item in scope.row.steps"
                    :key="item.number"
                    :label="item.name"
                    :value="item.number">{{item.name}}</el-tag>


          </template>
        </el-table-column>
          <el-table-column label="开工时间">
          <template slot-scope="scope">{{ scope.row.start_date }}</template>
        </el-table-column>
         <el-table-column label="完工时间">
          <template slot-scope="scope">{{ scope.row.end_date }}</template>
        </el-table-column>
        
  <el-table-column label="创建时间">
          <template slot-scope="scope">{{ scope.row.create_time }}</template>
        </el-table-column>
        
      </el-table>
    <pagination
        v-show="subproductionplanList.count > 0"
        :total="subproductionplanList.count"
        :page.sync="listQuery.page"
        :limit.sync="listQuery.page_size"
        @pagination="getspList"
      />
    </el-card>
    
  </div>
</template>
  <script>
  import { getsubproductionplanList } from "@/api/pm";
import checkPermission from "@/utils/permission";


import Pagination from "@/components/Pagination"; // secondary package based on el-pagination

export default {
  components: { Pagination },
  data() {
    return {
       
      subproductionplanList: {
        count: 0,
      },
      listQuery: {
        page: 1,
        page_size: 20,
      },
       
      listLoading: true
    };
  },
  computed: {},
  watch: {},
  created() {
    this.getspList();
  },
  methods: {
    checkPermission,
  //订单列表
    getspList() {
      this.listLoading = true;
     console.log(this.listQuery)
      getsubproductionplanList(this.listQuery).then((response) => {
        if (response.data) {
          this.subproductionplanList = response.data;
        }
        this.listLoading = false;
      });
    },
  },
};
    
  </script>