{% set billing_url = entire_url('/accounting/billing.dspy') %} {% set download_url = entire_url('/accounting/billing_download.dspy') %} { "widgettype": "VBox", "id": "billing_page", "options": { "width": "100%", "height": "100%", "gap": "10px" }, "subwidgets": [ { "widgettype": "InlineForm", "id": "billing_form", "options": { "fields": [ { "name": "start_date", "label": "开始日期", "uitype": "date", "required": true }, { "name": "end_date", "label": "结束日期", "uitype": "date", "required": true } ], "submit_label": "查询" }, "binds": [ { "wid": "self", "event": "submit", "actiontype": "method", "target": "app.billing_tabular", "method": "render" } ] }, { "widgettype": "HBox", "id": "billing_stats_box", "options": { "width": "100%", "height": "40px", "gap": "20px", "align_items": "center" }, "subwidgets": [ { "widgettype": "Text", "id": "billing_stats", "options": { "text": "请输入日期范围进行查询", "css": "font-size: 14px; color: #666;" } }, { "widgettype": "Button", "id": "billing_download_btn", "options": { "label": "下载Excel", "css": "background-color: #52c41a; color: white; padding: 5px 15px; border-radius: 4px; cursor: pointer;" }, "binds": [ { "wid": "self", "event": "click", "actiontype": "script", "script": "var f=bricks.getWidgetById('billing_form');if(!f)return;var v=f.values||{};if(!v.start_date||!v.end_date){bricks.show_error({title:'提示',message:'请先选择日期范围'});return;}var u='{{download_url}}?start_date='+encodeURIComponent(v.start_date)+'&end_date='+encodeURIComponent(v.end_date);fetch(u,{credentials:'include'}).then(function(r){return r.json()}).then(function(d){if(d.status!=='ok'){bricks.show_error({title:'下载失败',message:d.data.message});return;}var b=atob(d.data.content),n=b.length,arr=new Uint8Array(n);for(var i=0;i