<template>
  <!-- 定投计划查询 -->
  <div class="platinum_fixed_investment_plan_query">
    <Filter @search="updateColumn" />
    <a-table :columns="columns" class="srcollYTable" :scroll="{ x: '100%', y: 'calc(100vh - 163px)' }" :pagination="false" :expandedRowKeys="expandedRowKeys" :customRow="Rowclick" :rowKey="(record,index)=>index" :data-source="tableList">
      <template #userinfotype="{ record }">
        <a>{{ record.userinfotype === 1 ? '个人' : '企业'}}</a>
      </template>

      <template #regularlymode="{ record }">
        <a>{{ record.regularlymode === 1 ? '按数量' : '按金额'}}</a>
      </template>
      <template #regularlystrategystatus="{ record }">
        <a>{{ getRegularStateName(record.regularlystrategystatus)}}</a>
      </template>

      <template #regularlycycle="{ record }">
        <a>{{ record.regularlycycle === 1 ?  "每周" + getWeekName(record.regularlycyclevalue) : "每月" + record.regularlycyclevalue + "日"}}</a>
      </template>
    </a-table>
  </div>
</template>

<script lang="ts">
import { EnumRouterName } from '@/common/constants/enumRouterName';
import { getRegularStateName, getWeekName } from '@/common/constants/enumsName';
import { ComposeTableParam, defineComponent, handleComposeTable, queryTableList } from '@/common/export/commonTable';
import { queryRStrategy } from '@/services/go/ermcp/qhj';
import { QhjRStrategy } from '@/services/go/ermcp/qhj/interface';
import Filter from './compoments/filter/index.vue';

export default defineComponent({
  name: 'platinum_fixed_investment_plan_query',
  components: { Filter },
  setup() {
    // 表格列表数据
    const { loading, tableList, queryTable } = queryTableList<QhjRStrategy>();
    const queryTableAction = () => {
      // 获取列表数据
      queryTable(queryRStrategy);
    };

    // 表格通用逻辑
    const param: ComposeTableParam = {
      queryFn: queryTableAction,
      tableName: 'table_pcweb_qhj_fixed_investment_plan_query',
    };

    return {
      ...handleComposeTable<QhjRStrategy>(param),
      loading,
      getRegularStateName,
      getWeekName,
      tableList,
    };
  },
});
</script>