<template>
  <!-- 定投价查询 -->
  <div class="platinum_fixed_investment_price_query_tab">
    <Filter @search="updateColumn" />
    <contextMenu :contextMenuList="firstBtn">
      <a-table :columns="columns"
               class="srcollYTable"
               :scroll="{ x: '100%', y: 'calc(100vh - 163px)' }"
               :pagination="false"
               :loading="loading"
               :expandedRowKeys="expandedRowKeys"
               :customRow="Rowclick"
               rowKey="key"
               :data-source="tableList">
        <!-- 商品名称 - 商品代码-->
        <template #goodsid="{ record }">
          <a>{{ record.goodsname + "-" +  record.goodscode }}</a>
        </template>
      </a-table>
    </contextMenu>
  </div>
</template>

<script lang="ts">
import { defineComponent, initData, getTableColumns, getTableEvent, queryTableList, contextMenu, BtnList, _getBtnList } from '@/common/export/table';
import { queryReckonPriceLog } from '@/services/go/ermcp/qhj';
import { QhjReckonPriceLog } from '@/services/go/ermcp/qhj/interface';
import Filter from '../../compoments/filter/index.vue';

export default defineComponent({
    name: 'platinum_fixed_investment_price_query_tab',
    components: { Filter, contextMenu, BtnList },
    setup() {
        // 表头数据
        const { columns, registerColumn, updateColumn } = getTableColumns();
        // 表格事件
        const { expandedRowKeys, selectedRow, Rowclick, btnClick } = getTableEvent<QhjReckonPriceLog>({});
        // 表格操作按钮列表
        const [firstBtn] = _getBtnList('platinum_fixed_investment_price_query_tab', false).value;
        // 表格列表数据
        const { loading, tableList, queryTable } = queryTableList<QhjReckonPriceLog>();
        initData(() => {
            // 获取列表数据
            queryTable(queryReckonPriceLog);
            // 注册表头信息 过滤
            registerColumn('table_pcweb_qhj_fixed_investment_price_query', ['tradedate', 'goodsid']);
        });

        return {
            columns,

            expandedRowKeys,
            selectedRow,
            Rowclick,
            updateColumn,
            firstBtn,
            loading,
            tableList,
            queryTable,
            btnClick,
        };
    },
});
</script>