<template>
  <!-- 添加原料仓库信息 -->
  <div class="addWagonLoad">
    <PageTitle>返回</PageTitle>
    <div class="form-box" style="margin-right: 10rem">
      <dil-form :formId="383" v-model="form1" ref="from1"></dil-form>
    </div>
    <div class="button-box">
      <el-button @click="cancel">取消</el-button>
      <el-button type="primary" @click="makeSure">确定</el-button>
    </div>
  </div>
</template>
<script>
import PageTitle from "@/components/Page/Title";
import { getCookie } from "@/utils/util.js";
export default {
  components: { PageTitle },
  data() {
    return {
      form1: {},
    };
  },
  mounted() {},
  methods: {
    makeSure() {
      let RmsCargoDep = {
        cargoType: this.form1.cargoType,
        cargoName: this.form1.cargoName,
        userId: getCookie("userId"),
      };
      if (RmsCargoDep.cargoType == null || RmsCargoDep.cargoName == null)
        this.$message.error("存在空值！");
      else
        this.axios
          .post("/api/v1/rms/insertCargoDep", RmsCargoDep)
          .then((res) => {
            if (res.data.code == 200) {
              this.$message({
                type: "success",
                message: "新增成功!",
              });
              this.$router.go(-1);
            } else {
              this.$message({
                type: "warning",
                message: res.data.data,
              });
            }
          });
    },
    // 取消
    cancel() {
      this.$router.go(-1);
    },
  },
};
</script>
<style lang='scss' >
.addWagonLoad {
  .button-box {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    .el-button {
      width: 80px;
      margin-right: 10px;
    }
  }
  .form-box {
    display: flex;
    justify-content: center;
    margin-top: 90px;
    .el-form-item {
      display: flex;
      justify-content: center;
      .el-form-item__label {
        display: flex;
        align-items: center;
      }
      .el-form-item__content {
        .el-input {
          .el-input__inner {
            width: 250px;
          }
        }
      }
    }
  }
}
</style>
