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": {
"width": "100%",
"height": "100%",
"style": {
"padding": "16px"
}
"padding": "16px"
},
"subwidgets": [
{
"widgettype": "HBox",
"options": {
"style": {
"marginBottom": "16px",
"gap": "8px"
}
"marginBottom": "16px",
"gap": "8px"
},
"subwidgets": [
{
"widgettype": "Text",
"options": {
"style": {
"fontSize": "20px",
"fontWeight": "bold"
},
"text": "客户管理"
"text": "客户管理",
"fontSize": "20px",
"fontWeight": "bold"
}
},
{

View File

@ -1,65 +1,185 @@
{
"widgettype": "Page",
"options": {
"title": "客户编辑",
"style": {"height": "100vh", "padding": "0"}
},
"subwidgets": [
{
"widgettype": "VBox",
"options": {"style": {"padding": "16px", "flex": 1, "overflow": "auto"}},
"subwidgets": [
"widgettype": "Page",
"options": {
"title": "客户编辑",
"height": "100vh",
"padding": "0"
},
"subwidgets": [
{
"widgettype": "Form",
"id": "customer_form",
"options": {
"submit_url": "{{entire_url('api/customers_create.dspy')}}",
"method": "POST",
"layout": "vertical",
"style": {"maxWidth": "600px"},
"fields": [
{"name": "customer_name", "label": "客户名称", "uitype": "text", "required": true},
{"name": "customer_type", "label": "客户类型", "uitype": "code", "required": true, "data": [
{"value": "enterprise", "text": "企业客户"},
{"value": "individual", "text": "个人客户"},
{"value": "government", "text": "政府客户"}
]},
{"name": "contact_person", "label": "联系人", "uitype": "text"},
{"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')"}
"widgettype": "VBox",
"options": {
"padding": "16px",
"flex": 1,
"overflow": "auto"
},
"subwidgets": [
{
"widgettype": "Form",
"id": "customer_form",
"options": {
"submit_url": "{{entire_url('api/customers_create.dspy')}}",
"method": "POST",
"layout": "vertical",
"fields": [
{
"name": "customer_name",
"label": "客户名称",
"uitype": "text",
"required": true
},
{
"name": "customer_type",
"label": "客户类型",
"uitype": "code",
"required": true,
"data": [
{
"value": "enterprise",
"text": "企业客户"
},
{
"value": "individual",
"text": "个人客户"
},
{
"value": "government",
"text": "政府客户"
}
]
},
{
"name": "contact_person",
"label": "联系人",
"uitype": "text"
},
{
"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",
"options": {
"title": "客户列表",
"style": {
"height": "100vh",
"padding": "0"
}
"height": "100vh",
"padding": "0"
},
"subwidgets": [
{
"widgettype": "VBox",
"options": {
"style": {
"padding": "16px",
"flex": 1,
"overflow": "hidden"
}
"padding": "16px",
"flex": 1,
"overflow": "hidden"
},
"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": "customer_grid",
"options": {
"url": "{{entire_url('api/customers_list.dspy')}}",
"style": {
"flex": 1
},
"columns": [
{
"field": "customer_code",
@ -112,7 +101,8 @@
"icon": "delete",
"action": "doDelete('{% raw %}{{selectedRow.id}}{% endraw %}')"
}
]
],
"flex": 1
}
}
]

View File

@ -1,34 +1,68 @@
{
"widgettype": "Page",
"options": {
"title": "客户公海",
"style": {"height": "100vh", "padding": "0"}
},
"subwidgets": [
{
"widgettype": "VBox",
"options": {"style": {"padding": "16px", "flex": 1, "overflow": "hidden"}},
"subwidgets": [
"widgettype": "Page",
"options": {
"title": "客户公海",
"height": "100vh",
"padding": "0"
},
"subwidgets": [
{
"widgettype": "DataGrid",
"id": "pool_grid",
"options": {
"url": "{{entire_url('api/customer_pool_list.dspy')}}",
"style": {"flex": 1},
"columns": [
{"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 %}')"}
"widgettype": "VBox",
"options": {
"padding": "16px",
"flex": 1,
"overflow": "hidden"
},
"subwidgets": [
{
"widgettype": "DataGrid",
"id": "pool_grid",
"options": {
"url": "{{entire_url('api/customer_pool_list.dspy')}}",
"columns": [
{
"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",
"options": {
"title": "客户交接",
"style": {"height": "100vh", "padding": "0"}
},
"subwidgets": [
{
"widgettype": "VBox",
"options": {"style": {"padding": "16px", "flex": 1, "overflow": "hidden"}},
"subwidgets": [
"widgettype": "Page",
"options": {
"title": "客户交接",
"height": "100vh",
"padding": "0"
},
"subwidgets": [
{
"widgettype": "DataGrid",
"id": "handover_grid",
"options": {
"url": "{{entire_url('api/handover_list.dspy')}}",
"style": {"flex": 1},
"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}
"widgettype": "VBox",
"options": {
"padding": "16px",
"flex": 1,
"overflow": "hidden"
},
"subwidgets": [
{
"widgettype": "DataGrid",
"id": "handover_grid",
"options": {
"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
}
}
]
}
}
]
}
]
]
}