216 lines
		
	
	
		
			6.2 KiB
		
	
	
	
		
			Python
		
	
	
	
			
		
		
	
	
			216 lines
		
	
	
		
			6.2 KiB
		
	
	
	
		
			Python
		
	
	
	
<template>
 | 
						|
  <div class="app-container">
 | 
						|
    <el-card class="box-card">
 | 
						|
      <div slot="header" class="clearfix">
 | 
						|
        <span>生产任务列表</span>
 | 
						|
       
 | 
						|
       <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-table
 | 
						|
        :data="productionplanList.results"
 | 
						|
        border
 | 
						|
        fit
 | 
						|
        stripe
 | 
						|
        style="width: 100%"
 | 
						|
        height="300"
 | 
						|
      >
 | 
						|
        <el-table-column type="index" width="50" />
 | 
						|
 | 
						|
        <el-table-column label="任务编号" width="110">
 | 
						|
          <template slot-scope="scope">{{ scope.row.number }}</template>
 | 
						|
        </el-table-column>
 | 
						|
        <el-table-column label="订单编号" width="110">
 | 
						|
          <template slot-scope="scope">{{ scope.row.order_.number }}</template>
 | 
						|
        </el-table-column>
 | 
						|
        <el-table-column label="合同编号" width="110">
 | 
						|
          <template slot-scope="scope" v-if="scope.row.contract">{{
 | 
						|
            scope.row.order_.contract_.number
 | 
						|
          }}</template>
 | 
						|
        </el-table-column>
 | 
						|
 | 
						|
        <el-table-column label="产品名称" width="250" >
 | 
						|
          <template slot-scope="scope">{{ scope.row.product_.name }}</template>
 | 
						|
        </el-table-column>
 | 
						|
        <el-table-column label="产品型号" width="110">
 | 
						|
          <template slot-scope="scope">{{
 | 
						|
            scope.row.product_.specification
 | 
						|
          }}</template>
 | 
						|
        </el-table-column>
 | 
						|
        <el-table-column label="产品单位" width="110">
 | 
						|
          <template slot-scope="scope">{{ scope.row.product_.unit }}</template>
 | 
						|
        </el-table-column>
 | 
						|
        <el-table-column label="生产数量" width="110">
 | 
						|
          <template slot-scope="scope">{{ scope.row.count }}</template>
 | 
						|
        </el-table-column>
 | 
						|
          <el-table-column label="生产状态" width="110">
 | 
						|
          <template slot-scope="scope">{{ scope.row.count }}</template>
 | 
						|
        </el-table-column>
 | 
						|
        <el-table-column label="计划开工时间" width="110">
 | 
						|
          <template slot-scope="scope">{{ scope.row.start_date }}</template>
 | 
						|
        </el-table-column>
 | 
						|
        <el-table-column label="计划完工时间" width="110">
 | 
						|
          <template slot-scope="scope">{{ scope.row.end_date }}</template>
 | 
						|
        </el-table-column>
 | 
						|
        <el-table-column label="交付截止时间" width="110">
 | 
						|
          <template slot-scope="scope">{{
 | 
						|
            scope.row.order_.delivery_date
 | 
						|
          }}</template>
 | 
						|
        </el-table-column>
 | 
						|
 | 
						|
        <el-table-column
 | 
						|
          align="center"
 | 
						|
          label="操作"
 | 
						|
          fixed="right"
 | 
						|
         
 | 
						|
        >
 | 
						|
          <template slot-scope="scope">
 | 
						|
            <el-link
 | 
						|
              type="primary"
 | 
						|
              v-if="scope.row.is_planed"
 | 
						|
              @click="handleselectplan(scope)"
 | 
						|
              >详情
 | 
						|
            </el-link>
 | 
						|
          </template>
 | 
						|
        </el-table-column>
 | 
						|
      </el-table>
 | 
						|
      <pagination
 | 
						|
        v-show="productionplanList.count > 0"
 | 
						|
        :total="productionplanList.count"
 | 
						|
        :page.sync="listQuery.page"
 | 
						|
        :limit.sync="listQuery.page_size"
 | 
						|
        @pagination="getplanList"
 | 
						|
      />
 | 
						|
    </el-card>
 | 
						|
    <el-card class="box-card">
 | 
						|
      <div style="height: 40px;line-height: 40px;background: #F5F7FA;padding-left: 20px;">甘特图</div>
 | 
						|
      <gantt
 | 
						|
        style="position: relative"
 | 
						|
        v-if="proList.length>0"
 | 
						|
        :proList="proList"
 | 
						|
      ></gantt>
 | 
						|
    </el-card>
 | 
						|
  </div>
 | 
						|
