<template>
  <div class="eibs-tab">
    <c-col :span="8">
      <c-form-item label="申报编号" prop="errcfa.rptno" style="width: 100%">
        <c-input
          v-model="model.errcfa.rptno"
          maxlength="33"
          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="请选择开立日期"
          ></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="请选择截至日期"
          ></c-date-picker>
        </c-col>
      </el-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="请选择业务所属行"
          :code="codes.ownextkey5"
        >
        </c-select>
      </el-form-item>
    </c-col>
    <c-col :span="24" style="text-align: right; padding-right: 20px">
      <el-button type="primary" size="small">查询</el-button>
    </c-col>

    <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-button size="small" type="primary" @click="onErrcfaSerbut">
                {{ $t('errcfa.C0000011') }}
            </c-button>
        </c-col>

        <c-col :span="12">
            <c-form-item label="Select Error Message" prop="errcfa.msgstm">
                <c-input v-model="model.errcfa.msgstm" :placeholder="$t('other.please_enter') + 'Select Error Message'">
                </c-input>
            </c-form-item>
        </c-col>

        <c-col :span="12">
            <c-button size="small" type="primary" @click="onErrcfaCorbut">
                {{ $t('errcfa.C0000010') }}
            </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 "申报编号" 200 1 0:0 1',
          '1 2 "反馈日期" 150 4 7:2 1 ',
          '5 3 "业务编号" 150 1 0:0 1',
          '4 4 "错误信息" 250 1 0:0 1',
          '2 5 "接口反馈文件" 325 1 0:0 1',
        ],
        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.errcfa_msgstm.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>