From 997c7a445e9e1d90f6aeb794176d51435f7462ff Mon Sep 17 00:00:00 2001 From: yumoqing Date: Sun, 31 May 2026 10:27:14 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E8=B4=A6=E5=8D=95?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E9=A1=B5=E9=9D=A2=EF=BC=8C=E6=8C=89=E6=9C=BA?= =?UTF-8?q?=E6=9E=84id+=E6=97=A5=E6=9C=9F=E8=8C=83=E5=9B=B4=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2acc=5Fdetail?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wwwroot/billing.dspy | 30 +++++++++++++++++++ wwwroot/billing.ui | 70 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 wwwroot/billing.dspy create mode 100644 wwwroot/billing.ui diff --git a/wwwroot/billing.dspy b/wwwroot/billing.dspy new file mode 100644 index 0000000..4f78cc2 --- /dev/null +++ b/wwwroot/billing.dspy @@ -0,0 +1,30 @@ +debug(f'{params_kw=}') +userid = await get_user() +userorgid = await get_userorgid() + +start_date = params_kw.get('start_date', '') +end_date = params_kw.get('end_date', '') + +if not start_date or not end_date: + return json.dumps({'total': 0, 'rows': []}, ensure_ascii=False, default=str) + +ns = { + 'orgid': userorgid, + 'start_date': start_date, + 'end_date': end_date, + 'page': int(params_kw.get('page', 1)), + 'rows': int(params_kw.get('rows', 30)), + 'sort': 'acc_date desc' +} + +async with get_sor_context(request._run_ns, 'accounting') as sor: + sql = """select d.acc_date, d.acc_timestamp, d.acc_dir, d.summary, +d.amount, d.balance, s.name as subject_name +from acc_detail d +join account a on d.accountid = a.id +join subject s on a.subjectid = s.id +where a.orgid = ${orgid}$ + and d.acc_date >= ${start_date}$ + and d.acc_date <= ${end_date}$""" + ret = await sor.sqlExe(sql, ns) + return json.dumps(ret, ensure_ascii=False, default=str) diff --git a/wwwroot/billing.ui b/wwwroot/billing.ui new file mode 100644 index 0000000..3dea29b --- /dev/null +++ b/wwwroot/billing.ui @@ -0,0 +1,70 @@ +{% set start_date = params_kw.get('start_date', '') %} +{% set end_date = params_kw.get('end_date', '') %} +{ + "widgettype":"VBox", + "options":{ + "width":"100%", + "css":"card", + "cwidth":30, + "gap":"8px" + }, + "subwidgets":[ + { + "widgettype":"Title6", + "options":{ + "text":"账单查询" + } + }, + { + "widgettype":"Form", + "options":{ + "fields":[ + { + "name":"start_date", + "label":"开始日期", + "uitype":"str", + "value":"{{start_date}}" + }, + { + "name":"end_date", + "label":"结束日期", + "uitype":"str", + "value":"{{end_date}}" + } + ], + "buttons":[ + { + "name":"query", + "label":"查询", + "bgcolor":"#1890ff" + } + ] + }, + "binds":[ + { + "wid":"self", + "event":"submit", + "actiontype":"urlwidget", + "target":"self", + "options":{ + "url":"{{entire_url('/accounting/billing.ui')}}" + } + } + ] + } +{% if start_date and end_date %} + ,{ + "widgettype":"DataViewer", + "options":{ + "data_url":"{{entire_url('/accounting/billing.dspy')}}", + "data_params":{ + "start_date":"{{start_date}}", + "end_date":"{{end_date}}" + }, + "editable":false, + "page_size":30 + } + } +{% endif %} + ] +}