This commit is contained in:
yumoqing 2026-05-03 14:25:31 +08:00
parent 41636f0c91
commit 74d9c1e426

View File

@ -1,67 +1,120 @@
{ {
"type": "Page", "id": "customer_management",
"title": "Customer Management", "widgettype": "VBox",
"content": { "options": {
"type": "VBox", "width": "100%",
"style": {"padding": "16px", "height": "100%"}, "height": "100%",
"children": [ "style": {
"padding": "16px"
}
},
"subwidgets": [
{ {
"type": "HBox", "widgettype": "HBox",
"justify": "space-between", "options": {
"style": {"marginBottom": "16px"}, "style": {
"children": [ "marginBottom": "16px",
{"type": "Text", "content": "Customer List", "style": {"fontSize": "20px", "fontWeight": "bold"}}, "gap": "8px"
{"type": "Button", "id": "addCustomerBtn", "text": "Add Customer", "variant": "primary", "leadingIcon": "add", "onclick": "openDialog('addCustomerDialog')"} }
},
"subwidgets": [
{
"widgettype": "Text",
"options": {
"label": "客户管理",
"style": {
"fontSize": "20px",
"fontWeight": "bold"
}
}
},
{
"widgettype": "Filler",
"options": {}
},
{
"widgettype": "Button",
"id": "btn_add_customer",
"options": {
"label": "新增客户",
"variant": "primary"
}
}
] ]
}, },
{ {
"type": "CRUD", "widgettype": "Tabular",
"id": "customerCRUD", "id": "customer_grid",
"api": { "options": {
"list": "main/customer_management/api/customers_list.dspy", "data_url": "{{entire_url('api/customers_list.dspy')}}",
"create": "main/customer_management/api/customers_create.dspy", "data_method": "GET",
"update": "main/customer_management/api/customers_update.dspy", "row_options": {
"delete": "main/customer_management/api/customers_delete.dspy"
},
"columns": [
{"field": "customer_name", "title": "Customer Name", "width": 180},
{"field": "customer_type", "title": "Type", "width": 100, "formatter": "code:customer_type"},
{"field": "phone", "title": "Phone", "width": 130},
{"field": "email", "title": "Email", "width": 180},
{"field": "industry", "title": "Industry", "width": 120},
{"field": "customer_level", "title": "Level", "width": 100, "formatter": "code:customer_level"},
{"field": "region", "title": "Region", "width": 100},
{"field": "status", "title": "Status", "width": 80, "formatter": "code:customer_status"},
{"field": "created_at", "title": "Created", "width": 160}
],
"style": {"flex": 1}
},
{
"type": "Dialog",
"id": "addCustomerDialog",
"title": "Add Customer",
"width": 600,
"content": {
"type": "Form",
"id": "addCustomerForm",
"fields": [ "fields": [
{"field": "customer_name", "title": "Customer Name", "uitype": "TextField", "required": true}, {
{"field": "customer_type", "title": "Type", "uitype": "SelectField", "required": true, "options": "code:customer_type"}, "name": "customer_code",
{"field": "phone", "title": "Phone", "uitype": "TextField"}, "title": "客户编码",
{"field": "email", "title": "Email", "uitype": "TextField"}, "uitype": "str",
{"field": "tax_id", "title": "Tax ID", "uitype": "TextField"}, "cwidth": 12
{"field": "industry", "title": "Industry", "uitype": "TextField"}, },
{"field": "customer_level", "title": "Level", "uitype": "SelectField", "options": "code:customer_level", "value": "potential"}, {
{"field": "address", "title": "Address", "uitype": "TextField"}, "name": "customer_name",
{"field": "region", "title": "Region", "uitype": "TextField"}, "title": "客户名称",
{"field": "owner_id", "title": "Owner ID", "uitype": "TextField", "required": true} "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
}
], ],
"actions": [ "toolbar": [
{"type": "Button", "text": "Cancel", "onclick": "closeDialog('addCustomerDialog')"}, {
{"type": "Button", "text": "Submit", "variant": "primary", "onclick": "submitForm('addCustomerForm', 'main/customer_management/api/customers_create.dspy', 'addCustomerDialog', 'customerCRUD')"} "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}}')"
} }
] ]
} }
} }
}
]
}