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

<script lang="ts">
import { defineComponent } from 'vue';
import { Ermcp3AreaStockApply } from '@/views/manage/inventory-review/list/setup';
import { useFilter } from '@/common/components/filter/setup';
import FilterOption from '@/common/components/filter/index.vue';

export default defineComponent({
  name: 'check-out-in-filter-table',
  components: {
    FilterOption,
  },
  setup(props, context) {
    const { selectList, inputList, buttonList, search } = useFilter<Ermcp3AreaStockApply>(context);

    selectList.value = [
      {
        key: 'contracttype',
        selectedValue: 0,
        options: [
          { label: '全部合同类型', value: 0 },
          { label: '采购', value: 1 },
          { label: '销售', value: -1 }
        ],
        onChange: search
      },
      {
        key: 'inouttype',
        selectedValue: 0,
        options: [
          { label: '全部出入库类型', value: 0 },
          { label: '采购入库', value: 5 },
          { label: '销售出库', value: 6 },
          { label: '生产入库', value: 7 },
          { label: '生产出库', value: 8 }
        ],
        onChange: search
      }
    ]

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

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