<template>
  <div class="eibs-tab" style="">
    <c-col :span="24">
      <c-col :span="11">
        <c-col :span="24">
          <el-form-item label="信用证参考号" prop="dedgrp.rec.ownref">
            <c-fullbox>
              <c-input
                v-model="model.dedgrp.rec.ownref"
                maxlength="16"
                placeholder="请输入信用证参考号"
                disabled
              ></c-input>
              <template slot="footer">
                <c-button style="padding: 0 14px" size="small" type="primary">
                  <span
                    style="
                      font-size: 15px;
                      font-family: '宋体';
                      font-weight: bold;
                    "
                    >i</span
                  >
                </c-button>
              </template>
            </c-fullbox>
          </el-form-item>
        </c-col>
        <!-- <c-col :span="1" style="text-align: right;margin-left:10px">
                    <c-button
                        style="margin:0;padding: 0 14px;"
                        size="small"
                        type="primary"
                    >
                    <span style="font-size:15px;font-family:'宋体';font-weight:bold">i</span>
                    </c-button>
                </c-col> -->
      </c-col>

      <c-col :span="11" :offset="1">
        <c-col :span="12">
          <el-form-item label="信用证余额" prop="dedgrp.cbs.opn1.cur">
            <c-input
              v-model="model.dedgrp.cbs.opn1.cur"
              maxlength="3"
              placeholder="请输入Currency"
              disabled
            ></c-input>
          </el-form-item>
        </c-col>
        <c-col :span="12">
          <el-form-item label="" prop="dedgrp.cbs.opn1.amt" label-width="2%">
            <c-input
              v-model="model.dedgrp.cbs.opn1.amt"
              placeholder="请输入Balance"
              disabled
            ></c-input>
          </el-form-item>
        </c-col>
      </c-col>
    </c-col>

    <c-col :span="24" style="height: 24px; margin-top: -10px">
      <el-form-item label="单据信息" class="messageLabel"> </el-form-item>
    </c-col>
    <c-col :span="24" style="height: 0px">
      <el-divider></el-divider>
    </c-col>

    <c-col :span="11" style="margin-top: 10px">
      <c-col :span="24">
        <c-col :span="22">
          <el-form-item label="单据参考号" prop="bfdgrp.rec.ownref">
            <c-input
              v-model="model.bfdgrp.rec.ownref"
              maxlength="16"
              placeholder="请输入单据参考号"
              disabled
            ></c-input>
          </el-form-item>
        </c-col>
        <c-col :span="2" style="text-align: right">
          <c-button
            style="margin: 0; padding: 0 14px"
            size="small"
            type="primary"
          >
            <span
              style="font-size: 15px; font-family: '宋体'; font-weight: bold"
              >i</span
            >
          </c-button>
        </c-col>
      </c-col>
    </c-col>

    <c-col :span="11" :offset="1" style="margin-top: 10px">
      <el-form-item label="单据摘要" prop="bfdgrp.rec.nam">
        <c-input
          v-model="model.bfdgrp.rec.nam"
          maxlength="40"
          placeholder="请输入Name of Bill Contract"
          disabled
        ></c-input>
      </el-form-item>
    </c-col>

    <!-- ==========middle-left======== -->
    <c-col :span="11">
      <c-col :span="24">
        <c-col :span="12">
          <el-form-item label="单据金额" prop="bfdgrp.cbs.max.cur">
            <c-select
              v-model="model.bfdgrp.cbs.max.cur"
              placeholder="请选择单据金额"
              disabled
            >
            </c-select>
          </el-form-item>
        </c-col>
        <c-col :span="12">
          <el-form-item label="" prop="bfdgrp.cbs.max.amt" label-width="2%">
            <c-input
              v-model="model.bfdgrp.cbs.max.amt"
              placeholder="请输入单据金额"
              disabled
            ></c-input>
          </el-form-item>
        </c-col>
      </c-col>

      <c-col :span="24">
        <c-col :span="12">
          <el-form-item label="单据余额" prop="bfdgrp.cbs.opn1.cur">
            <c-select
              v-model="model.bfdgrp.cbs.opn1.cur"
              placeholder="请选择单据余额"
              disabled
            ></c-select>
          </el-form-item>
        </c-col>
        <c-col :span="12">
          <el-form-item label="" prop="bfdgrp.cbs.opn1.amt" label-width="2%">
            <c-input
              v-model="model.bfdgrp.cbs.opn1.amt"
              placeholder="请输入Balance"
              disabled
            ></c-input>
          </el-form-item>
        </c-col>
      </c-col>
      <c-col :span="24">
        <c-col :span="24">
          <el-form-item label="远期单据到期日" prop="bfdgrp.rec.matdat">
            <c-date-picker
              type="date"
              v-model="model.bfdgrp.rec.matdat"
              style="width: 100%"
              placeholder="请选择远期单据到期日"
              disabled
            ></c-date-picker>
          </el-form-item>
        </c-col>
      </c-col>

      <c-col :span="24">
        <c-col :span="12">
          <el-form-item label="到单日期" prop="bfdgrp.rec.rcvdat">
            <c-date-picker
              type="date"
              v-model="model.bfdgrp.rec.rcvdat"
              style="width: 100%"
              placeholder="请选择到单日期"
              disabled
            ></c-date-picker>
          </el-form-item>
        </c-col>
        <c-col :span="1"> &nbsp; </c-col>
        <c-col :span="11">
          <el-form-item label="提示日期" prop="bfdgrp.rec.predat">
            <c-date-picker
              type="date"
              v-model="model.bfdgrp.rec.predat"
              style="width: 100%"
              placeholder="请选择提示日期"
              disabled
            ></c-date-picker>
          </el-form-item>
        </c-col>
      </c-col>
      <c-col :span="24">
        <el-form-item label="单据类型" prop="bfdgrp.rec.doctypcod">
          <c-select
            v-model="model.bfdgrp.rec.doctypcod"
            style="width: 100%"
            placeholder="请选择单据类型"
            disabled
          >
            <el-option
              v-for="item in codes.bedtyp"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </c-select>
          <!--
            <c-select v-model="model.ditp.doctypcod" :code="code.bedtyp" />
