<template>
  <!-- 修改原料仓库信息 -->
  <div id="contractDetails">
    <page-title>返回</page-title>
    <div class="main">
    </div>
    <div class="contractTitle">
      <div class="form-box">
          <dil-form :formId="383" 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";
import { getCookie } from "@/utils/util.js";
import { get } from "http";
export default {
  components: { PageTitle },
  data() {
    return {
    form1: {},
    warehouseName : '',
    shipperName: '',
    options: [{
          value: '',
          label: ''
        }],
    };
  },
  mounted() {
    this.information();
  },
  methods: {
    information() {
      //编辑
    //   console.log("warehouseId",this.$route.params.warehouseId);
      this.axios
        .post(
          "/api/v1/rms/getCargoDepById/" +
            this.$route.params.cargoCarrierId
        )
        .then((res) => {
            res.data.data.forEach((e) => {
            this.form1 = e;
          });
            
        });
    },
    //单选下拉框

    // 返回
    onClickCancel() {
      this.$router.go(-1);
    },
    // 确认
    onClickConfirm() {
       let RmsCargoDep={
      cargoCarrierId:  this.$route.params.cargoCarrierId,
      cargoName:this.form1.cargoName,
      cargoType:this.form1.cargoType,
      userId:getCookie("userId"),
    };
    console.log("rms",RmsCargoDep);
        this.axios
          .post(
            "/api/v1/rms/updateCargoDep",
          RmsCargoDep 
          )
          .then((res) => {
            if (res.data.code == "200") {
              this.$router.go(-1);
            }
          });
    },
  },
};
</script>
<style lang='scss' scoped>
.form-box,
 .button-box{
    display: flex;
    justify-content: center;
    margin-top: 2rem;
    .el-button{
      width: 80px;
      margin-right: 10px;
    }
  }
  .shipperName{
    display: flex;
    justify-content: center;
  }
  .point{
    display: flex;
    justify-content: center;
    margin-top: 1rem;
  }
</style>