<template>
  <!-- 修改车皮装车实绩 -->
  <div id="contractDetails">
    <page-title>编辑</page-title>
    <div class="main">
      <span class="text">车皮装车实绩</span>
      <span class="a"></span>
    </div>
    <div class="contractTitle">
      <div class="form-box">
        <div class="form-one">
          <dil-form :formId="103" v-model="form1"></dil-form>
        </div>
      </div>
    </div>

    <div class="button-box">
      <el-button type="primary" @click="onClickConfirm">确认</el-button>
      <el-button @click="onClickCancel">返回</el-button>
    </div>
  </div>
</template>

<script>
import PageTitle from "@/components/Page/Title";
import { sjTime } from "@/utils/sharedJsFile";
export default {
  components: { PageTitle },
 data(){
     return {
      form1: {},
  }
 },
  mounted() {
    this.information();
  },
  methods: {
    information() {
      //编辑车皮装车作业
      this.$axios
        .post("/api/v1/tms/getTmstrainLoadingResultByResultId/" + this.$route.params.resultId)
        .then((res) => {
          res.data.data.forEach((e) => {
            this.form1 = e;
            console.log(e);
            console.log(this.form1);
            console.log(this.$route.params.resultId);
          });
        });
    },
    handleCheckedCitiesChange(value) {
      console.log(value);
    },
    // 返回
    onClickCancel() {
      this.$router.go(-1);
    },
    currentRadioChange(row) {
      this.aaaa = row;
    },
    // 确认
    onClickConfirm() {
      let tmstrainLoadingResult = {
        resultId: this.$route.params.resultId,
        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
      };
      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||
      tmstrainLoadingResult.resultRemarks==null
      ) this.$message.error("必填项存在空值！");
      else
      this.$axios
        .post("/api/v1/tms/upadteTmstrainLoadingResultByResultId",tmstrainLoadingResult)
        .then(() => {
          this.$message({
            type: "success",  
            message: "修改成功!",
          });
          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>