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 6fe0cb4930
commit 321b1b7acb
5 changed files with 315 additions and 148 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,65 +1,185 @@
{ {
"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": "customer_form", "options": {
"options": { "padding": "16px",
"submit_url": "{{entire_url('api/customers_create.dspy')}}", "flex": 1,
"method": "POST", "overflow": "auto"
"layout": "vertical", },
"style": {"maxWidth": "600px"}, "subwidgets": [
"fields": [ {
{"name": "customer_name", "label": "客户名称", "uitype": "text", "required": true}, "widgettype": "Form",
{"name": "customer_type", "label": "客户类型", "uitype": "code", "required": true, "data": [ "id": "customer_form",
{"value": "enterprise", "text": "企业客户"}, "options": {
{"value": "individual", "text": "个人客户"}, "submit_url": "{{entire_url('api/customers_create.dspy')}}",
{"value": "government", "text": "政府客户"} "method": "POST",
]}, "layout": "vertical",
{"name": "contact_person", "label": "联系人", "uitype": "text"}, "fields": [
{"name": "phone", "label": "电话", "uitype": "text"}, {
{"name": "email", "label": "邮箱", "uitype": "text"}, "name": "customer_name",
{"name": "tax_id", "label": "税号", "uitype": "text"}, "label": "客户名称",
{"name": "industry", "label": "行业", "uitype": "code", "data": [ "uitype": "text",
{"value": "manufacturing", "text": "制造业"}, "required": true
{"value": "technology", "text": "科技"}, },
{"value": "finance", "text": "金融"}, {
{"value": "retail", "text": "零售"}, "name": "customer_type",
{"value": "other", "text": "其他"} "label": "客户类型",
]}, "uitype": "code",
{"name": "customer_level", "label": "客户等级", "uitype": "code", "data": [ "required": true,
{"value": "potential", "text": "潜在客户"}, "data": [
{"value": "active", "text": "活跃客户"}, {
{"value": "vip", "text": "VIP客户"} "value": "enterprise",
]}, "text": "企业客户"
{"name": "address", "label": "地址", "uitype": "textarea"}, },
{"name": "owner_id", "label": "负责人", "uitype": "text", "required": true}, {
{"name": "region", "label": "区域", "uitype": "code", "data": [ "value": "individual",
{"value": "east", "text": "华东"}, "text": "个人客户"
{"value": "south", "text": "华南"}, },
{"value": "west", "text": "华西"}, {
{"value": "north", "text": "华北"} "value": "government",
]}, "text": "政府客户"
{"name": "status", "label": "状态", "uitype": "code", "data": [ }
{"value": "active", "text": "有效"}, ]
{"value": "inactive", "text": "无效"} },
]} {
], "name": "contact_person",
"buttons": [ "label": "联系人",
{"type": "submit", "text": "保存", "variant": "primary"}, "uitype": "text"
{"type": "button", "text": "取消", "action": "navigate('main/customer_management/customer_list.ui')"} },
{
"name": "phone",
"label": "电话",
"uitype": "text"
},
{
"name": "email",
"label": "邮箱",
"uitype": "text"
},
{
"name": "tax_id",
"label": "税号",
"uitype": "text"
},
{
"name": "industry",
"label": "行业",
"uitype": "code",
"data": [
{
"value": "manufacturing",
"text": "制造业"
},
{
"value": "technology",
"text": "科技"
},
{
"value": "finance",
"text": "金融"
},
{
"value": "retail",
"text": "零售"
},
{
"value": "other",
"text": "其他"
}
]
},
{
"name": "customer_level",
"label": "客户等级",
"uitype": "code",
"data": [
{
"value": "potential",
"text": "潜在客户"
},
{
"value": "active",
"text": "活跃客户"
},
{
"value": "vip",
"text": "VIP客户"
}
]
},
{
"name": "address",
"label": "地址",
"uitype": "textarea"
},
{
"name": "owner_id",
"label": "负责人",
"uitype": "text",
"required": true
},
{
"name": "region",
"label": "区域",
"uitype": "code",
"data": [
{
"value": "east",
"text": "华东"
},
{
"value": "south",
"text": "华南"
},
{
"value": "west",
"text": "华西"
},
{
"value": "north",
"text": "华北"
}
]
},
{
"name": "status",
"label": "状态",
"uitype": "code",
"data": [
{
"value": "active",
"text": "有效"
},
{
"value": "inactive",
"text": "无效"
}
]
}
],
"buttons": [
{
"type": "submit",
"text": "保存",
"variant": "primary"
},
{
"type": "button",
"text": "取消",
"action": "navigate('main/customer_management/customer_list.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
}
} }
}, },
{ {
@ -53,9 +45,6 @@
"id": "customer_grid", "id": "customer_grid",
"options": { "options": {
"url": "{{entire_url('api/customers_list.dspy')}}", "url": "{{entire_url('api/customers_list.dspy')}}",
"style": {
"flex": 1
},
"columns": [ "columns": [
{ {
"field": "customer_code", "field": "customer_code",
@ -112,7 +101,8 @@
"icon": "delete", "icon": "delete",
"action": "doDelete('{% raw %}{{selectedRow.id}}{% endraw %}')" "action": "doDelete('{% raw %}{{selectedRow.id}}{% endraw %}')"
} }
] ],
"flex": 1
} }
} }
] ]

View File

@ -1,34 +1,68 @@
{ {
"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": "hidden"}},
"subwidgets": [
{ {
"widgettype": "DataGrid", "widgettype": "VBox",
"id": "pool_grid", "options": {
"options": { "padding": "16px",
"url": "{{entire_url('api/customer_pool_list.dspy')}}", "flex": 1,
"style": {"flex": 1}, "overflow": "hidden"
"columns": [ },
{"field": "customer_code", "header": "客户编码", "width": 120}, "subwidgets": [
{"field": "customer_name", "header": "客户名称", "width": 200}, {
{"field": "industry", "header": "行业", "width": 120}, "widgettype": "DataGrid",
{"field": "recycle_reason", "header": "回收原因", "width": 150}, "id": "pool_grid",
{"field": "pool_status", "header": "状态", "width": 80}, "options": {
{"field": "recycle_time", "header": "回收时间", "width": 150} "url": "{{entire_url('api/customer_pool_list.dspy')}}",
], "columns": [
"toolbar": [ {
{"type": "button", "text": "领取", "icon": "get_app", "action": "claimCustomer('{% raw %}{{selectedRow.id}}{% endraw %}')"} "field": "customer_code",
"header": "客户编码",
"width": 120
},
{
"field": "customer_name",
"header": "客户名称",
"width": 200
},
{
"field": "industry",
"header": "行业",
"width": 120
},
{
"field": "recycle_reason",
"header": "回收原因",
"width": 150
},
{
"field": "pool_status",
"header": "状态",
"width": 80
},
{
"field": "recycle_time",
"header": "回收时间",
"width": 150
}
],
"toolbar": [
{
"type": "button",
"text": "领取",
"icon": "get_app",
"action": "claimCustomer('{% raw %}{{selectedRow.id}}{% endraw %}')"
}
],
"flex": 1
}
}
] ]
}
} }
] ]
}
]
} }

