Yb-components Yb-components
首页
开发规范
yb-cli
  • 开发指南
  • 更新日志
  • 组件
关于
首页
开发规范
yb-cli
  • 开发指南
  • 更新日志
  • 组件
关于
  • 开发指南
  • 更新日志
  • 数据展示

    • YbTable 表格
    • YbCardList 卡片列表
    • YbTree 树
    • YbCascaderList 级联列表
    • YbSimpleTablePage 分页查询表格
    • YbSimpleCardPage 分页卡片列表
    • YbBasicProfile 基础详情数据展示
    • YbOutscrollLayout 固定在滚动区域外
    • YbOutscrollTree 固定在滚动区域外的Tree
    • YbInfoLayout 信息页布局
    • YbEditLayout 编辑页布局
  • 数据录入

    • YbRowsPopoverForm 浮层多行表单
    • YbFormily 配置式表单
    • YbForm 表单
    • YbRowsForm 多行表单
    • YbCollapseForm 折叠表单
    • YbQueryFilter 筛选表单
      • YbFilesSelect 文件选择器
      • YbRangeWrapper 范围结构
      • YbRangeDatepicker 日期范围
      • YbRange 范围
      • YbFormulaInput 简单运算公式输入
      • YbCron 表达式生成器
      • YbTreeSelect 树型选择器
      • YbInputgroupWrapper 复合组
      • YbThemeSelect 主题风格选择器
      • YbSelect 选择器
      • YbPaginationSelect 分页选择器
      • YbCodemirror 代码编辑器
      • YbCodemirrorSql SQL编辑器
      • YbCodemirrorJson JSON编辑器
      • YbCodemirrorXml XML编辑器
      • YbCombiDatepicker 组合时间
      • YbQuarterPicker 季度选择器
      • YbRangeQuarterPicker 季度范围选择器
      • YbConditionSelect 条件选择器
      • YbCheckboxGroup 多选框组
      • YbIconSelect 选择器
      • YbTagsInput 标签输入框
    • 其他组件

      • YbBallLoading 加载中
      • YbSymbolIcon 多色小图标
      • YbKeybuttonsPopover
      • YbPercentBattery 电池百分比
      • YbAffix 固钉
      • YbPagination 分页器
      • YbCollapse 折叠面板
      • YbScrollTool 滚动工具
    • 物料

      • YbMainSideMenu 侧栏菜单
      • YbLoadRemote 远程应用加载
      • YbLayoutPro 布局
      • YbMainPro 主页
      • YbAppMain 应用主页
      • YbAppLogin 普通登录页
      • YbAppPortal Portal登录页
    • 指令

      • v-fixed-in-scroller
    • Mixins

      • pageList_mixin
      • getScopedSlot_mixin
      • editFormPage_mixin
      • uploadProgressPage_mixin
      • rowActions_mixin
      • rowDeletes_mixin
      • drawerToRouterTab_mixin
    • 实验室

      • YbSwiper 轮播
    • 组件
    • 数据录入
    liaoyingmin
    2023-02-08

    YbQueryFilter 筛选表单

    结合 yb-form 设计筛选表单,目前用于 yb-simple-table-page 与 yb-simple-card-page 的筛选表单使用

    # 基本使用

    collapsed
    <template>
        <div style="margin-bottom:20px">
            collapsed
            <el-switch v-model="collapsed"></el-switch>
        </div>
        <yb-query-filter
            ref="form"
            :searchForm="searchForm"
            v-model="formModel"
            @search="handleSearch"
            :defaultRowsNumber="2"
            :collapsed.sync="collapsed"
        >
            <template v-slot:formItems="{ formModel, formItem }">
                <el-input v-model="formModel[formItem.prop]" clearable></el-input>
            </template>
        </yb-query-filter>
    </template>
    <script>
        export default {
            data() {
                return {
                    collapsed: true,
                    searchForm: {
                        formItems: [
                            {
                                label: '病案号',
                                prop: 'medicalRecordNumber',
                            },
                            {
                                label: '姓名',
                                prop: 'patientName',
                                defaultValue: '1',
                                autoSearch: false,
                            },
                            {
                                label: '信息分类',
                                prop: 'projectTypeName',
                            },
                            {
                                label: '地区',
                                prop: 'area',
                            },
                            {
                                label: '指标名称',
                                prop: 'name',
                            },
                            {
                                label: '指标内容',
                                prop: 'content',
                            },
                            {
                                label: '指标类型',
                                prop: 'type',
                            },
                            {
                                label: '指标状态',
                                prop: 'status',
                            },
                        ],
                        spans: { xl: 8, lg: 12 },
                    },
                    formModel: {},
                };
            },
            methods: {
                handleSearch() {
                    this.$alert(this.formModel);
                },
            },
        };
    </script>
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    显示 复制 复制

    # 插槽使用

    • 查询表单的插槽,同 yb-form 插槽使用
    • 在默认的查询与重置按钮后追加内容的插槽:"searchFormButtonsAppended"
    <template>
        <yb-query-filter
            ref="form"
            :searchForm="searchForm"
            v-model="formModel"
            @search="handleSearch"
        >
            <template v-slot:formItems="{ formModel, formItem }">
                <el-input v-model="formModel[formItem.prop]" clearable></el-input>
            </template>
            <template v-slot:patientName="{ formModel, formItem }">
                <el-date-picker
                    type="date"
                    placeholder="选择日期"
                    v-model="formModel[formItem.prop]"
                ></el-date-picker>
            </template>
            <template v-slot:other-buttons="">
                <el-button type="primary">新增</el-button>
                <el-button type="primary">导入</el-button>
            </template>
            <!-- 默认的查询与重置按钮后追加内容的插槽 -->
            <template v-slot:searchFormButtonsAppended="{ formModel, formItem }">
                <el-button type="danger">全部删除</el-button>
            </template>
        </yb-query-filter>
    </template>
    <script>
        export default {
            data() {
                return {
                    searchForm: {
                        formItems: [
                            {
                                label: '病案号',
                                prop: 'medicalRecordNumber',
                            },
                            {
                                label: '姓名',
                                prop: 'patientName',
                            },
                            {
                                label: '',
                                prop: 'other-buttons',
                                // 排放在默认的查询按钮之后
                                after: true,
                                // 调整单独的栅栏占格
                                spans: { xl: 5, lg: 5, md: 5 },
                            },
                            {
                                /**
                                 * 默认查询按钮项的属性:
                                 * {
                                 *      label: '',
                                 *      prop: 'searchFormButtons',
                                 *      excludeSpans: true,
                                 * }
                                 * 可进行覆盖追加属性
                                 */
                                prop: 'searchFormButtons',
                                excludeSpans: false,
                                // 调整单独的栅栏占格
                                spans: { xl: 6, lg: 6, md: 6 },
                            },
                        ],
                        spans: { xl: 6, lg: 8 },
                    },
                    formModel: {},
                };
            },
            methods: {
                handleSearch() {
                    console.log(this.formModel);
                },
            },
        };
    </script>
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    显示 复制 复制

    # YbQueryFilter Attributes

    参数 说明 类型 可选值 默认值
    searchForm 筛选条件配置,详细配置 SearchForm object -- --
    showCollapse 是否显示折叠器 boolean -- true
    defaultRowsNumber 自定义折叠状态下默认显示的表单控件行数,没有设置或小于 0,则显示两行控件,不包含查询重置按钮 number -- 2
    collapsed 是否折叠状态,支持.sync 修饰符 boolean -- true
    v-model/value 表单值 object -- --

    # YbQueryFilter SearchForm Attributes

    参数 说明 类型 可选值 默认值
    autoSearch 改变表单值,是否自动调用查询事件,当配置为 false 时,formItems 中配置 autoSearch 将无效 boolean -- true
    formItems 查询表单项的配置,详细配置 FormItems object[] -- []
    formClass 查询表单 className string -- --
    formStyle 查询表单样式 object -- --
    spans 查询表单占格,如果是 object 类型,将与默认的{ xl: 4,lg: 6,md: 8,sm: 12, xs: 24}进行合并,总占格数为 24 boolean -- false

    # YbQueryFilter FormItems Attributes

    参数 说明 类型 可选值 默认值
    autoSearch 改变该字段值,是否自动调用查询事件 boolean -- true
    after 是否渲染在重置按钮之后 boolean -- true
    - 同yb-form 的 formItems object -- --

    # YbQueryFilter Methods

    事件名称 说明 回调参数
    getYbForm 取得 yb-form 的组件实例 --

    # YbQueryFilter Events

    事件名称 说明 回调参数
    search 查询事件 value
    change 筛选条件展开,收起点击后事件 {collapsed, formModel}
    - 其他事件,同el-form (opens new window) --
    上次更新: 2023/02/27, 18:52:11
    YbCollapseForm 折叠表单
    YbFilesSelect 文件选择器

    ← YbCollapseForm 折叠表单 YbFilesSelect 文件选择器→

    Theme by Vdoing | Copyright © 2021-2025 YB-GZ | MIT License
    • 跟随系统
    • 浅色模式
    • 深色模式
    • 阅读模式