CTL/res/cfg.json

404 lines
16 KiB
JSON
Raw Normal View History

2024-06-21 09:05:50 +00:00
{
"type": "page",
"title": "Hello world",
2024-06-28 00:33:59 +00:00
"regions": [
"body"
],
2024-06-21 09:05:50 +00:00
"body": [
{
"type": "tpl",
2024-06-28 00:33:59 +00:00
"id": "u:f439a8330e02",
2024-06-21 09:05:50 +00:00
"tpl": "初始页面",
"wrapperComponent": "",
2024-06-28 00:33:59 +00:00
"inline": false
2024-06-21 09:05:50 +00:00
},
{
"type": "grid",
"columns": [
{
"body": [],
"id": "u:39c97acec8cc"
},
{
"body": [
{
"type": "collapse-group",
"activeKey": [
"1"
],
"body": [
{
"type": "collapse",
"key": "1",
"active": true,
"header": "通用",
"body": [
{
"type": "button-toolbar",
"label": "按钮工具栏",
2024-06-28 00:33:59 +00:00
"data": {
"x": "yy"
},
2024-06-21 09:05:50 +00:00
"buttons": [
{
"type": "button",
"label": "按钮1",
"onEvent": {
"click": {
"actions": [
2024-06-28 00:33:59 +00:00
{
"ignoreError": false,
"script": "const buttonText = context.props.label;\ndoAction({\n actionType: 'ajax',\n args: {\n api: {\n url: '/sendData',\n method: 'post',\n data: {\n buttonLabel: buttonText\n }\n }\n }\n});\n",
"actionType": "custom"
}
]
2024-06-21 09:05:50 +00:00
}
},
2024-06-28 00:33:59 +00:00
"id": "u:sendButtonText"
2024-06-21 09:05:50 +00:00
},
{
"type": "button",
"label": "按钮2",
"onEvent": {
"click": {
"actions": [
2024-06-28 00:33:59 +00:00
{
"ignoreError": false,
"actionType": "custom",
"script": "const buttonText = context.props.label;\ndoAction({\n actionType: 'ajax',\n args: {\n api: {\n url: '/sendData',\n method: 'post',\n data: {\n buttonLabel: buttonText\n },\n successMessage: '请求成功',\n errorMessage: '请求失败'\n }\n }\n});\n"
}
2024-06-21 09:05:50 +00:00
]
}
},
"id": "u:8eae2c306cc5"
}
],
"id": "u:b6649c1b1585"
},
2024-06-28 15:41:01 +00:00
{
"type": "input-number",
"label": "数字输入",
"name": "freq",
"keyboard": true,
"id": "numberInput",
"step": 12,
"displayMode": "base",
"size": "full",
"mode": "inline",
"required": true,
"min": 225000,
"max": 500000,
"value": 225000,
"kilobitSeparator": true,
"unitOptions": [
{
"label": "kHz"
}
],
"placeholder": "225,000到500,000之间"
},
{
"type": "button",
"label": "提交",
"id": "submitButton",
"size": "md",
"block": false,
2024-06-30 11:03:47 +00:00
"disabledOn": "this.freq === undefined || this.freq === ''",
2024-06-28 15:41:01 +00:00
"onEvent": {
"click": {
"actions": [
{
"ignoreError": false,
"actionType": "ajax",
"outputVar": "responseResult",
"api": {
"url": "/sendData",
"method": "post",
"data": {
"frequency": "${freq}"
}
},
"messages": {
"success": "数据已成功发送",
"failed": "发送数据失败,请重试"
}
}
]
}
}
},
2024-06-21 09:05:50 +00:00
{
"type": "button-group-select",
"name": "buttonGroupSelect",
"label": "单选",
"inline": false,
"options": [
{
"label": "选项1",
"value": "a"
},
{
"label": "选项2",
"value": "b"
}
],
"id": "u:5112d83e3943",
"multiple": false,
"value": "a"
2024-06-28 15:41:01 +00:00
},
{
"type": "switch",
"label": "天通",
"mode": "inline",
"name": "switchTT",
"falseValue": false,
"trueValue": true,
"id": "u:bd2f8c0b2176",
"onEvent": {
"change": {
"weight": 0,
"actions": [
{
"ignoreError": false,
"actionType": "custom",
"script": "const buttonText = context.props.label + (!context.props.value?'开':'关');\ndoAction({\n actionType: 'ajax',\n args: {\n api: {\n url: '/sendData',\n method: 'post',\n data: {\n buttonLabel: buttonText\n },\n successMessage: '请求成功',\n errorMessage: '请求失败'\n }\n }\n});\n"
}
]
}
}
},
{
"type": "switch",
"label": "超短波",
"mode": "inline",
"name": "switchCDB",
2024-06-28 15:41:01 +00:00
"falseValue": false,
"trueValue": true,
"id": "u:bd2f8c0b2176",
"onEvent": {
"change": {
"weight": 0,
"actions": [
{
"ignoreError": false,
"actionType": "custom",
"script": "const buttonText = context.props.label + (!context.props.value?'开':'关');\ndoAction({\n actionType: 'ajax',\n args: {\n api: {\n url: '/sendData',\n method: 'post',\n data: {\n buttonLabel: buttonText\n },\n successMessage: '请求成功',\n errorMessage: '请求失败'\n }\n }\n});\n"
}
]
}
}
2024-06-21 09:05:50 +00:00
}
],
"id": "u:53511e674086"
},
{
"type": "collapse",
2024-06-28 00:33:59 +00:00
"header": "调试",
2024-06-21 09:05:50 +00:00
"body": [
{
2024-06-30 02:58:37 +00:00
"type": "service",
"interval": 1500, // 每1.5秒刷新一次
"silentPolling": true,
2024-06-30 02:58:37 +00:00
"api": "/api/getStatus", // API接口
"data": {
"maxBarCnt":"60",
2024-06-30 12:26:26 +00:00
"width":"5px",
"height":"30px",
"powerdown":"#808080",
"alive":"#00ff00",
"dead":"#ff0000",
2024-06-30 02:58:37 +00:00
"items": [
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
{"color": ["${powerdown}","${powerdown}","${powerdown}"]},
2024-06-30 02:58:37 +00:00
]
},
//"schemaApi": "/loadSchema?schema=bar"
"body":[
{
"type": "table-view",
"trs": [
{
"background": "#F7F7F7",
"tds": [
2024-06-30 02:58:37 +00:00
{
"body": {
"type": "tpl",
"wrapperComponent": "",
"tpl": "模块",
"id": "u:19f87144bbea"
},
"id": "u:fddabc45cb59",
"align": "center",
"valign": "middle"
},
{
"body": {
"type": "tpl",
"wrapperComponent": "",
"tpl": "最后一分钟状态",
"id": "u:420e9a9f9353"
},
"id": "u:6ffa039534e7",
"align": "center",
"valign": "middle"
},
{
"body": {
"type": "tpl",
"wrapperComponent": "",
"tpl": "最近一次状态",
"id": "u:2dfafcf526f9"
},
"id": "u:fe0dab630536",
"align": "center",
"valign": "middle"
}
],
"id": "u:37a706fd866d"
},
{
"tds": [
{
"body": {
"type": "tpl",
"wrapperComponent": "",
"tpl": "TT",
"id": "u:518882ea6114"
},
"id": "u:897aee319eb4",
"align": "center",
"valign": "middle"
},
{
"body": {
2024-06-30 02:58:37 +00:00
"type": "each",
"name": "items",
"items": {
"type": "tpl",
"tpl": "<div style='width: ${width}; height: ${height}; border-radius: 2px; background-color: ${color[0]}; box-shadow: 0 0 5px ${color[0]}, 0 0 10px ${color[0]} inset'></div>",
2024-06-30 02:58:37 +00:00
"style": {
"display": "inline-block",
2024-06-30 09:29:27 +00:00
"marginRight": "5px",
"marginBottom": "-5px"
2024-06-30 02:58:37 +00:00
}
}
}
"id": "u:4804d1216011",
"width": "80%",
"align": "center",
"valign": "middle"
},
{
"body": {
"type": "tpl",
"wrapperComponent": "",
"tpl": "<div style='width: ${height}; height: ${height}; border-radius: 2px; background-color: ${items[59].color[0]}; box-shadow: 0 0 5px ${items[59].color[0]}, 0 0 10px ${items[59].color[0]} inset'></div>",
"id": "u:20d501a115fc"
},
"id": "u:ba272dd0e407",
"align": "center",
"valign": "middle"
}
2024-06-30 02:58:37 +00:00
],
"id": "u:42c47c152e5f"
},
],
"id": "u:18e5f253165a"
}
]
,
2024-06-30 02:58:37 +00:00
"onEvent": {
"fetchInited": {
"actions": [
{
"actionType": "custom",
"script": "const colorMap=[context.props.data.powerdown,context.props.data.dead,context.props.data.alive];\n const ncolor = [colorMap[event.data.responseData.state[0]+1],colorMap[event.data.responseData.state[1]+1],colorMap[event.data.responseData.state[2]+1]];\n console.log(event.data.responseData.state,ncolor);\ncontext.props.data.items.push({'color':ncolor})\nif (context.props.data.items.length > context.props.data.maxBarCnt) {\n context.props.data.items.shift(); // Remove the oldest value\n};"
},
2024-06-30 02:58:37 +00:00
]
}
}
}
2024-06-21 09:05:50 +00:00
],
"key": "6",
"id": "u:4ad528b09137"
}
],
"id": "u:8035637b2ce6"
}
],
"id": "u:63b382ec7d2f"
}
],
"id": "u:a9f37a6134a4"
}
],
"id": "u:ddf6e6d384e7",
"pullRefresh": {
"disabled": true
},
2024-06-28 00:33:59 +00:00
"data": {
"x": "xx"
},
"asideResizor": false
2024-06-21 09:05:50 +00:00
}