accounting/wwwroot/billing.ui

162 lines
4.5 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_text": "查询"
},
"binds": [
{
"wid": "billing_form",
"event": "submit",
"actiontype": "script",
"target": "billing_form",
"script": "var dv = bricks.getWidgetById('billing_tabular', bricks.app.root); dv.render(params); fetch('{{billing_url}}?start_date=' + params.start_date + '&end_date=' + params.end_date).then(function(r){return r.json()}).then(function(d){var t=bricks.getWidgetById('billing_stats',bricks.app.root);if(t&&d.stats)t.dom_element.textContent='总条数: '+d.stats.total_count+' | 借方合计: ¥'+parseFloat(d.stats.debit_sum).toFixed(2)+' | 贷方合计: ¥'+parseFloat(d.stats.credit_sum).toFixed(2);var b=bricks.getWidgetById('billing_download_btn',bricks.app.root);if(b){b.dom_element.style.display='inline-block';b.dom_element.onclick=function(){fetch('{{download_url}}?start_date='+params.start_date+'&end_date='+params.end_date).then(function(r){return r.json()}).then(function(d){if(d.status==='ok'){var c=atob(d.data.content);var n=new Array(c.length);for(var i=0;i<c.length;i++)n[i]=c.charCodeAt(i);var a=new Uint8Array(n);var bl=new Blob([a],{type:'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'});var u=window.URL.createObjectURL(bl);var l=document.createElement('a');l.href=u;l.download=d.data.filename;document.body.appendChild(l);l.click();document.body.removeChild(l);window.URL.revokeObjectURL(u)}})}}})"
}
]
},
{
"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": {
"text": "Excel",
"css": "display: none; background-color: #52c41a; color: white; padding: 5px 15px; border-radius: 4px; cursor: pointer;"
}
}
]
},
{
"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
}
]
}
}
}
]
}