diff --git a/pyproject.toml b/pyproject.toml index e68c50c..67d0099 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,6 +11,7 @@ dependencies = [ "sqlor", "bricks_for_python", "requests", + "openpyxl", ] [tool.setuptools.packages.find] diff --git a/scripts/load_path.py b/scripts/load_path.py index 4792491..30d071b 100644 --- a/scripts/load_path.py +++ b/scripts/load_path.py @@ -92,6 +92,9 @@ PATHS = [ # DingTalk f"/{MOD}/api/submit_approval.dspy", f"/{MOD}/api/dingtalk_callback.dspy", + # Export + f"/{MOD}/api/export_leads.dspy", + f"/{MOD}/api/export_content.dspy", ] def run(role, paths): diff --git a/wwwroot/admin.ui b/wwwroot/admin.ui index 30fa308..9bbd987 100644 --- a/wwwroot/admin.ui +++ b/wwwroot/admin.ui @@ -309,6 +309,66 @@ } ] }, + { + "widgettype": "HBox", + "options": { + "width": "100%", + "gap": "12px", + "marginTop": "16px", + "padding": "12px", + "css": "card", + "alignItems": "center" + }, + "subwidgets": [ + { + "widgettype": "Text", + "options": { + "text": "📥 数据导出", + "fontSize": "16px", + "fontWeight": "bold" + } + }, + { + "widgettype": "Filler" + }, + { + "widgettype": "Button", + "id": "btn_export_leads", + "options": { + "label": "导出商机线索", + "css": "primary" + }, + "binds": [ + { + "wid": "self", + "event": "click", + "actiontype": "script", + "options": { + "code": "var btn=this;btn.setLabel('生成中...');fetch(bricks.absurl('/cms/api/export_leads.dspy',btn)).then(function(r){return r.json()}).then(function(d){if(d.status==='ok'){var bin=atob(d.data);var bytes=new Uint8Array(bin.length);for(var i=0;i