<template>
  <div class="eibs-tab">
    <!-- left -->
    <c-col :span="11">
      <c-col :span="24">
        <c-col :span="20">
          <el-form-item
            label="Export L/C Ref."
            prop="ledgrp.rec.ownref"
            style="width: 100%"
          >
            <c-input
              v-model="model.ledgrp.rec.ownref"
              maxlength="16"
              placeholder="Please input Export L/C Ref."
              style="width: 95%"
              disabled
            ></c-input>
          </el-form-item>
        </c-col>
        <!-- <c-col :span="1" style="text-align: right"> -->
        <c-col :span="1">
          <!-- <el-form-item label="" label-width="5px"> -->
          <c-button
            style="margin: 0 10px 0 0; padding: 0 12px"
            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="2" :offset="1" style="text-align: right">
          <!-- <el-form-item label="" label-width="5px"> -->
          <c-button
            style="margin: 0 0"
            size="small"
            type="primary"
            :disabled="this.flag"
            @click="onDetpButgetref"
          >
            Get
          </c-button>
          <!-- </el-form-item> -->
        </c-col>
        <!-- </c-col> -->
      </c-col>

      <c-col :span="24">
        <c-col :span="20">
          <el-form-item
            label="Bill Set Reference"
            prop="bedgrp.rec.ownref"
            style="width: 100%"
          >
            <c-input
              v-model="model.bedgrp.rec.ownref"
              maxlength="16"
              placeholder="Please input Bill Set Reference"
              style="width: 95%"
              disabled
            ></c-input>
          </el-form-item>
        </c-col>
        <!-- <c-col :span="1" style="text-align: right"> -->
        <c-col :span="1">
          <!-- <el-form-item label="" label-width="5px"> -->
          <c-button
            style="margin: 0 10px 0 0; padding: 0 12px"
            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="2" :offset="1" style="text-align: right">
          <!-- <el-form-item label="" label-width="5px"> -->
          <c-button
            style="margin: 0 0"
            size="small"
            type="primary"
            :disabled="this.flag"
            @click="onDetpButgetref"
          >
            Get
          </c-button>
          <!-- </el-form-item> -->
        </c-col>
        <!-- </c-col> -->
      </c-col>
      <c-col :span="24">
        <el-form-item label="Document Amount" prop="bedgrp.cbs.max.cur">
          <c-fullbox>
            <c-input
              v-model="model.bedgrp.cbs.max.cur"
              maxlength="3"
              style="width: 50%"
              placeholder="Please input Document Amount"
              disabled
            ></c-input>
            <c-input
              v-model="model.bedgrp.cbs.max.amt"
              style="width: 50%"
              placeholder="Please input Balance"
              disabled
            ></c-input>
            <template slot="footer">
              <c-checkbox
                v-model="model.betp.adaflg"
                style="margin-left: 10px"
                disabled
                >Add. Amount</c-checkbox
              >
            </template>
          </c-fullbox>
        </el-form-item>
      </c-col>
      <c-col :span="24">
        <c-col :span="12">
          <el-form-item label="Open Amount" prop="bedgrp.cbs.opn1.cur">
            <c-input
              v-model="model.bedgrp.cbs.opn1.cur"
              maxlength="3"
              placeholder="Please input Open Amoun"
              disabled
            ></c-input>
          </el-form-item>
        </c-col>
        <c-col :span="12">
          <el-form-item label="" label-width="5px" prop="bedgrp.cbs.max.amt">
            <c-input
              v-model="model.bedgrp.cbs.max.amt"
              placeholder="Please input Balance"
              disabled
            ></c-input>
          </el-form-item>
        </c-col>
      </c-col>
      <c-col :span="24">
        <el-form-item label="Document Type" prop="bedgrp.rec.doctypcod">
          <c-select
            v-model="model.bedgrp.rec.doctypcod"
            style="width: 100%"
            placeholder="Please input Document Type"
            disabled
          >
            <el-option
              v-for="item in codes.doctypcod1"
              :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="Maturity Date" prop="bedgrp.rec.matdat">
          <c-date-picker
            type="date"
            v-model="model.bedgrp.rec.matdat"
            style="width: 100%"
            placeholder="Please select Maturity Date"
            disabled
          ></c-date-picker>
        </el-form-item>
      </c-col>
      <c-col :span="24">
        <c-col :span="12">
          <el-form-item label="Received on" prop="bedgrp.rec.rcvdat">
            <c-date-picker
              type="date"
              v-model="model.bedgrp.rec.rcvdat"
              style="width: 100%"
              placeholder="Please select Received on"
              disabled
            ></c-date-picker>
          </el-form-item>
        </c-col>
        <c-col :span="12">
          <el-form-item label="Presented on" prop="bedgrp.rec.predat">
            <c-date-picker
              type="date"
              v-model="model.bedgrp.rec.predat"
              style="width: 100%"
              placeholder="Please select Presented on"
              disabled
            ></c-date-picker>
          </el-form-item>
        </c-col>
      </c-col>
      <c-col :span="24">
        <el-form-item label="Document Status" prop="bedgrp.rec.docsta">
          <c-select
            v-model="model.bedgrp.rec.docsta"
            style="width: 100%"
            placeholder="Please select Document Status"
            disabled
          >
            <el-option
              v-for="item in codes.docsta1"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </c-select>
        </el-form-item>
      </c-col>
    </c-col>

    <!-- right -->
    <c-col :span="11" :offset="1">
      <c-col :span="24">
        <c-col :span="12">
          <el-form-item label="Open Amt. L/C" prop="ledgrp.cbs.opn1.cur">
            <c-input
              v-model="model.ledgrp.cbs.opn1.cur"
              maxlength="3"
              placeholder="Please input Open Amt. L/C"
              disabled
            ></c-input>
          </el-form-item>
        </c-col>
        <c-col :span="12">
          <el-form-item label="" label-width="5px" prop="ledgrp.cbs.opn1.amt">
            <c-input
              v-model="model.ledgrp.cbs.opn1.amt"
              placeholder="Please input Balance"
              disabled
            ></c-input>
          </el-form-item>
        </c-col>
      </c-col>

      <c-col :span="24">
        <el-form-item label="Name" prop="bedgrp.rec.nam">
          <c-input
            v-model="model.bedgrp.rec.nam"
            maxlength="40"
            placeholder="Please input Name"
            disabled
          ></c-input>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <c-ptsmsg
          :model="model"
          :argadr="{
            title: 'Presented by',
            grp: 'bedgrp',
            rol: 'prb',
          }"
          :disabled="true"
          :enRef="true"
          :enNam="true"
        ></c-ptsmsg>
      </c-col>
      <c-col :span="24">
        <c-ptsmsg
          :model="model"
          :argadr="{
            title: 'Issuing Bank',
            grp: 'bedgrp',
            rol: 'iss',
          }"
          :disabled="true"
          :enRef="true"
          :enNam="true"
        ></c-ptsmsg>
      </c-col>
      <c-col :span="24">
        <c-ptsmsg
          :model="model"
          :argadr="{
            title: 'Applicant',
            grp: 'bedgrp',
            rol: 'apl',
          }"
          :disabled="true"
          :enRef="true"
          :enNam="true"
        ></c-ptsmsg>
      </c-col>
    </c-col>
    <c-col :span="24">
      <el-form-item style="margin-left: 0px">
        <el-divider />
      </el-form-item>
    </c-col>

    <!-- next part -->
    <c-col :span="24" style="margin-bottom: 35px">
      <c-istream-table
        ref="table"
        :list="model.liaall.tenstm.rows || []"
        :columns="stmData.columns"
        :showSelection="true"
        v-on:multipleSelect="multipleSelect"
      >
      </c-istream-table>
    </c-col>
    <!-- left -->
    <c-col :span="12">
      <c-col :span="24">
        <c-col :span="12">
          <el-form-item label="Doc. Amount Part" prop="bedgrp.cbs.opn2.cur">
            <c-input
              v-model="model.bedgrp.cbs.opn2.cur"
              maxlength="3"
              placeholder="Please input Doc. Amount Part"
              disabled
            ></c-input>
          </el-form-item>
        </c-col>
        <c-col :span="12">
          <el-form-item label="" label-width="5px" prop="aamset.utlamt">
            <c-input
              v-model="model.aamset.utlamt"
              placeholder="Please input Doc. Amount Part"
              disabled
            ></c-input>
          </el-form-item>
        </c-col>
      </c-col>

      <c-col :span="24">
        <c-col :span="12">
          <el-form-item label="Add. Amount Part" prop="bedgrp.cbs.opn2.cur">
            <c-input
              v-model="model.bedgrp.cbs.opn2.cur"
              maxlength="3"
              placeholder="Please input Add. Amount Part"
              disabled
            ></c-input>
          </el-form-item>
        </c-col>
        <c-col :span="12">
          <el-form-item label="" label-width="5px" prop="aamset.utlamt2">
            <c-input
              v-model="model.aamset.utlamt2"
              placeholder="Please input Add. Amount Part"
              disabled
            ></c-input>
          </el-form-item>
        </c-col>
      </c-col>
      <c-col :span="24">
        <el-form-item label="" prop="rmbclm.clmrmbflg">
          <c-checkbox v-model="clmrmbflg"
            >Claim Reimbursement(e.g via MT 742)</c-checkbox
          >
        </el-form-item>
      </c-col>
    </c-col>

    <!-- right -->
    <c-col :span="12">
      <c-col :span="24">
        <c-form-item label="Less comm." prop="bedgrp.rec.lescom">
          <c-input
            v-model="model.bedgrp.rec.lescom"
            placeholder="Please input Less comm.'"
          ></c-input>
        </c-form-item>
      </c-col>

      <c-col :span="24">
        <c-form-item label="Narrative :77A:" prop="trnmod.trndoc.nar754">
          <c-input
            type="textarea"
            v-model="model.trnmod.trndoc.nar754"
            maxlength="35"
            show-word-limit
            placeholder="Please input Narrative :77A:'"
          ></c-input>
        </c-form-item>
      </c-col>
    </c-col>

    <!-- bottom -->
    <c-col :span="24">
      <el-form-item
        label="Payment instructions to ISS/AVB"
        prop="payinstxt"
        style="width: 100%"
      >
        <c-fullbox>
          <c-input
            type="textarea"
            v-model="model.payinstxt"
            maxlength="65"
            show-word-limit
            placeholder="Please input Payment instructions to ISS/AVB"
          ></c-input>
          <template slot="footer">
            <c-button
              style="margin-left: 10px; padding: 0 10px"
              size="small"
              type="primary"
            >
              ...
            </c-button>
          </template>
        </c-fullbox>
      </el-form-item>
    </c-col>

    <!-- <c-col :span="12">
        <c-form-item label="Drag  Drop Sender" prop="betp.ledget.sdamod.dadsnd">
            <c-input  v-model="model.betp.ledget.sdamod.dadsnd"  :placeholder="$t('other.please_enter')+'Drag  Drop Sender'"></c-input>
        </c-form-item>
       </c-col>
                 SF000052 : 参考号
                  
       <c-col :span="12">
        <c-form-item :label="$t('betp.SF000052')" prop="ledgrp.rec.ownref">
            <c-input  v-model="model.ledgrp.rec.ownref" maxlength="16"  :placeholder="$t('other.please_enter')+$t('betp.SF000052')"></c-input>
        </c-form-item>
       </c-col>
                  
       <c-col :span="12">
        <c-form-item label="" prop="betp.ledget.sdamod.seainf">
            <c-input  v-model="model.betp.ledget.sdamod.seainf"  :placeholder="$t('other.please_enter')+''"></c-input>
        </c-form-item>
       </c-col>
                 SF000053 : 信用证余额
                  
       <c-col :span="12">
        <c-form-item label="Currency" prop="ledgrp.cbs.opn1.cur">
            <c-input  v-model="model.ledgrp.cbs.opn1.cur" maxlength="3"  :placeholder="$t('other.please_enter')+'Currency'"></c-input>
        </c-form-item>
       </c-col>
                  
       <c-col :span="12">
        <c-form-item label="Balance" prop="ledgrp.cbs.opn1.amt">
            <c-input  v-model="model.ledgrp.cbs.opn1.amt"  :placeholder="$t('other.please_enter')+'Balance'"></c-input>
        </c-form-item>
       </c-col>
                  
       <c-col :span="12">
        <c-form-item label="Drag  Drop Sender" prop="betp.recget.sdamod.dadsnd">
            <c-input  v-model="model.betp.recget.sdamod.dadsnd"  :placeholder="$t('other.please_enter')+'Drag  Drop Sender'"></c-input>
        </c-form-item>
       </c-col>
                 SF000061 : 单据参考号
                  
       <c-col :span="12">
        <c-form-item :label="$t('betp.SF000061')" prop="bedgrp.rec.ownref">
            <c-input  v-model="model.bedgrp.rec.ownref" maxlength="16"  :placeholder="$t('other.please_enter')+$t('betp.SF000061')"></c-input>
        </c-form-item>
       </c-col>
                  
       <c-col :span="12">
        <c-form-item label="" prop="betp.recget.sdamod.seainf">
            <c-input  v-model="model.betp.recget.sdamod.seainf"  :placeholder="$t('other.please_enter')+''"></c-input>
        </c-form-item>
       </c-col>
                 SF000077 : 摘要
                  
       <c-col :span="12">
        <c-form-item label="Externally Displayed Name to Identify the Contract" prop="bedgrp.rec.nam">
            <c-input  v-model="model.bedgrp.rec.nam" maxlength="40"  :placeholder="$t('other.please_enter')+'Externally Displayed Name to Identify the Contract'"></c-input>
        </c-form-item>
       </c-col>
                 SF000060 : 单据金额
                  
       <c-col :span="12">
        <el-form-item :label="$t('betp.SF000060')" prop="bedgrp.cbs.max.cur">
            <c-select v-model="model.bedgrp.cbs.max.cur" style="width:100%" :placeholder="$t('other.please_enter')+$t('betp.SF000060')">
              </c-select>
        </el-form-item>
       </c-col>
                  
       <c-col :span="12">
        <c-form-item :label="$t('betp.SF000060')" prop="bedgrp.cbs.max.amt">
            <c-input  v-model="model.bedgrp.cbs.max.amt"  :placeholder="$t('other.please_enter')+$t('betp.SF000060')"></c-input>
        </c-form-item>
       </c-col>
                 SF000056 : 交单人
                  
       <c-col :span="12">
        <c-form-item :label="$t('betp.SF000056')" prop="bedgrp.prb.pts.ref">
            <c-input  v-model="model.bedgrp.prb.pts.ref" maxlength="16"  :placeholder="$t('other.please_enter')+$t('betp.SF000056')"></c-input>
        </c-form-item>
       </c-col>
                  
       <c-col :span="12">
	    <c-checkbox v-model="model.betp.adaflg">{{$t('betp.CF000051')}}</c-checkbox>
       </c-col>
                 SF000059 : 单据余额
                  
       <c-col :span="12">
        <c-form-item :label="$t('betp.SF000059')" prop="bedgrp.cbs.opn1.cur">
            <c-input  v-model="model.bedgrp.cbs.opn1.cur" maxlength="3"  :placeholder="$t('other.please_enter')+$t('betp.SF000059')"></c-input>
        </c-form-item>
       </c-col>
                  
       <c-col :span="12">
        <c-form-item label="Balance" prop="bedgrp.cbs.opn1.amt">
            <c-input  v-model="model.bedgrp.cbs.opn1.amt"  :placeholder="$t('other.please_enter')+'Balance'"></c-input>
        </c-form-item>
       </c-col>
                  
       <c-col :span="12">
        <c-form-item label="Name of Party" prop="bedgrp.prb.pts.nam">
            <c-input  v-model="model.bedgrp.prb.pts.nam" maxlength="40"  :placeholder="$t('other.please_enter')+'Name of Party'"></c-input>
        </c-form-item>
       </c-col>
                 SF000063 : 开证行
                 SF000065 : 编号
                  
       <c-col :span="12">
        <c-form-item :label="$t('betp.SF000063')" prop="bedgrp.iss.pts.ref">
            <c-input  v-model="model.bedgrp.iss.pts.ref" maxlength="16"  :placeholder="$t('other.please_enter')+$t('betp.SF000063')"></c-input>
        </c-form-item>
       </c-col>
                 SF000062 : 单据类型
                  
       <c-col :span="12">
        <el-form-item :label="$t('betp.SF000062')" prop="bedgrp.rec.doctypcod">
            <c-select v-model="model.bedgrp.rec.doctypcod" style="width:100%" :placeholder="$t('other.please_enter')+$t('betp.SF000062')">
              </c-select>
        </el-form-item>
       </c-col>
                  
       <c-col :span="12">
        <c-form-item label="Name of Party" prop="bedgrp.iss.pts.nam">
            <c-input  v-model="model.bedgrp.iss.pts.nam" maxlength="40"  :placeholder="$t('other.please_enter')+'Name of Party'"></c-input>
        </c-form-item>
       </c-col>
                 SF000055 : 到期日
                  
       <c-col :span="12">
        <el-form-item :label="$t('betp.SF000055')" prop="bedgrp.rec.matdat">
            <c-date-picker type="date"  v-model="model.bedgrp.rec.matdat" style="width:100%"  :placeholder="$t('other.please_enter')+$t('betp.SF000055')"></c-date-picker>
        </el-form-item>
       </c-col>
                 SF000054 : 到单日期
                  
       <c-col :span="12">
        <el-form-item :label="$t('betp.SF000054')" prop="bedgrp.rec.rcvdat">
            <c-date-picker type="date"  v-model="model.bedgrp.rec.rcvdat" style="width:100%"  :placeholder="$t('other.please_enter')+$t('betp.SF000054')"></c-date-picker>
        </el-form-item>
       </c-col>
                 SF000057 : 提示日期
                  
       <c-col :span="12">
        <el-form-item label="Presentation Date" prop="bedgrp.rec.predat">
            <c-date-picker type="date"  v-model="model.bedgrp.rec.predat" style="width:100%"  :placeholder="$t('other.please_enter')+'Presentation Date'"></c-date-picker>
        </el-form-item>
       </c-col>
                 SF000058 : 申请人
                 SF000066 : 编号
                  
       <c-col :span="12">
        <c-form-item :label="$t('betp.SF000058')" prop="bedgrp.apl.pts.ref">
            <c-input  v-model="model.bedgrp.apl.pts.ref" maxlength="16"  :placeholder="$t('other.please_enter')+$t('betp.SF000058')"></c-input>
        </c-form-item>
       </c-col>
                 SF000064 : 单据状态
                  
       <c-col :span="12">
        <c-form-item :label="$t('betp.SF000064')" prop="bedgrp.rec.docsta">
            <c-input  v-model="model.bedgrp.rec.docsta" maxlength="40"  :placeholder="$t('other.please_enter')+$t('betp.SF000064')"></c-input>
        </c-form-item>
       </c-col>
                  
       <c-col :span="12">
        <c-form-item label="Name of Party" prop="bedgrp.apl.pts.nam">
            <c-input  v-model="model.bedgrp.apl.pts.nam" maxlength="40"  :placeholder="$t('other.please_enter')+'Name of Party'"></c-input>
        </c-form-item>
       </c-col>
                  
       <c-col :span="12">
	    <c-checkbox v-model="model.rmbclm.clmrmbflg">{{$t('betrcl.CF000051')}}</c-checkbox>
       </c-col>
                  
       <c-col :span="12">
        <c-form-item label="Tenor Stream" prop="liaall.tenstm">
            <c-input  v-model="model.liaall.tenstm"  :placeholder="$t('other.please_enter')+'Tenor Stream'"></c-input>
        </c-form-item>
       </c-col>
                 S0000014 : 单据金额
                  
       <c-col :span="12">
        <el-form-item label="Currency" prop="bedgrp.cbs.opn2.cur">
            <c-select v-model="model.bedgrp.cbs.opn2.cur" style="width:100%" :placeholder="$t('other.please_enter')+'Currency'">
              </c-select>
        </el-form-item>
       </c-col>
                  
       <c-col :span="12">
        <c-form-item label="Doc. Amount utilized/settled" prop="aamset.utlamt">
            <c-input  v-model="model.aamset.utlamt"  :placeholder="$t('other.please_enter')+'Doc. Amount utilized/settled'"></c-input>
        </c-form-item>
       </c-col>
                 S0000013 : 附加金额
                  
       <c-col :span="12">
        <c-form-item label="Add. Amount utilized/settled" prop="aamset.utlamt2">
            <c-input  v-model="model.aamset.utlamt2"  :placeholder="$t('other.please_enter')+'Add. Amount utilized/settled'"></c-input>
        </c-form-item>
       </c-col>
                 SG000058 : Payment instructions to ISS/AVB
                  
       <c-col :span="12">
        <c-button size="small" type="primary" icon="el-icon-search" @click="onPayinsButtxmsel">
             {{$t('betrcl.CF000059')}}
        </c-button>
       </c-col>
                  
       <c-col :span="12">
        <c-form-item label="Payment instructions to ISS/AVB" prop="payinstxt">
            <c-input type="textarea" v-model="model.payinstxt" maxlength="65" show-word-limit :placeholder="$t('other.please_enter')+'Payment instructions to ISS/AVB'" ></c-input>
        </c-form-item>
        </c-col>
                 SG000057 : Less comm.
                  
       <c-col :span="12">
        <c-form-item label="Less comm." prop="bedgrp.rec.lescom">
            <c-input  v-model="model.bedgrp.rec.lescom"  :placeholder="$t('other.please_enter')+'Less comm.'"></c-input>
        </c-form-item>
       </c-col>
                 SF000047 : Narrative :77A:
                  
       <c-col :span="12">
        <c-form-item label="Narrative :77A:" prop="trnmod.trndoc.nar754">
            <c-input type="textarea" v-model="model.trnmod.trndoc.nar754" maxlength="35" show-word-limit :placeholder="$t('other.please_enter')+'Narrative :77A:'" ></c-input>
        </c-form-item>
        </c-col> -->
  </div>
