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:25 +08:00
parent a7d7b9da68
commit 9e3734525c
4 changed files with 358 additions and 244 deletions

View File

@ -1,66 +1,72 @@
{ {
"widgettype": "VBox", "widgettype": "VBox",
"options": { "options": {
"maxWidth": "100%", "maxWidth": "100%",
"padding": "15px" "padding": "15px"
},
"subwidgets": [
{
"widgettype": "Text",
"options": {
"text": "审批详情",
"fontSize": "18px",
"fontWeight": "bold",
"marginBottom": "20px"
}
}, },
{ "subwidgets": [
"widgettype": "Form",
"options": {
"tblname": "approval_task",
"mode": "view",
"fields": ["title", "step_name", "description", "assigned_at", "due_at"],
"fieldLabels": {
"title": "审批事项",
"step_name": "审批步骤",
"description": "详细说明",
"assigned_at": "分配时间",
"due_at": "截止时间"
}
}
},
{
"widgettype": "HBox",
"options": {
"marginTop": "30px",
"gap": "10px"
},
"subwidgets": [
{ {
"widgettype": "Button", "widgettype": "Text",
"options": { "options": {
"text": "批准", "text": "审批详情",
"onClick": "approve_task", "fontSize": "18px",
"style": { "fontWeight": "bold",
"backgroundColor": "#28a745", "marginBottom": "20px"
"color": "white",
"flex": "1"
} }
}
}, },
{ {
"widgettype": "Button", "widgettype": "Form",
"options": { "options": {
"text": "拒绝", "tblname": "approval_task",
"onClick": "reject_task", "mode": "view",
"style": { "fields": [
"backgroundColor": "#dc3545", "title",
"color": "white", "step_name",
"flex": "1" "description",
"assigned_at",
"due_at"
],
"fieldLabels": {
"title": "审批事项",
"step_name": "审批步骤",
"description": "详细说明",
"assigned_at": "分配时间",
"due_at": "截止时间"
}
} }
} },
{
"widgettype": "HBox",
"options": {
"marginTop": "30px",
"gap": "10px"
},
"subwidgets": [
{
"widgettype": "Button",
"options": {
"onClick": "approve_task",
"style": {
"backgroundColor": "#28a745",
"color": "white",
"flex": "1"
},
"label": "批准"
}
},
{
"widgettype": "Button",
"options": {
"onClick": "reject_task",
"style": {
"backgroundColor": "#dc3545",
"color": "white",
"flex": "1"
},
"label": "拒绝"
}
}
]
} }
] ]
}
]
} }

View File

