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

@ -1,58 +1,166 @@
{ {
"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": "opportunity_form", "options": {
"options": { "padding": "16px",
"submit_url": "{{entire_url('api/opportunities_create.dspy')}}", "flex": 1,
"method": "POST", "overflow": "auto"
"layout": "vertical", },
"style": {"maxWidth": "600px"}, "subwidgets": [
"fields": [ {
{"name": "opportunity_name", "label": "商机名称", "uitype": "text", "required": true}, "widgettype": "Form",
{"name": "customer_id", "label": "客户ID", "uitype": "text", "required": true}, "id": "opportunity_form",
{"name": "customer_name", "label": "客户名称", "uitype": "text", "required": true}, "options": {
{"name": "estimated_amount", "label": "预估金额", "uitype": "number", "required": true}, "submit_url": "{{entire_url('api/opportunities_create.dspy')}}",
{"name": "current_stage", "label": "阶段", "uitype": "code", "required": true, "data": [ "method": "POST",
{"value": "qualification", "text": "资格确认"}, "layout": "vertical",
{"value": "needs_analysis", "text": "需求分析"}, "fields": [
{"value": "proposal", "text": "方案报价"}, {
{"value": "negotiation", "text": "商务谈判"}, "name": "opportunity_name",
{"value": "closed_won", "text": "成交"}, "label": "商机名称",
{"value": "closed_lost", "text": "丢单"} "uitype": "text",
]}, "required": true
{"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": "customer_id",
{"name": "region", "label": "区域", "uitype": "code", "data": [ "label": "客户ID",
{"value": "east", "text": "华东"}, "uitype": "text",
{"value": "south", "text": "华南"}, "required": true
{"value": "west", "text": "华西"}, },
{"value": "north", "text": "华北"} {
]}, "name": "customer_name",
{"name": "probability", "label": "成功概率(%)", "uitype": "number"}, "label": "客户名称",
{"name": "description", "label": "描述", "uitype": "textarea"}, "uitype": "text",
{"name": "status", "label": "状态", "uitype": "code", "data": [ "required": true
{"value": "active", "text": "有效"}, },
{"value": "inactive", "text": "无效"} {
]} "name": "estimated_amount",
], "label": "预估金额",
"buttons": [ "uitype": "number",
{"type": "submit", "text": "保存", "variant": "primary"}, "required": true
{"type": "button", "text": "取消", "action": "navigate('main/opportunity_management/opportunity_management.ui')"} },
{
"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": [
{
"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,9 +27,7 @@
"options": { "options": {
"label": "搜索", "label": "搜索",
"placeholder": "商机名称/客户", "placeholder": "商机名称/客户",
"style": { "flex": 1
"flex": 1
}
} }
}, },
{ {
@ -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
} }
} }
] ]