<template>
  <c-row>
    <!-- =================信用证信息====================== -->
    <!-- =================顶部====================== -->
    <c-col :span="24">
      <c-col :span="10">
        <el-form-item label="信用证参考号" prop="didgrp.rec.ownref">
          <c-input
            v-model="model.didgrp.rec.ownref"
            placeholder="请输入参考号"
            disabled
            style="width:100%"
          ></c-input>
        </el-form-item>
      </c-col>
      <c-col :span="1" style="text-align: right">
        <el-form-item label-width="0">
          <c-button
                style="margin-left:0"
                size="small"
                type="primary"
                @click="onSeainf"
              >
              <span style="font-size:15px;font-family:'宋体';font-weight:bold">i</span>
              </c-button>
        </el-form-item>
      </c-col>
      <!-- <c-col :span="4">
      <el-form-item label="Drag  Drop Sender" prop="bdtp.recget.sdamod.dadsnd">
        <c-input
          v-model="model.bdtp.recget.sdamod.dadsnd"
          placeholder="请输入Drag  Drop Sender"
        ></c-input>
      </el-form-item>
     </c-col> -->
      <c-col :span="11" :offset="1">
        <el-form-item label="摘要" prop="didgrp.rec.nam">
          <c-input
            align="middle"
            v-model="model.didgrp.rec.nam"
            maxlength="40"
            placeholder="请输入摘要"
            disabled
          >
          </c-input>
        </el-form-item>
      </c-col>
    </c-col>

    <!-- =================左边====================== -->
    <c-col :span="11">
      <c-col :span="13">
        <el-form-item label="信用证金额">
          <c-select
            disabled
            v-model="model.didgrp.cbs.nom1.cur"
            style="width: 95%"
            placeholder="请选择币种"
            @keyup.enter.native="didCurEvent"
          >
            <el-option
              v-for="item in codes.cur"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </c-select>
        </el-form-item>
      </c-col>

      <c-col :span="11">
        <el-form-item
          style="text-align: left"
          label-width="0"
          prop="didgrp.cbs.nom1.amt"
        >
          <c-input
            disabled
            v-model="model.didgrp.cbs.nom1.amt"
            placeholder="请输入信用证金额"
          ></c-input>
        </el-form-item>
      </c-col>
      <!-- </c-col> -->

      <c-col :span="13">
        <el-form-item label="单据金额">
          <c-select
            disabled
            v-model="model.didgrp.cbs.opn1.cur"
            style="width: 95%"
            placeholder="请选择币种"
            @keyup.enter.native="didCurEvent"
          >
            <el-option
              v-for="item in codes.cur"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </c-select>
        </el-form-item>
      </c-col>

      <c-col :span="11">
        <el-form-item
          style="text-align: left"
          label-width="0"
          label=""
          prop="didgrp.cbs.opn1.amt"
        >
          <c-input
            disabled
            v-model="model.didgrp.cbs.opn1.amt"
            placeholder="请输入单据金额"
          ></c-input>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="指定银行" prop="didgrp.avbnam">
          <c-input
            disabled
            v-model="model.didgrp.avbnam"
            maxlength="40"
            placeholder="请输入指定银行"
          ></c-input>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="兑付方式">
          <c-select
            disabled
            v-model="model.didgrp.rec.avbby"
            style="width: 100%"
            placeholder="请选择兑付方式"
          >
            <el-option
              v-for="item in codes.avbby0"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </c-select>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="开证日期">
          <c-date-picker
            type="date"
            v-model="model.didgrp.rec.opndat"
            disabled
            style="width: 100%"
            placeholder="请选择开证日期"
          >
          </c-date-picker>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <!-- <span v-text="model.bdtp.zchday" data-path=".bdtp.zchday"> </span> -->
        <el-form-item label="最迟装运日期">
          <c-date-picker
            type="date"
            v-model="model.didgrp.rec.shpdat"
            disabled
            style="width: 100%"
            placeholder="请选择最迟货物装运/服务提供日期"
          ></c-date-picker>
        </el-form-item>
      </c-col>

      <c-col :span="24">
          <el-form-item label="到期日">
            <c-date-picker
              type="date"
              v-model="model.didgrp.rec.expdat"
              disabled
              style="width: 100%"
              placeholder="到期日"
            >
            </c-date-picker>
          </el-form-item>
      </c-col>
        

      <c-col :span="24">
        <el-form-item label="信用证类型">
          <c-select
            v-model="model.didgrp.rec.lcrtyp"
            style="width: 100%"
            disabled
            placeholder="请选择单据类型"
          >
            <el-option
              v-for="item in codes.lcrtyp"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </c-select>
        </el-form-item>
      </c-col>
    </c-col>

    <!-- =================右边====================== -->
    <c-col :span="11" :offset="1">
      <c-col :span="24">
        <el-form-item label="申请人编号" prop="bddgrp.apl.pts.ref">
          <c-input
            v-model="model.bddgrp.apl.pts.ref"
            maxlength="16"
            disabled
            placeholder="请输入申请人编号"
          ></c-input>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="申请人名称" prop="bddgrp.apl.pts.nam">
          <c-input
            v-model="model.bddgrp.apl.pts.nam"
            maxlength="40"
            disabled
            placeholder="申请人名称"
          ></c-input>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="受益人编号" prop="bddgrp.ben.pts.ref">
          <c-input
            v-model="model.bddgrp.ben.pts.ref"
            maxlength="16"
            disabled
            placeholder="请输入受益人编号"
          ></c-input>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="受益人名称" prop="bddgrp.ben.pts.nam">
          <c-input
            v-model="model.bddgrp.ben.pts.nam"
            maxlength="40"
            disabled
            placeholder="受益人名称"
          ></c-input>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="交单行编号" prop="bddgrp.prb.pts.ref">
          <c-input
            v-model="model.bddgrp.prb.pts.ref"
            maxlength="16"
            disabled
            placeholder="请输入交单行编号"
          ></c-input>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="交单行名称" prop="bddgrp.prb.pts.nam">
          <c-input
            v-model="model.bddgrp.prb.pts.nam"
            maxlength="40"
            disabled
            placeholder="交单行名称"
          ></c-input>
        </el-form-item>
      </c-col>

      <c-col :span="24">
          <el-form-item label="到期地点" prop="didgrp.rec.expplc">
            <c-input
              type="textarea"
              v-model="model.didgrp.rec.expplc"
              disabled
              maxlength="35"
              show-word-limit
              placeholder="请输入到期地点"
            ></c-input>
          </el-form-item>
        </c-col>
    </c-col>

    <c-col :span="24" style="height: 20px;margin-left:20px">
          <el-divider></el-divider>
        </c-col>

    <!-- =================单据信息====================== -->
    <!-- =================顶部====================== -->
    <c-col :span="24">
      <c-col :span="10">
        <el-form-item label="单据参考号" prop="bddgrp.rec.ownref">
          <c-input
            v-model="model.bddgrp.rec.ownref"
            maxlength="16"
            disabled
            placeholder="请输入单据参考号"
          ></c-input>
        </el-form-item>
      </c-col>

      <c-col :span="1" style="text-align: right">
        <el-form-item label-width="0">
          <c-button
            size="small"
            type="primary"
            style="margin-left: 0;padding:0 9px"
            @click="onBdtmodButgetref"
            >获取</c-button
          >
        </el-form-item>
      </c-col>

      <c-col :span="11" :offset="1">
        <el-form-item label="摘要" prop="bddgrp.rec.nam">
          <c-input
            align="middle"
            v-model="model.bddgrp.rec.nam"
            disabled
            maxlength="40"
            placeholder="请输入摘要"
          ></c-input>
        </el-form-item>
      </c-col>
    </c-col>

    <!-- =================左边====================== -->
    <c-col :span="11">
      <c-col :span="24">
        <el-form-item label="单据类型">
          <c-select
            v-model="model.bddgrp.rec.docflg"
            style="width: 100%"
            disabled
            placeholder="请选择单据类型"
          >
            <el-option
              v-for="item in codes.brdtyp"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </c-select>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <c-col :span="13">
          <el-form-item label="单据金额">
            <c-select
              disabled
              v-model="model.bddgrp.cbs.max.cur"
              style="width: 95%"
              placeholder="请选择币种"
              
            >
              <el-option
                v-for="item in codes.cur"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </c-select>
          </el-form-item>
        </c-col>

        <c-col :span="11">
          <el-form-item
            style="text-align: left"
            label-width="0"
            label=""
            prop="bddgrp.cbs.max.amt"
          >
            <c-input
              v-model="model.bddgrp.cbs.max.amt"
              placeholder="请输入单据金额"
            ></c-input>
          </el-form-item>
        </c-col>
      </c-col>

      <c-col :span="24">
        <el-form-item
          label="原发起直接参与机构"
          prop="trnmod.swiadd.oriinstgagt"
        >
          <c-input
            v-model="model.trnmod.swiadd.oriinstgagt"
            maxlength="20"
            disabled
            placeholder="请输入原发起直接参与机构"
          ></c-input>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="此信用证下的到单次数" prop="didgrp.rec.utlnbr">
          <c-input
            v-model="model.didgrp.rec.utlnbr"
            disabled
            placeholder="请输入此信用证下的到单次数"
          ></c-input>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="到单日期" prop="bddgrp.rec.rcvdat">
          <c-date-picker
            type="date"
            v-model="model.bddgrp.rec.rcvdat"
            style="width: 100%"
            placeholder="请选择到单日期"
          >
          </c-date-picker>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="交单日期" prop="bddgrp.rec.predat">
          <c-date-picker
            type="date"
            v-model="model.bddgrp.rec.predat"
            style="width: 100%"
            placeholder="请选择交单日期"
          >
          </c-date-picker>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="通知日期" prop="bddgrp.rec.orddat">
          <c-date-picker
            type="date"
            v-model="model.bddgrp.rec.orddat"
            style="width: 100%"
            placeholder="请选择通知日期"
          >
          </c-date-picker>
        </el-form-item>
      </c-col>

      <c-col :span="24">
          <!-- label-width="110px" -->
        <el-form-item label="货物装运/服务提供日期">
          <c-date-picker
            type="date"
            v-model="model.bddgrp.rec.shpdat"
            style="width: 100%"
            placeholder="请选择货物装运/服务提供日期"
          >
          </c-date-picker>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="远期起算日">
          <c-date-picker
            type="date"
            v-model="model.bddgrp.rec.stadat"
            disabled
            style="width: 100%"
            placeholder="请选择起算日"
          >
          </c-date-picker>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="远期到期日">
          <c-date-picker
            type="date"
            v-model="model.bddgrp.rec.matdat"
            style="width: 100%"
            disabled
            placeholder="请选择到期日"
          >
          </c-date-picker>
        </el-form-item>
      </c-col>

      <c-col :span="13">
        <el-form-item label="期限" prop="bddgrp.rec.tenmaxday">
          <c-input
            v-model="model.bddgrp.rec.tenmaxday"
            disabled
            placeholder="请输入期限"
            style="width:95%"
          ></c-input>
        </el-form-item>
      </c-col>

      <c-col :span="11">
        <el-form-item label="发票类型" label-width="110px" prop="bddgrp.rec.invtyp">
          <c-select
            v-model="model.bddgrp.rec.invtyp"
            style="width: 100%"
            placeholder="请选择发票类型"
          >
          <el-option
                v-for="item in codes.invtypCodes"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
          </c-select>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="收款行行号" prop="bddgrp.skh.pts.bankno">
          <c-input
            v-model="model.bddgrp.skh.pts.bankno"
            maxlength="20"
            style="width: 100%"
            placeholder="请输入收款行行号"
             
            @keyup.enter.native="showGridPromptDialog('bddgrp.skh.pts.bankno')"
          ></c-input>
          <!-- @keyup.enter.native="ptsBanknoEvent" -->
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="收款行名称" prop="bddgrp.skh.pts.jigomc">
          <c-input
            type="textarea"
            v-model="model.bddgrp.skh.pts.jigomc"
            style="width: 100%"
            maxlength="35"
            show-word-limit
            placeholder="请输入收款行名称"
          ></c-input>
        </el-form-item>
      </c-col>

      <!-- <c-col :span="24">
        <el-form-item label="申请人编号" prop="didgrp.apl.pts.ref">
          <c-input
            v-model="model.didgrp.apl.pts.ref"
            maxlength="16"
            style="width: 100%"
            placeholder="请输入申请人编号"
            @keyup.enter.native="ptsRefEvent"
          ></c-input>
        </el-form-item>
      </c-col> -->
    </c-col>
    <!-- =================右边====================== -->
    <c-col :span="11" :offset="1">
      <c-col :span="24">
        <el-form-item label="交单行" prop="bddgrp.rec.docprbrol">
          <c-select
            v-model="model.bddgrp.rec.docprbrol"
            :code="getValues('bddgrp.rec.docprbrol')"
            style="width: 100%"
            placeholder="请选择交单行类型"
            @change="docprbrolChange"
          >
          </c-select>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="交单行编号" prop="bddgrp.prb.pts.ref">
          <c-input
            v-model="model.bddgrp.prb.pts.ref"
            maxlength="16"
            style="width: 100%"
            placeholder="请输入交单行编号"
            @keyup.enter.native="ptsRefEvent"
          ></c-input>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="交单行BIC" prop="bddgrp.prb.pts.extkey">
          <c-input
            v-model="model.bddgrp.prb.pts.extkey"
            maxlength="16"
            style="width: 100%"
            placeholder="请输入交单行BIC"
            :disabled="model.bddgrp.rec.docprbrol == 'PRB' ? false : true"
          ></c-input>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="交单行联行行号" prop="bddgrp.prb.pts.bankno">
          <c-input
            v-model="model.bddgrp.prb.pts.bankno"
            maxlength="20"
            style="width: 100%"
            placeholder="请输入交单行联行行号"
            :disabled="model.bddgrp.rec.docprbrol == 'PRB' ? false : true"
             @keyup.enter.native="showGridPromptDialog('bddgrp.prb.pts.bankno')"
          ></c-input>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="交单行联行名称" prop="bddgrp.prb.pts.jigomc">
          <c-input
            type="textarea"
            v-model="model.bddgrp.prb.pts.jigomc"
            style="width: 100%"
            maxlength="35"
            show-word-limit
            placeholder="请输入联行名称"
            disabled
          ></c-input>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="交单行地址" prop="bddgrp.prb.pts.dizhii">
          <c-input
            type="textarea"
            v-model="model.bddgrp.prb.pts.dizhii"
            style="width: 100%"
            maxlength="35"
            show-word-limit
            placeholder="请输入交单行地址"
            :disabled="model.bddgrp.rec.docprbrol == 'PRB' ? false : true"
          ></c-input>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="原报文标识号" prop="trnmod.swiadd.orimsgid">
          <c-input
            v-model="model.trnmod.swiadd.orimsgid"
            maxlength="35"
            disabled
            style="width: 100%"
            placeholder="请输入原报文标识号"
          ></c-input>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="单据状态" prop="bddgrp.rec.docsta">
          <c-input
            v-model="model.bddgrp.rec.docsta"
            maxlength="1"
            disabled
            style="width: 100%"
            placeholder="请输入单据状态"
          ></c-input>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="原报文类型" prop="trnmod.swiadd.orimsgtyp">
          <c-select
            v-model="model.trnmod.swiadd.orimsgtyp"
            disabled
            style="width: 100%"
            placeholder="请选择原报文类型"
          >
          </c-select>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="">
          <c-checkbox v-model="model.bddgrp.rec.dscinsflg" @change="isShowDocpre"
            >录入单据、不符点、结算指示和货运详细信息</c-checkbox
          >
        </el-form-item>
      </c-col>

      <!-- <c-col :span="24">
        <c-checkbox v-model="model.bdtp.setnowflg">Register to Send and Settle Document</c-checkbox>
      </c-col> -->
    </c-col>
  </c-row>
