<template>
  <div class="filterTable">
    <FilterOption :selectList="selectList" :inputList="inputList" :buttonList="buttonList" />
    <slot></slot>
  </div>
</template>

<script lang="ts">
import { defineComponent } from 'vue';
import { Ermcp3ContractRsp } from '@/services/go/ermcp/spot-contract/interface';
import { useFilter } from '@/common/components/filter/setup';
import FilterOption from '@/common/components/filter/index.vue';

export default defineComponent({
  name: 'filter-spot-contract-search',
  components: {
    FilterOption
  },
  setup(props, context) {
    const { selectList, inputList, buttonList, search } = useFilter<Ermcp3ContractRsp>(context);

    selectList.value = [
      {
        key: 'pricetype',
        selectedValue: 0,
        options: [
          { label: '全部定价类型', value: 0 },
          { label: '一口价', value: 1 },
          { label: '点价', value: 2 },
          { label: '暂定价', value: 3 }
        ],
        onChange: search
      },
    ]

    inputList.value = [
      { keys: ['contractno'], value: '', placeholder: '模糊搜索合同编号' },
      { keys: ['sellusername', 'buyusername'], alias: 'negative', value: '', placeholder: '模糊搜索对手方' },
    ]

    return {
      selectList,
      inputList,
      buttonList,
    }
  },
})
</script>