<template>
  <!-- 添加港口信息 -->
  <div class="addWagonLoad">
    <PageTitle>返回</PageTitle>
    <div style="width:400px;margin-top: 20px;margin-left: 500px;">
      <el-input
      v-model="materialTypeName"
      >
      </el-input>
    </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";
export default {
  components: { PageTitle },
  data() {
    return {
      form1: {},
      materialTypeName:'',
      materialTypeId:null
    };
  },
  mounted() {
    this.materialTypeId=this.$route.params.materialTypeId
    this.materialTypeName=this.$route.params.materialTypeName
    console.log("数据显示")
    console.log(this.materialTypeName)
    console.log(this.materialTypeId)
  },
  methods: {
    makeSure() {
      let mapValue={
        materialTypeId:this.materialTypeId,
        materialTypeName:this.materialTypeName
      }
      this.axios
        .post("/api/v1/rms/updateMaterialForInward", mapValue)
        .then(res => {
          if (res.data.code == 0) {
            this.$message.success("修改成功");
            this.$router.go(-1);
          } else {
            this.$message.success("修改失败");
            this.$router.go(-1);
          }
        });
    },
    // 取消
    cancel() {
      this.$router.go(-1);
    }
  }
};
</script>
<style lang="scss">
.button-box {
  display: flex;
  justify-content: center;
  .el-button {
    width: 80px;
    margin-right: 10px;
  }
}
.form-box {
  display: flex;
  justify-content: center;
  .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>