@ -1,87 +1,185 @@
{ {
"id": "workflow_approval", "id": "workflow_approval",
"widgettype": "VBox", "widgettype": "VBox",
"options": {"width": "100%", "height": "100%", "style": {"padding": "16px"}}, "options": {
"subwidgets": [ "width": "100%",
{ "height": "100%",
"widgettype": "HBox", "style": {
"options": {"style": {"marginBottom": "16px", "gap": "8px"}}, "padding": "16px"
"subwidgets": [ }
{"widgettype": "Text", "options": {"label": "审批管理", "style": {"fontSize": "20px", "fontWeight": "bold"}}},
{"widgettype": "Filler", "options": {}}
]
}, },
{ "subwidgets": [
"widgettype": "TabPanel", {
"id": "approval_tabs", "widgettype": "HBox",
"options": { "options": {
"tab_pos": "top", "style": {
"items": [ "marginBottom": "16px",
{ "gap": "8px"
"name": "pending",
"label": "待审批",
"content": {
"widgettype": "Tabular",
"id": "pending_grid",
"options": {
"data_url": "{{entire_url('api/approvals_list.dspy?status=pending')}}",
"data_method": "GET",
"row_options": {
"fields": [
{"name": "approval_code", "title": "审批编号", "uitype": "str", "cwidth": 12},
{"name": "title", "title": "标题", "uitype": "str", "cwidth": 20},
{"name": "applicant", "title": "申请人", "uitype": "str", "cwidth": 10},
{"name": "apply_date", "title": "申请日期", "uitype": "str", "cwidth": 12},
{"name": "status", "title": "状态", "uitype": "str", "cwidth": 8}
]
} }
} },
} "subwidgets": [
}, {
{ "widgettype": "Text",
"name": "approved", "options": {
"label": "已审批", "style": {
"content": { "fontSize": "20px",
"widgettype": "Tabular", "fontWeight": "bold"
"id": "approved_grid", },
"options": { "text": "审批管理"
"data_url": "{{entire_url('api/approvals_list.dspy?status=approved')}}", }
"data_method": "GET", },
"row_options": { {
"fields": [ "widgettype": "Filler",
{"name": "approval_code", "title": "审批编号", "uitype": "str", "cwidth": 12}, "options": {}
{"name": "title", "title": "标题", "uitype": "str", "cwidth": 20},
{"name": "applicant", "title": "申请人", "uitype": "str", "cwidth": 10},
{"name": "apply_date", "title": "申请日期", "uitype": "str", "cwidth": 12},
{"name": "status", "title": "状态", "uitype": "str", "cwidth": 8}
]
} }
} ]
},
{
"widgettype": "TabPanel",
"id": "approval_tabs",
"options": {
"tab_pos": "top",
"items": [
{
"name": "pending",
"label": "待审批",
"content": {
"widgettype": "Tabular",
"id": "pending_grid",
"options": {
"data_url": "{{entire_url('api/approvals_list.dspy?status=pending')}}",
"data_method": "GET",
"row_options": {
"fields": [
{
"name": "approval_code",
"title": "审批编号",
"uitype": "str",
"cwidth": 12
},
{
"name": "title",
"title": "标题",
"uitype": "str",
"cwidth": 20
},
{
"name": "applicant",
"title": "申请人",
"uitype": "str",
"cwidth": 10
},
{
"name": "apply_date",
"title": "申请日期",
"uitype": "str",
"cwidth": 12
},
{
"name": "status",
"title": "状态",
"uitype": "str",
"cwidth": 8
}
]
}
}
}
},
{
"name": "approved",
"label": "已审批",
"content": {
"widgettype": "Tabular",
"id": "approved_grid",
"options": {
"data_url": "{{entire_url('api/approvals_list.dspy?status=approved')}}",
"data_method": "GET",
"row_options": {
"fields": [
{
"name": "approval_code",
"title": "审批编号",
"uitype": "str",
"cwidth": 12
},
{
"name": "title",
"title": "标题",
"uitype": "str",
"cwidth": 20
},
{
"name": "applicant",
"title": "申请人",
"uitype": "str",
"cwidth": 10
},
{
"name": "apply_date",
"title": "申请日期",
"uitype": "str",
"cwidth": 12
},
{
"name": "status",
"title": "状态",
"uitype": "str",
"cwidth": 8
}
]
}
}
}
},
{
"name": "rejected",
"label": "已拒绝",
"content": {
"widgettype": "Tabular",
"id": "rejected_grid",
"options": {
"data_url": "{{entire_url('api/approvals_list.dspy?status=rejected')}}",
"data_method": "GET",
"row_options": {
"fields": [
{
"name": "approval_code",
"title": "审批编号",
"uitype": "str",
"cwidth": 12
},
{
"name": "title",
"title": "标题",
"uitype": "str",
"cwidth": 20
},
{
"name": "applicant",
"title": "申请人",
"uitype": "str",
"cwidth": 10
},
{
"name": "apply_date",
"title": "申请日期",
"uitype": "str",
"cwidth": 12
},
{
"name": "status",
"title": "状态",
"uitype": "str",
"cwidth": 8
}
]
}
}
}
}
]
} }
}, }
{ ]
"name": "rejected",
"label": "已拒绝",
"content": {
"widgettype": "Tabular",
"id": "rejected_grid",
"options": {
"data_url": "{{entire_url('api/approvals_list.dspy?status=rejected')}}",
"data_method": "GET",
"row_options": {
"fields": [
{"name": "approval_code", "title": "审批编号", "uitype": "str", "cwidth": 12},
{"name": "title", "title": "标题", "uitype": "str", "cwidth": 20},
{"name": "applicant", "title": "申请人", "uitype": "str", "cwidth": 10},
{"name": "apply_date", "title": "申请日期", "uitype": "str", "cwidth": 12},
{"name": "status", "title": "状态", "uitype": "str", "cwidth": 8}
]
}
}
}
}
]
}
}
]
} }

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": "#D97706" "color": "#D97706",
"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": "#7C3AED" "color": "#7C3AED",
"text": "工作流配置"
} }
}, },
{ {
"widgettype": "Text", "widgettype": "Text",
"options": { "options": {
"label": "配置审批工作流模板",
"fontSize": "14px", "fontSize": "14px",
"color": "#6B7280", "color": "#6B7280",
"marginTop": "8px" "marginTop": "8px",
"text": "配置审批工作流模板"
} }
} }
] ]
@ -166,4 +166,4 @@
} }
} }
] ]
} }

