- export_leads.dspy: generate xlsx with openpyxl, base64 return - export_content.dspy: generate xlsx for content list - admin.ui: add export section with download buttons - load_path.py: register export endpoints for RBAC - pyproject.toml: add openpyxl dependency
382 lines
16 KiB
XML
382 lines
16 KiB
XML
{
|
|
"widgettype": "VBox",
|
|
"options": {
|
|
"width": "100%",
|
|
"height": "100%",
|
|
"padding": "20px"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"text": "企业CMS管理后台",
|
|
"fontSize": "24px",
|
|
"fontWeight": "bold",
|
|
"css": "title"
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"text": "管理官网内容、分类、商机线索和站点配置",
|
|
"fontSize": "14px",
|
|
"color": "#999",
|
|
"css": "subtitle"
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "ResponsableBox",
|
|
"options": {
|
|
"gap": "16px",
|
|
"minWidth": "220px",
|
|
"css": "admin-cards"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "Button",
|
|
"options": {
|
|
"css": "card",
|
|
"padding": "20px",
|
|
"borderRadius": "12px",
|
|
"border": "none"
|
|
},
|
|
"binds": [
|
|
{
|
|
"wid": "self",
|
|
"event": "click",
|
|
"actiontype": "urlwidget",
|
|
"target": "app.sage_main_content",
|
|
"options": {
|
|
"url": "{{entire_url('/cms_content_list')}}"
|
|
},
|
|
"mode": "replace"
|
|
}
|
|
],
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "VBox",
|
|
"options": {
|
|
"alignItems": "flex-start",
|
|
"gap": "8px"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"text": "📝",
|
|
"fontSize": "32px"
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"text": "内容管理",
|
|
"fontSize": "18px",
|
|
"fontWeight": "bold"
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"text": "新闻、案例、产品、Banner",
|
|
"fontSize": "13px",
|
|
"color": "#999"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"widgettype": "Button",
|
|
"options": {
|
|
"css": "card",
|
|
"padding": "20px",
|
|
"borderRadius": "12px",
|
|
"border": "none"
|
|
},
|
|
"binds": [
|
|
{
|
|
"wid": "self",
|
|
"event": "click",
|
|
"actiontype": "urlwidget",
|
|
"target": "app.sage_main_content",
|
|
"options": {
|
|
"url": "{{entire_url('/cms_sections_list')}}"
|
|
},
|
|
"mode": "replace"
|
|
}
|
|
],
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "VBox",
|
|
"options": {
|
|
"alignItems": "flex-start",
|
|
"gap": "8px"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"text": "🎨",
|
|
"fontSize": "32px"
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"text": "栏目管理",
|
|
"fontSize": "18px",
|
|
"fontWeight": "bold"
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"text": "栏目排序、显示隐藏、展示风格",
|
|
"fontSize": "13px",
|
|
"color": "#999"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"widgettype": "Button",
|
|
"options": {
|
|
"css": "card",
|
|
"padding": "20px",
|
|
"borderRadius": "12px",
|
|
"border": "none"
|
|
},
|
|
"binds": [
|
|
{
|
|
"wid": "self",
|
|
"event": "click",
|
|
"actiontype": "urlwidget",
|
|
"target": "app.sage_main_content",
|
|
"options": {
|
|
"url": "{{entire_url('/cms_categories_list')}}"
|
|
},
|
|
"mode": "replace"
|
|
}
|
|
],
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "VBox",
|
|
"options": {
|
|
"alignItems": "flex-start",
|
|
"gap": "8px"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"text": "📂",
|
|
"fontSize": "32px"
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"text": "内容分类",
|
|
"fontSize": "18px",
|
|
"fontWeight": "bold"
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"text": "管理产品分类、案例行业、新闻栏目",
|
|
"fontSize": "13px",
|
|
"color": "#999"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"widgettype": "Button",
|
|
"options": {
|
|
"css": "card",
|
|
"padding": "20px",
|
|
"borderRadius": "12px",
|
|
"border": "none"
|
|
},
|
|
"binds": [
|
|
{
|
|
"wid": "self",
|
|
"event": "click",
|
|
"actiontype": "urlwidget",
|
|
"target": "app.sage_main_content",
|
|
"options": {
|
|
"url": "{{entire_url('/cms_leads_list')}}"
|
|
},
|
|
"mode": "replace"
|
|
}
|
|
],
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "VBox",
|
|
"options": {
|
|
"alignItems": "flex-start",
|
|
"gap": "8px"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"text": "🎯",
|
|
"fontSize": "32px"
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"text": "商机线索",
|
|
"fontSize": "18px",
|
|
"fontWeight": "bold"
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"text": "访客留言、AI抽取商机",
|
|
"fontSize": "13px",
|
|
"color": "#999"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"widgettype": "Button",
|
|
"options": {
|
|
"css": "card",
|
|
"padding": "20px",
|
|
"borderRadius": "12px",
|
|
"border": "none"
|
|
},
|
|
"binds": [
|
|
{
|
|
"wid": "self",
|
|
"event": "click",
|
|
"actiontype": "urlwidget",
|
|
"target": "app.sage_main_content",
|
|
"options": {
|
|
"url": "{{entire_url('/cms_site_config_list')}}"
|
|
},
|
|
"mode": "replace"
|
|
}
|
|
],
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "VBox",
|
|
"options": {
|
|
"alignItems": "flex-start",
|
|
"gap": "8px"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"text": "⚙️",
|
|
"fontSize": "32px"
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"text": "站点配置",
|
|
"fontSize": "18px",
|
|
"fontWeight": "bold"
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"text": "首屏标语、页脚信息、联系方式",
|
|
"fontSize": "13px",
|
|
"color": "#999"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"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<bin.length;i++)bytes[i]=bin.charCodeAt(i);var blob=new Blob([bytes],{type:'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'});var url=URL.createObjectURL(blob);var a=document.createElement('a');a.href=url;a.download=d.filename;a.click();URL.revokeObjectURL(url);btn.setLabel('导出商机线索')}else{btn.setLabel('导出失败');setTimeout(function(){btn.setLabel('导出商机线索')},2000)}}).catch(function(){btn.setLabel('网络错误');setTimeout(function(){btn.setLabel('导出商机线索')},2000)})"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"widgettype": "Button",
|
|
"id": "btn_export_content",
|
|
"options": {
|
|
"label": "导出内容列表",
|
|
"css": "primary"
|
|
},
|
|
"binds": [
|
|
{
|
|
"wid": "self",
|
|
"event": "click",
|
|
"actiontype": "script",
|
|
"options": {
|
|
"code": "var btn=this;btn.setLabel('生成中...');fetch(bricks.absurl('/cms/api/export_content.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<bin.length;i++)bytes[i]=bin.charCodeAt(i);var blob=new Blob([bytes],{type:'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'});var url=URL.createObjectURL(blob);var a=document.createElement('a');a.href=url;a.download=d.filename;a.click();URL.revokeObjectURL(url);btn.setLabel('导出内容列表')}else{btn.setLabel('导出失败');setTimeout(function(){btn.setLabel('导出内容列表')},2000)}}).catch(function(){btn.setLabel('网络错误');setTimeout(function(){btn.setLabel('导出内容列表')},2000)})"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"widgettype": "VBox",
|
|
"id": "sage_main_content",
|
|
"options": {
|
|
"width": "100%",
|
|
"flex": "1",
|
|
"marginTop": "20px"
|
|
}
|
|
}
|
|
]
|
|
} |