<template>
  <div class="addShipPrice">
    <page-title>新增</page-title>
    <el-divider content-position="left">添加汽运价格</el-divider>
     <div class="form-box" style="margin-right: 10rem">
        <dil-form :formId="217" 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>
</template>

<script>
import PageTitle from "@/components/Page/Title";

export default {
  components: { PageTitle },
  data() {
    return {
      form1: {},
      value: undefined,
    };
  },
  created(){
    this.form1 = {
      priceDate:new Date()
    }
  },
  methods: {
    // 确定
    makeSure() {
      let amsContractTransportPrice = {
        priceValue: this.form1.priceValue,
        priceDate: sjTime(this.form1.priceDate)
      };
      console.log(amsContractTransportPrice);
      if (
      amsContractTransportPrice.priceValue==null||
      amsContractTransportPrice.priceDate==null
      ) this.$message.error("必填项存在空值！");
      else
      this.axios
        .post(
          "/api/v1/ams/addAmsContractTransportPrice",
          amsContractTransportPrice
        )
        .then((res) => {
          if (res.data.code == 200) {
            this.$message({
              type: "success",
              message: "新增成功!",
            });
            // this.$refs.table.refreshData();
            this.$router.go(-1);
          } else {
            this.$message.error("新增失败！");
          }
          this.$refs['table'].resetField();
        });
    },
    // 取消
    cancel() {
      this.$router.go(-1);
    },
  },
};
</script>
<style lang='scss' scoped>
</style>