<template>
  <c-row>
    <c-blkTextarea :model="model" v-bind="blk"> </c-blkTextarea>
    <br />
    <c-col v-if="dtyp === 'dogp'" :span="12">
      <el-form-item label="Goods code" prop="ledgrp.rec.stagod">
        <c-select
          v-model="model.ledgrp.rec.stagod"
          style="width: 100%"
          placeholder="请选择Goods code"
          :code="codes.godcod"
        >
        </c-select>
      </el-form-item>
    </c-col>
    <template v-if="dtyp === 'adcp'">
      <c-col :span="20" class="letopn_adcp_cheak">
        <c-checkbox v-model="model.ledgrp.rec.spcbenflg"
          >Special payment conditions for beneficiary</c-checkbox
        >
      </c-col>

      <c-col :span="20" class="letopn_adcp_cheak">
        <c-checkbox v-model="model.ledgrp.rec.spcrcbflg">
          Special payment conditions for receiving bank</c-checkbox
        >
      </c-col>

      <c-col :span="20" class="letopn_adcp_cheak">
        <c-checkbox v-model="model.ledgrp.rec.redclsflg"
          >Red/Green Clause</c-checkbox
        >
      </c-col>
      <c-blkTextarea :model="model" v-bind="blk1"> </c-blkTextarea>
    </template>
  </c-row>
</template>
<script>
import Api from "~/service/Api";
import CommonProcess from "~/mixin/CommonProcess";
import BlkTextarea from "./BlkTextarea";

export default {
  inject: ["root"],
  // dtyp=>dogp:货物描述；dorp：单据要求；adcp：附加条款；spcbenp：受益人特殊付款条款；spcrcvp：收款银行特殊付款条款
  props: ["model", "codes", "dtyp"],
  components: { "c-blkTextarea": BlkTextarea },
  mixins: [CommonProcess],
  data() {
    return {
      blk: this.getBlk(this.dtyp),
      blk1: {
        blkMsg: {
          title: "Instructions to Pay.,Accept.,Negot.bank",
          dataUrl: "ledgrp.blk.insbnk", //字段所在model路劲
          rows: 6,
          maxlength: 2000,
        },
        rulePath: "letp.insbnk.buttxmsel",
      },
    };
  },
  methods: {
    getBlk(dtyp) {
      let blk = { blkMsg: {}, rulePath: "" };
      switch (dtyp) {
        case "dogp":
          blk.blkMsg = {
            title: "Description of Goods",
            dataUrl: "ledgrp.blk.lcrgod", //字段所在model路劲
            rows: 20,
          };
          blk.rulePath = "letp.lcrgod.buttxmsel";
          break;
        case "dorp":
          blk.blkMsg = {
            title: "Documents Required",
            dataUrl: "ledgrp.blk.lcrdoc", //字段所在model路劲
            rows: 20,
          };
          blk.rulePath = "letp.lcrdoc.buttxmsel";
          break;
        case "adcp":
          blk.blkMsg = {
            title: "Additional Conditions",
            dataUrl: "ledgrp.blk.adlcnd", //字段所在model路劲
            rows: 16,
          };
          blk.rulePath = "letp.adlcnd.buttxmsel";
          break;
        case "spcbenp":
          blk.blkMsg = {
            title: "Special payment conditions for beneficiary",
            dataUrl: "ledgrp.blk.spcben", //字段所在model路劲
            rows: 20,
          };
          blk.rulePath = "letp.spcben.buttxmsel";
          break;
        case "spcrcvp":
          blk.blkMsg = {
            title: "Special payment conditions for receiving bank",
            dataUrl: "ledgrp.blk.spcrcb", //字段所在model路劲
            rows: 20,
          };
          blk.rulePath = "letp.spcrcb.buttxmsel";
          break;
      }
      return blk;
    },
  },
  computed: {},
  created: function () {},
};
</script>
<style>
.letopn_adcp_cheak {
  margin: 0px 0 10px 150px;
}
</style>
