fix: flatten style to options, fix Button/Text widget properties

- Flatten nested style objects directly into options
- Text/Title use 'text', Button uses 'label'
- All paths use {{entire_url()}}
This commit is contained in:
yumoqing 2026-05-05 19:36:12 +08:00
parent 94f258a345
commit bbd2dd4919
4 changed files with 205 additions and 142 deletions

View File

@ -1,30 +1,28 @@
{ {
"widgettype": "VBox", "widgettype": "VBox",
"options": { "options": {
"width": "100%",
"height": "100%"
},
"subwidgets": [
{
"widgettype": "Form",
"options": {
"title": "AI服务配置",
"tblname": "contract_ai_config",
"submit_url": "/api/contract/ai_config/save",
"width": "100%", "width": "100%",
"style": { "height": "100%"
"maxWidth": "800px", },
"margin": "0 auto" "subwidgets": [
}
},
"binds": [
{ {
"wid": "self", "widgettype": "Form",
"event": "submited", "options": {
"actiontype": "script", "title": "AI服务配置",
"script": "await bricks.show_resp_message_or_error(event.params); if (event.params.success) { bricks.app.goto_url('{{entire_url(\"contract_list.ui\")}}'); }" "tblname": "contract_ai_config",
"submit_url": "/api/contract/ai_config/save",
"width": "100%",
"maxWidth": "800px",
"margin": "0 auto"
},
"binds": [
{
"wid": "self",
"event": "submited",
"actiontype": "script",
"script": "await bricks.show_resp_message_or_error(event.params); if (event.params.success) { bricks.app.goto_url('{{entire_url(\"contract_list.ui\")}}'); }"
}
]
} }
] ]
}
]
} }

View File

