记录一下多层嵌套配置界面
{
"title": "表单向导",
"definitions": {
"selectCtrl": {
"type": "combo",
"name": "items",
"required": true,
"value": [
{
"type": "xpath"
}
],
"minLength": 1,
"multiple": true,
"typeSwitchable": false,
"conditions": [
{
"label": "xpath",
"test": "this.type === \"xpath\"",
"scaffold": {
"type": "xpath"
},
"items": [
{
"name": "arg",
"required": true,
"label": "${index+1}. ${type}",
"type": "input-text"
}
]
},
{
"label": "jpath",
"test": "this.type === \"jpath\"",
"scaffold": {
"type": "jpath"
},
"items": [
{
"name": "arg",
"required": true,
"label": "${index+1}. ${type}",
"type": "input-text"
}
]
},
{
"label": "mix",
"test": "this.type === \"mix\"",
"scaffold": {
"type": "mix"
},
"items": [
{
"name": "arg",
"required": true,
"label": "${index+1}. ${type}",
"type": "input-text"
}
]
},
{
"label": "split",
"test": "this.type === \"split\"",
"scaffold": {
"type": "split"
},
"items": [
{
"name": "arg",
"required": true,
"label": "${index+1}. ${type}",
"type": "input-text"
}
]
},
{
"label": "replace",
"test": "this.type === \"replace\"",
"scaffold": {
"type": "replace"
},
"items": [
{
"name": "arg",
"required": true,
"label": "${index+1}. ${type}",
"type": "input-text"
},
{
"name": "arg1",
"required": true,
"type": "input-text"
}
]
},
{
"label": "regex",
"test": "this.type === \"regex\"",
"scaffold": {
"type": "regex"
},
"items": [
{
"name": "arg",
"required": true,
"label": "${index+1}. ${type}",
"type": "input-text"
},
{
"name": "arg1",
"type": "input-number"
}
]
},
{
"label": "object",
"test": "this.type === \"more\" && this.isArray === false",
"scaffold": {
"type": "more",
"isArray": false
},
"items": [
{
"$ref": "itemCtrl",
"label": "${index+1}. ${type}",
"name": "arg"
}
]
},
{
"label": "array",
"test": "this.type === \"more\" && this.isArray === true",
"scaffold": {
"type": "more",
"isArray": true
},
"items": [
{
"$ref": "selectCtrl",
"label": "${index+1}. ${type}",
"name": "arg"
}
]
}
]
},
"itemCtrl": {
"type": "input-kvs",
"addButtonText": "新增字段",
"minLength": 1,
"draggable": false,
"deleteBtn": {
"type": "button",
"label": "删除",
"level": "danger"
},
"keyItem": {
"label": "字段名"
},
"required": true,
"valueItems": [
{
"$ref": "selectCtrl",
"name": "_value"
}
]
}
},
"debug":true,
"body": [
{
"type": "wizard",
"api": "/amis/api/mock2/form/saveForm?waitSeconds=2",
"initApi": "/amis/api/mock2/form/initData?waitSeconds=2",
"mode": "vertical",
"steps": [
{
"title": "基础信息配置",
"body": {
"type": "json-schema",
"name": "site",
"value": {
"downloaderPoolSize": 0,
"downloaderThreadSize": 10,
"retryTimes": 1,
"cycleRetryTimes": 0,
"sleepTime": 100
},
"required": true,
"schema": {
"type": "object",
"additionalProperties": false,
"required": [
"domain",
"downloaderPoolSize",
"downloaderThreadSize",
"retryTimes",
"cycleRetryTimes",
"sleepTime"
],
"properties": {
"domain": {
"type": "string",
"title": "爬虫唯一标识"
},
"downloaderPoolSize": {
"type": "number",
"title": "单次批量下载条数"
},
"downloaderThreadSize": {
"type": "number",
"title": "下载器线程池数量"
},
"retryTimes": {
"type": "number",
"title": "失败立即重试次数"
},
"cycleRetryTimes": {
"type": "number",
"title": "失败循环重试次数"
},
"sleepTime": {
"type": "number",
"title": "下载间隔(毫秒)"
}
}
}
}
},
{
"title": "抽取规则配置",
"body": [
{
"type": "combo",
"name": "modles",
"label": "模板配置",
"multiple": true,
"multiLine": true,
"value": [
{
"handle": "//page.request\n//page.response\n//page.result\n//page.helpUrls",
"items": {
"": [
{
"type": "xpath"
}
]
},
"tagUrl": "https://"
}
],
"tabsMode": true,
"tabsStyle": "card",
"minLength": 1,
"tabsLabelTpl": "模板${index|plus}",
"items": [
{
"name": "tagUrl",
"label": "网页过滤",
"required": true,
"type": "input-text",
"value": ""
},
{
"type": "divider"
},
{
"label": "规则设置",
"$ref": "itemCtrl",
"name": "items",
"value": {
"": [
{
"type": "xpath"
}
]
}
},
{
"type": "divider"
},
{
"name": "parse",
"type": "editor",
"label": "后处理",
"language": "javascript",
"value": ""
}
]
}
]
},
{
"title": "调度器配置",
"body": [
"这是最后一步了"
]
}
]
}
]
}