QueryForm 查询表单

用于表单查询,封装了多种类型的表单控件。

视图

Alt text

代码

<template>
  <div class="content-container">
    <query-form ref="queryTable"
                :form-fields="formFields"></query-form>
  </div>
</template>

<script>
export default {
    data () {
        return {
           formFields: [
                 {
                   label: '姓名',
                   placeholder: '请输入姓名',
                   columnName: 'name'
                 },
                 {
                   label: '昵称',
                   placeholder: '请输入昵称',
                   columnName: 'nickname'
                 },
                 {
                   label: '年龄',
                   placeholder: '请输入年龄',
                   columnName: 'age'
                 },
                 {
                   label: '性别',
                   type: 'select',
                   placeholder: '请选择性别',
                   columnName: 'select',
                   options: [
                     {
                       value: 0,
                       label: '全部'
                     },
                     {
                       value: 1,
                       label: '男'
                     },
                     {
                       value: 2,
                       label: '女'
                     }
                   ]
                 },
                 // 下拉框
                 {
                   label: '下拉框',
                   type: 'select',
                   placeholder: '请选择下拉框',
                   columnName: 'select1',
                   multiple: true,
                   options: [
                     {
                       value: 1,
                       label: '你好1'
                     },
                     {
                       value: 2,
                       label: '你好2'
                     }
                   ]
                 }
               ],
        }
    }
}
</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

Attributes

参数 说明 类型 可选值 默认值
formFields 参数 Array

QueryForm Events

事件名 说明 参数
getModel 当用户手动点击查询触发的事件 model

FormFields Attributes

参数 说明 类型 可选值 默认值
label string
type 类型 string 详情如下: text
placeholder 占位文本 string
columnName 对应字段 string
options type = select 时下拉选项 array
data type = selectTree 时下拉选项 array
props type = selectTree 配置选项 详情看 el-tree 插件 object
show 是否隐藏 boolean true/false true
defaultValue 默认值
multiple type = select 下拉框时可配置 false true / false
load 加载子树数据的方法,仅当 lazy 属性为true 时生效 function(node, resolve)
lazy 是否懒加载子节点,需与 load 方法结合使用 boolean true / false

FormFields Type Attributes

说明
text 纯文本框
select 下拉框
daterange 日期选择器
datetimerange 事件选择器
selectTree 下拉树
最后更新时间: 9/12/2019, 4:36:24 PM