View File

@ -1,98 +1,108 @@
{ {
"widgettype": "VBox", "widgettype": "VBox",
"options": { "options": {
"maxWidth": "100%", "maxWidth": "100%",
"padding": "10px" "padding": "10px"
}, },
"subwidgets": [ "subwidgets": [
{
"widgettype": "HBox",
"options": {
"alignItems": "center",
"justifyContent": "space-between",
"marginBottom": "15px"
},
"subwidgets": [
{ {
"widgettype": "Text", "widgettype": "HBox",
"options": { "options": {
"text": "审批中心", "alignItems": "center",
"fontSize": "20px", "justifyContent": "space-between",
"fontWeight": "bold" "marginBottom": "15px"
} },
"subwidgets": [
{
"widgettype": "Text",
"options": {
"text": "审批中心",
"fontSize": "20px",
"fontWeight": "bold"
}
},
{
"widgettype": "Button",
"options": {
"onClick": "goto('workflow_approval/approval_instance/create.ui')",
"style": {
"backgroundColor": "#007bff",
"color": "white",
"border": "none",
"padding": "8px 16px",
"borderRadius": "4px"
},
"label": "发起审批"
}
}
]
}, },
{ {
"widgettype": "Button", "widgettype": "TabPanel",
"options": { "options": {
"text": "发起审批", "items": [
"onClick": "goto('workflow_approval/approval_instance/create.ui')", {
"style": { "title": "待我审批",
"backgroundColor": "#007bff", "content": {
"color": "white", "widgettype": "DataGrid",
"border": "none", "options": {
"padding": "8px 16px", "tblname": "approval_task",
"borderRadius": "4px" "where": {
"approver_id": "${logined_userid}",
"status": "pending"
},
"fields": [
"title",
"step_name",
"assigned_at",
"due_at"
],
"fieldLabels": {
"title": "审批事项",
"step_name": "步骤",
"assigned_at": "分配时间",
"due_at": "截止时间"
},
"onRowClick": "goto('workflow_approval/approval_task/detail.ui?id=${id}')"
}
}
},
{
"title": "我发起的",
"content": {
"widgettype": "DataGrid",
"options": {
"tblname": "approval_instance",
"where": {
"initiator_id": "${logined_userid}"
},
"fields": [
"title",
"status",
"created_at",
"completed_at"
],
"fieldLabels": {
"title": "审批事项",
"status": "状态",
"created_at": "发起时间",
"completed_at": "完成时间"
},
"onRowClick": "goto('workflow_approval/approval_instance/detail.ui?id=${id}')"
}
}
},
{
"title": "工作流管理",
"content": {
"widgettype": "Frame",
"options": {
"src": "workflow_approval/approval_workflow/list.ui"
}
}
}
]
} }
}
} }
] ]
},
{
"widgettype": "TabPanel",
"options": {
"items": [
{
"title": "待我审批",
"content": {
"widgettype": "DataGrid",
"options": {
"tblname": "approval_task",
"where": {
"approver_id": "${logined_userid}",
"status": "pending"
},
"fields": ["title", "step_name", "assigned_at", "due_at"],
"fieldLabels": {
"title": "审批事项",
"step_name": "步骤",
"assigned_at": "分配时间",
"due_at": "截止时间"
},
"onRowClick": "goto('workflow_approval/approval_task/detail.ui?id=${id}')"
}
}
},
{
"title": "我发起的",
"content": {
"widgettype": "DataGrid",
"options": {
"tblname": "approval_instance",
"where": {
"initiator_id": "${logined_userid}"
},
"fields": ["title", "status", "created_at", "completed_at"],
"fieldLabels": {
"title": "审批事项",
"status": "状态",
"created_at": "发起时间",
"completed_at": "完成时间"
},
"onRowClick": "goto('workflow_approval/approval_instance/detail.ui?id=${id}')"
}
}
},
{
"title": "工作流管理",
"content": {
"widgettype": "Frame",
"options": {
"src": "workflow_approval/approval_workflow/list.ui"
}
}
}
]
}
}
]
} }