fix: 部署对齐——包名/URL前缀/模型格式/补json-build.sh,目标机json2ddl实测通过

This commit is contained in:
pipeline-agent 2026-08-29 23:07:29 +08:00
parent 25d0483325
commit bd63a6212d
12 changed files with 186 additions and 55 deletions

2
json/build.sh Executable file
View File

@ -0,0 +1,2 @@
#!/usr/bin/bash
xls2ui -m ../models -o ../wwwroot scense_drag *.json

View File

@ -1,34 +1,84 @@
{
"summary": [
{"table": "drag_graph", "desc": "拖拽编程画布", "primary": ["id"]},
{"table": "drag_template", "desc": "拖拽编程模板", "primary": ["id"]}
{
"name": "drag_graph",
"title": "拖拽编程画布",
"primary": [
"id"
]
}
],
"fields": [
{"table": "drag_graph", "name": "id", "type": "str", "len": 32, "notnull": true, "primary": true, "comment": "画布ID"},
{"table": "drag_graph", "name": "name", "type": "str", "len": 100, "notnull": true, "comment": "画布名称"},
{"table": "drag_graph", "name": "description", "type": "str", "len": 255, "default": "", "comment": "描述"},
{"table": "drag_graph", "name": "blocks", "type": "text", "comment": "块列表 JSON"},
{"table": "drag_graph", "name": "connections", "type": "text", "comment": "连线列表 JSON"},
{"table": "drag_graph", "name": "content", "type": "text", "comment": "编译产物(script_engine Python 脚本)"},
{"table": "drag_graph", "name": "status", "type": "str", "len": 16, "default": "1", "comment": "状态(0草稿/1启用)"},
{"table": "drag_graph", "name": "created_at", "type": "timestamp", "notnull": true, "comment": "创建时间"},
{"table": "drag_graph", "name": "updated_at", "type": "timestamp", "notnull": true, "comment": "更新时间"},
{"table": "drag_template", "name": "id", "type": "str", "len": 32, "notnull": true, "primary": true, "comment": "模板ID"},
{"table": "drag_template", "name": "name", "type": "str", "len": 100, "notnull": true, "comment": "模板名称"},
{"table": "drag_template", "name": "category", "type": "str", "len": 32, "default": "通用", "comment": "模板分类"},
{"table": "drag_template", "name": "description", "type": "str", "len": 255, "default": "", "comment": "描述"},
{"table": "drag_template", "name": "blocks", "type": "text", "comment": "块列表 JSON"},
{"table": "drag_template", "name": "connections", "type": "text", "comment": "连线列表 JSON"},
{"table": "drag_template", "name": "created_at", "type": "timestamp", "notnull": true, "comment": "创建时间"},
{"table": "drag_template", "name": "updated_at", "type": "timestamp", "notnull": true, "comment": "更新时间"}
{
"name": "id",
"title": "画布ID",
"type": "str",
"length": 255,
"nullable": "no"
},
{
"name": "name",
"title": "画布名称",
"type": "str",
"length": 255,
"nullable": "no"
},
{
"name": "description",
"title": "描述",
"type": "str",
"length": 255
},
{
"name": "blocks",
"title": "块列表 JSON",
"type": "text"
},
{
"name": "connections",
"title": "连线列表 JSON",
"type": "text"
},
{
"name": "content",
"title": "编译产物(script_engine Python 脚本)",
"type": "text"
},
{
"name": "status",
"title": "状态(0草稿/1启用)",
"type": "str",
"length": 255,
"default": "1"
},
{
"name": "created_at",
"title": "创建时间",
"type": "timestamp",
"nullable": "no"
},
{
"name": "updated_at",
"title": "更新时间",
"type": "timestamp",
"nullable": "no"
}
],
"indexes": [
{"table": "drag_graph", "name": "idx_drag_graph_name", "fields": ["name"]},
{"table": "drag_graph", "name": "idx_drag_graph_status", "fields": ["status"]},
{"table": "drag_template", "name": "idx_drag_template_name", "fields": ["name"]},
{"table": "drag_template", "name": "idx_drag_template_category", "fields": ["category"]}
{
"name": "idx_drag_graph_name",
"idxtype": "index",
"idxfields": [
"name"
]
},
{
"name": "idx_drag_graph_status",
"idxtype": "index",
"idxfields": [
"status"
]
}
],
"codes": [
{"table": "drag_graph", "field": "status", "table": "appcodes_kv", "valuefield": "k", "textfield": "v", "cond": "parentid='drag_status'"}
]
}
"codes": []
}

79
models/drag_template.json Normal file
View File

