<template>
  <!-- 修改货权转移页面 -->
    <div class="shipTransport">
    <page-title>返回</page-title>
    <div class="form">
      <div class="form_box">
          <dil-form :formId="143" v-model="form1"></dil-form>
      </div>        
    </div>
    <!-- 确定和取消 -->
    <div class="button_box">
      <el-button @click="onClickCancel">返回</el-button>
      <el-button type="primary" @click="onClickConfirm">确认</el-button>
    </div>
  </div>
</template>

<script>
import PageTitle from "@/components/Page/Title";
export default {
  components: { PageTitle },
    data(){
          return {
          form1: {},
        }
    },
  mounted() {
    this.information();
  },
  methods: {
    information() {
      //编辑请车作业
      this.axios
        .post("/api/v1/tms/selectByNoticeId/" + this.$route.params.noticeId)
        .then((res) => {
          res.data.data.forEach((e) => {
            this.form1 = e;
            console.log(e);
            console.log(this.form1);
            console.log(this.$route.params.pathId);
          });
          
        });
       
        
    },
    // 确认
    onClickConfirm() {
      let AmsshipDeliveryNotice = {
        noticeId: this.$route.params.noticeId,
        requesterGroupId:this.form1.requesterGroupId,
        carrierId:this.form1.carrierId,
        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,
        materialCapacityName:this.form1.materialCapacityName,
        noticeDistrbutionStatus:this.form1.noticeDistrbutionStatus,
        batchId:this.form1.batchId,
        purchaseContractUnitPrice:this.form1.purchaseContractUnitPrice,
        purchaseContractMoisture:this.form1.purchaseContractMoisture,
        tfeContent:this.form1.tfeContent,
        silicaContent:this.form1.silicaContent,
        aluminaContent:this.form1.aluminaContent,
        phosphorusContent:this.form1.phosphorusContent,
        manganeseContent:this.form1.manganeseContent,
     };

      // function isNumber() {
      //   var value = AmsshipCargoTransferResult.resultTelephoneFax;
      //   //验证是否为数字
      //   var patrn = /^(-)?\d+(\.\d+)?$/;
      //   if (patrn.exec(value) == null || value == "") {
      //     return false;
      //   } else {
      //     return true;
      //   }
      // }
      // var val = this.value;
      // if (
      //   AmsshipCargoTransferResult.resultTelephoneFax==null||
      //   AmsshipCargoTransferResult.resultContactPerson==null
      // ) this.$message.error("存在空值！");
      // else
      // if (!isNumber(val)) this.$message.error("联系电话必须是数字！");
      // else
      
      this.axios
        .post("/api/v1/tms/editDeliveryNotice" ,AmsshipDeliveryNotice
        )
        .then(() => {
          this.$message({
            type: "success",  
            message: "修改成功!",
          });
          this.$router.go(-1);
        });   
    },
      // 返回
    onClickCancel() {
      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;
              }
            }
          }
        }
      }
    }
  }
  .button_box{
    margin-left: 45%;
  }
}
</style>
