美文网首页
普通表单(可复用)使用总结(内部使用)

普通表单(可复用)使用总结(内部使用)

作者: newszhu | 来源:发表于2020-06-24 15:26 被阅读0次

参考的文件

标题控制:

  • id: '模块id',例如:dont_post_view1
  • name: '模块标题',例如:***信息
  • open: false, 初始是否是展开的
  • pages:[] 此模块下的项目
  • showby:'identityType,=,1' 展示的条件,默认展示

showby总结: 下面符合条件的时候展示控件或内容:

-  三个一组,同一个用逗号隔开。例如 : 'identityType,=,1'
- ||  或条件
- &&  且条件
- 都是逗号,是 且(&&)
- show  是否在展示 例如:'g29,show,true'
- =当值等于的时候 
- \> 当值大于的时候
- < 当值小于的时候
- <> 当不等于的时候
- in  当值在 后面的范围内,范围用 '| '分割 例如:'g19,in,G19_5|G19_6|G19_7'
- include  当值包含后面的时候返回true
- notinclude  当值不包含的时候 
- empty 当值为空/非空的时候  例如:'kfxqNum,empty,false''kfxqNum,empty,true'

  • showrelation :给这个组件打上标签,减少showby的调用。 例如:
{
                name: '11',
                type: 'radio',
                field: 'g39',
                showby: "o14,>,5,g7,=,G7_2",
                showrelation: ['g7','g8'],
                label1: '是',
                label2: '否',
                value1: 'G39_1',
                value2: 'G39_2',
            }

给 这个控件打上'g7'  'g8' 标签,当g7或者g8变化的时候才会计算这个控件的showby.。 如果不加,其他任何控件变化都要重新计算这个控件的显隐

子项控制

  • name:控件的名称
  • field : 控件对应的字段
  • showby: 同上
  • showrelation : 同上
  • style :动态样式,这个是直接设置的动态行间样式,所以要依据规范来写 例如:style: 'width:40%',
  • notrequired:是否是非必填项 boolean类型 例如: notrequired: true,
  • notsubmit : 是否不提交, boolean 不提交就设置为true,否则不需要设置
  • readonly : 是否只读 boolean 默认false
  • type :组件的类型,通过这个组件来进行匹配,可自定义,然后进行使用即可
    目前有:title text images roster select radio date sysdict sysdict-multi
  • type==radio 只支持两个,默认 是(1)否(2)
    • label1 value1 第一个选项的
    • label2 value2 第一个选项的 例如:
{
                name: '现常住地址',
                type: 'radio',
                label1: '市内',
                label2: '市外',
                value1: 'R_2',
                value2: 'R_1',
                field: 'changzhuAddressButongType',
                showby: "changzhuAddressType,=,R_2",
                showrelation: ['changzhuAddressType']
            }
  • type==select 单选列表 此用法较复杂,自己细品。其实这种特定的组件的参数设置,就和你定义组件时的想法有关了,此处主要作用就是传值
    • list :[] 备选项 例如:
{

               name: '<span style="color:#ff0000">[标识]</span>就读学校',
               subname: '(subname)',
               nameadd: '<span style="color:#ff0000">[标识]</span>',
               nametip: 'nametip,
               type: 'select',
               field: 'g14',
               showby: 'o14,<,15||g13,>,G13_1',
               showrelation: ['o14', 'g13', 'g12'],
               notrequired: true,
               relations: [{
                       where: 'g16,show,true,this,>,&&g16,<>,G16_2||g19,<>,G19_1',
                       then: [{
                               op: 'tip&goon',
                               tip: 'tip',
                           },
                           {
                               op: 'force-set',
                               field: 'g16',
                               value: 'G16_2',
                           },
                           {
                               op: 'force-set',
                               field: 'g19',
                               value: 'G19_1'
                           }
                       ]
                   },
                   {
                       where: 'this,=,,g19,=,G19_1',
                       then: {
                           op: 'force-set',
                           field: 'g19',
                           value: ''
                       }
                   },
                   {
                       where: 'this,=,,g16=,G16_2',
                       then: {
                           op: 'force-set',
                           field: 'g16',
                           value: ''
                       }
                   }
               ],
               list: [{
                       name: '不填报此项',
                       value: ''
                   },
                   {
                       value: 'G14_1',
                       name: '普通'
                   },
                   {
                       value: 'G14_2',
                       name: '特殊'
                   }
               ]
           }
  • type==multi-select :
    • maxchecked:当type==multi-select 时有这个字段, 标识最多选几个 例如:
                name: 'name',
                subname: '(按数量从多到少,择1-3条)',
                type: 'multi-select',
                showby: "g7,=,G7_2",
                showrelation: ['g7'],
                maxchecked: 3,
                field: 'shouruly',
                list: [{
                        value: 'R_1',
                        name: '工资收入'
                    }]
  • maxlength :最大长度 int 例如:maxlength: 10
  • validate : 格式验证 array[] 例如:
    validate:[{
                    checkType: 'cn',
                    errorMsg: '联系人姓名只能填写中文'
                }] 
  • placeholder:占位符 默认 请输入 +name 例如:placeholder: '请继续输入小区、单元、门牌号等信息',

  • subname : 跟在name后面 例如:subname: '(20周岁及以上填报)',

  • required_relation: 相关连的一项 最多两项,提示两项最少选一项 例如:required_relation: 'g6B', 此项和g6不能同时为空

  • relations:选中后的关联操作 arry类型 。 例如:

