<template>
    <div class="eibs-tab">
        <!-- <el-row> -->
        <el-col :span="24">
            <el-col :span="11">
                <el-form-item label="参考号" prop="didgrp.rec.tzref">
                    <c-input
                        v-model="model.didgrp.rec.tzref"
                        maxlength="35"
                        placeholder="请输入通知行编号"
                    ></c-input>
                </el-form-item>
            </el-col>
        </el-col>
        <!-- =========================通知行========================= -->
        <el-col :span="11">
            <el-form-item label="通知行BIC" prop="didgrp.adv.pts.extkey">
                <c-input
                    v-model="model.didgrp.adv.pts.extkey"
                    maxlength="16"
                    placeholder="请输入External Key of Address"
                    @keyup.enter.native="advPtsExtkeyEvent"
                ></c-input>
            </el-form-item>
            <el-form-item label="通知行联行行号" prop="didgrp.adv.pts.bankno">
                <c-input
                    v-model="model.didgrp.adv.pts.bankno"
                    maxlength="20"
                    placeholder="请输入Number of bank"
                    @keyup.enter.native="advPtsBanknoEvent"
                ></c-input>
            </el-form-item>

            <el-form-item label="通知行联行名称" prop="didgrp.adv.pts.jigomc">
                <c-input
                    disabled
                    type="textarea"
                    v-model="model.didgrp.adv.pts.jigomc"
                    maxlength="35"
                    show-word-limit
                    placeholder="请输入联行名称  电证用"
                ></c-input>
            </el-form-item>
            <el-form-item label="通知行地址" prop="didgrp.adv.pts.dizhii">
                <c-input
                    disabled
                    type="textarea"
                    v-model="model.didgrp.adv.pts.dizhii"
                    maxlength="35"
                    show-word-limit
                    placeholder="请输入地址  电证用"
                ></c-input>
            </el-form-item>
            <el-col :span="12">
                <el-form-item label="通知行邮编" prop="didgrp.adv.pts.youzbm">
                    <c-input
                        disabled
                        v-model="model.didgrp.adv.pts.youzbm"
                        maxlength="6"
                        placeholder="请输入邮编  电证用"
                    ></c-input>
                </el-form-item> </el-col
            ><el-col :span="12">
                <el-form-item label="通知行电话" prop="didgrp.adv.pts.dihdig" label-width="100px">
                    <c-input
                        disabled
                        v-model="model.didgrp.adv.pts.dihdig"
                        maxlength="16"
                        placeholder="请输入电话"
                    ></c-input>
                </el-form-item>
            </el-col>
        </el-col>
        <!-- =========================开证行========================= -->
        <el-col :span="11" :offset="1">
            <el-form-item label="开证行BIC" prop="didgrp.iss.pts.extkey">
                <c-input
                    
                    v-model="model.didgrp.iss.pts.extkey"
                    maxlength="16"
                    placeholder="请输入External Key of Address"
                    @keyup.enter.native="issPtsExtkeyEvent"
                ></c-input>
            </el-form-item>
            <el-form-item label="开证行联行行号" prop="didgrp.iss.pts.bankno">
                <c-input
                    disabled
                    v-model="model.didgrp.iss.pts.bankno"
                    maxlength="20"
                    placeholder="请输入Number of bank"
                ></c-input>
            </el-form-item>
            <el-form-item label="开证行联行名称" prop="didgrp.iss.pts.jigomc">
                <c-input
                    disabled
                    type="textarea"
                    v-model="model.didgrp.iss.pts.jigomc"
                    maxlength="35"
                    show-word-limit
                    placeholder="请输入联行名称  电证用"
                ></c-input>
            </el-form-item>
            <el-form-item label="开证行地址" prop="didgrp.iss.pts.dizhii">
                <c-input
                    disabled
                    type="textarea"
                    v-model="model.didgrp.iss.pts.dizhii"
                    maxlength="35"
                    show-word-limit
                    placeholder="请输入地址  电证用"
                ></c-input>
            </el-form-item>
            <el-col :span="12">
                <el-form-item label="开证行邮编" prop="didgrp.iss.pts.youzbm">
                    <c-input
                        disabled
                        v-model="model.didgrp.iss.pts.youzbm"
                        maxlength="6"
                        placeholder="请输入邮编  电证用"
                    ></c-input>
                </el-form-item>
            </el-col>
            <el-col :span="12">
                <el-form-item label="开证行电话" prop="didgrp.iss.pts.dihdig" label-width="100px" >
                    <c-input
                        disabled
                        v-model="model.didgrp.iss.pts.dihdig"
                        maxlength="16"
                        placeholder="请输入电话"
                    ></c-input>
                </el-form-item>
            </el-col>
        </el-col>
        <!-- ============= 议付行 ========================= -->
        <el-col :span="11">
            <el-form-item label="是否可议付" prop="didgrp.rec.fenctg">
                <c-select
                    v-model="model.didgrp.rec.fenctg"
                    style="width: 50%"
                    placeholder="请选择是否可议付"
                >
                    <el-option
                        v-for="item in codes.fenctg"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                    >
                    </el-option>
                </c-select>
            </el-form-item>
            <el-form-item label="指定的有关银行 " prop="didgrp.rec.avbwth">
                <c-select
                    :disabled="model.didgrp.rec.fenctg != 'Y'"
                    v-model="model.didgrp.rec.avbwth"
                    style="width: 100%"
                    placeholder="请选择指定的有关银行"
                >
                    <el-option
                        v-for="item in codes.avbwth"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                    >
                    </el-option>
                </c-select>
            </el-form-item>

            <el-form-item label="议付行联行行号" prop="didgrp.avb.pts.bankno">
                <c-input
                    :disabled="model.didgrp.rec.fenctg != 'Y'"
                    v-model="model.didgrp.avb.pts.bankno"
                    maxlength="20"
                    placeholder="请输入Number of bank"
                    @keyup.enter.native="avbPtsBanknoEvent"
                ></c-input>
            </el-form-item>

            <el-form-item label="议付行名称" prop="didgrp.avb.pts.jigomc">
                <c-input
                    disabled
                    type="textarea"
                    v-model="model.didgrp.avb.pts.jigomc"
                    maxlength="35"
                    show-word-limit
                    placeholder="请输入联行名称  电证用"
                ></c-input>
            </el-form-item>

            <el-form-item label="议付行地址" prop="didgrp.avb.pts.dizhii">
                <c-input
                    :disabled="model.didgrp.rec.fenctg != 'Y'"
                    type="textarea"
                    v-model="model.didgrp.avb.pts.dizhii"
                    maxlength="35"
                    show-word-limit
                    placeholder="请输入地址  电证用"
                ></c-input>
            </el-form-item>
        </el-col>
        <!-- =========================保兑行========================= -->
        <el-col :span="11" :offset="1">
            <el-form-item label="是否可保兑" prop="didgrp.rec.bdflg">
                <c-select
                    v-model="model.didgrp.rec.bdflg"
                    style="width: 50%"
                    placeholder="请选择是否可保兑"
                >
                    <el-option
                        v-for="item in codes.bdflg"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                    >
                    </el-option>
                </c-select>
            </el-form-item>

            <el-form-item label="保兑行联行行号" prop="didgrp.rmb.pts.bankno">
                <c-input
                    :disabled="model.didgrp.rec.bdflg != 'Y'"
                    v-model="model.didgrp.rmb.pts.bankno"
                    maxlength="20"
                    placeholder="请输入Number of bank"
                    @keyup.enter.native="rmbPtsBanknoEvent"
                ></c-input>
            </el-form-item>

            <el-form-item label="保兑行名称" prop="didgrp.rmb.pts.jigomc">
                <c-input
                    disabled
                    type="textarea"
                    v-model="model.didgrp.rmb.pts.jigomc"
                    maxlength="35"
                    show-word-limit
                    placeholder="请输入联行名称  电证用"
                ></c-input>
            </el-form-item>
            <el-form-item label="保兑行地址" prop="didgrp.rmb.pts.dizhii">
                <c-input
                    :disabled="model.didgrp.rec.bdflg != 'Y'"
                    type="textarea"
                    v-model="model.didgrp.rmb.pts.dizhii"
                    maxlength="35"
                    show-word-limit
                    placeholder="请输入地址  电证用"
                ></c-input>
            </el-form-item>
        </el-col>
        <el-col :span="24">&nbsp;</el-col>
        <!-- ========================转让行 ======================== -->
        <el-col :span="11">
            <el-form-item label="是否可以转让" prop="didgrp.rec.lcrtyp">
                <c-select
                    v-model="model.didgrp.rec.lcrtyp"
                    style="width: 50%"
                    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>
            <!-- </el-row> -->
            <el-form-item label="转让行联行行号" prop="didgrp.cmb.pts.bankno">
                <c-input
                    :disabled="model.didgrp.rec.lcrtyp != 'IT'"
                    v-model="model.didgrp.cmb.pts.bankno"
                    maxlength="20"
                    placeholder="请输入Number of bank"
                    @keyup.enter.native="cmbPtsBanknoEvent"
                ></c-input>
            </el-form-item>
            <el-form-item label="转让行名称" prop="didgrp.cmb.pts.jigomc">
                <c-input
                    disabled
                    type="textarea"
                    v-model="model.didgrp.cmb.pts.jigomc"
                    show-word-limit
                    placeholder="请输入联行名称  电证用"
                ></c-input>
            </el-form-item>
            <el-form-item label="转让行地址" prop="didgrp.cmb.pts.dizhii">
                <c-input
                   :disabled="model.didgrp.rec.lcrtyp != 'IT'"
                    type="textarea"
                    v-model="model.didgrp.cmb.pts.dizhii"
                    maxlength="35"
                    show-word-limit
                    placeholder="请输入地址  电证用"
                ></c-input>
            </el-form-item>
        </el-col>
        <!-- ========================申请行 ======================== -->
        <el-col :span="11" :offset="1">
            <el-form-item label="申请行联行行号" prop="didgrp.apc.pts.bankno">
                <c-input
                    v-model="model.didgrp.apc.pts.bankno"
                    maxlength="20"
                    placeholder="请输入Number of bank"
                    @keyup.enter.native="apcPtsBanknoEvent"
                ></c-input>
            </el-form-item>
            <el-form-item label="申请行名称" prop="didgrp.apc.pts.jigomc">
                <c-input
                    disabled
                    type="textarea"
                    v-model="model.didgrp.apc.pts.jigomc"
                    maxlength="35"
                    show-word-limit
                    placeholder="请输入联行名称  电证用"
                ></c-input>
            </el-form-item>
            <el-form-item label="申请行地址" prop="didgrp.apc.pts.dizhii">
                <c-input
                    type="textarea"
                    v-model="model.didgrp.apc.pts.dizhii"
                    maxlength="35"
                    show-word-limit
                    placeholder="请输入地址  电证用"
                ></c-input> </el-form-item
            >            <el-col :span="12">
                <el-form-item label="申请人邮编" prop="didgrp.apc.pts.youzbm">
                    <c-input
                        v-model="model.didgrp.apc.pts.youzbm"
                        maxlength="6"
                        placeholder="请输入邮编  电证用"
                    ></c-input>
                </el-form-item>
            </el-col><el-col :span="12">
                <el-form-item label="申请人电话" prop="didgrp.apc.pts.dihdig" label-width="100px">
                    <c-input
                        v-model="model.didgrp.apc.pts.dihdig"
                        maxlength="16"
                        show-word-limit
                        placeholder="请输入电话 电证用"
                    ></c-input>
                </el-form-item>
            </el-col>

        </el-col>

        <c-grid-ety-prompt-dialog ref="etyDialog"
            :title="gridPromptDialog.title" 
            :columnStr="gridPromptDialog.columnStr" 
            :data="gridPromptDialog.data"
            :type="gridPromptDialog.type"
            :rulePath="gridPromptDialog.rulePath"
            v-on:select-ety="selectEty"
            >
        </c-grid-ety-prompt-dialog>
    </div>
