<template>
    <div class="eibs-tab">
        <c-list-search @form-reset="handleReset" @form-search="handleSearch">
            <template v-slot="searchSlot">
                <el-form class="m-table-search-form" ref="paramsForm" label-position="right" label-width="110px"
                    size="small">
                    <el-row>
                        <c-col :span="8">
                            <c-form-item label="业务编号" prop="cfaquep.ownref" style="width: 100%">
                                <c-input v-model="model.cfaquep.ownref" maxlength="16" placeholder="请输入业务编号"></c-input>
                            </c-form-item>
                        </c-col>
                        <c-col :span="8">
                            <el-form-item label="开立日期" prop="cfaquep.frmdat" style="width: 100%">
                                <c-col :span="11">
                                    <c-date-picker type="date" v-model="model.cfaquep.frmdat" style="width:100%"
                                        placeholder="请选择起始日期" value-format="yyyy-MM-dd"></c-date-picker>
                                </c-col>
                                <c-col :span="2" style="text-align: center">
                                    <label style="display: inline-block; width: 100%">-</label>
                                </c-col>
                                <c-col :span="11">
                                    <c-date-picker type="date" v-model="model.cfaquep.tildat" style="width:100%"
                                        placeholder="请选择截至日期" value-format="yyyy-MM-dd"></c-date-picker>
                                </c-col>
                            </el-form-item>
                        </c-col>
                        <c-col :span="8">
                            <el-form-item label="申报类型" prop="cfaquep.cfatyp" style="width: 100%">
                                <c-select v-model="model.cfaquep.cfatyp" style="width:100%" placeholder="请选择申报类型">
                                </c-select>
                            </el-form-item>
                        </c-col>
                    </el-row>
                    <el-row v-show="searchSlot.searchToggle">
                        <c-col :span="8">
                            <c-form-item label="申报号码" prop="cfaquep.rptno" style="width: 100%">
                                <c-input v-model="model.cfaquep.rptno" maxlength="28" placeholder="请输入申报号码">
                                </c-input>
                            </c-form-item>
                        </c-col>
                        <c-col :span="8">
                            <c-form-item label="查询日期类型" prop="cfaquep.dattyp" style="width: 100%">
                                <c-input v-model="model.cfaquep.dattyp" maxlength="1" placeholder="请选择查询日期类型">
                                </c-input>
                            </c-form-item>
                        </c-col>
                        <c-col :span="8">
                            <c-form-item label="笔数" prop="cfaquep.sum" style="width: 100%">
                                <c-input v-model="model.cfaquep.sum" placeholder="请输入笔数">
                                </c-input>
                            </c-form-item>
                        </c-col>

                        <c-col :span="8">
                            <el-form-item label="业务所属行" prop="cfaquep.ownextkey" style="width: 100%">
                                <c-select v-model="model.cfaquep.ownextkey" style="width:100%" placeholder="请选择业务所属行">
                                </c-select>
                            </el-form-item>
                        </c-col>
                        <c-col :span="8">
                            <c-form-item label="业务情况" prop="cfaquep.staflg" style="width: 100%">
                                <c-input v-model="model.cfaquep.staflg" maxlength="1" placeholder="请选择业务情况"></c-input>
                            </c-form-item>
                        </c-col>
                    </el-row>
                </el-form>
            </template>
        </c-list-search>

        <div style="height:90%">
            <c-col :span="24">
                <c-istream-table :list="stmData.data" :columns="stmData.columns" :showButtonFlg="true">
                    <!-- 自定义组件里加了最右边的一列”操作“ -->
                    <el-table-column fixed="right" prop="op" label="操作" width="140px">
                        <template slot="header">
                            <c-col :span="11" style="text-align: center"><span>操作</span></c-col>
                        </template>
                        <template slot-scope="scope">
                            <!-- 申请一个弹出主键放在插槽,加工已渲染的数据 -->
                            <el-popover placement="top-start" title="历史信息" width="800" trigger="click"
                                :ref="'popover_' + scope.row.IDX">
                                <div style=" text-align: right; margin-top: -30px; margin-right: 5px; font-size: 16px;">
                                    <span class="el-icon-close" @click="closeTrn('popover_' + scope.row.IDX)" />
                                </div>
                                <c-istream-table :list="trnData.data" :columns="trnData.columns">
                                    <el-table-column prop="op" label="操作" width="0">
                                        <template slot-scope="scope">
                                            <c-button style="margin-left: 0" size="small"
                                                @click="display(scope.row['INR'])">
                                                详情
                                            </c-button>
                                        </template>
                                    </el-table-column>
                                </c-istream-table>
                                <c-button style="margin-left: 0" size="small"
                                    @click="getTrnInfo(scope.$index, scope.row)" slot="reference">
                                    详情
                                </c-button>
                            </el-popover>
                            <c-button style="margin-left: 5px" size="small" type="primary"
                                @click="getButtons(scope.row['业务参考号'])">
                                处理
                            </c-button>
                        </template>
                    </el-table-column>
                </c-istream-table>
            </c-col>
        </div>

        <!-- <c-col :span="12">
            <c-form-item label="Selection" prop="eblstm">
                <c-input v-model="model.eblstm" :placeholder="$t('other.please_enter') + 'Selection'"></c-input>
            </c-form-item>
        </c-col>

        <c-col :span="12">
            <c-form-item label="EAD Selection" prop="eadstm">
                <c-input v-model="model.eadstm" :placeholder="$t('other.please_enter') + 'EAD Selection'"></c-input>
            </c-form-item>
        </c-col>

        <c-col :span="12">
            <c-form-item label="EAF Selection" prop="eafstm">
                <c-input v-model="model.eafstm" :placeholder="$t('other.please_enter') + 'EAF Selection'"></c-input>
            </c-form-item>
        </c-col>

        <c-col :span="12">
            <c-form-item label="EBA Selection" prop="ebastm">
                <c-input v-model="model.ebastm" :placeholder="$t('other.please_enter') + 'EBA Selection'"></c-input>
            </c-form-item>
        </c-col>

        <c-col :span="12">
            <c-form-item label="ECA Selection" prop="ecastm">
                <c-input v-model="model.ecastm" :placeholder="$t('other.please_enter') + 'ECA Selection'"></c-input>
            </c-form-item>
        </c-col>

        <c-col :span="12">
            <c-button size="small" type="primary" @click="onSerbut">
                {{ $t('cfasel.C0000010') }}
            </c-button>
        </c-col>

        <c-col :span="12">
            <c-button size="small" type="primary" @click="onDtlbut">
                {{ $t('cfasel.C0000011') }}
            </c-button>
        </c-col>

        <c-col :span="12">
            <c-button size="small" type="primary" @click="onAddbut">
                {{ $t('cfasel.C0000012') }}
            </c-button>
        </c-col>

        <c-col :span="12">
            <c-button size="small" type="primary" @click="onAmebut">
                {{ $t('cfasel.C0000013') }}
            </c-button>
        </c-col>

        <c-col :span="12">
            <c-button size="small" icon="el-icon-delete" @click="onDelbut">
                {{ $t('cfasel.C0000014') }}
            </c-button>
        </c-col>

        <c-col :span="12">
            <c-button size="small" type="primary" @click="onExpbut">
                {{ $t('cfasel.C0000016') }}
            </c-button>
        </c-col>

        <c-col :span="12">
            <c-button size="small" type="primary" @click="onAddbut2">
                {{ $t('cfasel.C0000017') }}
            </c-button>
        </c-col>

        <c-col :span="12">
            <c-button size="small" type="primary" @click="onAmelixi">
                {{ $t('cfasel.C0000019') }}
            </c-button>
        </c-col>

        <c-col :span="12">
            <c-button size="small" type="primary" @click="onExi">
                {{ $t('errcfa.C0000012') }}
            </c-button>
        </c-col> -->
    </div>
