### 通用筛选器

常用于管理端表格上方筛选过滤，基本用法<br />
> <ve-filtrate ...></ve-filtrate> <br />
> 支持传入一个配置项filtrates用来设置过滤条件 <br />
> 加载默认会执行一次submit事件，若不想执行可通过属性 :defSubmit="false" 去除<br />
> 如果存在@reset="reset1"则重置事件会走自定义的reset1方法，否则走submit事件<br />
> 对于select类型，如果不需要全部选项，使用property:{noplease:true} 设置，此时必需有default默认选择值<br />
> 节点的data或者getData为选择的数据。 (可支持异步回调 getData return的是一个promise)<br />

:::demo

```html

<template>
    <ve-filtrate ref="veFiltrate" :advanced="true" :filtrates="filtrates" @submit="query"
                 :searchLoading="searchLoading"></ve-filtrate>
</template>

<script>
    export default {
        data() {
            return {
                result: {},  // 筛选条件汇总结果，过滤参数
                searchLoading: false,    // loading效果
                tableData: [],  // 下方表格数据
                filtrates: [   // 过滤筛选配置项
                    {
                        type: "text", label: "文字展示", key: "text",
                        property: {name: "name"},
                        default: {id: "123", name: "只读文字123"}
                    },
                    {
                        type: "input", label: "文字输入框", key: "userName",
                        property: {type: "input"},
                        default: "需要就给我赋值"
                    },
                    {
                        type: "input", label: "数字输入框", key: "numValue",
                        property: {type: "number"},
                        default: 456
                    },
                    {
                        type: "inputRange", label: "数字区间", key: "inputRange",
                        property: {unit: "%"},
                        default: {}
                    },
                    {
                        type: "filterSelect", label: "单选可搜索", key: "filterSelect",
                        getData: function getData() {
                            return {
                                1: '启用', 0: '禁用'
                            };
                        },
                        property: {filterable: true},
                        default: ""
                    },
                    {
                        type: "doubleSelect", label: "混合选项1", key: "doubleSelect",
                        getData: function getData() {
                            return [
                                {1: '启用1', 0: '禁用1'},
                                {1: '启用2启用2启用2启用2', 0: '禁用2禁用2禁用2禁用2'}
                            ]
                        },
                        property: {filterable: true},
                        default: [1, ["0"]]
                    },
                    {
                        type: "doubleSelectRemote",
                        label: "混合选项2",
                        key: "doubleSelectRemote",
                        getData: function getData() {
                            return {1: '启用1', 0: '禁用1'}
                        },
                        property: {
                            filterable: true,
                            props: {label: "name", value: "id"},
                            remoteMethod: function remoteMethod(item, query) {
                                item.options = [{
                                    id: 132, name: 'name'
                                }];
                            }
                        }
                    },
                    {
                        type: "selectCascader",
                        label: "混合选项3",
                        key: "selectCascader",
                        getData: function getData() {
                            return [
                                {1: '启用1', 0: '禁用1'},
                                USSD.getProjectTree()
                            ];
                        },
                        property: {
                            filterable: true,
                            props: {label: "name", value: "id", children: "children", multiple: true}
                        }
                    },
                    {
                        type: "selectInput", label: "选择输入", key: "selectInput", getData: function getData() {
                            return {1: '启用', 0: '禁用'};
                        },
                        property: {
                            clearable: true},
                            immediateChange: true,
                            default: {input: "12", select: "1"}
                        },
                    {
                        "type": "filterCheckSelect",
                        "label": "多选可搜索",
                        "key": "filterCheckSelect",
                        "getData": function getData() {
                            return {
                                "1": '启用', "0": '禁用'
                            };
                        },
                        "property": {
                            "filterable": true
                        },
                        "default": []
                    },
                    {
                        "type": "filterCheckSelect", "label": "多选可搜索", "key": "filterCheckSelect1", "property": {
                            "type": "remote", "placeholder": "请输入自定义文字", "props": {
                                "label": "className", "value": "classId"
                            },
                            "clearable": true, "remoteMethod": function remoteMethod(item, query) {
                                item.options = {};
                                if (query) {
                                    item.options = COMMONAPI.lcgClassListSync(query);
                                }
                            }
                        },
                        "default": []
                    },
                    {
                        "type": "remoteSelect", "label": "搜索选择", "key": "remoteSelect", "property": {
                            "placeholder": "请输入自定义文字", "props": {
                                "label": "className", "value": "classId"
                            },
                            "remoteMethod": function remoteMethod(item, query) {
                                if (query) {
                                    item.options = COMMONAPI.lcgClassListSync(query);
                                } else {
                                    item.options = {};
                                }
                            }
                        }
                    },
                    {
                        "type": "select", "label": "是否禁用", "key": "isDisabled", "getData": function getData() {
                            return {
                                1: 123
                            };
                        },
                        "property": {}, "change": function change(model, itemMap) {
                            var child = itemMap["userName"];
                            child.model = model;
                            // console.log(model);
                            // child.show=false;
                            // this.data={1:123,2:456};
                            // this.refire();
                            child.refire();
                            child.before({
                                type: "input", label: "输入框new", key: "userName111", property: {
                                    type: 'input'
                                },
                                default:
                                    '输入框new'
                            });
                        },
                        "default": ""
                    },
                    {
                        "type": "treeSelectStrictly",
                        "label": "树状单选择",
                        "key": "treeSelectStrictly",
                        "getData": function getData() {
                            return USSD.getProjectTree();
                        },
                        "property": {
                            "props": {
                                "label": "name", "value": "id", "children": "children"
                            }
                        },
                        "default": "PROJECT20191126010000000023"
                    },
                    {
                        "type": "treeSelect", "label": "树状子节点", "key": "treeSelect", "getData": function getData() {
                            return USSD.getProjectTree();
                        },
                        "property": {
                            "props": {
                                "label": "name", "value": "id", "children": "children"
                            }
                        },
                        "default": "PROJECT20191126010000000023"
                    },
                    {
                        "type": "treeCheckSelect",
                        "label": "树状多选择",
                        "key": "treeCheckSelect",
                        "getData": function getData() {
                            return USSD.getProjectTree();
                        },
                        "property": {
                            "leafOnly": false, "props": {
                                "label": "name", "value": "id", "children": "children"
                            }
                        },
                        "default": ["PROJECT20191126010000000023"]
                    },
                    {
                        "type": "selectDialog", "label": "选择标签", "key": "userTagSelect", "property": {
                            "type": "userTagSelect"
                        },
                        "default": {}
                    },
                    {
                        "type": "selectDialog", "label": "选择班级", "key": "classSelect", "property": {
                            "type": "classSelect"
                        },
                        "default": {}
                    },
                    {
                        "type": "selectDialog", "label": "选择产品班级", "key": "productClassCheck", "property": {
                            "type": "productClassCheck"
                        },
                        "default": []
                    },
                    {
                        "type": "selectDialog", "label": "选择班型", "key": "classTypeCheck", "property": {
                            "type": "classTypeCheck", "schoolId": "", "projectId": "", "projectYear": ""
                        },
                        "default": []
                    },
                    {
                        "type": "datePicker", "label": "年月日", "key": "datePicker", "default": "2019-02-03"
                    },
                    {
                        "type": "datePickerYear", "label": "年份", "key": "datePickerYear", "property": {
                            "pickerOptions": {}
                        },
                        "default": "2021"
                    },
                    {
                        "type": "rangePicker", "label": "起止日期", "key": "receiptDate", "property": {
                            "startPlaceholder": "开始时间", "endPlaceholder": "结束时间", "separator": "至"
                        },
                        "default": {
                            "start": "2020-05-19", "end": "2020-06-22"
                        }
                    },
                    {
                        "type": "rangePicker", "label": "起止日期(范围)", "key": "receiptDate1", "property": {
                            "startPlaceholder": "开始时间",
                            "endPlaceholder": "结束时间",
                            "separator": "至",
                            "minDate": "2020-09-02",
                            "maxDate": "2020-09-20"
                        }
                    },
                    {
                        "type": "rangePicker", "label": "起止月份", "key": "receiptMonth", "property": {
                            "type": "monthrange"
                        },
                        "default": {}
                    },
                    {
                        "type": "rangePickerSingle",
                        "label": "起止日期独立",
                        "key": "rangePickerSingle",
                        "property": {},
                        "default": {}
                    },
                    {
                        "type": "rangePickerSingle", "label": "起止日期独立(范围)", "key": "rangePickerSingle1", "property": {
                            "startPlaceholder": "开始时间",
                            "endPlaceholder": "结束时间",
                            "separator": "至",
                            "minDate": "2020-09-02",
                            "maxDate": "2020-09-20"
                        }
                    },
                    {
                        "type": "rangePickerSingle", "label": "起止时间独立", "key": "timerangePickerSingle", "property": {
                            "type": "time", "minDate": "2020-09-02", "maxDate": "2020-09-20"
                        },
                        "default": {
                            "start": "2020-09-03 00:00:00", "end": "2020-09-18 23:59:59"
                        }
                    },
                    {
                        "type": "pickerSelect", "label": "快捷时间选择", "key": "selectPicker", "property": {
                            "type": "selectPicker", "options": [{
                                "label": "本月", "model": {
                                    "start": "2020-09-01", "end": "2020-09-31"
                                }
                            },
                                {
                                    "label": "今年", "model": {
                                        "start": "2020-01-01", "end": "2020-12-31"
                                    }
                                }]
                        },
                        "fullLine": true, "default": {
                            "start": "2020-09-16", "end": "2020-09-24"
                        }
                    },
                    {
                        "type": "pickerSelect", "label": "限制范围时间选择", "key": "selectPickerLimit", "property": {
                            "type": "selectPickerLimit", "options": [{
                                "label": "本月", "model": {
                                    "start": "2020-09-01", "end": "2020-09-31"
                                }
                            },
                                {
                                    "label": "今年", "model": {
                                        "start": "2020-01-01", "end": "2020-12-31"
                                    }
                                }], "autoSet": true
                        }
                    },
                    {
                        "type": "treeSelect",
                        "label": "项目",
                        "key": "projectId",
                        "immediateChange": true,
                        "getData": function getData() {
                            return USSD.getProjectTree();
                        },
                        "property": {
                            "props": {
                                "label": "name", "value": "id", "children": "children"
                            }
                        },
                        "default": "",
                        "change": function change(mode, itemMap) {
                            console.log(mode, itemMap);
                            var child = itemMap["subjectId"];
                            child.model = '';
                            child.getData = function () {
                                return USSD.getSubsByProId(mode);
                            };
                            child.refire();
                            var classTypeItem = itemMap["classTypeCheck"];
                            classTypeItem.property.projectId = mode;
                            classTypeItem.property.studentclassYear = '2020';
                            classTypeItem.property.dptId = 'DPT20200409010000004155';
                            classTypeItem.default = [];
                            classTypeItem.refire();
                            var tableItem = itemMap["userTagSelect"];
                            tableItem.model = [];
                            tableItem.refire();
                        }
                    },
                    {
                        "type": "filterSelect", "label": "科目", "key": "subjectId", "getData": function getData() {
                            return {};
                        },
                        "property": {
                            "filterable": true
                        },
                        "default": ""
                    }],
            }
        },
            methods: {
                query(result)
                {
                    console.log(result)
                    this.result = result
                    this.searchLoading = true;
                    this.getTableData(this.result)  // 根据条件请求表格数据
                    // 查询结束后，关闭loading效果，
                    this.searchLoading = false;
                }
            ,
                getTableData(obj)
                {
                    console.log(obj)
                }
            }
        }
</script>
```

:::

### Attributes

| 参数      | 说明          | 类型      | 可选值                           | 默认值  |
|---------- |--------------                        |---------- |------      |--------
| little    |  设置筛选项目比较少的筛选样式             | Boolean    | true,false | false
| advanced  |  是否展开显示所有                       | Boolean    | true,false | false
| filtrates |  过滤条件配置项                        | obj         |            |

### Slot

```
<ve-filtrate ...>
	<el-button slot="primaryPrv" @click="MsgBox.alert('点击更多条件')">更多条件</el-button>
	<el-button slot="dashedNext" @click="MsgBox.alert('点击高级筛选')">高级筛选</el-button>
</ve-filtrate>
```

| 插槽名称        | 说明      |
|----------      |--------  |
| primaryPrv     | 更多条件  |
| dashedNext     | 高级筛选  |

### Events

| 事件名称    | 说明     |
|---------- |-------- |
| submit    | 默认会执行一次，可通过添加 :defSubmit="false" 去除
