<template>
  <!-- 修改承运商信息 -->
  <div id="contractDetails">
    <page-title>查看详情</page-title>
    <div class="main">
    </div>
    <div class="contractimage">
      <el-image 
            style=" height:150px;text-align:center"
            :src="src" 
            :preview-src-list="srcList">
          </el-image>
          <el-image 
            style=" height:150px;text-align:center"
            :src="src1" 
            :preview-src-list="srcList1">
          </el-image>
          <el-image 
            style=" height:150px;text-align:center"
            :src="src2" 
            :preview-src-list="srcList2">
          </el-image>
    </div>
    <div class="contractTitle">
      <div class="form_box">
          <dil-form :disabled=true :formId="330" v-model="form1">
          </dil-form>
         
      </div>
    </div>
  </div>
</template>

<script>
import PageTitle from "@/components/Page/Title";

export default {
  components: { PageTitle },
  data() {
    return {
      direction2:"",
      formInline:{},
      isShow:false,
      src:"",
      srcList:[],
      src1:"",
      srcList1:[],
      src2:"",
      srcList2:[],
      inputText:"",
      form1: {},
      registerDate:"",
      mapValue:"",
      drawer: false,
      options:{
        // first请求数据的地址
        requestUrl: "/api/v1/rms/getCarrierBidAreaList?apiId=406",
        selectionType: "radio",
         mapList:[],
         registerDate:"",
         mapValue:""
      },
    };
  },
 
  mounted() {
      console.log(this.$route)
    this.information();
  },

  methods: {

    
    handleClose(){

    },

    onclick(){
      this.options.requestUrl="/api/v1/rms/getCarrierBidAreaList?apiId=406&con=" +this.inputText;
    },
    currentRadioChange(selection){
      this.mapList=selection, 
      console.log(this.mapList) 
      this.bidArea=this.mapList.bidArea
     
    },
    information() {
      //编辑
      this.axios
        .post(
          "/api/v1/rms/getCarrierById/" +
            this.$route.params.carrierId
        )
        .then((res) => {
            
          res.data.data.forEach((e) => {
            this.form1 = e;
            this.srcList=[];
            this.srcList1=[];
            this.srcList2=[];
            this.isShow=true;
            this.src=e.carrierBusinessAblelicense;
            this.srcList.push(e.carrierBusinessAblelicense);
            this.src1=e.carrierBusinessLicense;
            this.srcList1.push(e.carrierBusinessLicense);
            this.src2=e.carrierTransportCertificate;
            this.srcList2.push(e.carrierTransportCertificate);
          });
        });
    },
    // 返回
    onClickCancel() {
      this.$router.go(-1);
    },
    // 确认
    onClickConfirm() {  
       let RmsCarrier={
        carrierId:this.$route.params.carrierId,
        carrierName:this.form1.carrierName,
        carrierTransportCertificate:this.form1.carrierTransportCertificate,
        carrierBusinessLicense:this.form1.carrierBusinessLicense,
        carrierBusinessAblelicense:this.form1.carrierBusinessAblelicense,
        carrierAbbreviation:this.form1.carrierAbbreviation,
        carrierAddress:this.form1.carrierAddress,
        registerNo:this.form1.registerNo,
        carrierBidAreaId:this.mapList.bidAreaId,
        carrierLegalRepresentative:this.form1.carrierLegalRepresentative,
        registerCapital:this.form1.registerCapital,
        businessScope:this.form1.businessScope,
        annualDate:this.form1.annualDate,
        companyStatusDesc:this.form1.companyStatusDesc,
        companyTypeDesc:this.form1.companyTypeDesc,
        operationPeriod:this.form1.operationPeriod,
        registerOrganization:this.form1.registerOrganization,
        registerAptitudes:this.form1.registerAptitudes,
        contactsName:this.form1.contactsName,
        carrierContactNumber:this.form1.carrierContactNumber,
        carrierType:this.form1.carrierType,
        carrierTransportType:this.form1.carrierTransportType
      };
       let registerDate={
        registerDate: this.form1.registerDate,
      };
      let mapValue={
        RmsCarrier:RmsCarrier,
        registerDate:registerDate
      };
       if(
        RmsCarrier.carrierName ==null ||
       // RmsCarrier.carrierTransportCertificate ==null ||
       // RmsCarrier.carrierBusinessLicense ==null ||
       // RmsCarrier.carrierBusinessAblelicense ==null ||
        RmsCarrier.carrierAbbreviation ==null ||
        RmsCarrier.carrierAddress ==null ||
        RmsCarrier.registerNo ==null ||
        RmsCarrier.carrierBidAreaId ==null || 
        RmsCarrier.carrierLegalRepresentative ==null ||
        RmsCarrier.registerCapital ==null ||
        RmsCarrier.businessScope ==null ||
        RmsCarrier.annualDate ==null ||
        RmsCarrier.companyStatusDesc ==null ||
        RmsCarrier.companyTypeDesc ==null ||
        RmsCarrier.operationPeriod ==null ||
        registerDate.registerDate ==null ||
        RmsCarrier.registerOrganization ==null ||
        RmsCarrier.registerAptitudes ==null ||
        RmsCarrier.contactsName ==null ||
        RmsCarrier.carrierContactNumber ==null ||
        RmsCarrier.carrierType ==null ||
        RmsCarrier.carrierTransportType ==null 
      )this.$message.error("存在空值！");
        this.axios
          .post(
            "/api/v1/rms/updateCarrier",
            mapValue
          )
          .then((res) => {
            if (res.data.code == "200") {
              this.$router.go(-1);
            }
          });
    },
  },
};
</script>
<style lang='scss'>

  .contractimage{
    text-align: center;
    position: relative;
    left: 85px;
  }
  .form_box {
    display: flex;
    justify-content: center;
    margin-left: 170px;
    margin-top: 15px;
    .el-form-item {
      display: flex;
      justify-content: center;
      .el-form-item__label {
        display: flex;
        align-items: center;
      }
      .el-form-item__content {
        width: 250px;
        .el-radio-group {
          width: 500px;
        }
        .el-date-editor {
          width: 250px;
        }
        .el-input__inner {
          width: 250px;
        }
      }
    }
  }
.center{
   display: flex;
    justify-content: center;
}
.button-box{
    display: flex;
    justify-content: center;
    .el-button{
      width: 80px;
      margin-right: 10px;
    }
  }
</style>