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

View File

@ -1,83 +1,255 @@
{
"widgettype": "Page",
"options": {
"title": "仪表板",
"style": {"height": "100%", "padding": "0"}
},
"subwidgets": [
{
"widgettype": "VBox",
"options": {"style": {"padding": "16px", "flex": 1, "overflow": "auto"}},
"subwidgets": [
"widgettype": "Page",
"options": {
"title": "仪表板",
"height": "100%",
"padding": "0"
},
"subwidgets": [
{
"widgettype": "HBox",
"options": {"style": {"marginBottom": "16px", "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)"}},
"subwidgets": [
{"widgettype": "Text", "options": {"text": "客户总数", "style": {"fontSize": "14px", "color": "#666"}}},
{"widgettype": "Text", "id": "kpi_customers", "options": {"text": "--", "style": {"fontSize": "28px", "fontWeight": "bold", "color": "#1E40AF"}}}
]
"widgettype": "VBox",
"options": {
"padding": "16px",
"flex": 1,
"overflow": "auto"
},
{
"widgettype": "VBox",
"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_opportunities", "options": {"text": "--", "style": {"fontSize": "28px", "fontWeight": "bold", "color": "#059669"}}}
]
},
{
"widgettype": "VBox",
"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_contracts", "options": {"text": "--", "style": {"fontSize": "28px", "fontWeight": "bold", "color": "#D97706"}}}
]
},
{
"widgettype": "VBox",
"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_receivables", "options": {"text": "--", "style": {"fontSize": "28px", "fontWeight": "bold", "color": "#DC2626"}}}
]
}
]
},
{
"widgettype": "HBox",
"options": {"style": {"gap": "16px", "flexWrap": "wrap"}},
"subwidgets": [
{
"widgettype": "VBox",
"options": {"style": {"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": "销售漏斗", "style": {"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": {"style": {"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": "最新商机", "style": {"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}
]}}
]
}
]
"subwidgets": [
{
"widgettype": "HBox",
"options": {
"marginBottom": "16px",
"gap": "12px",
"flexWrap": "wrap"
},
"subwidgets": [
{
"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_customers",
"options": {
"text": "--",
"fontSize": "28px",
"fontWeight": "bold",
"color": "#1E40AF"
}
}
]
},
{
"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_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",
"options": {
"maxWidth": "100%",
"padding": "10px"
},
"subwidgets": [
{
"widgettype": "HBox",
"options": {
"alignItems": "center",
"justifyContent": "space-between",
"marginBottom": "15px"
},
"subwidgets": [
"widgettype": "VBox",
"options": {
"maxWidth": "100%",
"padding": "10px"
},
"subwidgets": [
{
"widgettype": "Text",
"options": {
"text": "统一仪表板",
"fontSize": "20px",
"fontWeight": "bold"
}
"widgettype": "HBox",
"options": {
"alignItems": "center",
"justifyContent": "space-between",
"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",
"options": {
"data": [
{"value": "executive", "label": "管理视图"},
{"value": "sales", "label": "销售视图"},
{"value": "finance", "label": "财务视图"},
{"value": "customer", "label": "客户视图"}
],
"onChange": "switch_dashboard",
"style": {
"width": "120px"
}
}
"widgettype": "ScrollView",
"options": {
"maxHeight": "calc(100vh - 100px)"
},
"subwidgets": [
{
"widgettype": "VBox",
"options": {
"gap": "15px"
},
"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",
"options": {
"onClick": "goto('unified_dashboard/report_template/create.ui')",
"style": {
"backgroundColor": "#007bff",
"color": "white",
"border": "none",
"padding": "6px 12px",
"borderRadius": "4px"
},
"label": "新建报表"
"label": "新建报表",
"backgroundColor": "#007bff",
"color": "white",
"border": "none",
"padding": "6px 12px",
"borderRadius": "4px"
}
}
]

View File

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