<template>
  <!-- 添加车皮装车实绩 -->
  <div class="addWagonLoad">
    <page-title>新增</page-title>
    <el-divider content-position="left">车皮装车实绩</el-divider>
     <div class="form-box" style="margin-right: 10rem">
        <dil-form :formId="102" 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 class="primarybtn">
      <el-button class="btn" @click="goback">取消</el-button>
      <el-button type="primary" class="btn" @click="submitclick"
        >确定</el-button
      >
    </div> -->
  </div>
</template>

<script>
import PageTitle from "@/components/Page/Title";
import { sjTime } from "@/utils/sharedJsFile";
export default {
  components: { PageTitle },
  data() {
    return {
      form1: {},
      value: undefined,
    };
  },
  mounted() {},
  methods: {
    // 确定
    makeSure() {
      let tmstrainLoadingResult = {
        resultWagonNo: this.form1.resultWagonNo,
        resultBillableTonnage: this.form1.resultBillableTonnage,
        resultIsclear: this.form1.resultIsclear,
        resultClass: this.form1.resultClass,
        sendStationId: this.form1.sendStationId,
        arrivalStationId: this.form1.arrivalStationId,
        resultLoadingDate: sjTime(this.form1.resultLoadingDate),
        batchId: this.form1.batchId,
        capacityId: this.form1.capacityId,
        resultMaterialNumber: this.form1.resultMaterialNumber,
        resultMaterialTheoryweight: this.form1.resultMaterialTheoryweight,
        resultRemarks: this.form1.resultRemarks
      };
      console.log(tmstrainLoadingResult);
      if (tmstrainLoadingResult.resultWagonNo==null||
      tmstrainLoadingResult.resultBillableTonnage==null||
      tmstrainLoadingResult.resultIsclear==null||
      tmstrainLoadingResult.resultClass==null||
      tmstrainLoadingResult.sendStationId==null||
      tmstrainLoadingResult.arrivalStationId==null||
      tmstrainLoadingResult.resultLoadingDate==null||
      tmstrainLoadingResult.batchId==null
      
      ) this.$message.error("必填项存在空值！");
      else
      this.$axios
        .post(
          "/api/v1/tms/insertTmstrainLoadingResult",
          tmstrainLoadingResult
        )
         .then(() => {
          this.$message({
            type: "success",  
            message: "新增成功!",
          });
          this.$router.go(-1);
        });
    },
    // 取消
    cancel() {
      this.$router.go(-1);
    },
  },
};
</script>
<style lang='scss'>
</style>