//修改计划
<template>
  <div id="endMaintenance">
    <page-title>修改计划</page-title>
    <div class="main">
      <span class="text">修改</span>
      <span class="a"></span>
    </div>
    <div>
      <div class="form-box" style="margin-left: 5rem">
        <dil-form :formId="307" v-model="form"></dil-form>       
      </div>
    </div>
    <template>
			<div>		
						<dilTable v-bind.sync="first" >
						</dilTable>
            </div>
		</template>
    <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: {},
      first:{
        requestUrl:"/api/v1/ams/getTruckRequirementList?apiId=250&requirementStatus=2",
      }
    };
  },
  mounted(){
      this.information();
  },
  methods: {
    information(){
         this.axios
        .post("api/v1/ams/selectInwardPlanToUpdate/" + this.$route.params.planId)
        .then((res) => {
          res.data.data.forEach((e) => {
            this.form= e;
            console.log(e);
            console.log(this.form1);
            console.log(this.$route.params.resultId);
          });
        });
    },
    // 修改
    makeSure() {
      console.log(this.form)
      let plan = {
        requirementId : this.mapList.requirementId,
        planTruckNumber: this.form.planTruckNumber,
        carrierId: this.form.carrierId
      };
          
      this.axios
        .post(
          "/api/v1/ams/addTruckPlan",
          plan
        )
        .then((res) => {
            console.log(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>
