NAV
json

ForForm API WIKI 文档

ForForm API WIKI 自定义表单接口文档

接口调用的参数格式

目前接口部分使用 HTTPBody 来进行参数传递,接口支持 application/jsonBody 格式

同时也支持 application/x-www-form-urlencoded 的 Body 格式

两种方式均需要在 Header 中注明内容类型的属性。

请勿使用from-data传递Payload

鉴权

获取APP_IDAPP_SECRET后,通过/api/auth/token接口获取token,将token通过 authorization Bearer token的形式传递,接口详情查看具体接口文档。

接口返回说明

第一层 http code返回码,目前常见返回码如下

Http code 说明
200 调用成功
304 本地资源为最新资源,无需从服务器获取
400 调用失败,返回自定义错误
401 鉴权失败
403 权限不足,没有调用权限
412 本地资源版本和服务器资源版本不一致,请刷新
500 服务器本身出错

第二层 接口返回内容中的status和error字段

对于status,我们有如下规定

错误说明

error(针对于APP端)

为字符串,会给出status的具体错误原因描述,可信赖字段,可直接展示至前端页面

errors (针对于PC端 用于表单验证)

为一个对象,会给出status的具体错误原因描述,这个字段适用于程序开发中的错误调试,不应该把他的返回内容作为代码逻辑判断的条件。也不应直接在前端页面显示。

示例

{
    "status": 1,
    "errors": {
        "account": " account 不能为空",
        "code": " code 不能为空"
    }
}

Etag介绍

详细文档

接口地址说明

http https
线下 http://47.112.148.159:8981
预发布
正式 待定

表单

获取表单配置

GET_FROM

获取表单配置

可以设置逻辑表单的组件:单项选择, 多项选择, 下拉单选, 下拉多选

可以设置动态数据的组件:下拉单选、下拉多选、级联选择, 联想输入

组件被关联后默认是隐藏,如果组件本身又设置了隐藏, 本身隐藏权重最大,永远不能显示

单选、多选、下拉选择的默认值必须从设置的选项里面选择,如果设置的默认值是选项之外的,客户端默认擦除默认值。

组件的配置项,如果用户没有配置的选项默认为空字符串

想要了解更多?请查看Etag介绍

HTTP Method

GET

HTTP Request

/api/form/{id}

Request Parameters Query

Request Parameters Body

Response Data

Response Schema

Title Description Type Tips
status 状态:0成功 非0失败 integer
errors status非0时,返回错误信息,键值对 object 参数验证错误
error 错误信息 message 逻辑错误
data 表单具体数据 Data object

Data Schema

Title Description Type Tips
id 表单ID integer
title 表单标题 integer
description 表单描述 string
modules 表单组件列表 []Module

Module Schema

Title Description Type Tips
id 组件ID integer
label 组件名称 string
field 字段值(用于表单提交) string
value 组件默认值 string
required 是否必填 bool
logic_id 组件逻辑ID 用来处理逻辑关系 integer
placeholder 占位符 bool
full_module 是否展示组件label bool
display 是否展示,组件初始状态 bool
editable 是否可编辑 bool
tips 组件提示 string
engine 组件引擎配置 Engine object
regx_list 组件校验规则列表 []Regx
resource 组件资源 []Resource
style 组件样式(现在没有数据,待定...) []Style

Engine Schema

Title Description Type Tips
name 引擎名称 string
config 引擎配置(键值对,服务端不关心具体内容) Config object ⚠️ 默认值为空对象{}不是null

Config Schema 参考可用Engine和对应配置目录:引擎配置项

Regx Schema

Title Description Type Tips
id 校验ID integer
name 校验规则名称 integer
expression 校验规则 string
error_message 错误提示 string

Resource Schema

Title Description Type Tips
id 资源ID integer
type 资源类型1本地资源 2远程资源 integer
title 资源名称 string
options 本地资源列表 []Option ⚠️ 远程资源(type=2)时,返回应空数组即可
api_setting 远程资源 ApiSetting object ⚠️ 本地资源(type=1)时,该值为null

