accounting/wwwroot/billing.ui

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%",
"gap": "20px",
"align_items": "center"
},
"subwidgets": [
{
"widgettype": "Text",
"id": "billing_stats",
"options": {
"text": "请输入日期范围进行查询",
"css": "font-size: 14px; color: #666;"
}
},
{
"widgettype": "Text",
"id": "billing_download_btn",
"options": {
"text": " 下载Excel ",
"bgcolor": "#52c41a",
"color": "#FFFFFF",
"css": "border-radius: 4px; padding: 4px 12px; cursor: pointer; font-size: 14px;"
},
"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
}
]
}
}
}
]
}