<template>
  <div class="eibs-tab">
    <!-- 上方 -->
    <c-row>
      <c-col :span="24">
        <!-- 上左 -->
        <c-col :span="12">
          <c-col :span="24">
            <c-form-item label="Transfer Reference" prop="ltdgrp.rec.ownref">
              <c-fullbox>
                <c-input
                  v-model="model.ltdgrp.rec.ownref"
                  maxlength="16"
                  placeholder="请输入Transfer Reference"
                  disabled
                ></c-input>
                <template slot="footer">
                  <c-button
                    style="margin: 0 10px 0 10px; padding: 0 12px"
                    size="small"
                    type="primary"
                  >
                    <span
                      style="
                        font-size: 15px;
                        font-family: '宋体';
                        font-weight: bold;
                      "
                      >i</span
                    >
                  </c-button>
                </template>
              </c-fullbox>
            </c-form-item>
          </c-col>
          <c-col :span="24">
            <c-form-item label="Doc.Set Reference" prop="btdgrp.rec.ownref">
              <c-fullbox>
                <c-input
                  v-model="model.btdgrp.rec.ownref"
                  maxlength="16"
                  placeholder="请输入Doc.Set Reference"
                  disabled
                ></c-input>
                <template slot="footer">
                  <c-button
                    style="margin: 0 10px 0 10px; padding: 0 12px"
                    size="small"
                    type="primary"
                  >
                    <span
                      style="
                        font-size: 15px;
                        font-family: '宋体';
                        font-weight: bold;
                      "
                      >i</span
                    >
                  </c-button>
                </template>
              </c-fullbox>
            </c-form-item>
          </c-col>
          <c-col :span="24">
            <c-col :span="12">
              <el-form-item label="Document Amount" prop="btdgrp.cbs.max.cur">
                <c-select
                  v-model="model.btdgrp.cbs.max.cur"
                  style="width: 100%"
                  placeholder="请输入Document Amount"
                  :code="codes.curtxt1"
                  disabled
                >
                </c-select>
              </el-form-item>
            </c-col>
            <c-col :span="12">
              <c-col :span="16">
                <c-form-item label-width="5px" prop="btdgrp.cbs.max.amt">
                  <c-input
                    v-model="model.btdgrp.cbs.max.amt"
                    placeholder="请输入"
                    disabled
                    style="width: 95%"
                  ></c-input>
                </c-form-item>
              </c-col>

              <c-col :span="8" class="centerLable">
                <c-checkbox disabled v-model="model.bttp0.aammod.addamtflg">
                  Add.Amount
                </c-checkbox>
              </c-col>
            </c-col>
          </c-col>
          <c-col :span="24">
            <c-col :span="12">
              <c-form-item label="Open Amount" prop="btdgrp.cbs.opn1.cur">
                <c-input
                  v-model="model.btdgrp.cbs.opn1.cur"
                  maxlength="3"
                  placeholder="请输入Open Amount"
                  disabled
                ></c-input>
              </c-form-item>
            </c-col>

            <c-col :span="12">
              <c-form-item label-width="5px" prop="btdgrp.cbs.opn1.amt">
                <c-input
                  v-model="model.btdgrp.cbs.opn1.amt"
                  placeholder="请输入"
                  disabled
                ></c-input>
              </c-form-item>
            </c-col>
          </c-col>
          <c-col :span="24">
            <c-form-item label="Document Type" prop="btdgrp.rec.doctypcod">
              <c-select
                v-model="model.btdgrp.rec.doctypcod"
                maxlength="16"
                placeholder="请输入Document Type"
                style="width:100%"
                :code="codes.brdtyp"
                disabled
              ></c-select>
            </c-form-item>
          </c-col>
          <c-col :span="24">
            <el-form-item label="Maturity Date" prop="btdgrp.rec.matdat">
              <c-date-picker
                type="date"
                v-model="model.btdgrp.rec.matdat"
                style="width: 100%"
                placeholder="请选择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 2nd Ben."
                prop="btdgrp.rec.rcvdatbe2"
              >
                <c-date-picker
                  type="date"
                  v-model="model.btdgrp.rec.rcvdatbe2"
                  style="width: 100%"
                  placeholder="请选择Received on 2nd Ben."
                  disabled
                ></c-date-picker>
              </el-form-item>
            </c-col>
            <c-col :span="12">
              <el-form-item
                label="Received on 1st Ben."
                prop="btdgrp.rec.rcvdatbe1"
              >
                <c-date-picker
                  type="date"
                  v-model="model.btdgrp.rec.rcvdatbe1"
                  style="width: 100%"
                  placeholder="请选择Received on 1st Ben."
                  disabled
                ></c-date-picker>
              </el-form-item>
            </c-col>
          </c-col>
          <c-col :span="24">
            <c-form-item label="Document Set status" prop="btdgrp.rec.docsta">
              <c-select
                v-model="model.btdgrp.rec.docsta"
                maxlength="40"
                style="width:100%"
                placeholder="请输入Document Set status"
                disabled
                :code="codes.docsta2"
              ></c-select>
            </c-form-item>
          </c-col>
        </c-col>
        <!-- 上右 -->
        <c-col :span="11" :offset="1">
          <c-col :span="24">
            <c-form-item label="L/C Reference" prop="ledgrp.rec.ownref">
              <c-input
                v-model="model.ledgrp.rec.ownref"
                maxlength="16"
                placeholder="请输入L/C Reference"
                disabled
              ></c-input>
            </c-form-item>
          </c-col>
          <c-col :span="24">
            <c-form-item label="Name of Bill Contract" prop="btdgrp.rec.nam">
              <c-input
                v-model="model.btdgrp.rec.nam"
                maxlength="40"
                placeholder="请输入Name of Bill Contract"
                disabled
              ></c-input>
            </c-form-item>
          </c-col>
          <c-col :span="24">
            <c-form-item label="1st Beneficiary Ref." prop="btdgrp.be1.pts.ref">
              <c-input
                v-model="model.btdgrp.be1.pts.ref"
                maxlength="16"
                placeholder="请输入1st Beneficiary Ref."
                disabled
              ></c-input>
            </c-form-item>
          </c-col>
          <c-col :span="24">
            <c-form-item label="Name of Party" prop="btdgrp.be1.pts.nam">
              <c-input
                v-model="model.btdgrp.be1.pts.nam"
                maxlength="40"
                placeholder="请输入Name of Party"
                disabled
              ></c-input>
            </c-form-item>
          </c-col>
          <c-col :span="24">
            <c-form-item label="2nd Beneficiary Ref." prop="btdgrp.be2.pts.ref">
              <c-input
                v-model="model.btdgrp.be2.pts.ref"
                maxlength="16"
                placeholder="请输入2nd Beneficiary Ref."
                disabled
              ></c-input>
            </c-form-item>
          </c-col>
          <c-col :span="24">
            <c-form-item label="Name of Party" prop="btdgrp.be2.pts.nam">
              <c-input
                v-model="model.btdgrp.be2.pts.nam"
                maxlength="40"
                placeholder="请输入Name of Party"
                disabled
              ></c-input>
            </c-form-item>
          </c-col>
        </c-col>
      </c-col>
    </c-row>
    <!-- 中间 -->
    <c-col :span="24" style="height: 0px">
      <el-divider></el-divider>
    </c-col>
    <c-row>
      <c-col :span="24">
        <!-- 下左 -->
        <c-col :span="12">
          <c-col :span="24">
            <c-istream-table
              ref="table"
              :list="model.liaall.tenstm.rows || []"
              :columns="trnData.columns"
              :showSelection="true"
              v-on:multipleSelect="multipleSelect"
              prop="liaall.tenstm"
            >
            </c-istream-table>
          </c-col>
          <c-col :span="24">
            <p>Settlement Instructions</p>
          </c-col>
          <c-col :span="24">
            <c-form-item label-width="0" prop="btdgrp.blk.setinsbt">
              <c-fullbox>
                <c-input
                  type="textarea"
                  v-model="model.btdgrp.blk.setinsbt"
                  maxlength="1300"
                  show-word-limit
                  placeholder="请输入Settlement Instructions transaction field"
                  rows="8"
                ></c-input>
                <template slot="footer">
                  <c-button
                    size="small"
                    type="primary"
                    icon="el-icon-search"
                    @click="
                      showGridPromptDialog(
                        'setins.buttxmsel',
                        null,
                        null,
                        { TXT: 'btdgrp.blk.setinsbt' },
                        { TXT: false },
                        'doxpDialog'
                      )
                    "
                  >
                    ...
                  </c-button>
                </template>
              </c-fullbox>
            </c-form-item>
          </c-col>
          <c-col :span="24">
            <c-form-item label="Less comm." prop="btdgrp.rec.lescom">
              <c-input
                v-model="model.btdgrp.rec.lescom"
                placeholder="请输入Less comm."
                style="width:80%"
              ></c-input>
            </c-form-item>
          </c-col>
        </c-col>
        <!-- 下右 -->
        <c-col :span="11" :offset="1">
          <c-col :span="24">
            <p>Doc.Amount Part</p>
          </c-col>
          <c-col :span="24">
            <c-col :span="12">
              <el-form-item label-width="0" prop="btdgrp.cbs.opn2.cur">
                <c-select
                  v-model="model.btdgrp.cbs.opn2.cur"
                  style="width: 100%"
                  placeholder="请选择Currency"
                  :code="codes.curtxt1"
                  disabled
                >
                </c-select>
              </el-form-item>
            </c-col>
            <c-col :span="12">
              <c-form-item label-width="5px" prop="aamset.utlamt">
                <c-input
                  v-model="model.aamset.utlamt"
                  placeholder="请输入Doc. Amount utilized/settled"
                  disabled
                ></c-input>
              </c-form-item>
            </c-col>
          </c-col>
          <c-col :span="24">
            <p>Add. Amount Part</p>
          </c-col>
          <c-col :span="24">
            <c-col :span="12">
              <el-form-item label-width="0" prop="btdgrp.cbs.opn2.cur">
                <c-select
                  v-model="model.btdgrp.cbs.opn2.cur"
                  style="width: 100%"
                  placeholder="请选择Currency"
                  :code="codes.curtxt1"
                  disabled
                >
                </c-select>
              </el-form-item>
            </c-col>
            <c-col :span="12">
              <c-form-item label-width="5px" prop="aamset.utlamt2">
                <c-input
                  v-model="model.aamset.utlamt2"
                  placeholder="请输入Add. Amount utilized/settled"
                  disabled
                ></c-input>
              </c-form-item>
            </c-col>
          </c-col>
          <c-col :span="24">
            <p>Narrative :77A:</p>
          </c-col>
          <c-col :span="24">
            <c-form-item label-width="5px" prop="trnmod.trndoc.nar754">
              <c-input
                type="textarea"
                v-model="model.trnmod.trndoc.nar754"
                maxlength="700"
                show-word-limit
                placeholder="请输入Narrative :77A:"
                rows="8"
              ></c-input>
            </c-form-item>
          </c-col>
          <c-col :span="24">
            <c-checkbox v-model="model.rmbclm.clmrmbflg">
              Send MT 742
            </c-checkbox>
          </c-col>
        </c-col>
      </c-col>
    </c-row>
  </div>
