<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="118" 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";

export default {
  components: { PageTitle },
 data(){
     return {
      form1: {},
  }
 },
  mounted() {
    this.information();
  },
  methods: {
    information() {
      //编辑车皮装车作业
      this.axios
        .post("/api/v1/tms/getTmstrainWagonUnLoadResultByUnLoadingId/" + this.$route.params.unloadingId)
        .then((res) => {
          res.data.data.forEach((e) => {
            this.form1 = e;
            console.log(e);
            console.log(this.form1);
            console.log(this.$route.params.unloadingId);
          });
        });
    },
    handleCheckedCitiesChange(value) {
      console.log(value);
    },
    // 返回
    onClickCancel() {
      this.$router.go(-1);
    },
    currentRadioChange(row) {
      this.aaaa = row;
    },
    //确定
    onClickConfirm() {
      let tmstrainWagonUnloadResult = {
        unloadingId: this.$route.params.unloadingId,
        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.resultArrivalDate==null||
      tmstrainWagonUnloadResult.resultUnloadTime==null||
      tmstrainWagonUnloadResult.unloadingPointId==null||
      tmstrainWagonUnloadResult.resultBigTicketWeight==null||
      tmstrainWagonUnloadResult.resultRailHorizontalWeight==null
      ) this.$message.error("存在空值！");
      else
      this.axios
        .post(
          "/api/v1/tms/upadteTmstrainWagonUnLoadResultByUnLoadingId",
          tmstrainWagonUnloadResult
        )
        .then(() => {
          this.$message({
            type: "success",  
            message: "修改成功!",
          });
          this.$router.go(-1);
        });
    },
  },
};
</script>
<style lang="scss" scoped>
// @import "@/styles/TMS/addwagonload.scss";
</style>