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:11 +08:00
parent a2cb5a8eec
commit 2bbb3d038e
3 changed files with 178 additions and 86 deletions

View File

@ -4,28 +4,22 @@
"options": { "options": {
"width": "100%", "width": "100%",
"height": "100%", "height": "100%",
"style": {
"padding": "16px" "padding": "16px"
}
}, },
"subwidgets": [ "subwidgets": [
{ {
"widgettype": "HBox", "widgettype": "HBox",
"options": { "options": {
"style": {
"marginBottom": "16px", "marginBottom": "16px",
"gap": "8px" "gap": "8px"
}
}, },
"subwidgets": [ "subwidgets": [
{ {
"widgettype": "Text", "widgettype": "Text",
"options": { "options": {
"style": { "text": "商机管理",
"fontSize": "20px", "fontSize": "20px",
"fontWeight": "bold" "fontWeight": "bold"
},
"text": "商机管理"
} }
}, },
{ {

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,40 +21,143 @@
"submit_url": "{{entire_url('api/opportunities_create.dspy')}}", "submit_url": "{{entire_url('api/opportunities_create.dspy')}}",
"method": "POST", "method": "POST",
"layout": "vertical", "layout": "vertical",
"style": {"maxWidth": "600px"},
"fields": [ "fields": [
{"name": "opportunity_name", "label": "商机名称", "uitype": "text", "required": true}, {
{"name": "customer_id", "label": "客户ID", "uitype": "text", "required": true}, "name": "opportunity_name",
{"name": "customer_name", "label": "客户名称", "uitype": "text", "required": true}, "label": "商机名称",
{"name": "estimated_amount", "label": "预估金额", "uitype": "number", "required": true}, "uitype": "text",
{"name": "current_stage", "label": "阶段", "uitype": "code", "required": true, "data": [ "required": true
{"value": "qualification", "text": "资格确认"}, },
{"value": "needs_analysis", "text": "需求分析"}, {
{"value": "proposal", "text": "方案报价"}, "name": "customer_id",
{"value": "negotiation", "text": "商务谈判"}, "label": "客户ID",
{"value": "closed_won", "text": "成交"}, "uitype": "text",
{"value": "closed_lost", "text": "丢单"} "required": true
]}, },
{"name": "expected_close_date", "label": "预计成交日期", "uitype": "date", "required": true}, {
{"name": "owner_id", "label": "负责人ID", "uitype": "text", "required": true}, "name": "customer_name",
{"name": "owner_name", "label": "负责人", "uitype": "text", "required": true}, "label": "客户名称",
{"name": "region", "label": "区域", "uitype": "code", "data": [ "uitype": "text",
{"value": "east", "text": "华东"}, "required": true
{"value": "south", "text": "华南"}, },
{"value": "west", "text": "华西"}, {
{"value": "north", "text": "华北"} "name": "estimated_amount",
]}, "label": "预估金额",
{"name": "probability", "label": "成功概率(%)", "uitype": "number"}, "uitype": "number",
{"name": "description", "label": "描述", "uitype": "textarea"}, "required": true
{"name": "status", "label": "状态", "uitype": "code", "data": [ },
{"value": "active", "text": "有效"}, {
{"value": "inactive", "text": "无效"} "name": "current_stage",
]} "label": "阶段",
"uitype": "code",
"required": true,
"data": [
{
"value": "qualification",
"text": "资格确认"
},
{
"value": "needs_analysis",
"text": "需求分析"
},
{
"value": "proposal",
"text": "方案报价"
},
{
"value": "negotiation",
"text": "商务谈判"
},
{
"value": "closed_won",
"text": "成交"
},
{
"value": "closed_lost",
"text": "丢单"
}
]
},
{
"name": "expected_close_date",
"label": "预计成交日期",
"uitype": "date",
"required": true
},
{
"name": "owner_id",
"label": "负责人ID",
"uitype": "text",
"required": true
},
{
"name": "owner_name",
"label": "负责人",
"uitype": "text",
"required": true
},
{
"name": "region",
"label": "区域",
"uitype": "code",
"data": [
{
"value": "east",
"text": "华东"
},
{
"value": "south",
"text": "华南"
},
{
"value": "west",
"text": "华西"
},
{
"value": "north",
"text": "华北"
}
]
},
{
"name": "probability",
"label": "成功概率(%)",
"uitype": "number"
},
{
"name": "description",
"label": "描述",
"uitype": "textarea"
},
{
"name": "status",
"label": "状态",
"uitype": "code",
"data": [
{
"value": "active",
"text": "有效"
},
{
"value": "inactive",
"text": "无效"
}
]
}
], ],
"buttons": [ "buttons": [
{"type": "submit", "text": "保存", "variant": "primary"}, {
{"type": "button", "text": "取消", "action": "navigate('main/opportunity_management/opportunity_management.ui')"} "type": "submit",
] "text": "保存",
"variant": "primary"
},
{
"type": "button",
"text": "取消",
"action": "navigate('main/opportunity_management/opportunity_management.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": "opportunity_grid", "id": "opportunity_grid",
"options": { "options": {
"url": "{{entire_url('api/opportunities_list.dspy')}}", "url": "{{entire_url('api/opportunities_list.dspy')}}",
"style": {
"flex": 1
},
"columns": [ "columns": [
{ {
"field": "opportunity_name", "field": "opportunity_name",
@ -120,7 +109,8 @@
"icon": "delete", "icon": "delete",
"action": "doDelete('{% raw %}{{selectedRow.id}}{% endraw %}')" "action": "doDelete('{% raw %}{{selectedRow.id}}{% endraw %}')"
} }
] ],
"flex": 1
} }
} }
] ]