<template>
  <div class="eibs">
    <c-list-search @form-reset="handleReset" @form-search="handleSearch">
      <!-- 持续展示区 -->
      <template v-slot="searchSlot">
        <el-form
          class="m-table-search-form"
          ref="paramsForm"
          label-position="left"
          label-width="110px"
          size="small"
        >
          <c-row>
            <c-col :span="24">
              <c-col :span="8">
                <el-form-item
                  label="业务编号"
                  prop="infcon.seaownref"
                  style="width: 100%"
                >
                  <c-input
                    v-model="model.infcon.seaownref"
                    maxlength="16"
                    @change="changeOwnref"
                    placeholder="请输入业务编号"
                  ></c-input>
                </el-form-item>
              </c-col>

              <c-col :span="8">
                <el-form-item
                  label="日期"
                  prop="infcon.opndatfrom"
                  style="width: 100%"
                >
                  <c-col :span="11">
                    <c-date-picker
                      type="date"
                      v-model="model.infcon.opndatfrom"
                      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.infcon.opndatto"
                      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="infcon.searef"
                  style="width: 100%"
                >
                  <c-input
                    v-model="model.infcon.searef"
                    placeholder="请输入客户名称"
                  ></c-input>
                </el-form-item>
              </c-col>
            </c-col>
          </c-row>

          <!-- 可控展示区 -->
          <c-row v-show="searchSlot.searchToggle">
               <c-col :span="8">
                  <el-form-item label="是否闭卷" prop="infcon.isClosed" style="width: 100%">
                    <c-select v-model="model.infcon.isClosed" dbCode='cxmflg'  placeholder="请选择是否闭卷">
                    </c-select>
                  </el-form-item>
                </c-col>
          </c-row>
        </el-form>
      </template>
    </c-list-search>

    <c-col :span="24" style="margin-top: 0px">
      <c-button class="medium_bcs" size="medium" style="margin-left: 0px" type="primary" @click="toCctdav">建立光票托收</c-button>
    </c-col>

    <div style="height: 90%">
      <c-col :span="24">
        <c-tabs v-model="activeTab"  type="card" ref="elment">
        <el-table
            v-loading="load"
            :data="stmData.data"
            height="calc(100vh - 480px)"
            border
            :columns="stmData.columns"
            :showButtonFlg="true"
            :highlight-current-row="true"
            @row-dblclick="TableDblRow"
        >
          <el-table-column
              v-for="(item, key) in stmData.columns"
              :key="key"
              :label="item.label"
              :prop="item.prop"
              :min-width="item.width"
          >
            <template  slot-scope="scope">
              <div style="text-align: center" v-if="item.prop.indexOf('amt') >= 0">{{moneyFormat(scope.row[item.prop],scope.row.cur)}}</div>
              <div v-else>{{scope.row[item.prop]}}</div>
            </template>
          </el-table-column>
          <!-- 自定义组件里加了最右边的一列”操作“ -->
          <el-table-column fixed="right" prop="op" label="操作" width="180px">
            <template slot="header">
              <!-- 插槽里放了一个文字 一个按钮 -->
              <c-col :span="11" style="text-align: center"
              ><span>操作</span>
              </c-col>
            </template>
            <template slot-scope="scope">
              <!-- 申请一个弹出主键放在插槽,加工已渲染的数据 -->
              <c-button
                  style="margin-right: 7px"
                  size="small"
                  type="text"
                  @click="handler(scope.row)"
              >处理
              </c-button>
              <el-popover
                  placement="top-start"
                  title="历史信息"
                  width="1200"
                   trigger="manual" 
                  v-clickOutside="closeDisplayDialog"
                  :ref="'popover_' + scope.row.inr"
              >
                <div
                    style="
                    text-align: right;
                    margin-top: -30px;
                    margin-right: 5px;
                    font-size: 16px;
                  "
                >
                  <span
                      class="el-icon-close"
                      style="cursor: pointer"
                      @click="closeDetailsDialog('popover_' + scope.row.inr)"
                  ></span>
                </div>
                <el-table
                    :data="trnData.data"
                    :columns="trnData.columns"
                    :showButtonFlg="true"
                >
                  <el-table-column
                      v-for="(item, key) in trnData.columns"
                      :key="key"
                      :label="item.label"
                      :prop="item.prop"
                      :width="item.width"
                  >
                    <template slot-scope="scope">
                      <div>{{ scope.row[item.prop] }}</div>
                    </template>
                  </el-table-column>
                  <el-table-column
                      fixed="right"
                      prop="op"
                      label="操作"
                      width="100px"
                  >
                    <template slot-scope="scope">
                      <c-button
                          style="margin-left: 0"
                          size="small"
                          @click="display(scope.row)"
                      >快照</c-button
                      >
                    </template>
                  </el-table-column>
                </el-table>
                <c-button
                    style="margin-left: 0px"
                    size="small"
                    type="text"
                    @click="details(scope.row)"
                    slot="reference"
                >
                  快照
                </c-button>
                 <c-button 
                  style="margin-left: 0" 
                  type="text" 
                  size="small" 
                  slot="reference" 
                  @click="toInfo(scope.row,'CCD','')">
                      Info
                 </c-button>
              </el-popover>
            </template>
          </el-table-column>
        </el-table>
      <div class="pagination-box" 
              style="display:block">
          <el-pagination
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
              :current-page.sync="pagination.pageIndex"
              :page-sizes="[10, 20, 50, 100, 500]"
              :page-size="pagination.pageSize"
              layout="total, sizes, prev, pager, next, jumper"
              :total="pagination.total">
          </el-pagination>
        </div>
        </c-tabs>
      </c-col>
      <!-- 点击处理ba弹框 -->
      <el-dialog
          v-if="initdialog"
					v-dialogDrag
          :visible.sync="initdialog"
          title="交易列表"
          append-to-body
          width="70%"
      >
        <m-busbtn ref="childs" :trnUrl="trnUrl" :inifrm="inifrm" :activeTab="activeTab" :model="handleModel" @onChoose="handleClick"></m-busbtn>
      </el-dialog>
     <!--业务锁及待处理数据弹窗-->
    <m-chklap ref="lockAndPending"  @changeBtn="changeBtn"></m-chklap>
    </div>
  </div>
