<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="116" 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 tmstrainWagonUnloadResult = {
        resultWagonNo: this.form1.resultWagonNo,
        resultArrivalDate: sjTime(this.form1.resultArrivalDate),
        resultUnloadTime: sjTime(this.form1.resultUnloadTime),
        unloadingPointId: this.form1.unloadingPointId,
        resultBigTicketWeight: this.form1.resultBigTicketWeight,
        resultRailHorizontalWeight: this.form1.resultRailHorizontalWeight,
        resultRemark: this.form1.resultRemark
      };
      console.log(tmstrainWagonUnloadResult);
      if (tmstrainWagonUnloadResult.resultWagonNo==null
      ||tmstrainWagonUnloadResult.resultArrivalDate==null||
      tmstrainWagonUnloadResult.resultUnloadTime==null||
      tmstrainWagonUnloadResult.unloadingPointId==null||
      tmstrainWagonUnloadResult.resultBigTicketWeight==null||
      tmstrainWagonUnloadResult.resultRailHorizontalWeight==null||
      tmstrainWagonUnloadResult.resultRemark==null
      ) this.$message.error("存在空值！");
      else
      this.$axios
        .post(
          "/api/v1/tms/insertTmstrainWagonUnLoadResult",
          tmstrainWagonUnloadResult
        )
        .then(() => {
          this.$message({
            type: "success",  
            message: "新增成功!",
          });
          this.$router.go(-1);
        });
    },
    // 取消
    cancel() {
      this.$router.go(-1);
    },
  },
};
</script>
<style lang='scss'>
.addWagonLoad{
    .cp{
      width: 100%;
      display: flex;
      justify-content: center;
      align-items: center;
      padding-top: 0.625rem;
      padding-bottom: 0.625rem;
      .cp_title{
        .cp_top{
          width: 3.125rem;
          padding-right: 1.25rem;
        }
      }
    }
    .cpList{
      display: flex;
      justify-content: center;
      width: 100%;height: 10rem;
      .list{
        width: 45%;
        border: #000 0.0625rem solid;
        padding: 0.625rem;
        display: flex;
        flex-wrap: wrap;
        .cpList1{
          background-color: #c9c7c7;
          height: 1.875rem;
          margin-right: 0.5rem;
          padding: 0.625rem;
          display: flex;
          align-items: center;
          justify-content: center;
          position: relative;
          .itu{
            position: absolute;
            top:-0.125rem;
            right: 0.0625rem;
            width: 0.625rem;height: 0.625rem;
          }
        }
      }
    }
    .material{
      display: flex;
      justify-content: center;
      align-items: center;
      height: 3.75rem;
      .text{
        text-align: right;
        width: 8.125rem;
      }
    }
    .forwardingUnit{
      display: flex;
      justify-content: center;
      align-items: center;
      height: 3.75rem;
      .text{
        text-align: right;
        width: 8.125rem;
      }
    }
    .remark{
      display: flex;
      justify-content: center;
      align-items: center;
      height: 3.75rem;
      .text{
        text-align: right;
        width: 60px;
      }
    }
    .form{
      margin-top: 1.25rem;
      display: flex;
      justify-content: center;
      padding-left: 9.375rem;
    }
    .button-box{
      display: flex;
      justify-content: center;
    }
  }
</style>