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:14 +08:00
parent 32622d0a97
commit c9e1879d80
5 changed files with 393 additions and 253 deletions

View File

@ -4,64 +4,52 @@
"options": { "options": {
"width": "100%", "width": "100%",
"height": "100%", "height": "100%",
"style": { "padding": "16px"
"padding": "16px"
}
}, },
"subwidgets": [ "subwidgets": [
{ {
"widgettype": "Text", "widgettype": "Text",
"options": { "options": {
"style": { "text": "工作台",
"fontSize": "20px", "fontSize": "20px",
"fontWeight": "bold", "fontWeight": "bold",
"marginBottom": "16px" "marginBottom": "16px"
},
"text": "工作台"
} }
}, },
{ {
"widgettype": "HBox", "widgettype": "HBox",
"options": { "options": {
"style": { "gap": "16px",
"gap": "16px", "flexWrap": "wrap",
"flexWrap": "wrap", "marginBottom": "24px"
"marginBottom": "24px"
}
}, },
"subwidgets": [ "subwidgets": [
{ {
"widgettype": "VBox", "widgettype": "VBox",
"options": { "options": {
"style": { "background": "#4CAF50",
"background": "#4CAF50", "color": "white",
"color": "white", "padding": "24px",
"padding": "24px", "borderRadius": "8px",
"borderRadius": "8px", "minWidth": "200px",
"minWidth": "200px", "flex": 1
"flex": 1
}
}, },
"subwidgets": [ "subwidgets": [
{ {
"widgettype": "Text", "widgettype": "Text",
"options": { "options": {
"style": { "text": "客户总数",
"fontSize": "14px", "fontSize": "14px",
"opacity": 0.9 "opacity": 0.9
},
"text": "客户总数"
} }
}, },
{ {
"widgettype": "Text", "widgettype": "Text",
"id": "lbl_customer_count", "id": "lbl_customer_count",
"options": { "options": {
"style": { "text": "--",
"fontSize": "32px", "fontSize": "32px",
"fontWeight": "bold" "fontWeight": "bold"
},
"text": "--"
} }
} }
] ]
@ -69,35 +57,29 @@
{ {
"widgettype": "VBox", "widgettype": "VBox",
"options": { "options": {
"style": { "background": "#2196F3",
"background": "#2196F3", "color": "white",
"color": "white", "padding": "24px",
"padding": "24px", "borderRadius": "8px",
"borderRadius": "8px", "minWidth": "200px",
"minWidth": "200px", "flex": 1
"flex": 1
}
}, },
"subwidgets": [ "subwidgets": [
{ {
"widgettype": "Text", "widgettype": "Text",
"options": { "options": {
"style": { "text": "商机总数",
"fontSize": "14px", "fontSize": "14px",
"opacity": 0.9 "opacity": 0.9
},
"text": "商机总数"
} }
}, },
{ {
"widgettype": "Text", "widgettype": "Text",
"id": "lbl_opportunity_count", "id": "lbl_opportunity_count",
"options": { "options": {
"style": { "text": "--",
"fontSize": "32px", "fontSize": "32px",
"fontWeight": "bold" "fontWeight": "bold"
},
"text": "--"
} }
} }
] ]
@ -105,35 +87,29 @@
{ {
"widgettype": "VBox", "widgettype": "VBox",
"options": { "options": {
"style": { "background": "#FF9800",
"background": "#FF9800", "color": "white",
"color": "white", "padding": "24px",
"padding": "24px", "borderRadius": "8px",
"borderRadius": "8px", "minWidth": "200px",
"minWidth": "200px", "flex": 1
"flex": 1
}
}, },
"subwidgets": [ "subwidgets": [
{ {
"widgettype": "Text", "widgettype": "Text",
"options": { "options": {
"style": { "text": "合同总数",
"fontSize": "14px", "fontSize": "14px",
"opacity": 0.9 "opacity": 0.9
},
"text": "合同总数"
} }
}, },
{ {
"widgettype": "Text", "widgettype": "Text",
"id": "lbl_contract_count", "id": "lbl_contract_count",
"options": { "options": {
"style": { "text": "--",
"fontSize": "32px", "fontSize": "32px",
"fontWeight": "bold" "fontWeight": "bold"
},
"text": "--"
} }
} }
] ]
@ -141,35 +117,29 @@
{ {
"widgettype": "VBox", "widgettype": "VBox",
"options": { "options": {
"style": { "background": "#F44336",
"background": "#F44336", "color": "white",
"color": "white", "padding": "24px",
"padding": "24px", "borderRadius": "8px",
"borderRadius": "8px", "minWidth": "200px",
"minWidth": "200px", "flex": 1
"flex": 1
}
}, },
"subwidgets": [ "subwidgets": [
{ {
"widgettype": "Text", "widgettype": "Text",
"options": { "options": {
"style": { "text": "待审批",
"fontSize": "14px", "fontSize": "14px",
"opacity": 0.9 "opacity": 0.9
},
"text": "待审批"
} }
}, },
{ {
"widgettype": "Text", "widgettype": "Text",
"id": "lbl_approval_count", "id": "lbl_approval_count",
"options": { "options": {
"style": { "text": "--",
"fontSize": "32px", "fontSize": "32px",
"fontWeight": "bold" "fontWeight": "bold"
},
"text": "--"
} }
} }
] ]

View File

@ -1,83 +1,255 @@
{ {
"widgettype": "Page", "widgettype": "Page",
"options": { "options": {
"title": "仪表板", "title": "仪表板",
"style": {"height": "100%", "padding": "0"} "height": "100%",
}, "padding": "0"
"subwidgets": [ },
{ "subwidgets": [
"widgettype": "VBox",
"options": {"style": {"padding": "16px", "flex": 1, "overflow": "auto"}},
"subwidgets": [
{ {
"widgettype": "HBox", "widgettype": "VBox",
"options": {"style": {"marginBottom": "16px", "gap": "12px", "flexWrap": "wrap"}}, "options": {
"subwidgets": [ "padding": "16px",
{ "flex": 1,
"widgettype": "VBox", "overflow": "auto"
"options": {"style": {"flex": 1, "minWidth": "200px", "backgroundColor": "#fff", "borderRadius": "8px", "padding": "16px", "boxShadow": "0 2px 4px rgba(0,0,0,0.1)"}},
"subwidgets": [
{"widgettype": "Text", "options": {"text": "客户总数", "style": {"fontSize": "14px", "color": "#666"}}},
{"widgettype": "Text", "id": "kpi_customers", "options": {"text": "--", "style": {"fontSize": "28px", "fontWeight": "bold", "color": "#1E40AF"}}}
]
}, },
{ "subwidgets": [
"widgettype": "VBox", {
"options": {"style": {"flex": 1, "minWidth": "200px", "backgroundColor": "#fff", "borderRadius": "8px", "padding": "16px", "boxShadow": "0 2px 4px rgba(0,0,0,0.1)"}}, "widgettype": "HBox",
"subwidgets": [ "options": {
{"widgettype": "Text", "options": {"text": "活跃商机", "style": {"fontSize": "14px", "color": "#666"}}}, "marginBottom": "16px",
{"widgettype": "Text", "id": "kpi_opportunities", "options": {"text": "--", "style": {"fontSize": "28px", "fontWeight": "bold", "color": "#059669"}}} "gap": "12px",
] "flexWrap": "wrap"
}, },
{ "subwidgets": [
"widgettype": "VBox", {
"options": {"style": {"flex": 1, "minWidth": "200px", "backgroundColor": "#fff", "borderRadius": "8px", "padding": "16px", "boxShadow": "0 2px 4px rgba(0,0,0,0.1)"}}, "widgettype": "VBox",
"subwidgets": [ "options": {
{"widgettype": "Text", "options": {"text": "合同总数", "style": {"fontSize": "14px", "color": "#666"}}}, "flex": 1,
{"widgettype": "Text", "id": "kpi_contracts", "options": {"text": "--", "style": {"fontSize": "28px", "fontWeight": "bold", "color": "#D97706"}}} "minWidth": "200px",
] "backgroundColor": "#fff",
}, "borderRadius": "8px",
{ "padding": "16px",
"widgettype": "VBox", "boxShadow": "0 2px 4px rgba(0,0,0,0.1)"
"options": {"style": {"flex": 1, "minWidth": "200px", "backgroundColor": "#fff", "borderRadius": "8px", "padding": "16px", "boxShadow": "0 2px 4px rgba(0,0,0,0.1)"}}, },
"subwidgets": [ "subwidgets": [
{"widgettype": "Text", "options": {"text": "应收总额", "style": {"fontSize": "14px", "color": "#666"}}}, {
{"widgettype": "Text", "id": "kpi_receivables", "options": {"text": "--", "style": {"fontSize": "28px", "fontWeight": "bold", "color": "#DC2626"}}} "widgettype": "Text",
] "options": {
} "text": "客户总数",
] "fontSize": "14px",
}, "color": "#666"
{ }
"widgettype": "HBox", },
"options": {"style": {"gap": "16px", "flexWrap": "wrap"}}, {
"subwidgets": [ "widgettype": "Text",
{ "id": "kpi_customers",
"widgettype": "VBox", "options": {
"options": {"style": {"flex": 2, "minWidth": "400px", "backgroundColor": "#fff", "borderRadius": "8px", "padding": "16px", "boxShadow": "0 2px 4px rgba(0,0,0,0.1)"}}, "text": "--",
"subwidgets": [ "fontSize": "28px",
{"widgettype": "Text", "options": {"text": "销售漏斗", "style": {"fontSize": "16px", "fontWeight": "bold", "marginBottom": "12px"}}}, "fontWeight": "bold",
{"widgettype": "DataGrid", "id": "funnel_grid", "options": {"url": "{{entire_url('api/dashboard_kpi.dspy')}}?type=sales_funnel", "columns": [ "color": "#1E40AF"
{"field": "stage", "header": "阶段", "width": 120}, }
{"field": "count", "header": "数量", "width": 80}, }
{"field": "amount", "header": "金额", "width": 120} ]
]}} },
] {
}, "widgettype": "VBox",
{ "options": {
"widgettype": "VBox", "flex": 1,
"options": {"style": {"flex": 1, "minWidth": "300px", "backgroundColor": "#fff", "borderRadius": "8px", "padding": "16px", "boxShadow": "0 2px 4px rgba(0,0,0,0.1)"}}, "minWidth": "200px",
"subwidgets": [ "backgroundColor": "#fff",
{"widgettype": "Text", "options": {"text": "最新商机", "style": {"fontSize": "16px", "fontWeight": "bold", "marginBottom": "12px"}}}, "borderRadius": "8px",
{"widgettype": "DataGrid", "id": "recent_opp_grid", "options": {"url": "{{entire_url('api/dashboard_kpi.dspy')}}?type=recent_opportunities", "columns": [ "padding": "16px",
{"field": "customer_name", "header": "客户", "width": 120}, "boxShadow": "0 2px 4px rgba(0,0,0,0.1)"
{"field": "estimated_amount", "header": "金额", "width": 100}, },
{"field": "current_stage", "header": "阶段", "width": 80} "subwidgets": [
]}} {
] "widgettype": "Text",
} "options": {
] "text": "活跃商机",
"fontSize": "14px",
"color": "#666"
}
},
{
"widgettype": "Text",
"id": "kpi_opportunities",
"options": {
"text": "--",
"fontSize": "28px",
"fontWeight": "bold",
"color": "#059669"
}
}
]
},
{
"widgettype": "VBox",
"options": {
"flex": 1,
"minWidth": "200px",
"backgroundColor": "#fff",
"borderRadius": "8px",
"padding": "16px",
"boxShadow": "0 2px 4px rgba(0,0,0,0.1)"
},
"subwidgets": [
{
"widgettype": "Text",
"options": {
"text": "合同总数",
"fontSize": "14px",
"color": "#666"
}
},
{
"widgettype": "Text",
"id": "kpi_contracts",
"options": {
"text": "--",
"fontSize": "28px",
"fontWeight": "bold",
"color": "#D97706"
}
}
]
},
{
"widgettype": "VBox",
"options": {
"flex": 1,
"minWidth": "200px",
"backgroundColor": "#fff",
"borderRadius": "8px",
"padding": "16px",
"boxShadow": "0 2px 4px rgba(0,0,0,0.1)"
},
"subwidgets": [
{
"widgettype": "Text",
"options": {
"text": "应收总额",
"fontSize": "14px",
"color": "#666"
}
},
{
"widgettype": "Text",
"id": "kpi_receivables",
"options": {
"text": "--",
"fontSize": "28px",
"fontWeight": "bold",
"color": "#DC2626"
}
}
]
}
]
},
{
"widgettype": "HBox",
"options": {
"gap": "16px",
"flexWrap": "wrap"
},
"subwidgets": [
{
"widgettype": "VBox",
"options": {
"flex": 2,
"minWidth": "400px",
"backgroundColor": "#fff",
"borderRadius": "8px",
"padding": "16px",
"boxShadow": "0 2px 4px rgba(0,0,0,0.1)"
},
"subwidgets": [
{
"widgettype": "Text",
"options": {
"text": "销售漏斗",
"fontSize": "16px",
"fontWeight": "bold",
"marginBottom": "12px"
}
},
{
"widgettype": "DataGrid",
"id": "funnel_grid",
"options": {
"url": "{{entire_url('api/dashboard_kpi.dspy')}}?type=sales_funnel",
"columns": [
{
"field": "stage",
"header": "阶段",
"width": 120
},
{
"field": "count",
"header": "数量",
"width": 80
},
{
"field": "amount",
"header": "金额",
"width": 120
}
]
}
}
]
},
{
"widgettype": "VBox",
"options": {
"flex": 1,
"minWidth": "300px",
"backgroundColor": "#fff",
"borderRadius": "8px",
"padding": "16px",
"boxShadow": "0 2px 4px rgba(0,0,0,0.1)"
},
"subwidgets": [
{
"widgettype": "Text",
"options": {
"text": "最新商机",
"fontSize": "16px",
"fontWeight": "bold",
"marginBottom": "12px"
}
},
{
"widgettype": "DataGrid",
"id": "recent_opp_grid",
"options": {
"url": "{{entire_url('api/dashboard_kpi.dspy')}}?type=recent_opportunities",
"columns": [
{
"field": "customer_name",
"header": "客户",
"width": 120
},
{
"field": "estimated_amount",
"header": "金额",
"width": 100
},
{
"field": "current_stage",
"header": "阶段",
"width": 80
}
]
}
}
]
}
]
}
]
} }
] ]
}
]
} }

View File

@ -1,66 +1,76 @@
{ {
"widgettype": "VBox", "widgettype": "VBox",
"options": { "options": {
"maxWidth": "100%", "maxWidth": "100%",
"padding": "10px" "padding": "10px"
}, },
"subwidgets": [ "subwidgets": [
{
"widgettype": "HBox",
"options": {
"alignItems": "center",
"justifyContent": "space-between",
"marginBottom": "15px"
},
"subwidgets": [
{ {
"widgettype": "Text", "widgettype": "HBox",
"options": { "options": {
"text": "统一仪表板", "alignItems": "center",
"fontSize": "20px", "justifyContent": "space-between",
"fontWeight": "bold" "marginBottom": "15px"
} },
"subwidgets": [
{
"widgettype": "Text",
"options": {
"text": "统一仪表板",
"fontSize": "20px",
"fontWeight": "bold"
}
},
{
"widgettype": "Select",
"options": {
"data": [
{
"value": "executive",
"label": "管理视图"
},
{
"value": "sales",
"label": "销售视图"
},
{
"value": "finance",
"label": "财务视图"
},
{
"value": "customer",
"label": "客户视图"
}
],
"onChange": "switch_dashboard",
"width": "120px"
}
}
]
}, },
{ {
"widgettype": "Select", "widgettype": "ScrollView",
"options": { "options": {
"data": [ "maxHeight": "calc(100vh - 100px)"
{"value": "executive", "label": "管理视图"}, },
{"value": "sales", "label": "销售视图"}, "subwidgets": [
{"value": "finance", "label": "财务视图"}, {
{"value": "customer", "label": "客户视图"} "widgettype": "VBox",
], "options": {
"onChange": "switch_dashboard", "gap": "15px"
"style": { },
"width": "120px" "subwidgets": [
} {
} "widgettype": "HBox",
"options": {
"gap": "10px",
"flexWrap": "wrap"
},
"subwidgets": []
}
]
}
]
} }
] ]
},
{
"widgettype": "ScrollView",
"options": {
"maxHeight": "calc(100vh - 100px)"
},
"subwidgets": [
{
"widgettype": "VBox",
"options": {
"gap": "15px"
},
"subwidgets": [
{
"widgettype": "HBox",
"options": {
"gap": "10px",
"flexWrap": "wrap"
},
"subwidgets": []
}
]
}
]
}
]
} }

View File

@ -25,14 +25,12 @@
"widgettype": "Button", "widgettype": "Button",
"options": { "options": {
"onClick": "goto('unified_dashboard/report_template/create.ui')", "onClick": "goto('unified_dashboard/report_template/create.ui')",
"style": { "label": "新建报表",
"backgroundColor": "#007bff", "backgroundColor": "#007bff",
"color": "white", "color": "white",
"border": "none", "border": "none",
"padding": "6px 12px", "padding": "6px 12px",
"borderRadius": "4px" "borderRadius": "4px"
},
"label": "新建报表"
} }
} }
] ]

View File

@ -2,29 +2,23 @@
"widgettype": "Page", "widgettype": "Page",
"options": { "options": {
"title": "报表中心", "title": "报表中心",
"style": { "height": "100%",
"height": "100%", "padding": "0"
"padding": "0"
}
}, },
"subwidgets": [ "subwidgets": [
{ {
"widgettype": "VBox", "widgettype": "VBox",
"options": { "options": {
"style": { "padding": "16px",
"padding": "16px", "flex": 1,
"flex": 1, "overflow": "auto"
"overflow": "auto"
}
}, },
"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
}
} }
}, },
{ {
@ -53,9 +45,6 @@
"id": "report_grid", "id": "report_grid",
"options": { "options": {
"url": "{{entire_url('api/report_list.dspy')}}", "url": "{{entire_url('api/report_list.dspy')}}",
"style": {
"flex": 1
},
"columns": [ "columns": [
{ {
"field": "template_name", "field": "template_name",
@ -90,7 +79,8 @@
"icon": "view", "icon": "view",
"action": "navigate('main/unified_dashboard/report_view.ui?id={% raw %}{{selectedRow.id}}{% endraw %}')" "action": "navigate('main/unified_dashboard/report_view.ui?id={% raw %}{{selectedRow.id}}{% endraw %}')"
} }
] ],
"flex": 1
} }
} }
] ]