// 新增汽车装货
<template>
  <div id="endMaintenance">
    <page-title>新增汽车装货</page-title>
    <div class="main">
      <span class="text">新增</span>
    </div>
    <div>
      <div class="form-box" style="margin-left: 5rem">
        <dil-form :formId="245" v-model="form"></dil-form>
      </div>
    </div>
    <div class="" style="margin-left:40rem">
      <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";
import { sjTime } from "@/utils/sharedJsFile";
export default {
  components: { PageTitle },
  data() {
    return {
      form: {},
    };
  },
  methods: {
    // 新增
    makeSure() {
      let BmsTrainFreight = {
        settlementDate: sjTime(this.form.settlementDate),
        settlementDayWagons: this.form.settlementDayWagons,
        settlementDayTonnage: this.form.settlementDayTonnage,
        settlementDayTransportCost: this.form.settlementDayTransportCost,
        settlementDayFloatCost: this.form.settlementDayFloatCost,
        settlementDayMargin: this.form.settlementDayMargin,
        settlementMonthWagons:this.form.settlementMonthWagons,
        settlementMonthTonnage:this.form.settlementMonthTonnage,
        settlementMonthTotalMonth:this.form.settlementMonthTotalMonth
      };
      this.$axios
        .post(
          "/api/v1/bms/addTrainSettlement",
          BmsTrainFreight
        )
        .then((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">
</style>
