171 lines
4.2 KiB
XML
171 lines
4.2 KiB
XML
{% 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",
|
|
"bgcolor": "#52c41a",
|
|
"color": "#FFFFFF"
|
|
},
|
|
"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<n;i++)arr[i]=b.charCodeAt(i);var blob=new Blob([arr],{type:'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'});var a=document.createElement('a');a.href=URL.createObjectURL(blob);a.download=d.data.filename;a.click()}).catch(function(e){bricks.show_error({title:'下载失败',message:e.toString()})})"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"widgettype": "Tabular",
|
|
"id": "billing_tabular",
|
|
"options": {
|
|
"width": "100%",
|
|
"flex": "1",
|
|
"cheight": 9,
|
|
"data_url": "{{entire_url('/accounting/billing.dspy')}}",
|
|
"editable": false,
|
|
"page_rows": 60,
|
|
"cache_limit": 3,
|
|
"row_options": {
|
|
"browserfields": {
|
|
"exclouded": ["row_num_"]
|
|
},
|
|
"fields": [
|
|
{
|
|
"name": "acc_date",
|
|
"title": "日期",
|
|
"type": "date",
|
|
"uitype": "date",
|
|
"datatype": "date",
|
|
"label": "日期",
|
|
"cwidth": 12
|
|
},
|
|
{
|
|
"name": "acc_timestamp",
|
|
"title": "时间",
|
|
"type": "timestamp",
|
|
"uitype": "timestamp",
|
|
"datatype": "timestamp",
|
|
"label": "时间",
|
|
"cwidth": 16
|
|
},
|
|
{
|
|
"name": "subject_name",
|
|
"title": "科目",
|
|
"type": "str",
|
|
"length": 50,
|
|
"uitype": "str",
|
|
"datatype": "str",
|
|
"label": "科目",
|
|
"cwidth": 14
|
|
},
|
|
{
|
|
"name": "acc_dir",
|
|
"title": "方向",
|
|
"type": "str",
|
|
"length": 4,
|
|
"uitype": "str",
|
|
"datatype": "str",
|
|
"label": "方向",
|
|
"cwidth": 8
|
|
},
|
|
{
|
|
"name": "summary",
|
|
"title": "摘要",
|
|
"type": "str",
|
|
"length": 100,
|
|
"uitype": "str",
|
|
"datatype": "str",
|
|
"label": "摘要",
|
|
"cwidth": 30
|
|
},
|
|
{
|
|
"name": "amount",
|
|
"title": "金额",
|
|
"type": "float",
|
|
"length": 18,
|
|
"dec": 4,
|
|
"uitype": "float",
|
|
"datatype": "float",
|
|
"label": "金额",
|
|
"cwidth": 12
|
|
},
|
|
{
|
|
"name": "balance",
|
|
"title": "余额",
|
|
"type": "float",
|
|
"length": 18,
|
|
"dec": 4,
|
|
"uitype": "float",
|
|
"datatype": "float",
|
|
"label": "余额",
|
|
"cwidth": 12
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|