// 编辑钢材发运日计划
<template>
  <div id="endMaintenance">
    <page-title>编辑钢材发运日计划</page-title>
    <div>
      <div class="form-box">
        <dil-form :formId="252" v-model="form"></dil-form>
      </div>
    </div>
    <div class="button-box">
      <el-button type="primary" @click="makeSure">确认新增</el-button>
      <el-button type="primary" @click="cancel">返回</el-button>
    </div>
  </div>
</template>
<script>
import PageTitle from "@/components/Page/Title";

export default {
  components: { PageTitle },
  data() {
    return {
      form: {},
    };
  },
  methods: {
    // 编辑
    makeSure() {
      let BmsTrainFreight = {
        dayPlanId: this.$route.params.dayPlanId,
        dayplanDate: sjTime(this.form.dayplanDate),
        shipperId: this.form.shipperId,
        dayplanDeliveryDate: sjTime(this.form.dayplanDeliveryDate),
        dayplanOwnCarsAmout: this.form.dayplanOwnCarsAmout,
        dayplanToTheStationId: this.form.dayplanToTheStationId,
        dayplanWagonNumber: this.form.dayplanWagonNumber,
        dayplanConsigneeName:this.form.dayplanConsigneeName,
        dayplanConsigneeTel:this.form.dayplanConsigneeTel,
      };     
      this.axios
        .post(
          "/api/v1/bms/addTrainSettlement",
          BmsTrainFreight
        )
        .then((res) => {
            console.log(res)
          if (res.data.code == 200) {
            this.$message({
              type: "success",
              message: "新增成功!",
            });            
            this.$router.go(-1);
          } else {
            this.$message.error("新增失败！");
          }
        });
    },
    // 返回
    cancel() {
      this.$router.go(-1);
    },
  },
};
</script>

<style lang="scss" scoped>
.form-box{
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 5px;
  margin-bottom: 20px;
}
.button-box{
  display: flex;
  text-align: center;
  align-items: center;
  justify-content: center;
  margin-top: 0.3125rem;
  margin-bottom: 1.25rem;
}
</style>
