fix: Text widgets use 'text' not 'label', Button widgets use 'label' not 'text'

Per bricks-framework spec:
- Text/Title: use 'text' for non-i18n, 'otext'+'i18n:true' for i18n
- Button: use 'label' for button text
This commit is contained in:
yumoqing 2026-05-05 19:28:22 +08:00
parent 309f366839
commit 6fe0cb4930
3 changed files with 249 additions and 173 deletions

View File

@ -1,120 +1,120 @@
{ {
"id": "customer_management", "id": "customer_management",
"widgettype": "VBox", "widgettype": "VBox",
"options": { "options": {
"width": "100%", "width": "100%",
"height": "100%", "height": "100%",
"style": {
"padding": "16px"
}
},
"subwidgets": [
{
"widgettype": "HBox",
"options": {
"style": { "style": {
"marginBottom": "16px", "padding": "16px"
"gap": "8px"
} }
},
"subwidgets": [
{
"widgettype": "Text",
"options": {
"label": "客户管理",
"style": {
"fontSize": "20px",
"fontWeight": "bold"
}
}
},
{
"widgettype": "Filler",
"options": {}
},
{
"widgettype": "Button",
"id": "btn_add_customer",
"options": {
"label": "新增客户",
"variant": "primary"
}
}
]
}, },
{ "subwidgets": [
"widgettype": "Tabular", {
"id": "customer_grid", "widgettype": "HBox",
"options": { "options": {
"data_url": "{{entire_url('api/customers_list.dspy')}}", "style": {
"data_method": "GET", "marginBottom": "16px",
"row_options": { "gap": "8px"
"fields": [ }
{
"name": "customer_code",
"title": "客户编码",
"uitype": "str",
"cwidth": 12
}, },
{ "subwidgets": [
"name": "customer_name", {
"title": "客户名称", "widgettype": "Text",
"uitype": "str", "options": {
"cwidth": 15 "style": {
}, "fontSize": "20px",
{ "fontWeight": "bold"
"name": "customer_type", },
"title": "类型", "text": "客户管理"
"uitype": "str", }
"cwidth": 10 },
}, {
{ "widgettype": "Filler",
"name": "industry", "options": {}
"title": "行业", },
"uitype": "str", {
"cwidth": 10 "widgettype": "Button",
}, "id": "btn_add_customer",
{ "options": {
"name": "contact_person", "label": "新增客户",
"title": "联系人", "variant": "primary"
"uitype": "str", }
"cwidth": 10 }
}, ]
{ },
"name": "phone", {
"title": "电话", "widgettype": "Tabular",
"uitype": "str", "id": "customer_grid",
"cwidth": 12 "options": {
}, "data_url": "{{entire_url('api/customers_list.dspy')}}",
{ "data_method": "GET",
"name": "status", "row_options": {
"title": "状态", "fields": [
"uitype": "str", {
"cwidth": 8 "name": "customer_code",
"title": "客户编码",
"uitype": "str",
"cwidth": 12
},
{
"name": "customer_name",
"title": "客户名称",
"uitype": "str",
"cwidth": 15
},
{
"name": "customer_type",
"title": "类型",
"uitype": "str",
"cwidth": 10
},
{
"name": "industry",
"title": "行业",
"uitype": "str",
"cwidth": 10
},
{
"name": "contact_person",
"title": "联系人",
"uitype": "str",
"cwidth": 10
},
{
"name": "phone",
"title": "电话",
"uitype": "str",
"cwidth": 12
},
{
"name": "status",
"title": "状态",
"uitype": "str",
"cwidth": 8
}
],
"toolbar": [
{
"type": "button",
"text": "新增",
"icon": "add",
"action": "navigate('customer_edit.ui')"
},
{
"type": "button",
"text": "编辑",
"icon": "edit",
"action": "navigate('customer_edit.ui?id={{selectedRow.id}}')"
},
{
"type": "button",
"text": "删除",
"icon": "delete",
"action": "doDelete('{{selectedRow.id}}')"
}
]
}
} }
],
"toolbar": [
{
"type": "button",
"text": "新增",
"icon": "add",
"action": "navigate('customer_edit.ui')"
},
{
"type": "button",
"text": "编辑",
"icon": "edit",
"action": "navigate('customer_edit.ui?id={{selectedRow.id}}')"
},
{
"type": "button",
"text": "删除",
"icon": "delete",
"action": "doDelete('{{selectedRow.id}}')"
}
]
} }
} ]
}
]
} }