</template>
<script>
import Api from "~/service/Api";
import CommonProcess from "~/mixin/CommonProcess";
import CodeTable from "~/config/CodeTable";
import Event from "~/model/Ditdck/Event";
import Utils from "~/utils";

export default {
  inject: ["root"],
  props: ["model", "codes"],
  mixins: [CommonProcess],
  data() {
    return {};
  },
  methods: {
    ...Event,
    didCurEvent() {
      this.executeDefault("didgrp.cbs.nom1.cur").then((res) => {
        if ((res.respCode == SUCCESS)) {
          Utils.copyValueFromVO(this.model, res.data);
        }
      });
    },
    bddCurEvent() {
      this.executeDefault("bddgrp.cbs.max.cur").then((res) => {
        if ((res.respCode == SUCCESS)) {
          Utils.copyValueFromVO(this.model, res.data);
        }
      });
    },
    docprbrolChange(){
      this.executeRule("bddgrp.rec.docprbrol").then((res) => {
        if ((res.respCode == SUCCESS)) {
          debugger;
          Utils.copyValueFromVO(this.model, res.data);
        }
      });
    },
    ptsRefEvent(){
       this.executeRule("trnmod.ptsmod.wrkptspta.pts.ref").then((res) => {
        if ((res.respCode == SUCCESS)) {
          debugger;
          Utils.copyValueFromVO(this.model, res.data);
        }
      });
    },
    ptsBanknoEvent(){
       this.executeRule("bddgrp.skh.pts.bankno").then((res) => {
        if ((res.respCode == SUCCESS)) {
          debugger;
          Utils.copyValueFromVO(this.model, res.data);
        }
      });
    },
    isShowDocpre(val){
        this.$emit("changeShowDocpre", val);
    },
  },
  created: function () {},
};
</script>
<style scoped>
.el-col >>> .el-divider--horizontal {
  margin-top: 5px;
}
</style>