<template>
  <el-container>
    <el-header style="width: 100%; height: 22px;font-size: 12px;">
      <el-form :inline="true" label-width="55px" label-position="right">
        <el-row>
          <el-col :span="20">
            <el-form-item label="船号:">
              <ProjectSelect ref="projectSelectRef" />
            </el-form-item>
            <el-form-item label="批量:">
              <el-input v-model="queryParam.dcPl" type="search" placeholder="批量" />
            </el-form-item>
            <el-form-item label="分段:">
              <el-input v-model="queryParam.dcFd" type="search" placeholder="分段" />
            </el-form-item>
          </el-col>
          <el-col :span="4" style="text-align: right">
            <el-button type="success" @click="wzxjc">零件齐套检查</el-button>
            <el-button type="success" @click="bgong">报工</el-button>
          </el-col>
        </el-row>
      </el-form>
    </el-header>
    <el-container style="padding-top: 5px">
      <el-main>
        <PPComponent ref="ppComponentRef" :height="750" />
      </el-main>
    </el-container>
  </el-container>
</template>
<script>
import ProjectSelect from "@/components/ProjectSelect/index.vue";
import {bgList, yppbg} from "@/api/zyjh";
import {getBFangDwxx} from "@/views/zyjhzx/bfang/comps/api";
import PPComponent from "@/views/zyjhzx/bfang/comps/PPComponent.vue";
import {EventBus} from "@/event-bus";

export default {
  name:'YppFk',
  components: {PPComponent, ProjectSelect},
  data(){
    return{
      queryParam:{
        dcCh:'',
        dcPl:'',
        dcFd:'',
      },
      list:[],
      qyData:[],
      qyList:[],
    }
  },
  created(){
    getBFangDwxx().then((res)=>{
      this.qyData=res.data
      const qyList=[]
      Object.keys(this.qyData).forEach(key=>{
        const qy={label:key,value:key};
        qyList.push(qy)
      })
      this.qyList=qyList
    })
  },
  methods:{
    bgong(){
      EventBus.$emit('yppbg', {})
      // const data=this.$refs.bFangRef.getCheckboxRecords()
      // if(data.length>0){
      //   yppbg(data).then(()=>{
      //     this.$message.success('成功');
      //     this.wzxjc()
      //   })
      // }
    },
    wzxjc(){
      this.queryParam.dcPl = this.$refs.projectSelectRef.getDcch()
      bgList(this.queryParam).then((res) => {
        res.data.forEach(item=>{
          item.status='已配盘'
          Object.values(this.qyData).forEach(dwList=>{
            dwList.forEach(dwxx=>{
              if (dwxx.id===item.dwxxId){
                item.qy=dwxx.qy
                item.dwh=dwxx.dwh
              }
            })
          })
        })
        this.gridOptions.data=res.data
      })
    },
  }
}
</script>

<style lang="scss" scoped >
.el-header{margin:0;padding: 5px;height:auto;
  .el-input{
    width: 80px;
  }
  .el-select{
    width: 90px;
  }
}

.el-container{padding: 0;margin:0;}
.el-main{padding: 0;}
.el-col{padding: 0;height: 32px;}
.el-aside{background: #fff;padding: 0}
.el-container{padding: 0}
.el-row {}
.el-row:last-child {margin-bottom: 0; }

.tableStyles{
  background: #0a76a4;
}

.my-dropdown {
  width: 400px;
  height: 400px;
  background-color: #fff;
  border: 1px solid #dcdfe6;
  box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0.1);
  font-size: 12px;

}
.mytable1{

}
.borderClass{

}
.vxe-input {
  display: inline-block !important;
  position: relative !important;
  width: auto;
}
.el-input {
  display: inline-block !important;
  position: relative !important;
  width: auto;
}
.keyword-lighten {
  color: #000;
  background-color: #FFFF00;
}

.vxe-textarea--inner {
  line-height: inherit;
}
.el-form-item__label-wrap {
  margin-left: 0px !important;
  float: left;
}
.fontClass{
  font-size: 12px;
  font-weight: bold;
}


</style>