@ -0,0 +1,79 @@
{
"summary": [
{
"name": "drag_template",
"title": "拖拽编程模板",
"primary": [
"id"
]
}
],
"fields": [
{
"name": "id",
"title": "模板ID",
"type": "str",
"length": 255,
"nullable": "no"
},
{
"name": "name",
"title": "模板名称",
"type": "str",
"length": 255,
"nullable": "no"
},
{
"name": "category",
"title": "模板分类",
"type": "str",
"length": 255,
"default": "通用"
},
{
"name": "description",
"title": "描述",
"type": "str",
"length": 255
},
{
"name": "blocks",
"title": "块列表 JSON",
"type": "text"
},
{
"name": "connections",
"title": "连线列表 JSON",
"type": "text"
},
{
"name": "created_at",
"title": "创建时间",
"type": "timestamp",
"nullable": "no"
},
{
"name": "updated_at",
"title": "更新时间",
"type": "timestamp",
"nullable": "no"
}
],
"indexes": [
{
"name": "idx_drag_template_name",
"idxtype": "index",
"idxfields": [
"name"
]
},
{
"name": "idx_drag_template_category",
"idxtype": "index",
"idxfields": [
"category"
]
}
],
"codes": []
}

View File

@ -3,7 +3,7 @@ requires = ["setuptools>=45", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "drag"
name = "scense_drag"
version = "1.0.0"
description = "元景 W-09 拖拽编程画布模块——拖块连线编译为 script_engine 可执行脚本"
requires-python = ">=3.8"
@ -11,4 +11,4 @@ dependencies = ["sqlor", "bricks_for_python"]
[tool.setuptools.packages.find]
where = ["."]
include = ["drag*"]
include = ["scense_drag*"]

View File

@ -26,7 +26,7 @@ def find_sage_root():
def main():
sage = find_sage_root()
script_dir = os.path.dirname(os.path.abspath(__file__))
mod = 'drag'
mod = 'scense_drag'
if sage:
sys.path.insert(0, sage)
try:
@ -40,26 +40,26 @@ def main():
# any 角色:静态资源
any_paths = [
'/drag/drag-canvas.js', '/drag/drag-editor.js', '/drag/drag.css',
'/scense_drag/drag-canvas.js', '/scense_drag/drag-editor.js', '/scense_drag/drag.css',
]
# logined 角色:页面与接口
logined_paths = [
'/drag/index.ui', '/drag/editor.ui',
'/drag/api/block_defs.dspy', '/drag/api/graph_save.dspy',
'/drag/api/graph_list.dspy', '/drag/api/graph_get.dspy',
'/drag/api/graph_delete.dspy', '/drag/api/graph_compile.dspy',
'/drag/api/graph_validate.dspy', '/drag/api/graph_publish.dspy',
'/drag/api/template_save.dspy', '/drag/api/template_list.dspy',
'/drag/api/template_delete.dspy', '/drag/api/template_use.dspy',
'/drag/api/get_search_entity.dspy', '/drag/api/get_search_drag_status.dspy',
'/drag/api/get_search_template_category.dspy',
'/scense_drag/index.ui', '/scense_drag/editor.ui',
'/scense_drag/api/block_defs.dspy', '/scense_drag/api/graph_save.dspy',
'/scense_drag/api/graph_list.dspy', '/scense_drag/api/graph_get.dspy',
'/scense_drag/api/graph_delete.dspy', '/scense_drag/api/graph_compile.dspy',
'/scense_drag/api/graph_validate.dspy', '/scense_drag/api/graph_publish.dspy',
'/scense_drag/api/template_save.dspy', '/scense_drag/api/template_list.dspy',
'/scense_drag/api/template_delete.dspy', '/scense_drag/api/template_use.dspy',
'/scense_drag/api/get_search_entity.dspy', '/scense_drag/api/get_search_drag_status.dspy',
'/scense_drag/api/get_search_template_category.dspy',
# CRUD 子目录xls2ui 生成,注册目录+文件)
'/drag/drag_graph', '/drag/drag_graph/index.ui',
'/drag/drag_graph/get_drag_graph.dspy', '/drag/drag_graph/add_drag_graph.dspy',
'/drag/drag_graph/update_drag_graph.dspy', '/drag/drag_graph/delete_drag_graph.dspy',
'/drag/drag_template', '/drag/drag_template/index.ui',
'/drag/drag_template/get_drag_template.dspy', '/drag/drag_template/add_drag_template.dspy',
'/drag/drag_template/update_drag_template.dspy', '/drag/drag_template/delete_drag_template.dspy',
'/scense_drag/drag_graph', '/scense_drag/drag_graph/index.ui',
'/scense_drag/drag_graph/get_drag_graph.dspy', '/scense_drag/drag_graph/add_drag_graph.dspy',
'/scense_drag/drag_graph/update_drag_graph.dspy', '/scense_drag/drag_graph/delete_drag_graph.dspy',
'/scense_drag/drag_template', '/scense_drag/drag_template/index.ui',
'/scense_drag/drag_template/get_drag_template.dspy', '/scense_drag/drag_template/add_drag_template.dspy',
'/scense_drag/drag_template/update_drag_template.dspy', '/scense_drag/drag_template/delete_drag_template.dspy',
]
for p in any_paths:

View File

@ -123,7 +123,7 @@
} else if (pd.uitype === 'entity') {
input = document.createElement('select');
input.innerHTML = '<option value="">请选择实体…</option>';
apiFetch(entireUrl('/drag/api/get_search_entity.dspy'), {}).then(function (r) {
apiFetch(entireUrl('/scense_drag/api/get_search_entity.dspy'), {}).then(function (r) {
var items = (r && r.data) || [];
items.forEach(function (it) {
var op = document.createElement('option');
@ -179,7 +179,7 @@
blocks: g.blocks,
connections: g.connections
};
apiFetch(entireUrl('/drag/api/graph_save.dspy'), payload).then(function (r) {
apiFetch(entireUrl('/scense_drag/api/graph_save.dspy'), payload).then(function (r) {
if (r.status === 200 && r.data && r.data.success) {
state.graphId = r.data.id;
toast('保存成功' + (r.data.valid ? '' : '(存在校验错误,见校验结果)'), 'success');
@ -193,7 +193,7 @@
function doValidate() {
if (!state.canvas) { return; }
var g = state.canvas.getGraph();
apiFetch(entireUrl('/drag/api/graph_validate.dspy'),
apiFetch(entireUrl('/scense_drag/api/graph_validate.dspy'),
{blocks: g.blocks, connections: g.connections}).then(function (r) {
var d = r.data || {};
showValidate(d.errors || []);
@ -220,7 +220,7 @@
function doCompile() {
if (!state.canvas) { return; }
var g = state.canvas.getGraph();
apiFetch(entireUrl('/drag/api/graph_compile.dspy'),
apiFetch(entireUrl('/scense_drag/api/graph_compile.dspy'),
{name: state.graphName, blocks: g.blocks, connections: g.connections}).then(function (r) {
var d = r.data || {};
var out = $('#compile-output');
@ -237,7 +237,7 @@
function doPublish() {
if (!state.graphId) { toast('请先保存画布再发布', 'error'); return; }
apiFetch(entireUrl('/drag/api/graph_publish.dspy'), {id: state.graphId}).then(function (r) {
apiFetch(entireUrl('/scense_drag/api/graph_publish.dspy'), {id: state.graphId}).then(function (r) {
if (r.status === 200 && r.data && r.data.success) {
toast('已发布到脚本引擎:' + (r.data.script_name || ''), 'success');
} else {
@ -282,7 +282,7 @@
}
// 加载块定义 → 初始化画布
apiFetch(entireUrl('/drag/api/block_defs.dspy'), {}).then(function (r) {
apiFetch(entireUrl('/scense_drag/api/block_defs.dspy'), {}).then(function (r) {
state.blockDefs = (r && r.data) || {categories: [], blocks: {}};
renderBlockPanel();
var container = $('#canvas-area');
@ -303,7 +303,7 @@
// 通过查询参数 ?graph_id=xxx 载入画布
var m = location.search.match(/[?&]graph_id=([^&]+)/);
if (!m || !state.canvas) { return; }
apiFetch(entireUrl('/drag/api/graph_get.dspy'), {id: decodeURIComponent(m[1])}).then(function (r) {
apiFetch(entireUrl('/scense_drag/api/graph_get.dspy'), {id: decodeURIComponent(m[1])}).then(function (r) {
if (r.status === 200 && r.data) {
state.graphId = r.data.id;
state.graphName = r.data.name || '';

View File

@ -19,7 +19,7 @@
"widgettype": "VBox",
"options": {"backgroundColor": "#FFFFFF", "padding": "20px", "cursor": "pointer", "borderRadius": "8px", "border": "1px solid #e0e6ed"},
"binds": [{"wid": "self", "event": "click", "actiontype": "urlwidget", "target": "app.drag_content",
"options": {"url": "{{entire_url('/drag/drag_graph_list')}}", "method": "GET"}, "mode": "replace"}],
"options": {"url": "{{entire_url('/scense_drag/drag_graph_list')}}", "method": "GET"}, "mode": "replace"}],
"subwidgets": [
{"widgettype": "Text", "options": {"label": "画布管理", "fontSize": "16px", "fontWeight": "bold"}},
{"widgettype": "Text", "options": {"label": "已保存画布列表:查看/编辑/删除/发布", "fontSize": "12px", "color": "#7f8c8d", "marginTop": "6px"}}
@ -29,7 +29,7 @@
"widgettype": "VBox",
"options": {"backgroundColor": "#FFFFFF", "padding": "20px", "cursor": "pointer", "borderRadius": "8px", "border": "1px solid #e0e6ed"},
"binds": [{"wid": "self", "event": "click", "actiontype": "urlwidget", "target": "app.drag_content",
"options": {"url": "{{entire_url('/drag/drag_template_list')}}", "method": "GET"}, "mode": "replace"}],
"options": {"url": "{{entire_url('/scense_drag/drag_template_list')}}", "method": "GET"}, "mode": "replace"}],
"subwidgets": [
{"widgettype": "Text", "options": {"label": "模板管理", "fontSize": "16px", "fontWeight": "bold"}},
{"widgettype": "Text", "options": {"label": "常用流程模板:一键应用生成新画布", "fontSize": "12px", "color": "#7f8c8d", "marginTop": "6px"}}