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

@ -2,77 +2,249 @@
"widgettype": "Page", "widgettype": "Page",
"options": { "options": {
"title": "仪表板", "title": "仪表板",
"style": {"height": "100%", "padding": "0"} "height": "100%",
"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": "HBox", "widgettype": "HBox",
"options": {"style": {"marginBottom": "16px", "gap": "12px", "flexWrap": "wrap"}}, "options": {
"marginBottom": "16px",
"gap": "12px",
"flexWrap": "wrap"
},
"subwidgets": [ "subwidgets": [
{ {
"widgettype": "VBox", "widgettype": "VBox",
"options": {"style": {"flex": 1, "minWidth": "200px", "backgroundColor": "#fff", "borderRadius": "8px", "padding": "16px", "boxShadow": "0 2px 4px rgba(0,0,0,0.1)"}}, "options": {
"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_customers", "options": {"text": "--", "style": {"fontSize": "28px", "fontWeight": "bold", "color": "#1E40AF"}}} "widgettype": "Text",
"options": {
"text": "客户总数",
"fontSize": "14px",
"color": "#666"
}
},
{
"widgettype": "Text",
"id": "kpi_customers",
"options": {
"text": "--",
"fontSize": "28px",
"fontWeight": "bold",
"color": "#1E40AF"
}
}
] ]
}, },
{ {
"widgettype": "VBox", "widgettype": "VBox",
"options": {"style": {"flex": 1, "minWidth": "200px", "backgroundColor": "#fff", "borderRadius": "8px", "padding": "16px", "boxShadow": "0 2px 4px rgba(0,0,0,0.1)"}}, "options": {
"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_opportunities", "options": {"text": "--", "style": {"fontSize": "28px", "fontWeight": "bold", "color": "#059669"}}} "widgettype": "Text",
"options": {
"text": "活跃商机",
"fontSize": "14px",
"color": "#666"
}
},
{
"widgettype": "Text",
"id": "kpi_opportunities",
"options": {
"text": "--",
"fontSize": "28px",
"fontWeight": "bold",
"color": "#059669"
}
}
] ]
}, },
{ {
"widgettype": "VBox", "widgettype": "VBox",
"options": {"style": {"flex": 1, "minWidth": "200px", "backgroundColor": "#fff", "borderRadius": "8px", "padding": "16px", "boxShadow": "0 2px 4px rgba(0,0,0,0.1)"}}, "options": {
"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_contracts", "options": {"text": "--", "style": {"fontSize": "28px", "fontWeight": "bold", "color": "#D97706"}}} "widgettype": "Text",
"options": {
"text": "合同总数",
"fontSize": "14px",
"color": "#666"
}
},
{
"widgettype": "Text",
"id": "kpi_contracts",
"options": {
"text": "--",
"fontSize": "28px",
"fontWeight": "bold",
"color": "#D97706"
}
}
] ]
}, },
{ {
"widgettype": "VBox", "widgettype": "VBox",
"options": {"style": {"flex": 1, "minWidth": "200px", "backgroundColor": "#fff", "borderRadius": "8px", "padding": "16px", "boxShadow": "0 2px 4px rgba(0,0,0,0.1)"}}, "options": {
"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": "Text",
"id": "kpi_receivables",
"options": {
"text": "--",
"fontSize": "28px",
"fontWeight": "bold",
"color": "#DC2626"
}
}
] ]
} }
] ]
}, },
{ {
"widgettype": "HBox", "widgettype": "HBox",
"options": {"style": {"gap": "16px", "flexWrap": "wrap"}}, "options": {
"gap": "16px",
"flexWrap": "wrap"
},
"subwidgets": [ "subwidgets": [
{ {
"widgettype": "VBox", "widgettype": "VBox",
"options": {"style": {"flex": 2, "minWidth": "400px", "backgroundColor": "#fff", "borderRadius": "8px", "padding": "16px", "boxShadow": "0 2px 4px rgba(0,0,0,0.1)"}}, "options": {
"flex": 2,
"minWidth": "400px",
"backgroundColor": "#fff",
"borderRadius": "8px",
"padding": "16px",
"boxShadow": "0 2px 4px rgba(0,0,0,0.1)"
},
"subwidgets": [ "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": [ "widgettype": "Text",
{"field": "stage", "header": "阶段", "width": 120}, "options": {
{"field": "count", "header": "数量", "width": 80}, "text": "销售漏斗",
{"field": "amount", "header": "金额", "width": 120} "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", "widgettype": "VBox",
"options": {"style": {"flex": 1, "minWidth": "300px", "backgroundColor": "#fff", "borderRadius": "8px", "padding": "16px", "boxShadow": "0 2px 4px rgba(0,0,0,0.1)"}}, "options": {
"flex": 1,
"minWidth": "300px",
"backgroundColor": "#fff",
"borderRadius": "8px",
"padding": "16px",
"boxShadow": "0 2px 4px rgba(0,0,0,0.1)"
},
"subwidgets": [ "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": [ "widgettype": "Text",
{"field": "customer_name", "header": "客户", "width": 120}, "options": {
{"field": "estimated_amount", "header": "金额", "width": 100}, "text": "最新商机",
{"field": "current_stage", "header": "阶段", "width": 80} "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

@ -25,17 +25,27 @@
"widgettype": "Select", "widgettype": "Select",
"options": { "options": {
"data": [ "data": [
{"value": "executive", "label": "管理视图"}, {
{"value": "sales", "label": "销售视图"}, "value": "executive",
{"value": "finance", "label": "财务视图"}, "label": "管理视图"
{"value": "customer", "label": "客户视图"} },
{
"value": "sales",
"label": "销售视图"
},
{
"value": "finance",
"label": "财务视图"
},
{
"value": "customer",
"label": "客户视图"
}
], ],
"onChange": "switch_dashboard", "onChange": "switch_dashboard",
"style": {
"width": "120px" "width": "120px"
} }
} }
}
] ]
}, },
{ {

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,10 +27,8 @@
"options": { "options": {
"label": "搜索报表", "label": "搜索报表",
"placeholder": "报表名称", "placeholder": "报表名称",
"style": {
"flex": 1 "flex": 1
} }
}
}, },
{ {
"widgettype": "Button", "widgettype": "Button",
@ -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
} }
} }
] ]