diff --git a/wwwroot/base.ui b/wwwroot/base.ui index b6a6ec8..ad3722f 100644 --- a/wwwroot/base.ui +++ b/wwwroot/base.ui @@ -1,67 +1,120 @@ { - "type": "Page", - "title": "Customer Management", - "content": { - "type": "VBox", - "style": {"padding": "16px", "height": "100%"}, - "children": [ - { - "type": "HBox", - "justify": "space-between", - "style": {"marginBottom": "16px"}, - "children": [ - {"type": "Text", "content": "Customer List", "style": {"fontSize": "20px", "fontWeight": "bold"}}, - {"type": "Button", "id": "addCustomerBtn", "text": "Add Customer", "variant": "primary", "leadingIcon": "add", "onclick": "openDialog('addCustomerDialog')"} - ] + "id": "customer_management", + "widgettype": "VBox", + "options": { + "width": "100%", + "height": "100%", + "style": { + "padding": "16px" + } + }, + "subwidgets": [ + { + "widgettype": "HBox", + "options": { + "style": { + "marginBottom": "16px", + "gap": "8px" + } }, - { - "type": "CRUD", - "id": "customerCRUD", - "api": { - "list": "main/customer_management/api/customers_list.dspy", - "create": "main/customer_management/api/customers_create.dspy", - "update": "main/customer_management/api/customers_update.dspy", - "delete": "main/customer_management/api/customers_delete.dspy" + "subwidgets": [ + { + "widgettype": "Text", + "options": { + "label": "客户管理", + "style": { + "fontSize": "20px", + "fontWeight": "bold" + } + } }, - "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", + { + "widgettype": "Filler", + "options": {} + }, + { + "widgettype": "Button", + "id": "btn_add_customer", + "options": { + "label": "新增客户", + "variant": "primary" + } + } + ] + }, + { + "widgettype": "Tabular", + "id": "customer_grid", + "options": { + "data_url": "{{entire_url('api/customers_list.dspy')}}", + "data_method": "GET", + "row_options": { "fields": [ - {"field": "customer_name", "title": "Customer Name", "uitype": "TextField", "required": true}, - {"field": "customer_type", "title": "Type", "uitype": "SelectField", "required": true, "options": "code:customer_type"}, - {"field": "phone", "title": "Phone", "uitype": "TextField"}, - {"field": "email", "title": "Email", "uitype": "TextField"}, - {"field": "tax_id", "title": "Tax ID", "uitype": "TextField"}, - {"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"}, - {"field": "region", "title": "Region", "uitype": "TextField"}, - {"field": "owner_id", "title": "Owner ID", "uitype": "TextField", "required": true} + { + "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 + } ], - "actions": [ - {"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')"} + "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}}')" + } ] } } - ] - } + } + ] } \ No newline at end of file