</template>
 | 
						|
<script>
 | 
						|
import gantt from "@/components/Gantt/index";
 | 
						|
import { getordertoplan } from "@/api/sam";
 | 
						|
import {
 | 
						|
  createProductionplan,
 | 
						|
  getProductionplanList,
 | 
						|
  createsubplan,
 | 
						|
} from "@/api/pm";
 | 
						|
import { getMaterialList } from "@/api/mtm";
 | 
						|
import checkPermission from "@/utils/permission";
 | 
						|
 | 
						|
import { genTree } from "@/utils";
 | 
						|
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
 | 
						|
const defaulteorderplan = {};
 | 
						|
export default {
 | 
						|
  components: { Pagination, gantt },
 | 
						|
  data() {
 | 
						|
    return {
 | 
						|
      productionplanList: {
 | 
						|
        count: 0,
 | 
						|
      },
 | 
						|
      listQuery: {
 | 
						|
        page: 1,
 | 
						|
        page_size: 20,
 | 
						|
      },
 | 
						|
    
 | 
						|
      listLoading: true,
 | 
						|
      proList: [],
 | 
						|
 | 
						|
    };
 | 
						|
  },
 | 
						|
  computed: {},
 | 
						|
  watch: {},
 | 
						|
  created() {
 | 
						|
    this.getplanList();
 | 
						|
  },
 | 
						|
  methods: {
 | 
						|
    checkPermission,
 | 
						|
    //搜索生产计划
 | 
						|
  handleFilter() {
 | 
						|
      this.listQuery.page = 1;
 | 
						|
      this.getplanList();
 | 
						|
    },
 | 
						|
    resetFilter() {
 | 
						|
      this.listQuery = {
 | 
						|
        page: 1,
 | 
						|
        page_size: 20,
 | 
						|
      }
 | 
						|
      this.getplanList();
 | 
						|
    },
 | 
						|
    //生产计划列表
 | 
						|
 | 
						|
    //列表
 | 
						|
    getplanList() {
 | 
						|
      let that = this;
 | 
						|
      this.listLoading = true;
 | 
						|
      getProductionplanList(this.listQuery).then((response) => {
 | 
						|
        if (response.data) {
 | 
						|
          this.productionplanList = response.data;
 | 
						|
          let list = response.data.results;
 | 
						|
          let arr = [];
 | 
						|
          list.forEach((item) => {
 | 
						|
            if (!item.children || item.children.length < 1) {
 | 
						|
              let startTime = new Date(item.start_date).getTime();
 | 
						|
              let endTime = new Date(item.end_date).getTime();
 | 
						|
              let obj = new Object();
 | 
						|
              obj.name = item.number;
 | 
						|
              obj.id = item.id;
 | 
						|
              obj.top = 20;
 | 
						|
              obj.startTime = startTime;
 | 
						|
              obj.endTime = endTime;
 | 
						|
              obj.planTime = [startTime, endTime];
 | 
						|
              obj.per = item.count;
 | 
						|
              obj.type = 1;
 | 
						|
              obj.productName = item.product_.name;
 | 
						|
              obj.productNum = item.product_.specification;
 | 
						|
              obj.isShow = true;
 | 
						|
              arr.push(obj);
 | 
						|
            }
 | 
						|
            debugger;
 | 
						|
            that.proList = arr;
 | 
						|
          });
 | 
						|
        }
 | 
						|
        this.listLoading = false;
 | 
						|
      });
 | 
						|
    },
 | 
						|
  },
 | 
						|
};
 | 
						|
</script>
 | 
						|
 | 
						|
//样式文件
 | 
						|
<style>
 | 
						|
.el-table .warning-row {
 | 
						|
  background: oldlace;
 | 
						|
}
 | 
						|
 | 
						|
.el-table .success-row {
 | 
						|
  background: #f0f9eb;
 | 
						|
}
 | 
						|
</style>
 |