diff --git a/wwwroot/base.ui b/wwwroot/base.ui index 8e2e25e..9bbbd70 100644 --- a/wwwroot/base.ui +++ b/wwwroot/base.ui @@ -1,67 +1,120 @@ { - "type": "Page", - "title": "Opportunity Management", - "content": { - "type": "VBox", - "style": {"padding": "16px", "height": "100%"}, - "children": [ - { - "type": "HBox", - "justify": "space-between", - "style": {"marginBottom": "16px"}, - "children": [ - {"type": "Text", "content": "Opportunity List", "style": {"fontSize": "20px", "fontWeight": "bold"}}, - {"type": "Button", "text": "Add Opportunity", "variant": "primary", "leadingIcon": "add", "onclick": "openDialog('addOpportunityDialog')"} - ] + "id": "opportunity_management", + "widgettype": "VBox", + "options": { + "width": "100%", + "height": "100%", + "style": { + "padding": "16px" + } + }, + "subwidgets": [ + { + "widgettype": "HBox", + "options": { + "style": { + "marginBottom": "16px", + "gap": "8px" + } }, - { - "type": "CRUD", - "id": "opportunityCRUD", - "api": { - "list": "api/opportunities_list.dspy", - "create": "api/opportunities_create.dspy", - "update": "api/opportunities_update.dspy", - "delete": "api/opportunities_delete.dspy" + "subwidgets": [ + { + "widgettype": "Text", + "options": { + "label": "商机管理", + "style": { + "fontSize": "20px", + "fontWeight": "bold" + } + } }, - "columns": [ - {"field": "opportunity_name", "title": "Opportunity", "width": 200}, - {"field": "customer_name", "title": "Customer", "width": 150}, - {"field": "estimated_amount", "title": "Amount", "width": 120}, - {"field": "current_stage", "title": "Stage", "width": 120}, - {"field": "probability", "title": "Probability", "width": 100}, - {"field": "expected_close_date", "title": "Close Date", "width": 120}, - {"field": "owner_name", "title": "Owner", "width": 100}, - {"field": "status", "title": "Status", "width": 80, "formatter": "code:opportunity_status"}, - {"field": "created_at", "title": "Created", "width": 160} - ], - "style": {"flex": 1} - }, - { - "type": "Dialog", - "id": "addOpportunityDialog", - "title": "Add Opportunity", - "width": 600, - "content": { - "type": "Form", - "id": "addOpportunityForm", + { + "widgettype": "Filler", + "options": {} + }, + { + "widgettype": "Button", + "id": "btn_add_opportunity", + "options": { + "label": "新增商机", + "variant": "primary" + } + } + ] + }, + { + "widgettype": "Tabular", + "id": "opportunity_grid", + "options": { + "data_url": "{{entire_url('api/opportunities_list.dspy')}}", + "data_method": "GET", + "row_options": { "fields": [ - {"field": "opportunity_name", "title": "Opportunity Name", "uitype": "TextField", "required": true}, - {"field": "customer_id", "title": "Customer ID", "uitype": "TextField", "required": true}, - {"field": "customer_name", "title": "Customer Name", "uitype": "TextField", "required": true}, - {"field": "estimated_amount", "title": "Estimated Amount", "uitype": "TextField", "required": true}, - {"field": "current_stage", "title": "Stage", "uitype": "TextField", "required": true}, - {"field": "expected_close_date", "title": "Expected Close Date", "uitype": "DateField", "required": true}, - {"field": "owner_id", "title": "Owner ID", "uitype": "TextField", "required": true}, - {"field": "owner_name", "title": "Owner Name", "uitype": "TextField", "required": true}, - {"field": "region", "title": "Region", "uitype": "TextField"}, - {"field": "description", "title": "Description", "uitype": "TextField"} + { + "name": "opportunity_code", + "title": "商机编码", + "uitype": "str", + "cwidth": 12 + }, + { + "name": "opportunity_name", + "title": "商机名称", + "uitype": "str", + "cwidth": 15 + }, + { + "name": "customer_name", + "title": "客户", + "uitype": "str", + "cwidth": 12 + }, + { + "name": "stage", + "title": "阶段", + "uitype": "str", + "cwidth": 10 + }, + { + "name": "amount", + "title": "金额", + "uitype": "str", + "cwidth": 12 + }, + { + "name": "probability", + "title": "概率", + "uitype": "str", + "cwidth": 8 + }, + { + "name": "expected_close_date", + "title": "预计关闭日期", + "uitype": "str", + "cwidth": 12 + } ], - "actions": [ - {"type": "Button", "text": "Cancel", "onclick": "closeDialog('addOpportunityDialog')"}, - {"type": "Button", "text": "Submit", "variant": "primary", "onclick": "submitForm('addOpportunityForm', 'api/opportunities_create.dspy', 'addOpportunityDialog', 'opportunityCRUD')"} + "toolbar": [ + { + "type": "button", + "text": "新增", + "icon": "add", + "action": "navigate('opportunity_edit.ui')" + }, + { + "type": "button", + "text": "编辑", + "icon": "edit", + "action": "navigate('opportunity_edit.ui?id={{selectedRow.id}}')" + }, + { + "type": "button", + "text": "删除", + "icon": "delete", + "action": "doDelete('{{selectedRow.id}}')" + } ] } } - ] - } -} + } + ] +} \ No newline at end of file