<template>
  <!-- 过滤客户资料表格 -->
  <div class="filterTable">
    <FilterOption :selectList="selectList"
                  :inputList="inputList"
                  :fixedBtnList="fixedBtnList" />
    <slot></slot>
  </div>
</template>

<script lang="ts">
import FilterOption from '@/common/components/filter/index.vue';
import { defineComponent } from 'vue';
import { handleFilter, InputList, SelectList } from '@/common/setup/filter';
export default defineComponent({
    name: 'check-out-in-filter-table',
    components: {
        FilterOption,
    },
    props: {
        inOrOut: {
            type: String,
            default: 'in',
        },
    },
    setup(props, context) {
        // 入库过滤类型
        const inList = [
            { value: 1, lable: '采购入库' },
            { value: 3, lable: '生产入库' },
        ];
        // 出库过滤类型
        const outList = [
            { value: 2, lable: '销售出库' },
            { value: 4, lable: '生产出库' },
        ];
        const select: SelectList[] = [
            {
                value: undefined,
                key: 'contracttype',
                placeholder: '全部合同类型',
                list: [
                    { value: 1, lable: '采购' },
                    { value: -1, lable: '销售' },
                ],
            },
            {
                value: undefined,
                key: 'inouttype',
                placeholder: props.inOrOut === 'in' ? '全部入库类型' : '全部出库类型',
                list: props.inOrOut === 'in' ? inList : outList,
            },
        ];
        const input: InputList[] = [
            { value: '', placeholder: '模糊搜索对手方', key: 'buyusernameOrsellusername' },
            { value: '', placeholder: '模糊搜索合同编号', key: 'contractno' },
            { value: '', placeholder: '模糊搜索现货品种', key: 'deliverygoodsname' },
        ];
        return {
            ...handleFilter(select, input, context),
        };
    },
});
</script>

<style lang="less">
</style>;
