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

View File

@ -1,53 +1,148 @@
{
"widgettype": "Page",
"options": {
"title": "合同编辑",
"style": {"height": "100vh", "padding": "0"}
},
"subwidgets": [
{
"widgettype": "VBox",
"options": {"style": {"padding": "16px", "flex": 1, "overflow": "auto"}},
"subwidgets": [
"widgettype": "Page",
"options": {
"title": "合同编辑",
"height": "100vh",
"padding": "0"
},
"subwidgets": [
{
"widgettype": "Form",
"id": "contract_form",
"options": {
"submit_url": "{{entire_url('api/contracts_create.dspy')}}",
"method": "POST",
"layout": "vertical",
"style": {"maxWidth": "600px"},
"fields": [
{"name": "contract_number", "label": "合同编号", "uitype": "text", "required": true},
{"name": "title", "label": "合同名称", "uitype": "text", "required": true},
{"name": "party_a", "label": "甲方", "uitype": "text", "required": true},
{"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')"}
"widgettype": "VBox",
"options": {
"padding": "16px",
"flex": 1,
"overflow": "auto"
},
"subwidgets": [
{
"widgettype": "Form",
"id": "contract_form",
"options": {
"submit_url": "{{entire_url('api/contracts_create.dspy')}}",
"method": "POST",
"layout": "vertical",
"fields": [
{
"name": "contract_number",
"label": "合同编号",
"uitype": "text",
"required": true
},
{
"name": "title",
"label": "合同名称",
"uitype": "text",
"required": true
},
{
"name": "party_a",
"label": "甲方",
"uitype": "text",
"required": true
},
{
"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",
"options": {
"title": "合同管理",
"style": {
"height": "100vh",
"padding": "0"
}
"height": "100vh",
"padding": "0"
},
"subwidgets": [
{
"widgettype": "VBox",
"options": {
"style": {
"padding": "16px",
"flex": 1,
"overflow": "hidden"
}
"padding": "16px",
"flex": 1,
"overflow": "hidden"
},
"subwidgets": [
{
"widgettype": "HBox",
"options": {
"style": {
"marginBottom": "16px",
"gap": "8px"
}
"marginBottom": "16px",
"gap": "8px"
},
"subwidgets": [
{
@ -33,9 +27,7 @@
"options": {
"label": "搜索",
"placeholder": "合同编号/名称",
"style": {
"flex": 1
}
"flex": 1
}
},
{
@ -62,9 +54,6 @@
"id": "contract_grid",
"options": {
"url": "{{entire_url('api/contract_list.dspy')}}",
"style": {
"flex": 1
},
"columns": [
{
"field": "contract_number",
@ -131,7 +120,8 @@
"icon": "delete",
"action": "doDelete('{% raw %}{{selectedRow.id}}{% endraw %}')"
}
]
],
"flex": 1
}
}
]