Option Schema

Title Description Type Tips
label 资源名称 string
value 资源值1本地资源 2远程资源 string
event 事件 Event object ⚠️默认为null
logic_id 逻辑ID integer
p_logic_id 父逻辑ID integer ⚠️ 一级逻辑ID无父节点,默认是0
child_logic_ids 子逻辑节点 []integer
children 子逻辑节点 []Option ⚠️ 这里时递归引用

Event Schema

Title Description Type Tips
event_type 事件类型 show展示、disabled禁用 string
link_module 组件ID列表 []integer ⚠️ 应该是Module.logic_id

ApiSetting Schema

Title Description Type Tips
uri 资源地址 string
list_key 数据的下标 string
label_key 资源名称的下标 string
value_key 资源值的下标 string
children_key 子级数据下标 string
request_method 筛选时的请求方式 string
search_key 可收缩的字段 string

Response Data Json

{
  "status": 0,
  "data": {
    "id": 422,
    "name": "测试表单标题1",
    "description": "这是一条测试数据",
    "bg_img": "",
    "status": 0,
    "modules": [
      {
        "id": 1600,
        "form_id": 422,
        "required": false,
        "label": "oms测试组件1",
        "field": "1",
        "logic_id": 1,
        "tips": "oms测试组件1",
        "value": "1",
        "placeholder": "xxxx",
        "display": true,
        "editable": true,
        "resource": [
          {
            "type": 1,
            "api_settings": null,
            "options": [
              {
                "id": 758,
                "label": "a",
                "value": "a",
                "logic_id": 1,
                "p_logic_id": 0,
                "child_logic_ids": [
                  2
                ],
                "event": {
                  "event_type": "display_on",
                  "link_module": [
                    4,
                    5
                  ]
                },
                "children": [
                  {
                    "id": 759,
                    "label": "b",
                    "value": "b",
                    "logic_id": 2,
                    "p_logic_id": 1,
                    "child_logic_ids": [
                      3
                    ],
                    "event": {
                      "event_type": "display_off",
                      "link_module": [
                        4,
                        5
                      ]
                    },
                    "children": [
                      {
                        "id": 760,
                        "label": "c",
                        "value": "c",
                        "logic_id": 3,
                        "p_logic_id": 2,
                        "child_logic_ids": [],
                        "event": {
                          "event_type": "display_off",
                          "link_module": [
                            4,
                            5
                          ]
                        },
                        "children": []
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ],
        "regx_list": [
          {
            "id": 790,
            "name": "test",
            "expression": "/[一-龥豈-鶴]/",
            "error_message": "包含无效字符1"
          },
          {
            "id": 791,
            "name": "1111",
            "expression": "测试叔叔说",
            "error_message": "包含无效字符1"
          }
        ],
        "engine": {
          "name": "SimpleText",
          "config": {
            "minInputlength": "8",
            "maxInputlength": "10"
          }
        }
      },
      {
        "id": 1601,
        "form_id": 422,
        "required": false,
        "label": "oms测试组件1",
        "field": "2",
        "logic_id": 1,
        "tips": "oms测试组件1",
        "value": "1",
        "placeholder": "xxxx",
        "display": true,
        "editable": true,
        "resource": [
          {
            "type": 2,
            "api_settings": {
              "id": 154,
              "uri": "https://www.fastmock.site/mock/532e60f1fc8ce344d5709c8f022f5cc7/api/school/attendee",
              "list_key": "data",
              "label_key": "label",
              "value_key": "value",
              "children_key": "",
              "request_method": "POST",
              "search_key": "search"
            },
            "options": []
          }
        ],
        "regx_list": [
          {
            "id": 792,
            "name": "test",
            "expression": "/[一-龥豈-鶴]/",
            "error_message": "包含无效字符2"
          },
          {
            "id": 793,
            "name": "1111",
            "expression": "测试叔叔说",
            "error_message": "包含无效字符2"
          }
        ],
        "engine": {
          "name": "SimpleText",
          "config": {
            "minInputlength": "8",
            "maxInputlength": "10"
          }
        }
      },
      {
        "id": 1602,
        "form_id": 422,
        "required": true,
        "label": "oms测试组件2",
        "field": "3",
        "logic_id": 2,
        "tips": "oms测试组件2",
        "value": "2",
        "placeholder": "xxxx",
        "display": true,
        "editable": true,
        "resource": [],
        "regx_list": [
          {
            "id": 794,
            "name": "test",
            "expression": "/[一-龥豈-鶴]/",
            "error_message": "包含无效字符3"
          }
        ],
        "engine": {
          "name": "SimpleText",
          "config": {
            "minInputlength": "8",
            "maxInputlength": "10"
          }
        }
      },
      {
        "id": 1603,
        "form_id": 422,
        "required": false,
        "label": "oms测试组件1",
        "field": "4",
        "logic_id": 1,
        "tips": "oms测试组件1",
        "value": "1",
        "placeholder": "xxxx",
        "display": true,
        "editable": true,
        "resource": [
          {
            "type": 1,
            "api_settings": null,
            "options": [
              {
                "id": 761,
                "label": "是",
                "value": "是",
                "logic_id": 0,
                "p_logic_id": 0,
                "child_logic_ids": [],
                "event": null,
                "children": []
              },
              {
                "id": 762,
                "label": "否",
                "value": "否",
                "logic_id": 0,
                "p_logic_id": 0,
                "child_logic_ids": [],
                "event": null,
                "children": []
              }
            ]
          }
        ],
        "regx_list": [
          {
            "id": 795,
            "name": "test",
            "expression": "/[一-龥豈-鶴]/",
            "error_message": "包含无效字符2"
          },
          {
            "id": 796,
            "name": "1111",
            "expression": "测试叔叔说",
            "error_message": "包含无效字符2"
          }
        ],
        "engine": {
          "name": "SimpleText",
          "config": {
            "minInputlength": "8",
            "maxInputlength": "10"
          }
        }
      }
    ]
  }
}

创建表单

HTTP Method

POST

HTTP Request

/api/form

Request Parameters Query

Request Parameters Body

Title Description Type Required Tips
title 表单标题 string
description 表单描述 string
modules 表单组件列表 []Module

Module Schema

Title Description Type Required Tips
label 组件名称 string
field 字段值(用于提交) string
value 组件默认值 string
logic_id 组件逻辑ID,用来处理逻辑组件关系 int
placeholder 占位符 string
full_module 是否展示组件label bool 弃用,通过label是否有值判断
display 是否展示,组件初始状态 bool
editable 是否可编辑 bool
tips 组件提示 string
engine 组件引擎配置 Engine
regx_list 组件校验规则列表 []Regx
resource 组件资源 []Resource
style 组件样式(现在没有数据,待定...) array

Engine Schema

Title Description Type Required Tips
name 引擎名称 string
config 引擎配置 object ⚠️没有时为空对象

Regx Schema

Title Description Type Required Tips
name 规则名称 string
expression 校验规则 string
error_message 错误提示 string

Resource Schema

Title Description Type Required Tips
options 本地资源列表 []Option ⚠️ 远程资源(type=2)时,返回应空数组即可
api_setting 远程资源 type为1时,该值为null ApiSettingobject ⚠️ 本地资源(type=1)时,该值为null

Option Schema

Title Description Type Required Tips
label 资源名称 string
value 资源值 string
event 事件 Event
children 子级 []Option 用来处理多级联动关系

Event Schema

Title Description Type Required Tips
event_type 事件类型 show展示、disable禁用 string
link_module 组件ID列表 []integer ⚠️ 应该是Module.logic_id

ApiSetting Schema

Title Description Type Required Tips
uri 资源地址 string
list_key 数据的下标 string
label_key 资源名称的下标 string
value_key 资源值的下标 string
children_key 子级数据下标 string
request_method 筛选时的请求方式 string
search_key 可筛选的字段 string

Request Parameters Body Json

{
    "name": "测试表单标题1",
    "description": "这是一条测试数据",
    "modules": [
        {
            "required": false,
            "order": 0,
            "label": "oms测试组件1",
            "field": "1",
            "value": "1",
            "logic_id": 1,
            "placeholder": "xxxx",
            "full_module": true,
            "display": true,
            "editable": true,
            "tips": "oms测试组件1",
            "engine": {
                "name": "SimpleText",
                "config": {
                    "minInputlength": 8,
                    "maxInputlength": 10,
                    "type": "text"
                }
            },
            "regx_list": [
                {
                    "name": "test",
                    "expression": "/[一-龥豈-鶴]/",
                    "error_message": "包含无效字符1"
                },
                {
                    "name": "1111",
                    "expression": "测试叔叔说",
                    "error_message": "包含无效字符1"
                }
            ],
            "resource": [
                {
                    "api_setting": [],
                    "options": [
                        {
                            "label": "a",
                            "value": "a",
                            "event": {
                                "event_type": "display_on",
                                "link_module": [
                                    4,
                                    5
                                ]
                            },
                            "children": [
                                {
                                    "label": "b",
                                    "value": "b",
                                    "event": {
                                        "event_type": "display_off",
                                        "link_module": [
                                            4,
                                            5
                                        ]
                                    }
                                },
                                {
                                    "label": "c",
                                    "value": "c",
                                    "event": {
                                        "event_type": "display_off",
                                        "link_module": [
                                            4,
                                            5
                                        ]
                                    },
                                    "children": [
                                        {
                                            "label": "d",
                                            "value": "d",
                                            "event": {
                                                "event_type": "display_off",
                                                "link_module": [
                                                    4,
                                                    5
                                                ]
                                            },
                                            "children": [
                                                {
                                                    "label": "f",
                                                    "value": "f",
                                                    "event": {
                                                        "event_type": "display_off",
                                                        "link_module": [
                                                            4,
                                                            5
                                                        ]
                                                    }
                                                }

                                            ]
                                        }
                                    ]
                                },
                                {
                                    "label": "h",
                                    "value": "h",
                                    "event": {
                                        "event_type": "display_off",
                                        "link_module": [
                                            4,
                                            5
                                        ]
                                    }
                                }
                            ]
                        },
                        {
                            "label": "e",
                            "value": "e",
                            "event": {
                                "event_type": "display_off",
                                "link_module": [
                                    4,
                                    5
                                ]
                            }
                        },
                        {
                            "label": "g",
                            "value": "g",
                            "event": {
                                "event_type": "display_off",
                                "link_module": [
                                    4,
                                    5
                                ]
                            }
                        }
                    ]
                }
            ],
            "style": []
        },
        {
            "required": false,
            "order": 0,
            "label": "oms测试组件1",
            "field": "2",
            "value": "1",
            "logic_id": 1,
            "placeholder": "xxxx",
            "full_module": true,
            "display": true,
            "editable": true,
            "tips": "oms测试组件1",
            "engine": {
                "name": "SimpleText",
                "config": {
                    "minInputlength": 8,
                    "maxInputlength": 10
                }
            },
            "regx_list": [
                {
                    "name": "test",
                    "expression": "/[一-龥豈-鶴]/",
                    "error_message": "包含无效字符2"
                },
                {
                    "name": "1111",
                    "expression": "测试叔叔说",
                    "error_message": "包含无效字符2"
                }
            ],
            "resource": [
                {
                    "api_setting": {
                        "uri": "https://www.fastmock.site/mock/532e60f1fc8ce344d5709c8f022f5cc7/api/school/attendee",
                        "list_key": "data",
                        "label_key": "label",
                        "value_key": "value",
                        "children_key": "",
                        "request_method": "POST",
                        "search_key": "search"
                    },
                    "options": []
                }
            ],
            "style": []
        },
        {
            "required": true,
            "order": 0,
            "label": "oms测试组件2",
            "field": "3",
            "value": "2",
            "logic_id": 2,
            "placeholder": "xxxx",
            "full_module": true,
            "display": true,
            "editable": true,
            "tips": "oms测试组件2",
            "engine": {
                "name": "SimpleText",
                "config": {
                    "minInputlength": 8,
                    "maxInputlength": 10
                }
            },
            "regx_list": [
                {
                    "name": "test",
                    "expression": "/[一-龥豈-鶴]/",
                    "error_message": "包含无效字符3"
                }
            ],
            "resource": [],
            "style": []
        },
        {
            "required": false,
            "order": 0,
            "label": "oms测试组件1",
            "field": "4",
            "value": "1",
            "logic_id": 1,
            "placeholder": "xxxx",
            "full_module": true,
            "display": true,
            "editable": true,
            "tips": "oms测试组件1",
            "engine": {
                "name": "SimpleText",
                "config": {
                    "minInputlength": 8,
                    "maxInputlength": 10
                }
            },
            "regx_list": [
                {
                    "name": "test",
                    "expression": "/[一-龥豈-鶴]/",
                    "error_message": "包含无效字符2"
                },
                {
                    "name": "1111",
                    "expression": "测试叔叔说",
                    "error_message": "包含无效字符2"
                }
            ],
            "resource": [
                {
                    "api_setting": [],
                    "options": [
                        {
                            "label": "是",
                            "value": "是"
                        },
                        {
                            "label": "否",
                            "value": "否"
                        }
                    ]
                }
            ],
            "style": []
        }
    ]
}

Response Parameters Body

Title Description Type Required Tips
status 状态码 int 0成功 非0失败
data 表单数据 object

data

Title Description Type Required Tips
id 表单ID string
app_id 应用ID string
name 表单名称 string
description 表单描述 string
bg_img 表单背景图 string
status 表单状态 int 0禁用 1启用

Response Parameters Body Json

{
    "status": 0,
    "data": {
        "id": 186,
        "app_id": 1,
        "name": "参会信息报名数据表单",
        "description": "会展报名的表单的介绍哦",
        "source": null,
        "bg_img": null,
        "status": null
    }
}

更新表单

想要了解更多?请查看Etag介绍

HTTP Method

PUT

HTTP Request

/api/form/{id}

Request Parameters Query

Request Parameters Body

Title Description Type Required Tips
title 表单标题 integer
description 表单描述 string
modules 表单组件列表 array 参数详情见创建表单接口

Response Data

Title Description Type Required Tips
status 状态0成功 非0失败 int
data 表单组件数据 string

data

Title Description Type Required Tips
id 表单ID string
app_id 应用ID string
name 表单名称 string
description 表单描述 string
bg_img 表单背景图 string
status 表单状态 int 0禁用 1启用

Response Parameters Body Json

{
    "status": 0,
    "data": {
        "id": 186,
        "app_id": 1,
        "name": "参会信息报名数据表单",
        "description": "会展报名的表单的介绍哦",
        "source": null,
        "bg_img": null,
        "status": null
    }
}

Log

日期 作者 内容
2022/11/18 xlq 创建

授权

获取token

HTTP Method

POST

HTTP Request

/api/auth/token

Request Parameters Query

Request Parameters Body

Title Description Type Required Tips
app_key app Key string
app_secret 密钥 string

Response Data

Title Description Type Required Tips
status 状态:0成功 非0失败 integer
token status非0时,返回错误信息,键值对 string
token_method 加密算法 string
token_type token类型 string
expire_time 过期时间 int

Response Data Json

{
"status": 0,
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImtpZCI6ImZvcmZvcm0ifQ.eyJpc3MiOiJmb3Jmb3JtIiwic3ViIjoibmV3X21lZXRpbmdfc3lzIiwiaWRlbnQiOiIxZjY2ODQ3OGMyNDM0NGM5YjA0ZjE4MzhlYjc2MDFkNSIsImlhdCI6MTY2OTM0ODU0NywiZXhwIjoxNjY5MzUyMTQ3LCJhcHBfaWQiOjEsInJlYWQiOjEsIndyaXRlIjowfQ.1L4Lz1-Xg09VcyUw6M375jo2X5vAfnCKdkNPmgT_q8c",
"token_method": "HS256",
"token_type": "Bearer",
"expire_time": 1669352147
}

组件

创建常用项组件

HTTP Method

POST

HTTP Request

/api/form/module/normal

Request Parameters Query

Request Parameters Body

Title Description Type Required Tips
label 组件名称 string
field 字段值(用于提交) string
value 组件默认值 string
placeholder 占位符 string
full_module 是否展示组件label bool 弃用,通过label是否有值判断
display 是否展示,组件初始状态 bool
editable 是否可编辑 bool
tips 组件提示 string
engine 组件引擎配置(详细参数:参考更新接口) Engine
regx_list 组件校验规则列表(详细参数:参考更新接口) []Regx
resource 组件资源(详细参数:参考更新接口) []Resource

Response Data

Title Description Type Required Tips
status 状态0成功 非0失败 int

Response Data Json

{
    "status": 0,
    "data": "success"
}

更新组件

HTTP Method

POST

HTTP Request

/api/form/module/{module_id}

Request Parameters Query

Request Parameters Body

Title Description Type Required Tips
label 组件名称 string
field 字段值(用于提交) string
value 组件默认值 string
logic_id 组件逻辑ID,用来处理逻辑组件关系 int
placeholder 占位符 bool
full_module 是否展示组件label bool 弃用,通过label是否有值判断
display 是否展示,组件初始状态 bool
editable 是否可编辑 bool
tips 组件提示 string
engine 组件引擎配置(详细参数:参考更新接口) Engine
regx_list 组件校验规则列表(详细参数:参考更新接口) []Regx
resource 组件资源(详细参数:参考更新接口) []Resource

Response Data

Title Description Type Required Tips
status 状态0成功 非0失败 int
data 表单组件数据 string

data

Title Description Type Required Tips
id 组件ID int
form_id 表单ID int
label 组件名称 string
field 组件字段 string
description 描述 string
tips 提示 string
value 默认值 string
placeholder 占位符 string
display 是否展示 bool
editable 是否禁用 bool

Response Data Json

{
    "status": 0,
    "data": {
        "id": 318,
        "form_id": 138,
        "label": "Test",
        "field": "api_test",
        "description": null,
        "tips": "这是测试",
        "value": "",
        "placeholder": "这是测试",
        "display": true,
        "editable": true
    }
}

常用项组件列表

HTTP Method

GET

HTTP Request

/api/form/module/normal

Request Parameters Query

Request Parameters Body

Response Data

Title Description Type Required Tips
status 状态0成功 非0失败 int
data 组件详情 []Info 具体数据查看表单详情组件内容

Response Data Json

{
  "status": 0,
  "data": [
    {
      "id": 3656,
      "label": "级联选择"
    },
    {
      "id": 3657,
      "label": "性别"
    },
    {
      "id": 3658,
      "label": "手机号"
    }
  ]
}

组件详情

HTTP Method

GET

HTTP Request

/api/form/module/{id}

Request Parameters Query

Request Parameters Body

Response Data

Title Description Type Required Tips
status 状态0成功 非0失败 int
data 组件详情 []Info 具体数据查看表单详情组件内容

Response Data Json

{
  "status": 0,
  "data": {
    "id": 3658,
    "form_id": 0,
    "required": false,
    "label": "手机号",
    "field": "phone",
    "logic_id": 113,
    "tips": "",
    "full_module": true,
    "value": "",
    "placeholder": "请输入手机号",
    "display": true,
    "editable": true,
    "resource": [],
    "regx_list": [
      {
        "id": 1069,
        "name": "手机号",
        "expression": "/1\\d{10}/",
        "error_message": "手机号格式错误"
      }
    ],
    "engine": {
      "name": "SimpleText",
      "config": {
        "minInputlength": "",
        "maxInputlength": "",
        "type": "number"
      }
    }
  }
}

删除组件

HTTP Method

DELETE

HTTP Request

/api/form/module/{module_id}

Request Parameters Query

Request Parameters Body

Response Data

Title Description Type Required Tips
status 状态0成功 非0失败 int

Response Data Json

{
    "status": 0
}

资源

搜索资源

HTTP Method

GET

HTTP Request

/api/resource/search

Request Parameters Query

Title Description Type Required Tips
type 搜索的资源类型 int 默认搜索全部资源 1搜索本地资源 2搜索远程资源

Request Parameters Body

Response Data

Title Description Type Required Tips
status 状态0成功 非0失败 int
data 资源列表 []Resource

Resource Schema

Title Description Type Required Tips
id 资源ID int
app_id 应用ID int
type 资源类型 int 1本地资源 2远程资源
title 资源名称 string
api_settings 远程资源详情 []ApiSetting ⚠️当type为1时,值为null
options 本地资源详情 []Option ⚠️当type为2时,值为null

Option Schema

Title Description Type Required Tips
label 资源名称 string
value 资源值 string
logic_id 逻辑ID int 用来处理多级关系
p_logic_id 上级逻辑ID int 用来处理多级关系
child_logic_ids 子级逻辑ID列表 []integer ⚠️为Optionlogic_id
children 子级列表 []Option ⚠️值为Option本身

ApiSetting Schema

Title Description Type Required Tips
uri 资源地址 string
list_key 数据的下标 string
label_key 资源名称的下标 string
value_key 资源值的下标 string
children_key 子级数据下标 string
request_method 筛选时的请求方式 string
search_key 可筛选的字段 string

Response Data Json -> type = 1

{
  "status": 0,
  "data": [
    {
      "id": 23,
      "app_id": 1,
      "type": 1,
      "title": "选项是否",
      "api_settings": [],
      "options": [
        {
          "id": 142,
          "resource_id": 23,
          "label": "是",
          "value": "是"
        },
        {
          "id": 143,
          "resource_id": 23,
          "label": "否",
          "value": "否"
        }
      ]
    },
    {
      "id": 307,
      "app_id": 1,
      "type": 1,
      "title": "多级测试",
      "api_settings": [],
      "options": [
        {
          "id": 284,
          "resource_id": 307,
          "label": "1级1",
          "value": "0",
          "logic_id": 1,
          "p_logic_id": 0,
          "child_logic_ids": [
            2,
            3
          ],
          "children": [
            {
              "id": 285,
              "resource_id": 307,
              "label": "2级1",
              "value": "0",
              "logic_id": 2,
              "p_logic_id": 1,
              "child_logic_ids": [
                4
              ],
              "children": [
                {
                  "id": 287,
                  "resource_id": 307,
                  "label": "3级1",
                  "value": "0",
                  "logic_id": 4,
                  "p_logic_id": 2,
                  "child_logic_ids": [
                    5
                  ],
                  "children": [
                    {
                      "id": 288,
                      "resource_id": 307,
                      "label": "4级1",
                      "value": "0",
                      "logic_id": 5,
                      "p_logic_id": 4,
                      "child_logic_ids": [],
                      "children": []
                    }
                  ]
                }
              ]
            },
            {
              "id": 286,
              "resource_id": 307,
              "label": "2级2",
              "value": "0",
              "logic_id": 3,
              "p_logic_id": 1,
              "child_logic_ids": [],
              "children": []
            }
          ]
        },
        {
          "id": 289,
          "resource_id": 307,
          "label": "1级2",
          "value": "1",
          "logic_id": 4,
          "p_logic_id": 0,
          "child_logic_ids": [
            5
          ],
          "children": [
            {
              "id": 288,
              "resource_id": 307,
              "label": "4级1",
              "value": "0",
              "logic_id": 5,
              "p_logic_id": 4,
              "child_logic_ids": [],
              "children": []
            }
          ]
        },
        {
          "id": 290,
          "resource_id": 307,
          "label": "1级3",
          "value": "2",
          "logic_id": 5,
          "p_logic_id": 0,
          "child_logic_ids": [],
          "children": []
        }
      ]
    }
  ]
}

Response Data Json -> type = 2

{
  "status": 0,
  "data": [
    {
      "id": 23,
      "app_id": 1,
      "type": 1,
      "title": "测试远程资源",
      "options": [],
      "api_settings": [
        {
          "id": 139,
          "resource_id": 121,
          "uri": "https://www.fastmock.site/mock/532e60f1fc8ce344d5709c8f022f5cc7/api/school",
          "list_key": "data",
          "label_key": "label",
          "value_key": "value",
          "children_key": "",
          "request_method": "GET",
          "search_key": "search"
        }
      ]
    }
  ]
}

校验

搜索校验规则

HTTP Method

GET

HTTP Request

/api/rule/search

Request Parameters Query

Request Parameters Body

Response Data

Title Description Type Required Tips
status 状态0成功 非0失败 int
data 规则列表 []Rule

Rule Schema

Title Description Type Required Tips
id 规则ID int
app_id 应用ID int
name 规则名称 string
expression 校验逻辑 string
error_message 错误提示 string

Response Data Json

{
  "status": 0,
  "data": [
    {
      "id": 37,
      "app_id": 1,
      "name": "必须是中文",
      "expression": "/[\u9e00-\u9fa5]/",
      "error_message": "包含无效字符"
    }
  ]
}

引擎配置项

SimpleText 单行文本输入

Title Description Type Required Tips
minInputlength 最小长度 string
maxInputlength 最大长度 string
min 数字最大值 string
max 数字最小值 string
type 输入框类型 text、email、number string

Textarea 多行文本输入

Title Description Type Required Tips
areaMinLength 最小长度 string
areaMaxLength 最大长度 string

EnumText 联想输入

Title Description Type Required Tips
minlength 最小长度 string
maxlength 最大长度 string
enumLimit 匹配数量 string
enumType 是否可以自定义输入 string 0可以自定义输入 1强制使用联想输入
enumInit 初始触发 string
matchKeywordsLimit 最小搜索关键词个数限制 string
enumLimitKey 类似pageSize,可以自定义 string

Radio 单选

Title Description Type Required Tips
optDirection 排列方式 string

Checkbox 单选

Title Description Type Required Tips
optDirection 排列方式 string
minCheckCount 最小选择数量 string
maxCheckCount 最发选择数量 string

Select 下拉选择

Title Description Type Required Tips
multiple 是否可以多选 string
minCount 最小选择数量 string
maxCount 最大选择数量 string

Cascader 级联选择

无配置,resource中有children节点

Address 地址选择

Title Description Type Required Tips
precision 精度 string 1省 2市 3区

File 文件上传

Title Description Type Required Tips
fileType 文件格式 string
fileSize 文件大小 string
buttonText 按钮文字 string

Image 图片上传

图片选择可以多选

Title Description Type Required Tips
fileType 最小长度 string
fileSize 最小长度 string
buttonText 最小长度 string
multipleUpload 最小长度 string
display 最小长度 string

Date 时间选择

Title Description Type Required Tips
format 日期格式 string 年YYYY 年月YYYY-MM 年月日YYYY-MM-DD 年月日时分YYYY-MM-DD HH:mm 年月日时分秒YYYY-MM-DD HH:mm:ss
minDate 最小值 string
maxDate 最大值 string
now 默认当前时间 string

文档使用帮助

index.html.md文件中进行编辑目录和文档总体结构,然后在includes目录中添加对应的模块。

文档使用Markdown语言排版。

Markdown格式示例


# 标题
## 二级标题
### .......
    ```json
      代码块
    ```

表格
表头 | 表头
---------- | -------
内容 | 内容
内容 | 内容

`Something`

表格

表头 表头
内容 内容
内容 内容

Json 是没有注释的 避免在json中写注释

Something 高亮

加粗 粗体

横线

下划线

斜体

链接

图片