<template>
  <!-- 添加发货通知 -->
  <div class="shipTransport">
    <page-title>返回</page-title>
    <div class="form">
      <div class="form_box">
          <dil-form :formId="112" v-model="form1" ref="from1" @change="onchange"></dil-form>
      </div>
      <div class="liulan">
          <el-button type="primary" class="btn" @click="onDrawer">浏览</el-button>
      </div>     
    </div>
    <!-- 确定和取消 -->
    <div class="button_box">
      <el-button @click="cancel">取消</el-button>
      <el-button type="primary" @click="makeSure">确定</el-button>
    </div>
    <!-- 模态框 -->
    <el-drawer
      :visible.sync="drawer"
      :direction="direction"
      :before-close="handleClose"
      size="50%"
    >
      <el-input placeholder="请输入内容" v-model="input"  style="margin-top:10px;margin-left:20px;width:250px" clearable> </el-input>
      <el-button type="primary" class="btn" @click="onclick()"  style="margin-bottom:15px">
        <i class="el-icon-search"></i>查询
      </el-button>
    <dilTable v-bind.sync="options" @radio-change="currentRadioChange1" ></dilTable>
    </el-drawer>
  </div>
</template>

<script>
import PageTitle from "@/components/Page/Title";
export default {
  components: { PageTitle },
  data() {
    return {
      input:'',
      drawer:false,
      direction:"rtl",
      form1: {},
      options:{
        requestUrl:"/api/v1/tms/getBatchListForAttorney?apiId=375",
        selectionType:"radio",
        maplist:[]
      },
      value: undefined,
    };
  },
  mounted() {},
  methods: {
    onDrawer(){
        this.drawer = true
    },
    onchange(val){
     
    },
    onclick(){
        this.options.requestUrl = "/api/v1/tms/getBatchList?apiId=375&con=" + this.input
    },
    currentRadioChange1(selection){
        this.maplist = selection
        this.form1 = {
          batchId:selection.shipName + selection.materialName
                 }
    },
    handleClose(done){
        done();
    },
     makeSure() {
      let AmsshipDeliveryNotice = {
      //  purchaseId:this.form1.purchaseId,
       carrierId:this.form1.carrierId,
      //  noticeId:this.form1.noticeId,
      //  cargoId:this.form1.cargoId,
       requesterGroupId:this.form1.requesterGroupId,
      //  cargoTransferResultId:this.form1.cargoTransferResultId,
       noticeCommerceMethod:this.form1.noticeCommerceMethod,
       noticeHandoverMethod:this.form1.noticeHandoverMethod,
       portId:this.form1.portId,
       noticePortConstructionFee:this.form1.noticePortConstructionFee,
       noticeDeliveryTime:sjTime(
            this.form1.noticeDeliveryTime
          ),
       noticePileFreeDays:this.form1.noticePileFreeDays,
       noticeDistructionStatus:this.form1.noticeDistructionStatus,
       batchId:this.maplist.batchId,
       purchaseContractUnitPrice:this.form1.purchaseContractUnitPrice,
       purchaseContractMoisture:this.form1.purchaseContractMoisture,
       purchaseContractQualityindex:this.form1.purchaseContractQualityindex,
       //微元素含量
       tfeContent:this.form1.tfeContent,
       silicaContent:this.form1.silicaContent,
       aluminaContent:this.form1.aluminaContent,
       phosphorusContent:this.form1.phosphorusContent,
       manganeseContent:this.form1.manganeseContent,
       
      };
      if (
        // AmsshipDeliveryAttorney.attorneyId==null||
        // AmsshipDeliveryAttorney.downSwimPortId==null||
        // AmsshipDeliveryAttorney.attorenyPickupIdcard==null||
        // AmsshipDeliveryAttorney.attorneyContactTelephone==null||
        // AmsshipDeliveryAttorney.attorneyTime==null||
        // AmsshipDeliveryAttorney.attorneyPdffile==null
        AmsshipDeliveryNotice.noticeHandoverMethod==null
      ) this.$message.error("存在空值！");
      else 
      this.axios
        .post(
          "/api/v1/tms/insertDeliveryNotice",
           AmsshipDeliveryNotice
        )
        .then((res) => {
        //   console.log(res);
        //   console.log(this.form4);
          this.$router.go(-1);
        });
    },
    // 取消
    cancel() {
      this.$router.go(-1);
    },
  },
};
</script>
<style lang='scss'>
.shipTransport{
  .form{
    display: flex;
    .form_box{
      width: 320px;
      margin-left: 35%;
      margin-top: 30px;
      margin-right: 20px;
      .el-form{
        .preview-group{
          .el-form-item{
            .el-form-item__label{
              display: inline-block;
              width: 70px !important;
            }
            .el-form-item__content{
              .el-select{
                width: 250px;
              }
              .el-input{
                width: 250px;
              }
            }
          }
        }
      }
    }
  }
  .liulan{
      width: 120px;
      margin-top: 30px;
      .el-button{
        width: 100px !important;
        margin: auto;
      }
      .btn{
        margin-top: 0px;
      }
      .btn1{
        margin-top: 13px;
      }
      .btn2{
        margin-top: 67px;
      }
  }
  .button_box{
    margin-left: 45%;
  }
}
</style>
