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

@ -12,10 +12,8 @@
"tblname": "contract_ai_config", "tblname": "contract_ai_config",
"submit_url": "/api/contract/ai_config/save", "submit_url": "/api/contract/ai_config/save",
"width": "100%", "width": "100%",
"style": {
"maxWidth": "800px", "maxWidth": "800px",
"margin": "0 auto" "margin": "0 auto"
}
}, },
"binds": [ "binds": [
{ {

View File

@ -16,12 +16,10 @@
"widgettype": "Button", "widgettype": "Button",
"options": { "options": {
"styleType": "default", "styleType": "default",
"style": { "label": "返回列表",
"marginLeft": "20px", "marginLeft": "20px",
"marginTop": "8px" "marginTop": "8px"
}, },
"label": "返回列表"
},
"binds": [ "binds": [
{ {
"wid": "self", "wid": "self",
@ -41,12 +39,10 @@
"widgettype": "Button", "widgettype": "Button",
"options": { "options": {
"styleType": "primary", "styleType": "primary",
"style": { "label": "编辑合同",
"marginRight": "20px", "marginRight": "20px",
"marginTop": "8px" "marginTop": "8px"
}, },
"label": "编辑合同"
},
"binds": [ "binds": [
{ {
"wid": "self", "wid": "self",
@ -77,11 +73,9 @@
"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"
} }
}
}, },
{ {
"widgettype": "Filler", "widgettype": "Filler",
@ -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,12 +101,10 @@
"widgettype": "Text", "widgettype": "Text",
"options": { "options": {
"text": "合同附件", "text": "合同附件",
"style": {
"fontSize": "18px", "fontSize": "18px",
"fontWeight": "600", "fontWeight": "600",
"marginBottom": "10px" "marginBottom": "10px"
} }
}
}, },
{ {
"widgettype": "DataGrid", "widgettype": "DataGrid",
@ -143,22 +133,18 @@
"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"
} }
}
}, },
{ {
"widgettype": "Text", "widgettype": "Text",
@ -166,13 +152,11 @@
"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"
} }
}
}, },
{ {
"widgettype": "Filler", "widgettype": "Filler",
@ -184,11 +168,9 @@
"widgettype": "Text", "widgettype": "Text",
"options": { "options": {
"text": "关键时点:", "text": "关键时点:",
"style": {
"fontWeight": "600", "fontWeight": "600",
"marginBottom": "5px" "marginBottom": "5px"
} }
}
}, },
{ {
"widgettype": "Text", "widgettype": "Text",
@ -196,14 +178,12 @@
"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

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