-->
        </el-form-item>
      </c-col>
      <c-col :span="24">
        <el-form-item label="单据状态" prop="bfdgrp.rec.docsta">
          <!--
            <c-input  v-model="model.bfdgrp.rec.docsta" maxlength="40"  placeholder="请输入单据状态"></c-input>
            -->
          <c-select
            v-model="model.bfdgrp.rec.docsta"
            style="width: 100%"
            placeholder="请选择单据状态"
            disabled
          >
            <el-option
              v-for="item in codes.docsta"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </c-select>
        </el-form-item>
      </c-col>
    </c-col>
    <!-- ==========middle-right======== -->
    <c-col :span="11" :offset="1">
      <c-col :span="24">
        <el-form-item label="交单人" prop="bfdgrp.prb.pts.ref">
          <c-input
            v-model="model.bfdgrp.prb.pts.ref"
            maxlength="16"
            placeholder="请输入交单人"
            disabled
          ></c-input>
        </el-form-item>
      </c-col>

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

      <c-col :span="24">
        <el-form-item label="开证行" prop="dedgrp.rec.kzref">
          <c-input
            v-model="model.dedgrp.rec.kzref"
            maxlength="35"
            placeholder="请输入开证行行号"
            disabled
          ></c-input>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="" prop="bfdgrp.iss.pts.nam">
          <c-input
            v-model="model.bfdgrp.iss.pts.nam"
            maxlength="40"
            placeholder="请输入开证行名称"
            disabled
          ></c-input>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="申请人" prop="bfdgrp.apl.pts.ref">
          <c-input
            v-model="model.bfdgrp.apl.pts.ref"
            maxlength="16"
            placeholder="请输入申请人"
            disabled
          ></c-input>
        </el-form-item>
      </c-col>

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

    <!--头部end-->
    <c-col :span="24" style="height: 24px; margin-top: -10px">
      <el-form-item label="收款信息" class="messageLabel"> </el-form-item>
    </c-col>
    <c-col :span="24" style="height: 0px">
      <el-divider></el-divider>
    </c-col>
    <!--左边start-->
    <c-col :span="11">
      <!--<c-col :span="24" style="margin-top: 10px">
        <el-form-item label="" prop="liaall.tenstm">
          <c-input v-model="model.liaall.tenstm" placeholder=""></c-input>
        </el-form-item>
      </c-col>-->
      <c-col :span="24" style="margin-top: 10px">
        <c-col :span="12">
          <el-form-item label="付款金额" label-width="150px">
            <c-input
              v-model="model.setmod.doccur"
              maxlength="3"
              placeholder=""
              disabled
            ></c-input>
          </el-form-item>
        </c-col>
        <c-col :span="12" style="margin-top: 10px">
          <el-form-item label="" label-width="7px">
            <c-input
              v-model="model.setmod.docamt"
              placeholder="请输入付款金额"
              @keyup.enter.native="commonExecuteRule('setmod.docamt')"
            ></c-input>
          </el-form-item>
        </c-col>
      </c-col>
      <c-col :span="24">
        <c-col :span="12">
          <el-form-item label="扣减金额" label-width="150px">
            <c-input
              v-model="model.setmod.doccur"
              maxlength="3"
              placeholder=""
              disabled
            ></c-input>
          </el-form-item>
        </c-col>
        <c-col :span="12">
          <el-form-item label="" label-width="7px">
            <c-input
              v-model="model.setmod.redamt"
              placeholder="请输入扣减金额"
              @keyup.enter.native="commonExecuteRule('setmod.redamt')"
            ></c-input>
          </el-form-item>
        </c-col>
      </c-col>
      <c-col :span="24">
        <c-col :span="12">
          <el-form-item label="扣费后付款金额" label-width="150px">
            <c-input
              v-model="model.setmod.doccur"
              maxlength="3"
              placeholder=""
              disabled
            ></c-input>
          </el-form-item>
        </c-col>
        <c-col :span="12">
          <el-form-item label="" label-width="7px">
            <c-input
              v-model="model.setmod.setamt"
              disabled
              placeholder="请输入扣费后付款金额"
            ></c-input>
          </el-form-item>
        </c-col>
      </c-col>
      <c-col :span="24">
        <c-col :span="12">
          <el-form-item label="单据金额" label-width="150px">
            <c-input
              v-model="model.bfdgrp.cbs.opn2.cur"
              maxlength="3"
              placeholder=""
              disabled
            ></c-input>
          </el-form-item>
        </c-col>
        <c-col :span="12">
          <el-form-item label="" label-width="7px">
            <c-input
              v-model="model.aamset.utlamt"
              disabled
              placeholder="单据金额"
            ></c-input>
          </el-form-item>
        </c-col>
      </c-col>
      <c-col :span="24">
        <c-col :span="12">
          <el-form-item label="附加金额" label-width="150px">
            <c-input
              v-model="model.bfdgrp.cbs.opn2.cur"
              maxlength="3"
              placeholder=""
              disabled
            ></c-input>
          </el-form-item>
        </c-col>
        <c-col :span="12">
          <el-form-item label="" label-width="7px">
            <c-input
              v-model="model.aamset.utlamt2"
              disabled
              placeholder="附加金额"
            ></c-input>
          </el-form-item>
        </c-col>
      </c-col>
    </c-col>
    <!--左边end-->
    <!--右边start-->
    <c-col :span="11" :offset="1">
      <c-col :span="24" style="margin-top: 10px">
        <el-form-item>
          <c-col :span="4">
            <c-checkbox v-model="crefinflg">融资</c-checkbox>
          </c-col>
          <c-col :span="5">
            <c-checkbox v-model="clsflg">闭卷</c-checkbox>
          </c-col>
          <c-col :span="5">
            <c-checkbox v-model="frepayflg">无偿放单</c-checkbox>
          </c-col>
        </el-form-item>
      </c-col>
      <c-col :span="24">
        <c-col :span="12">
          <el-form-item label="福费廷转卖类型" prop="bpdgrp.rec.ffttyp">
            <c-select
              v-model="model.bpdgrp.rec.ffttyp"
              style="width: 100%"
              placeholder="请选择福费廷转卖类型"
            >
              <el-option
                v-for="item in codes.ffttyp"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </c-select>
          </el-form-item>
        </c-col>
      </c-col>
    </c-col>
    <c-col :span="24" style="height: 24px; margin-top: -10px">
      <el-form-item label="表外信息" class="messageLabel"> </el-form-item>
    </c-col>
    <c-col :span="24" style="height: 0px">
      <el-divider></el-divider>
    </c-col>
    <c-col :span="24" :offset="0">
      <c-istream-table
        ref="bwxxIst"
        :list="stmData.data"
        :columns="stmData.columns"
        :paginationShow="false"
        :showSelection="true"
      >
      </c-istream-table>
    </c-col>
    <c-col :span="24" style="height: 24px">
      <el-form-item label="待还融资" class="messageLabel"> </el-form-item>
    </c-col>
    <c-col :span="24" style="height: 0px">
      <el-divider></el-divider>
    </c-col>
    <c-col :span="24" :offset="0">
      <div class="e-table-wrapper">
        <c-table
          :data="model.bptbck.bptbckg"
          style="width: 100%"
          :paginationShow="false"
        >
          <el-table-column prop="ownref" label="Reference" width="auto">
          </el-table-column>
          <el-table-column prop="opncur" label="Cur." width="auto">
          </el-table-column>
          <el-table-column prop="opnamt" label="Open Amount" width="auto">
          </el-table-column>
          <el-table-column prop="bckamt" label="Amount Paid" width="auto">
          </el-table-column>
          <el-table-column prop="butcal" label="Cal." width="auto">
          </el-table-column>
        </c-table>
      </div>
    </c-col>
    <div></div>
  </div>