{
                name: 'name',
                type: 'radio',
                label1: 'label1',
                label2: 'label2',
                value1: 'G3_1',
                value2: 'G3_2',
                field: 'g3',
                relations: [{
                    where: 'this,=,G3_2,g27A_g27B,include,G27B_6', //规则和showBy一致,不过作用是返回true和false
                    then: [{   //进行的操作
                        field: 'g27A_g27B',
                        op: 'force-remove',
                        value: 'G27B_6'
                    }]
                }, {
                    where: 'true',
                    then: [{
                        field: 'jiti',
                        op: 'force-set',
                        value: '',
                        comprelations: 'true'// 当op是 force-set,这个字段为true,会将field 设置为value
                    }]
                }],
            }
  • op的介绍:
    • tip&stop 停止操作并给出提示 例如:
{
                        where: 'this,<>,G8_1,dbType,=,1',
                        then: {
                            op: 'tip&stop',
                            tip: 'tip',
                        }
                    }
  • config-add :给这个的控件增加配置 将field 控件的的 value 设置为true 例如:
{
                       op: 'config-add',
                       field: 'g43',
                       value: 'notrequired'
                   }
  • config-remove : 移除一条 配置 例如:
{
                        op: 'config-remove',
                        field: 'g43',
                        value: 'notrequired'
                    }
  • tip&goon :提示,并且继续运行 例如:
{
                        op: 'tip&goon',
                        tip: 'tip',
                    }
  • confirm :确认是否继续进行 例如:
{
                               op: 'confirm',
                               tip: 'tip',
                           }
  • force-set : 强制设置
  • force-add :强制添加 和 例如:将 field字段中,添加value
then: [{
                        op: 'tip&goon',
                        tip: 'tip',
                    }, {
                        op: 'force-add',
                        forceremove: 'G27A_5',
                        field: 'g27A_g27B',
                        value: 'G27B_3'
                    }]
  • force-remove :强制移除 例如:
then: [{
                       field: 'g27A_g27B',
                       op: 'force-remove',
                       value: 'G27B_6'
                   }]
  • plusfield :在获取上传数据的时候,如果表单中的数据不为空,则将表单中plusfield的值赋值给待提交数据的plusfield 例如:
{
                name: 'name',
                type: 'multi-select-plus',
                field: 'peixunWxq_peixunXq',
                showby: 'o14,>,15,o14,<,60,g7,=,G7_2',
                showrelation: ['g7', 'o14'],
                plusfield: 'peixunXqQt',
}

相关文章

网友评论

      本文标题:普通表单(可复用)使用总结(内部使用)

      本文链接:https://www.haomeiwen.com/subject/ohirfktx.html