<template>
  <!-- 过滤客户资料表格 -->
  <Filter @update="update">
    <a-select label-in-value
              class="conditionSelect ml10"
              style="width: 120px"
              v-model:value="selectedMd"
              @change="mdChange"
              placeholder="全部套保品种">
      <a-select-option v-for="item in middleGoods"
                       :key="item.lable">
        {{item.lable}}
      </a-select-option>
    </a-select>
    <a-button class="selectBtn">查询</a-button>
    <a-button class="selectBtn"
              @click="reset">重置</a-button>
  </Filter>
</template>

<script lang="ts">
import FilterOption from '@/common/components/filter/index.vue';
import { defineComponent } from 'vue';
import { ref } from 'vue';
import Filter from '../../../components/filter/index.vue';
import { handlMiddleGoods } from '@/views/report/setup';
import { initData } from '@/common/methods';

export default defineComponent({
    name: 'exposure-filter-table',
    components: { FilterOption, Filter },
    setup(props, context) {
        const { middleGoods, getTBList } = handlMiddleGoods();
        function update(value: any) {
            context.emit('update', value);
        }
        const selectedMd = ref(undefined);
        function mdChange(id: any) {
            context.emit('filter', { middlegoodsname: [id.key ? String(id.key) : ''] });
        }
        function reset() {
            selectedMd.value = undefined;
            mdChange('');
        }
        initData(() => {
            getTBList();
        });
        return {
            mdChange,
            reset,
            middleGoods,
            update,
            selectedMd,
        };
    },
});
</script>

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