</template>
<script>
import Api from "~/service/Api";
import Event from "~/model/Ditopn/Event";
import Utils from "~/utils";

export default {
    inject: ['root'],
    props: ["model", "codes"],
    data() {
        return {
            gridPromptDialog: {
                title: '',
                columnStr: '',
                data: [],
                type: '',
                rulePath: ''
            }
        };
    },
    methods: {
        /**
         * 通知行 extkey
         */
        advPtsExtkeyEvent() {
            Api.post("ditopn/executeRule/didgrp.adv.pts.extkey", Utils.getRequestDataFn.call(this)).then(
                (res) => {
                    if (res.respCode = "AAAAAA"){                    
                        if (res.data.params) {
                            Utils.copyValueFromVO(this.model, res.data);  
                        } else {
                            this.$refs.etyDialog.show = true
                            this.gridPromptDialog.title = res.data.title
                            this.gridPromptDialog.columnStr = res.data.columns
                            this.gridPromptDialog.data = res.data.vals.rows
                            this.gridPromptDialog.type = 'extkey'
                            this.gridPromptDialog.rulePath = 'didgrp.adv.pts.extkey'
                        }
                    }            
                }
            );
        },
        /**
         * 通知行
         */
        advPtsBanknoEvent() {
            Api.post("ditopn/executeRule/didgrp.adv.pts.bankno", Utils.getRequestDataFn.call(this)).then(
                (res) => {
                    if (res.respCode = "AAAAAA"){                    
                        if (res.data.params) {
                            Utils.copyValueFromVO(this.model, res.data);  
                        } else {
                            this.$refs.etyDialog.show = true
                            this.gridPromptDialog.title = res.data.title
                            this.gridPromptDialog.columnStr = res.data.columns
                            this.gridPromptDialog.data = res.data.vals.rows
                            this.gridPromptDialog.type = 'bankno'
                            this.gridPromptDialog.rulePath = 'didgrp.adv.pts.bankno'
                        }
                    }            
                }
            );
        },
        /**
         * 开证行 extkey
         */
        issPtsExtkeyEvent() {
            Api.post("ditopn/executeRule/didgrp.iss.pts.extkey", Utils.getRequestDataFn.call(this)).then(
                (res) => {
                    if (res.respCode = "AAAAAA"){                    
                        if (res.data.params) {
                            Utils.copyValueFromVO(this.model, res.data);  
                        } else {
                            this.$refs.etyDialog.show = true
                            this.gridPromptDialog.title = res.data.title
                            this.gridPromptDialog.columnStr = res.data.columns
                            this.gridPromptDialog.data = res.data.vals.rows
                            this.gridPromptDialog.type = 'extkey'
                            this.gridPromptDialog.rulePath = 'didgrp.iss.pts.extkey'
                        }
                    }            
                }
            );
        },
        /**
         * 议付行
         */
        avbPtsBanknoEvent() {
            Api.post("ditopn/executeRule/didgrp.avb.pts.bankno", Utils.getRequestDataFn.call(this)).then(
                (res) => {
                    if (res.respCode = "AAAAAA"){                    
                        if (res.data.params) {
                            Utils.copyValueFromVO(this.model, res.data);  
                        } else {
                            this.$refs.etyDialog.show = true
                            this.gridPromptDialog.title = res.data.title
                            this.gridPromptDialog.columnStr = res.data.columns
                            this.gridPromptDialog.data = res.data.vals.rows
                            this.gridPromptDialog.type = 'bankno'
                            this.gridPromptDialog.rulePath = 'didgrp.avb.pts.bankno'
                        }
                    }            
                }
            );
        },
        /**
         * 保兑行
         */
        rmbPtsBanknoEvent() {
            Api.post("ditopn/executeRule/didgrp.rmb.pts.bankno", Utils.getRequestDataFn.call(this)).then(
                (res) => {
                    if (res.respCode = "AAAAAA"){                    
                        if (res.data.params) {
                            Utils.copyValueFromVO(this.model, res.data);  
                        } else {
                            this.$refs.etyDialog.show = true
                            this.gridPromptDialog.title = res.data.title
                            this.gridPromptDialog.columnStr = res.data.columns
                            this.gridPromptDialog.data = res.data.vals.rows
                            this.gridPromptDialog.type = 'bankno'
                            this.gridPromptDialog.rulePath = 'didgrp.rmb.pts.bankno'
                        }
                    }            
                }
            );
        },
        /**
         * 转让行
         */
        cmbPtsBanknoEvent() {
            Api.post("ditopn/executeRule/didgrp.cmb.pts.bankno", Utils.getRequestDataFn.call(this)).then(
                (res) => {
                    if (res.respCode = "AAAAAA"){                    
                        if (res.data.params) {
                            Utils.copyValueFromVO(this.model, res.data);  
                        } else {
                            this.$refs.etyDialog.show = true
                            this.gridPromptDialog.title = res.data.title
                            this.gridPromptDialog.columnStr = res.data.columns
                            this.gridPromptDialog.data = res.data.vals.rows
                            this.gridPromptDialog.type = 'bankno'
                            this.gridPromptDialog.rulePath = 'didgrp.cmb.pts.bankno'
                        }
                    }            
                }
            );
        },
        /**
         * 申请行
         */
        apcPtsBanknoEvent() {
            Api.post("ditopn/executeRule/didgrp.apc.pts.bankno", Utils.getRequestDataFn.call(this)).then(
                (res) => {
                    if (res.respCode = "AAAAAA"){                    
                        if (res.respCode = "AAAAAA"){                    
                        if (res.data.params) {
                            Utils.copyValueFromVO(this.model, res.data);  
                        } else {
                            this.$refs.etyDialog.show = true
                            this.gridPromptDialog.title = res.data.title
                            this.gridPromptDialog.columnStr = res.data.columns
                            this.gridPromptDialog.data = res.data.vals.rows
                            this.gridPromptDialog.type = 'bankno'
                            this.gridPromptDialog.rulePath = 'didgrp.apc.pts.bankno'
                        }
                    }   
                    }            
                }
            );
        },
        selectEty(val, rulePath) {
            const props = rulePath.replaceAll(".", "_")
            const obj = {}
            obj[props] = val;
            Utils.copyValueFromVO(this.model, obj);
            Api.post(`ditopn/executeRule/${rulePath}`, Utils.getRequestDataFn.call(this)).then(
                (res) => {
                    if (res.respCode = "AAAAAA"){
                        Utils.copyValueFromVO(this.model, res.data);
                    }
                }
            );
        },
        ...Event 
    },
    created: function () {}
};
</script>
<style>
</style>
