<template>
  <el-dialog title="领料单打印" v-model="setCrewShow" :before-close="cancel" fullscreen @open="open">
    <el-form :inline="true" ref="linesForm" :model="lineForm" :rules="lineRules" label-width="90px">
        <el-row :gutter="24">
            <el-col :span="6">
                <el-form-item label="外协厂商:" prop="ocId">
                    <el-select v-model="lineForm.ocId"  placeholder="请选择" style="width: 300px;">
                        <el-option v-for="item in ocData" :key="item.id" :label="item.ocName" :value="item.id" />
                    </el-select>
                </el-form-item>
            </el-col>
            <el-col :span="6">
                <el-form-item label="外协单号:" prop="wxNo">
                    <el-input v-model="lineForm.wxNo" placeholder="请输入" style="width: 300px;"></el-input>
                </el-form-item>
            </el-col>
            <!-- <el-col :span="6">
                <el-form-item label="分派日期:" prop="wxNo">
                    <el-date-picker type="daterange" placeholder="请选择" v-model="lineForm.planIssuanceTime"
                    format="YYYY-MM-DD" value-format="YYYY-MM-DD" style="width: 300px;"></el-date-picker>
                </el-form-item>
            </el-col> -->
            <el-col :span="6">
                <el-form-item style="float: right;">
                    <el-button type="primary" @click="handleSearch">搜索</el-button>
                    <el-button  @click="handleReset">重置</el-button>
                </el-form-item>
            </el-col>
        </el-row>
    </el-form>
    <el-table :data="tableData">
      <el-table-column type="selection" width="55px"></el-table-column>
      <el-table-column label="外协订单号" prop="wxNo"></el-table-column>
      <el-table-column label="零件号" prop="partCode"></el-table-column>
      <el-table-column label="批次号" prop="batchNo"></el-table-column>
      <el-table-column label="生产标识" prop="productIdent"></el-table-column>
      <el-table-column label="分派日期" prop="planIssuanceTime"></el-table-column>
      <el-table-column label="需求数量" prop="makeQty"></el-table-column>
      <el-table-column label="协作计划工序" prop="planningProcess"></el-table-column>
      <el-table-column label="计划类型" prop="planningType"></el-table-column>
      <el-table-column label="主工序代码" prop="mainProcessCode"></el-table-column>
      <el-table-column label="单间面积" prop="area"></el-table-column>
      <el-table-column label="镀种" prop="plate"></el-table-column>
      <el-table-column label="备注" prop="memo"></el-table-column>
    </el-table>
    <template #footer>
      <div class="dialog-footer">
        <el-button @click="cancel()">取消</el-button>
        <el-button type="primary" @click="submit()"> 确认</el-button>
      </div>
    </template>
  </el-dialog>
</template>

<script>
import {getOemManufacturer,getPrintList} from "@/api/outsourcingManagement/oemOrder"
export default {
  props: {
    showPrint: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      setCrewShow: false,
      lineForm:{},
      lineRules:{},
      ocData:[],
      tableData:[],
    };
  },
  async mounted() {
    const ocRes = await getOemManufacturer();
    this.ocData = ocRes.data.data;
    this.setCrewShow = this.showPrint;
  },
  methods: {
    cancel(val) {
      this.setCrewShow = false;
      this.$emit('cancel', val);
    },
    handleSearch(){
        let params = {
            ocId:this.lineForm.ocId && this.lineForm.ocId,
            wxNo:this.lineForm.wxNo && this.lineForm.wxNo,
            current:1,
            size:9999
            // planIssuanceTimeStart:this.lineForm.planIssuanceTime && this.lineForm.planIssuanceTime.length != 0 && this.lineForm.planIssuanceTime[0],
            // planIssuanceTimeEnd:this.lineForm.planIssuanceTime && this.lineForm.planIssuanceTime.length != 0 && this.lineForm.planIssuanceTime[1],
        }
        getPrintList(params).then(res=>{
            console.log('res-----------',res)
            this.tableData = res.data.data.records
        })
    },
  },
};
</script>

<style>
</style>