<template>
  <!-- 船只信息页面 -->
  <div class="homeworkPath">
    <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">
        <el-form ><dil-form :formId="222" v-model="form"></dil-form></el-form>
      </div>
    </div>
    <div class="button-ins">
      <el-button type="primary" @click="makeSure">新增港口装卸费</el-button>
    </div>
    <dilTable v-bind.sync="option" @radio-change="currentRadioChange">
    </dilTable>
  </div>
</template>

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

export default {
  components: { PageTitle },
  data() {
    return {
      restaurants: [],
      state: "",
      form: {},
      option: {
        // 表格请求数据的地址
        requestUrl: "/api/v1/bms/getBatch?apiId=115",
        // 控制显示当选列
        selectionType: "radio",
        rowMap:{},
      },
    };
  },
  mounted() {
  },
  methods: {
    currentRadioChange(row) {
      this.rowMap=row
      console.log(this.rowMap);
    },
    // 新增
    makeSure() {
      let mapVal = {
        feeMaterialTonnage: this.form.feeMaterialTonnage,
      };
      console.log(mapVal);
      if (
      mapVal.feeMaterialTonnage==null
      ) this.$message.error("存在空值！");
      else
      this.axios
        .post(
          "/api/v1/bms/addPortHandlingFee",
          {
           mapVal:mapVal,
           rowMap:this.rowMap
          }
        )
        .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();
        });
    },
    handleSelect(item) {
      console.log(item);
    },
    onclick() {
      console.log(1);
    },
  },
};
</script>
<style lang='scss' scoped>
</style>