View File

@ -1,45 +1,121 @@
{ {
"widgettype": "Page", "widgettype": "Page",
"options": { "options": {
"title": "客户列表", "title": "客户列表",
"style": {"height": "100vh", "padding": "0"} "style": {
}, "height": "100vh",
"subwidgets": [ "padding": "0"
{
"widgettype": "VBox",
"options": {"style": {"padding": "16px", "flex": 1, "overflow": "hidden"}},
"subwidgets": [
{
"widgettype": "HBox",
"options": {"style": {"marginBottom": "16px", "gap": "8px"}},
"subwidgets": [
{"widgettype": "TextField", "id": "search_keyword", "options": {"label": "搜索", "placeholder": "客户名称/编码", "style": {"flex": 1}}},
{"widgettype": "Button", "id": "btn_search", "options": {"text": "搜索", "variant": "primary"}}
]
},
{
"widgettype": "DataGrid",
"id": "customer_grid",
"options": {
"url": "{{entire_url('api/customers_list.dspy')}}",
"style": {"flex": 1},
"columns": [
{"field": "customer_code", "header": "客户编码", "width": 120},
{"field": "customer_name", "header": "客户名称", "width": 200},
{"field": "customer_type", "header": "类型", "width": 100},
{"field": "industry", "header": "行业", "width": 120},
{"field": "contact_person", "header": "联系人", "width": 100},
{"field": "phone", "header": "电话", "width": 120},
{"field": "status", "header": "状态", "width": 80}
],
"toolbar": [
{"type": "button", "text": "新增", "icon": "add", "action": "navigate('main/customer_management/customer_edit.ui')"},
{"type": "button", "text": "编辑", "icon": "edit", "action": "navigate('main/customer_management/customer_edit.ui?id={% raw %}{{selectedRow.id}}{% endraw %}')"},
{"type": "button", "text": "删除", "icon": "delete", "action": "doDelete('{% raw %}{{selectedRow.id}}{% endraw %}')"}
]
}
} }
] },
} "subwidgets": [
] {
"widgettype": "VBox",
"options": {
"style": {
"padding": "16px",
"flex": 1,
"overflow": "hidden"
}
},
"subwidgets": [
{
"widgettype": "HBox",
"options": {
"style": {
"marginBottom": "16px",
"gap": "8px"
}
},
"subwidgets": [
{
"widgettype": "TextField",
"id": "search_keyword",
"options": {
"label": "搜索",
"placeholder": "客户名称/编码",
"style": {
"flex": 1
}
}
},
{
"widgettype": "Button",
"id": "btn_search",
"options": {
"variant": "primary",
"label": "搜索"
}
}
]
},
{
"widgettype": "DataGrid",
"id": "customer_grid",
"options": {
"url": "{{entire_url('api/customers_list.dspy')}}",
"style": {
"flex": 1
},
"columns": [
{
"field": "customer_code",
"header": "客户编码",
"width": 120
},
{
"field": "customer_name",
"header": "客户名称",
"width": 200
},
{
"field": "customer_type",
"header": "类型",
"width": 100
},
{
"field": "industry",
"header": "行业",
"width": 120
},
{
"field": "contact_person",
"header": "联系人",
"width": 100
},
{
"field": "phone",
"header": "电话",
"width": 120
},
{
"field": "status",
"header": "状态",
"width": 80
}
],
"toolbar": [
{
"type": "button",
"text": "新增",
"icon": "add",
"action": "navigate('main/customer_management/customer_edit.ui')"
},
{
"type": "button",
"text": "编辑",
"icon": "edit",
"action": "navigate('main/customer_management/customer_edit.ui?id={% raw %}{{selectedRow.id}}{% endraw %}')"
},
{
"type": "button",
"text": "删除",
"icon": "delete",
"action": "doDelete('{% raw %}{{selectedRow.id}}{% endraw %}')"
}
]
}
}
]
}
]
} }