@ -16,11 +16,9 @@
"widgettype": "Button", "widgettype": "Button",
"options": { "options": {
"styleType": "default", "styleType": "default",
"style": { "label": "返回列表",
"marginLeft": "20px", "marginLeft": "20px",
"marginTop": "8px" "marginTop": "8px"
},
"label": "返回列表"
}, },
"binds": [ "binds": [
{ {
@ -41,11 +39,9 @@
"widgettype": "Button", "widgettype": "Button",
"options": { "options": {
"styleType": "primary", "styleType": "primary",
"style": { "label": "编辑合同",
"marginRight": "20px", "marginRight": "20px",
"marginTop": "8px" "marginTop": "8px"
},
"label": "编辑合同"
}, },
"binds": [ "binds": [
{ {
@ -77,10 +73,8 @@
"record_id": "{% raw %}{{params_kw.get('contract_id')}}{% endraw %}", "record_id": "{% raw %}{{params_kw.get('contract_id')}}{% endraw %}",
"readonly": true, "readonly": true,
"width": "100%", "width": "100%",
"style": { "maxWidth": "1200px",
"maxWidth": "1200px", "margin": "0 auto"
"margin": "0 auto"
}
} }
}, },
{ {
@ -93,10 +87,8 @@
"widgettype": "HBox", "widgettype": "HBox",
"options": { "options": {
"width": "100%", "width": "100%",
"style": { "maxWidth": "1200px",
"maxWidth": "1200px", "margin": "0 auto"
"margin": "0 auto"
}
}, },
"subwidgets": [ "subwidgets": [
{ {
@ -109,11 +101,9 @@
"widgettype": "Text", "widgettype": "Text",
"options": { "options": {
"text": "合同附件", "text": "合同附件",
"style": { "fontSize": "18px",
"fontSize": "18px", "fontWeight": "600",
"fontWeight": "600", "marginBottom": "10px"
"marginBottom": "10px"
}
} }
}, },
{ {
@ -143,21 +133,17 @@
"widgettype": "Text", "widgettype": "Text",
"options": { "options": {
"text": "AI分析结果", "text": "AI分析结果",
"style": { "fontSize": "18px",
"fontSize": "18px", "fontWeight": "600",
"fontWeight": "600", "marginBottom": "10px"
"marginBottom": "10px"
}
} }
}, },
{ {
"widgettype": "Text", "widgettype": "Text",
"options": { "options": {
"text": "合规检查结果:", "text": "合规检查结果:",
"style": { "fontWeight": "600",
"fontWeight": "600", "marginBottom": "5px"
"marginBottom": "5px"
}
} }
}, },
{ {
@ -166,12 +152,10 @@
"fieldname": "ai_compliance_result", "fieldname": "ai_compliance_result",
"record_id": "{% raw %}{{params_kw.get('contract_id')}}{% endraw %}", "record_id": "{% raw %}{{params_kw.get('contract_id')}}{% endraw %}",
"tblname": "contract", "tblname": "contract",
"style": { "whiteSpace": "pre-wrap",
"whiteSpace": "pre-wrap", "backgroundColor": "#f8f9fa",
"backgroundColor": "#f8f9fa", "padding": "10px",
"padding": "10px", "borderRadius": "4px"
"borderRadius": "4px"
}
} }
}, },
{ {
@ -184,10 +168,8 @@
"widgettype": "Text", "widgettype": "Text",
"options": { "options": {
"text": "关键时点:", "text": "关键时点:",
"style": { "fontWeight": "600",
"fontWeight": "600", "marginBottom": "5px"
"marginBottom": "5px"
}
} }
}, },
{ {
@ -196,12 +178,10 @@
"fieldname": "ai_key_dates", "fieldname": "ai_key_dates",
"record_id": "{% raw %}{{params_kw.get('contract_id')}}{% endraw %}", "record_id": "{% raw %}{{params_kw.get('contract_id')}}{% endraw %}",
"tblname": "contract", "tblname": "contract",
"style": { "whiteSpace": "pre-wrap",
"whiteSpace": "pre-wrap", "backgroundColor": "#f8f9fa",
"backgroundColor": "#f8f9fa", "padding": "10px",
"padding": "10px", "borderRadius": "4px"
"borderRadius": "4px"
}
} }
} }
] ]

View File

@ -1,53 +1,148 @@
{ {
"widgettype": "Page", "widgettype": "Page",
"options": { "options": {
"title": "合同编辑", "title": "合同编辑",
"style": {"height": "100vh", "padding": "0"} "height": "100vh",
}, "padding": "0"
"subwidgets": [ },
{ "subwidgets": [
"widgettype": "VBox",
"options": {"style": {"padding": "16px", "flex": 1, "overflow": "auto"}},
"subwidgets": [
{ {
"widgettype": "Form", "widgettype": "VBox",
"id": "contract_form", "options": {
"options": { "padding": "16px",
"submit_url": "{{entire_url('api/contracts_create.dspy')}}", "flex": 1,
"method": "POST", "overflow": "auto"
"layout": "vertical", },
"style": {"maxWidth": "600px"}, "subwidgets": [
"fields": [ {
{"name": "contract_number", "label": "合同编号", "uitype": "text", "required": true}, "widgettype": "Form",
{"name": "title", "label": "合同名称", "uitype": "text", "required": true}, "id": "contract_form",
{"name": "party_a", "label": "甲方", "uitype": "text", "required": true}, "options": {
{"name": "party_b", "label": "乙方", "uitype": "text", "required": true}, "submit_url": "{{entire_url('api/contracts_create.dspy')}}",
{"name": "contract_type", "label": "合同类型", "uitype": "code", "required": true, "data": [ "method": "POST",
{"value": "sales", "text": "销售合同"}, "layout": "vertical",
{"value": "purchase", "text": "采购合同"}, "fields": [
{"value": "service", "text": "服务合同"}, {
{"value": "other", "text": "其他"} "name": "contract_number",
]}, "label": "合同编号",
{"name": "amount", "label": "合同金额", "uitype": "number"}, "uitype": "text",
{"name": "start_date", "label": "开始日期", "uitype": "date", "required": true}, "required": true
{"name": "end_date", "label": "结束日期", "uitype": "date", "required": true}, },
{"name": "sign_date", "label": "签署日期", "uitype": "date"}, {
{"name": "owner_id", "label": "负责人ID", "uitype": "text", "required": true}, "name": "title",
{"name": "org_id", "label": "组织ID", "uitype": "text"}, "label": "合同名称",
{"name": "status", "label": "状态", "uitype": "code", "data": [ "uitype": "text",
{"value": "draft", "text": "草稿"}, "required": true
{"value": "active", "text": "生效"}, },
{"value": "expired", "text": "过期"}, {
{"value": "terminated", "text": "终止"} "name": "party_a",
]} "label": "甲方",
], "uitype": "text",
"buttons": [ "required": true
{"type": "submit", "text": "保存", "variant": "primary"}, },
{"type": "button", "text": "取消", "action": "navigate('main/contract_management/contract_list.ui')"} {
"name": "party_b",
"label": "乙方",
"uitype": "text",
"required": true
},
{
"name": "contract_type",
"label": "合同类型",
"uitype": "code",
"required": true,
"data": [
{
"value": "sales",
"text": "销售合同"
},
{
"value": "purchase",
"text": "采购合同"
},
{
"value": "service",
"text": "服务合同"
},
{
"value": "other",
"text": "其他"
}
]
},
{
"name": "amount",
"label": "合同金额",
"uitype": "number"
},
{
"name": "start_date",
"label": "开始日期",
"uitype": "date",
"required": true
},
{
"name": "end_date",
"label": "结束日期",
"uitype": "date",
"required": true
},
{
"name": "sign_date",
"label": "签署日期",
"uitype": "date"
},
{
"name": "owner_id",
"label": "负责人ID",
"uitype": "text",
"required": true
},
{
"name": "org_id",
"label": "组织ID",
"uitype": "text"
},
{
"name": "status",
"label": "状态",
"uitype": "code",
"data": [
{
"value": "draft",
"text": "草稿"
},
{
"value": "active",
"text": "生效"
},
{
"value": "expired",
"text": "过期"
},
{
"value": "terminated",
"text": "终止"
}
]
}
],
"buttons": [
{
"type": "submit",
"text": "保存",
"variant": "primary"
},
{
"type": "button",
"text": "取消",
"action": "navigate('main/contract_management/contract_list.ui')"
}
],
"maxWidth": "600px"
}
}
] ]
}
} }
] ]
}
]
} }

View File

@ -2,29 +2,23 @@
"widgettype": "Page", "widgettype": "Page",
"options": { "options": {
"title": "合同管理", "title": "合同管理",
"style": { "height": "100vh",
"height": "100vh", "padding": "0"
"padding": "0"
}
}, },
"subwidgets": [ "subwidgets": [
{ {
"widgettype": "VBox", "widgettype": "VBox",
"options": { "options": {
"style": { "padding": "16px",
"padding": "16px", "flex": 1,
"flex": 1, "overflow": "hidden"
"overflow": "hidden"
}
}, },
"subwidgets": [ "subwidgets": [
{ {
"widgettype": "HBox", "widgettype": "HBox",
"options": { "options": {
"style": { "marginBottom": "16px",
"marginBottom": "16px", "gap": "8px"
"gap": "8px"
}
}, },
"subwidgets": [ "subwidgets": [
{ {
@ -33,9 +27,7 @@
"options": { "options": {
"label": "搜索", "label": "搜索",
"placeholder": "合同编号/名称", "placeholder": "合同编号/名称",
"style": { "flex": 1
"flex": 1
}
} }
}, },
{ {
@ -62,9 +54,6 @@
"id": "contract_grid", "id": "contract_grid",
"options": { "options": {
"url": "{{entire_url('api/contract_list.dspy')}}", "url": "{{entire_url('api/contract_list.dspy')}}",
"style": {
"flex": 1
},
"columns": [ "columns": [
{ {
"field": "contract_number", "field": "contract_number",
@ -131,7 +120,8 @@
"icon": "delete", "icon": "delete",
"action": "doDelete('{% raw %}{{selectedRow.id}}{% endraw %}')" "action": "doDelete('{% raw %}{{selectedRow.id}}{% endraw %}')"
} }
] ],
"flex": 1
} }
} }
] ]