<template>
  <!-- 过滤 -->
  <div class="filterTable">
    <a-range-picker v-model:value="date"
                    class="commonPicker"
                    style="width: 200px"
                    :show-time="{hideDisabledOptions: true}"
                    format="YYYY-MM-DD" />
    <FilterOption :selectList="selectList"
                  :inputList="inputList"
                  :fixedBtnList="fixedBtnList" />
    <slot></slot>
  </div>
</template>

<script lang="ts">
import FilterOption from '@/common/components/filter/index.vue';
import { defineComponent, ref } from 'vue';
import { handleFilter, handleTimeFilter, InputList, SelectList } from '@/common/setup/filter';
import { Moment } from 'moment';
import { inOrOutStatus, getApplyStatus } from '../../setup';

export default defineComponent({
    name: 'filter-withdrawal_review',
    components: { FilterOption },
    setup(props, context) {
        const date = ref<Moment[]>([]);
        const select: SelectList[] = [
            {
                value: ref({ value: inOrOutStatus.wait }),
                key: 'applystatus',
                placeholder: '全部状态',
                list: [
                    { value: inOrOutStatus.wait, lable: getApplyStatus(inOrOutStatus.wait) },
                    { value: inOrOutStatus.success, lable: getApplyStatus(inOrOutStatus.success) },
                    { value: inOrOutStatus.refuse, lable: getApplyStatus(inOrOutStatus.refuse) },
                ],
            },
        ];
        const input: InputList[] = [{ value: '', placeholder: '模糊搜索账号', key: 'accountcode' }];
        // 范围时间内过滤
        const { getFilterRangeTime } = handleTimeFilter('reqtime');
        const { selectList, inputList, fixedBtnList } = handleFilter(select, input, context, getFilterRangeTime(date));
        return {
            date,
            selectList,
            inputList,
            fixedBtnList,
        };
    },
});
</script>

<style lang="less">
.filterTable {
    .commonPicker.ant-calendar-picker {
        display: inline-flex;
        padding-top: 9px;
        padding-bottom: 6px;
        margin-right: 10px;
        .ant-input {
            border: 0;
            background: @m-grey9;
        }
    }
}
</style>;
