1. 概述

我们的表单设计,除了做一些简单的配置之外,用户也可以,通过开发来实现一些特殊的功能。下面就介绍下,表单的基本开发功能说明。

2. 表单数据结构

在做表单开发之前,我们需要最重要的是需要熟悉一下表单的数据结构,在设计的时候,我们可以通过预览,查看表单的数据结构。

2.1 表单数据结构如下:

{
  //主表字段
  "name": "老张",
  //单值多选
  "type": "a,b",
  //双值单选多选
  "favorite": "{\"label\":\"aa\",\"value\":\"a\"}",
  //一对多子表初始化数据
  "initData": {
    //合同子表初始数据
    "contracts": {
      "selected": true,
      "name": "",
      "total": ""
    }
  },
  //一对一子表
  "sub__linkman": {
    "name": "张三",
    "mobile": "15013092848"
  },
  //一对多子表
  "sub__contracts": [
    {
      "selected": false,
      "name": "苹果",
      "total": "200",
      "index_": "jsbjqpr780801"
    },
    {
      "selected": false,
      "name": "栗子",
      "total": "300",
      "index_": "ospevpi790979"
    }
  ]
}

2.2 表单权限结构数据

{
    "sub__contracts": {
        "total": "w",
        "name": "w",
        "tablerights": {
            "add": true,
            "edit": true,
            "editExist": true,
            "removeExist": true,
            "up": true,
            "down": true,
            "remove": true
        }
    },
    "buttons": {},
    "sub__linkman": {
        "name": "w",
        "mobile": "w",
        //子表权限
        "tablerights": {
            "add": true,
            "edit": true,
            "removeExist": true,
            "editExist": true,
            "up": true,
            "down": true,
            "remove": true
        }
    },
    "name": "w",
    "tabs": {},
    "type": "w",
    "favorite": "w"
}
权限 描述
w 可写
r 只读
none 无权限

3. 表单扩展开发

3.1 表单加载处理

http://doc.redxun.cn/docs/jpaas/formonload

3.2 表单提交前处理

http://doc.redxun.cn/docs/jpaas/formSubmit

3.3 自定义函数

http://doc.redxun.cn/docs/jpaas/customFunc

3.4 自定观察函数

有些情况下在数据变化的时候,我们需要进行观察,并做响应的一些逻辑处理,比如,我们在输入用户名的情况下,根据输入数据查询后端数据。

http://doc.redxun.cn/docs/jpaas/customWatch

http://doc.redxun.cn/docs/jpaas/watchCache

3.5 子表自定义函数

http://doc.redxun.cn/docs/jpaas/subtableFunc

文档更新时间: 2022-01-24 18:02   作者:zyg