</template>
<script>
import Api from "~/service/Api";
import commonProcess from "~/mixin/commonProcess";
import CodeTable from "~/config/CodeTable";
import Event from "~/model/Betrcl/Event";
import Ptsmsg from "~/views/Public/Ptsmsg";

export default {
  components: { "c-ptsmsg": Ptsmsg },
  inject: ["root"],
  props: ["model", "codes"],
  mixins: [commonProcess],
  data() {
    return {
      stmData: {
        columns: [
          '1 1 "Type" 250',
          '2 2 "Dbt" 250',
          '3 3 "Cdt" 250',
          '4 4 "Cur" 250',
          '5 5 "Amt" 250 2 8 1 4',
          '6 6 "Mat.Dat." 250 4 7 1',
        ],
        data: [],
      },
    };
  },
  computed: {
    clmrmbflg: {
      get() {
        return this.model.rmbclm.clmrmbflg === "X";
      },
      set(val) {
        this.model.rmbclm.clmrmbflg = val ? "X" : "";
      },
    },
    flag() {
      return this.model.mtabut.coninf.usr.extkey == "";
    },
  },
  mounted() {
    this.$nextTick(() => {});
  },
  methods: {
    ...Event,
    async multipleSelect(selection) {
      console.log(selection);
      if (selection) {
        let selIds = selection.map((x) => x + 1);
        let params = { selDst: "liaall.tenstm", selIds };
        const rtnmsg = await this.executeRule("liaall.tenstm", params);
        if (rtnmsg.respCode == SUCCESS) {
          this.updateModel(rtnmsg.data);
        } else {
          this.$notify.error({ title: "错误", message: "服务请求失败！" });
        }
      }
    },
  },
  created: function () {},
};
</script>
<style>
.messageLabel >>> .el-form-item__label {
  text-align: left;
  font-weight: bold;
  font-size: 12px;
}
</style>