View File

@ -10,11 +10,11 @@
{ {
"widgettype": "Text", "widgettype": "Text",
"options": { "options": {
"label": "客户管理",
"fontSize": "24px", "fontSize": "24px",
"fontWeight": "bold", "fontWeight": "bold",
"color": "#1E40AF", "color": "#1E40AF",
"marginBottom": "20px" "marginBottom": "20px",
"text": "客户管理"
} }
}, },
{ {
@ -49,19 +49,19 @@
{ {
"widgettype": "Text", "widgettype": "Text",
"options": { "options": {
"label": "客户列表",
"fontSize": "18px", "fontSize": "18px",
"fontWeight": "bold", "fontWeight": "bold",
"color": "#1E40AF" "color": "#1E40AF",
"text": "客户列表"
} }
}, },
{ {
"widgettype": "Text", "widgettype": "Text",
"options": { "options": {
"label": "查看所有客户信息,支持搜索和筛选",
"fontSize": "14px", "fontSize": "14px",
"color": "#6B7280", "color": "#6B7280",
"marginTop": "8px" "marginTop": "8px",
"text": "查看所有客户信息,支持搜索和筛选"
} }
} }
] ]
@ -91,19 +91,19 @@
{ {
"widgettype": "Text", "widgettype": "Text",
"options": { "options": {
"label": "新建客户",
"fontSize": "18px", "fontSize": "18px",
"fontWeight": "bold", "fontWeight": "bold",
"color": "#059669" "color": "#059669",
"text": "新建客户"
} }
}, },
{ {
"widgettype": "Text", "widgettype": "Text",
"options": { "options": {
"label": "创建新的客户档案",
"fontSize": "14px", "fontSize": "14px",
"color": "#6B7280", "color": "#6B7280",
"marginTop": "8px" "marginTop": "8px",
"text": "创建新的客户档案"
} }
} }
] ]
@ -133,19 +133,19 @@
{ {
"widgettype": "Text", "widgettype": "Text",
"options": { "options": {
"label": "客户池",
"fontSize": "18px", "fontSize": "18px",
"fontWeight": "bold", "fontWeight": "bold",
"color": "#D97706" "color": "#D97706",
"text": "客户池"
} }
}, },
{ {
"widgettype": "Text", "widgettype": "Text",
"options": { "options": {
"label": "公海客户池,领取和管理公共客户资源",
"fontSize": "14px", "fontSize": "14px",
"color": "#6B7280", "color": "#6B7280",
"marginTop": "8px" "marginTop": "8px",
"text": "公海客户池,领取和管理公共客户资源"
} }
} }
] ]
@ -175,19 +175,19 @@
{ {
"widgettype": "Text", "widgettype": "Text",
"options": { "options": {
"label": "客户交接",
"fontSize": "18px", "fontSize": "18px",
"fontWeight": "bold", "fontWeight": "bold",
"color": "#7C3AED" "color": "#7C3AED",
"text": "客户交接"
} }
}, },
{ {
"widgettype": "Text", "widgettype": "Text",
"options": { "options": {
"label": "管理客户交接流程和记录",
"fontSize": "14px", "fontSize": "14px",
"color": "#6B7280", "color": "#6B7280",
"marginTop": "8px" "marginTop": "8px",
"text": "管理客户交接流程和记录"
} }
} }
] ]