</template>
<script>
import Api from "~/service/Api"
import commonProcess from "~/mixin/commonProcess";
import CodeTable from "~/config/CodeTable"
import Event from "~/model/Cfasel/Event"

export default {
    inject: ['root'],
    props: ["model", "codes"],
    mixins: [commonProcess],
    data() {
        return {
            stmData: {
                columns: [
                    "0 1 \"业务流水\" 100 1 0:2 1 ",
                    "2 2 \"申报号码\" 180 1 0:0 1 ",
                    "3 3 \"业务参考号\" 150 1 0:0 1 ",
                    "4 4 \"柜员\" 100 1 0:2 1 ",
                    "5 5 \"日期\" 150 4 7:2 1 ",
                    "6 6 \"申报类型\" 120 1 0:2 1 CFATYP",
                    "7 7 \"信息类型\" 100 1 0:2 1 ",
                    "8 8 \"操作类型\" 100 1 0:2 1 ",
                    "9 9 \"状态\" 80 1 20:0 1 TransCFASTA",
                ],
                data: [],
            },
        }
    },
    methods: {
        ...Event,
        async handleSearch() {
            this.stmData.data = [];
            let frmdat = this.model.cfaquep.frmdat;
            if (!frmdat || frmdat == '') {
                this.$notify.error({ title: '错误', message: '查询开始日期必输!' });
                return;
            }
            let tildat = this.model.cfaquep.tildat;
            if (!tildat || tildat == '') {
                this.$notify.error({ title: '错误', message: '查询结束日期必输!' });
                return;
            }
            let rtnmsg = await this.executeRule("infbut.searow")
            if (rtnmsg.respCode == SUCCESS) {
                //TODO 处理数据逻辑
                this.stmData.data = rtnmsg.data.eblstm.rows;
                // this.updateModel(rtnmsg.data);
                //   this.stmData.data = rtnmsg.data.infbut_dspstm.rows;
                //this.model.infbut.dspstm = rtnmsg.data.infbut_dspstm
            }
            else {
                this.$notify.error({ title: '错误', message: '服务请求失败!' });
            }
        },
    },
    created: function () {

    }
}
</script>
<style>

</style>