</template>


<script>

import event from "../event";
import BusNavbar from "~/components/business/BusNavbar1";
import CheckLockAndPending from "~/components/business/CheckLockAndPending";


export default {
  inject: ["root"],
  props: ["model", "codes"],
  mixins: [event],
  components: {
    "m-busbtn": BusNavbar,
    "m-chklap": CheckLockAndPending, },
  data() {
    return {
      sptVisible:false,
      dealSptData:[],
      activeTab:'cc',
      oldRefId:"",
      handleModel:{},
      queryCon:{},
      trnUrl:"",
      inifrm:"",
      ownref: "",
      dialogTableVisible: false,
      dialogFlag: true,
      load:false,
      trnData: {
        columns: [
          {
            label: "业务编号",
            prop: "ownref",
            width:"160"
          },
          {
            label: "交易名称",
            prop: "inifrmname",
            width:"220"
          },
          {
            label: "交易码",
            prop: "inifrm",
            width:"100"
          },
          {
            label: "交易时间",
            prop: "inidattim",
            width:"160"
          },
          {
            label: "状态",
            prop: "relflgName",
            width:"100"
          },
          {
            label: "币种",
            prop: "reloricur",
            width:"100"
          },
          {
            label: "金额",
            prop: "reloriamt",
            width:"150"
          },
            ],
        data: [],
      },
      stmData: {
        columns: [
          {
            label: "业务编号",
            prop: "ownref",
            width:"150px",
          },
          {
            label: "客户号",
            prop: "preExtkey",
            width:"150px",
          },
          {
            label: "客户名称",
            prop: "preName",
            width:"250px",
          },
           {
            label: "币种",
            prop: "cur",
            width:"80px",
          },
          {
            label: "金额",
            prop: "amt",
            width:"180px",
          },
          {
            label: "代收行名称",
            prop: "colName",
            width:"250px",
          },
          {
            label: "日期",
            prop: "credat",
            width:"150px",
          },
          {
            label: "经办柜员",
            prop: "ownusr",
            width:"120px",
          },
        ],
        data: [
        ],
      },
      initdialog: false,
      pagination: {
        pageIndex: 1,
        pageSize: 10,
        total: 0,
      },
      handlerDataList: [],
    };
  },
  methods: {
  },
  created: function () {},
};
</script>
<style>
.btn-group-wrap {
  max-height: 200px;
  width: 100%;
  overflow-y: auto;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  flex-wrap: wrap;
}
.btn-item {
  margin-bottom: 10px;
  margin-right: 10px;
}
.medium_bcs {
  border-radius: 5px;
}
</style>