diff --git a/wwwroot/create_script.ui b/wwwroot/create_script.ui new file mode 100644 index 0000000..1f5c4a2 --- /dev/null +++ b/wwwroot/create_script.ui @@ -0,0 +1,70 @@ +{ + "widgettype": "VBox", + "options": { + "width": "100%", + "height": "100%", + "padding": "20px" + }, + "subwidgets": [ + { + "widgettype": "Text", + "options": { + "label": "新建脚本", + "fontSize": "20px" + } + }, + { + "widgettype": "Form", + "options": { + "title": "新建脚本", + "submit_url": "{{entire_url('/script_engine/script_engine/add_script_engine.dspy')}}", + "method": "POST", + "submit_label": "创建", + "fields": [ + { + "name": "script_name", + "label": "脚本名称", + "uitype": "str", + "required": true + }, + { + "name": "script_type", + "label": "脚本类型", + "uitype": "code", + "dataurl": "{{entire_url('/script_engine/api/get_search_script_type.dspy')}}", + "valueField": "script_type", + "textField": "script_type_text" + }, + { + "name": "content", + "label": "脚本内容", + "uitype": "text", + "required": true + }, + { + "name": "description", + "label": "描述", + "uitype": "str" + }, + { + "name": "status", + "label": "状态", + "uitype": "code", + "dataurl": "{{entire_url('/script_engine/api/get_search_status.dspy')}}", + "valueField": "status", + "textField": "status_text" + } + ] + }, + "binds": [ + { + "wid": "self", + "event": "submited", + "actiontype": "script", + "target": "self", + "script": "event.params.json().then(function(r){if(r&&r.widgettype){bricks.widgetBuild(r,bricks.Body)}else{var ok=r&&r.success;new bricks.Message({title:ok?'成功':'失败',message:ok?('已创建'+(r.id?(' id='+r.id):'')):(r&&r.message?r.message:'操作失败'),timeout:4})}})" + } + ] + } + ] +} \ No newline at end of file diff --git a/wwwroot/index.ui b/wwwroot/index.ui index 473b905..d733b4b 100644 --- a/wwwroot/index.ui +++ b/wwwroot/index.ui @@ -10,7 +10,7 @@ "subwidgets": [{"widgettype": "Text", "options": {"label": "脚本列表", "fontSize": "16px"}}]}, {"widgettype": "VBox", "options": {"backgroundColor": "#FFFFFF", "padding": "20px", "cursor": "pointer"}, "binds": [{"wid": "self", "event": "click", "actiontype": "urlwidget", "target": "app.script_engine_content", - "options": {"url": "{{entire_url('/script_engine/script_engine/add_script_engine.dspy')}}"}, "mode": "replace"}], + "options": {"url": "{{entire_url('/script_engine/create_script.ui')}}"}, "mode": "replace"}], "subwidgets": [{"widgettype": "Text", "options": {"label": "新建脚本", "fontSize": "16px"}}]} ]}, {"widgettype": "VBox", "id": "script_engine_content", "options": {"width": "100%", "flex": "1", "marginTop": "20px"}}