<template>
  <!-- 过滤仓库信息表格 -->
  <div class="filterTable">
    <FilterOption :selectList="selectList" :inputList="inputList" :buttonList="buttonList" />
    <slot></slot>
  </div>
</template>

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

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

    selectList.value = [
      {
        key: 'warehousetype',
        selectedValue: 0,
        options: [
          { label: '全部仓库类型', value: 0 },
          { label: '厂库', value: 1 },
          { label: '自有库', value: 2 },
          { label: '合作库', value: 3 }
        ],
        onChange: search
      },
    ]

    inputList.value = [
      { keys: ['warehousename', 'warehousecode'], value: '', placeholder: '模糊搜索仓库名称' },
      { keys: ['address'], value: '', placeholder: '模糊搜索仓库地址' },
    ]

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