</template>
<script>
import Api from "~/service/Api";
import CommonProcess from "~/mixin/CommonProcess";
import CodeTable from "~/config/CodeTable";
import Event from "~/model/Bftset/Event";
import Utils from "~/utils";

export default {
  inject: ["root"],
  props: ["model", "codes"],
  mixins: [CommonProcess],
  data() {
    return {
      stmData: {
        columns: [
          '1 1 "Type" 0 ',
          '2 2 "Dbt" 0 ',
          '3 3 "Cdt" 0 ',
          '4 4 "Cur" 0 ',
          '5 5 "Amt" 0 ',
          '6 6 "Mat Dat" 0 ',
        ],
        data: [],
      },
    };
  },
  computed: {
    crefinflg: {
      get() {
        return this.model.trtcre.crefinflg != "";
      },
      set(val) {
        this.model.trtcre.crefinflg = val ? "X" : "";
      },
    },
    clsflg: {
      get() {
        return this.model.mtabut.clsflg != "";
      },
      set(val) {
        this.model.mtabut.clsflg = val ? "X" : "";
      },
    },
    frepayflg: {
      get() {
        return this.model.bfdgrp.rec.frepayflg != "";
      },
      set(val) {
        this.model.bfdgrp.rec.frepayflg = val ? "X" : "";
      },
    },
  },
  methods: {
    ...Event,
    commonExecuteRule(ruleName) {
      this.executeRule(ruleName).then((res) => {
        if (res.respCode == SUCCESS) {
          Utils.copyValueFromVO(this.model, res.data);
        }
      });
    },
  },
  created: function () {},
};
</script>
<style scoped>
.el-checkbox {
  text-align: left;
  margin-right: 0;
}
.formItemLabel >>> .el-form-item__label {
  text-align: left;
  font-weight: bold;
}
.el-col >>> .el-divider--horizontal {
  margin-top: 1px;
}
.messageLabel >>> .el-form-item__label {
  text-align: left;
  font-weight: bold;
  font-size: 12px;
}
</style>
