<template>
  <!-- 添加提货委托 -->
  <div class="addWagonLoad">
    <PageTitle>返回</PageTitle>
    <el-divider content-position="left">提货委托</el-divider>
    <div class="form-box" style="margin-right: 10rem">
      <el-form
        ><dil-form :formId="113" v-model="form1" ref="from1"></dil-form
      ></el-form>
      <div class="buttonins">
        <el-button type="primary" @click="onDrawer">浏览</el-button>
      </div>
    </div>
    <div class="button-box">
      <el-button @click="cancel">取消</el-button>
      <el-button type="primary" @click="makeSure">确定</el-button>
    </div>
    <el-drawer
      :visible.sync="drawer"
      :direction="direction"
      :before-close="handleClose"
      size="30%"
    >
      <el-input
        placeholder="请输入内容"
        v-model="input"
        style="margin-top: 10px; margin-left: 20px"
        clearable
      >
      </el-input>
      <el-button
        type="primary"
        class="btn"
        @click="onclick()"
        style="margin-bottom: 15px"
      >
        <i class="el-icon-search"></i>查询
      </el-button>
      <dilTable
        v-bind.sync="options"
        @radio-change="currentRadioChange1"
      ></dilTable>
    </el-drawer>
  </div>
</template>
<script>
import PageTitle from "@/components/Page/Title";
export default {
  components: { PageTitle },
  data() {
    return {
      input: "",
      drawer: false,
      direction: "rtl",
      options: {
        requestUrl: "/api/v1/tms/getBatchListForAttorney?apiId=375",
        selectionType: "radio",
        maplist: [],
      },
      form1: {},
      value: undefined,
    };
  },
  mounted() {},
  methods: {
    onDrawer() {
      this.drawer = true;
    },
    onclick() {
      this.options.requestUrl =
        "/api/v1/tms/getBatchListForAttorney?apiId=375&con=" + this.input;
    },
    handleClose(done) {
      done();
    },
    currentRadioChange1(selection) {
      this.maplist = selection;
      this.form1 = {
        batchId: selection.shipName + selection.materialName,
      };
    },
    // 确定
    makeSure() {
      let AmsshipDeliveryAttorney = {
        downSwimPortId: this.form1.downSwimPortId,
        attorenyPickupIdcard: this.form1.attorenyPickupIdcard,
        attorneyContactTelephone: this.form1.attorneyContactTelephone,
        batchId: this.maplist.batchId,
        attorneyTime: sjTime(this.form1.attorneyTime),
        attorneyPdffile: this.form1.attorneyPdffile,
        noticeId: this.form1.noticeId,
        portId: this.form1.portId,
        attorneyPickupContactPerson: this.form1.attorneyPickupContactPerson,
        resultMemo: this.form1.resultMemo,
      };
      if (
        // AmsshipDeliveryAttorney.attorneyId==null||
        // AmsshipDeliveryAttorney.downSwimPortId==null||
        // AmsshipDeliveryAttorney.attorenyPickupIdcard==null||
        AmsshipDeliveryAttorney.attorneyContactTelephone == null
        // AmsshipDeliveryAttorney.attorneyTime==null||
        // AmsshipDeliveryAttorney.attorneyPdffile==null
      )
        this.$message.error("存在空值！");
      else
        this.axios
          .post(
            "/api/v1/tms/insertshipDeliveryAttorney",
            AmsshipDeliveryAttorney
          )
          .then((res) => {
            //   console.log(res);
            //   console.log(this.form4);
            this.$router.go(-1);
          });
    },
    // 取消
    cancel() {
      this.$router.go(-1);
    },
  },
};
</script>
<style lang='scss' scoped>

.buttonins {
  height: auto;
}
</style>