View File

@ -1,31 +1,60 @@
{ {
"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": "hidden"}},
"subwidgets": [
{ {
"widgettype": "DataGrid", "widgettype": "VBox",
"id": "handover_grid", "options": {
"options": { "padding": "16px",
"url": "{{entire_url('api/handover_list.dspy')}}", "flex": 1,
"style": {"flex": 1}, "overflow": "hidden"
"columns": [ },
{"field": "customer_name", "header": "客户名称", "width": 200}, "subwidgets": [
{"field": "from_owner_name", "header": "原负责人", "width": 120}, {
{"field": "to_owner_name", "header": "新负责人", "width": 120}, "widgettype": "DataGrid",
{"field": "handover_reason", "header": "交接原因", "width": 200}, "id": "handover_grid",
{"field": "status", "header": "状态", "width": 80}, "options": {
{"field": "created_at", "header": "创建时间", "width": 150} "url": "{{entire_url('api/handover_list.dspy')}}",
"columns": [
{
"field": "customer_name",
"header": "客户名称",
"width": 200
},
{
"field": "from_owner_name",
"header": "原负责人",
"width": 120
},
{
"field": "to_owner_name",
"header": "新负责人",
"width": 120
},
{
"field": "handover_reason",
"header": "交接原因",
"width": 200
},
{
"field": "status",
"header": "状态",
"width": 80
},
{
"field": "created_at",
"header": "创建时间",
"width": 150
}
],
"flex": 1
}
}
] ]
}
} }
] ]
}
]
} }