</template>
<script>
import Api from "~/service/Api";
import commonProcess from "~/mixin/commonProcess";
import CodeTable from "~/config/CodeTable";
import Event from "~/model/Bttrcl/Event";
import Utils from "~/utils";

export default {
  inject: ["root"],
  props: ["model", "codes"],
  mixins: [commonProcess],
  data() {
    return {
      trnData: {
        columns: [
          '1 1 "Type" 80',
          '2 2 "Dbt" 80',
          '3 3 "Cdt" 80',
          '4 4 "Cur" 80',
          '5 5 "Amt" 80',
          // '6 6 "Mat.Dat." 120 4 7 1',
          {
            index: 6,
            position: 6,
            width: 210,
            render: (item, scope) => {
              return scope.row[item.prop] === "null"
                ? ""
                : scope.row[item.prop];
            },
            label: "Mat.Dat.",
          },
        ],
        data: [],
      },
    };
  },
  methods: {
    ...Event,
    async multipleSelect(selection) {
      console.log(selection);
      if (selection.length > 1) {
        this.$notify({
          title: "error",
          message: "You cannot select more than one tenor",
          type: "error",
        });
      } else {
        let chkIds;
        if (selection.length === 0) {
          chkIds = [];
          // this.model.liaall.tensetstm.rows = []
          // this.model.liaall.tenstm.rows = []
        } else {
          chkIds = [selection[0] + 1];
        }
        //
        console.log(this.model.liaall.tensetstm);
        let params = { chkDst: "liaall.tenstm", chkIds };
        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>
</style>