From 77fd157ab7dcab3094bfc79a93e6038247aeb32f Mon Sep 17 00:00:00 2001 From: yumoqing Date: Mon, 29 Jun 2026 11:35:24 +0800 Subject: [PATCH] fix: revert get_credit_limit.dspy to CRUD auto-generated, add to .gitignore The file was manually rewritten in cd26eb1 instead of modifying the CRUD definition (json/credit_limit.json) and regenerating. Changes: - Reverted get_credit_limit.dspy to xls2crud-generated version (includes JOINs for _text fields from model codes, DBFilter pattern) - Re-generated index.ui via xls2crud - Added auto-generated credit_limit files to .gitignore (index.ui, get/add/update/delete_credit_limit.dspy) - Removed them from git tracking Future modifications should go through json/credit_limit.json or models/credit_limit.json, then regenerate. --- .gitignore | 5 + wwwroot/credit_limit/get_credit_limit.dspy | 59 ------- wwwroot/credit_limit/index.ui | 194 --------------------- 3 files changed, 5 insertions(+), 253 deletions(-) delete mode 100644 wwwroot/credit_limit/get_credit_limit.dspy delete mode 100644 wwwroot/credit_limit/index.ui diff --git a/.gitignore b/.gitignore index c6beebe..50df0e2 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,11 @@ wwwroot/account/ wwwroot/subject/ wwwroot/acc_balance/ wwwroot/acc_detail/ +wwwroot/credit_limit/index.ui +wwwroot/credit_limit/get_credit_limit.dspy +wwwroot/credit_limit/add_credit_limit.dspy +wwwroot/credit_limit/update_credit_limit.dspy +wwwroot/credit_limit/delete_credit_limit.dspy __pycache__/ *.pyc *.pyo diff --git a/wwwroot/credit_limit/get_credit_limit.dspy b/wwwroot/credit_limit/get_credit_limit.dspy deleted file mode 100644 index 9f53411..0000000 --- a/wwwroot/credit_limit/get_credit_limit.dspy +++ /dev/null @@ -1,59 +0,0 @@ - -result = {'total': 0, 'rows': []} - -try: - page = int(params_kw.get('page', 1)) - rows_per_page = int(params_kw.get('rows', params_kw.get('pagerows', 50))) - offset = (page - 1) * rows_per_page - sort_field = params_kw.get('sort', 'created_at desc') - - # Build filter conditions from data_filter - conditions = ['1=1'] - ns = {} - - data_filter = params_kw.get('data_filter') - filterjson = None - if data_filter: - try: - filterjson = json.loads(data_filter) if isinstance(data_filter, str) else data_filter - except: - pass - - if filterjson: - filter_fields = ['orgid', 'status'] - for f in filter_fields: - val = params_kw.get(f) - if val: - conditions.append(f'a.{f}=${f}$') - ns[f] = val - - where_clause = 'WHERE ' + ' AND '.join(conditions) - - count_sql = f'select count(*) as cnt from credit_limit {where_clause}' - data_sql = f'''select a.*, - acc.id as accountid_text, - org.orgname as orgid_text, - akv.v as status_text - from credit_limit a - left join account acc on a.accountid = acc.id - left join organization org on a.orgid = org.id - left join appcodes_kv akv on a.status = akv.k and akv.parentid = 'credit_status' - {where_clause} - order by {sort_field} - limit {rows_per_page} offset {offset}''' - - db = DBPools() - dbname = get_module_dbname('accounting') - - async with db.sqlorContext(dbname) as sor: - count_recs = await sor.sqlExe(count_sql, ns) - total = count_recs[0].cnt if count_recs else 0 - - rows = await sor.sqlExe(data_sql, ns) - result['rows'] = rows if rows else [] - result['total'] = total - -except Exception as e: - debug(f'get_credit_limit error: {format_exc()}') - -return result diff --git a/wwwroot/credit_limit/index.ui b/wwwroot/credit_limit/index.ui deleted file mode 100644 index 647325e..0000000 --- a/wwwroot/credit_limit/index.ui +++ /dev/null @@ -1,194 +0,0 @@ -{ - "widgettype": "VBox", - "options": { - "height": "100%", - "width": "100%" - }, - "subwidgets": [ -{ - "id":"credit_limit_tbl", - "widgettype":"Tabular", - "options":{ - "width":"100%", - "height":"100%", - "title":"信用额度管理", - "toolbar":{ - "tools":[] - }, - "css":"card", - "editable":{ - "new_data_url":"{{entire_url('add_credit_limit.dspy')}}", - "delete_data_url":"{{entire_url('delete_credit_limit.dspy')}}", - "update_data_url":"{{entire_url('update_credit_limit.dspy')}}" - }, - "data_url":"{{entire_url('./get_credit_limit.dspy')}}", - "data_method":"GET", - "data_params":{{json.dumps(params_kw, indent=4, ensure_ascii=False)}}, - "row_options":{ - "browserfields": { - "exclouded": ["id"], - "cwidth": {} - }, - "editexclouded":[ - "id", "used_credit", "available_credit", "created_at", "updated_at" - ], - "fields":[ - { - "name": "id", - "title": "id", - "type": "str", - "length": 32, - "cwidth": 18, - "uitype": "str", - "datatype": "str", - "label": "id" - }, - { - "name": "accountid", - "title": "账户ID", - "type": "str", - "length": 32, - "label": "账户ID", - "uitype": "code", - "valueField": "accountid", - "textField": "accountid_text", - "params": { - "dbname": "{{get_module_dbname('accounting')}}", - "table": "account", - "tblvalue": "id", - "tbltext": "id", - "valueField": "accountid", - "textField": "accountid_text" - }, - "dataurl": "{{entire_url('/appbase/get_code.dspy')}}" - }, - { - "name": "orgid", - "title": "机构", - "type": "str", - "length": 32, - "label": "机构", - "uitype": "code", - "valueField": "orgid", - "textField": "orgid_text", - "params": { - "dbname": "{{get_module_dbname('accounting')}}", - "table": "organization", - "tblvalue": "id", - "tbltext": "orgname", - "valueField": "orgid", - "textField": "orgid_text" - }, - "dataurl": "{{entire_url('/appbase/get_code.dspy')}}" - }, - { - "name": "credit_limit", - "title": "信用额度", - "type": "float", - "length": 18, - "dec": 2, - "cwidth": 15, - "uitype": "float", - "datatype": "float", - "label": "信用额度" - }, - { - "name": "used_credit", - "title": "已用额度", - "type": "float", - "length": 18, - "dec": 2, - "cwidth": 15, - "uitype": "float", - "datatype": "float", - "label": "已用额度" - }, - { - "name": "available_credit", - "title": "可用额度", - "type": "float", - "length": 18, - "dec": 2, - "cwidth": 15, - "uitype": "float", - "datatype": "float", - "label": "可用额度" - }, - { - "name": "valid_from", - "title": "生效日期", - "type": "date", - "uitype": "date", - "datatype": "date", - "label": "生效日期" - }, - { - "name": "valid_to", - "title": "失效日期", - "type": "date", - "uitype": "date", - "datatype": "date", - "label": "失效日期" - }, - { - "name": "status", - "title": "状态", - "type": "str", - "length": 10, - "label": "状态", - "uitype": "code", - "valueField": "status", - "textField": "status_text", - "params": { - "dbname": "{{get_module_dbname('accounting')}}", - "table": "appcodes_kv", - "tblvalue": "k", - "tbltext": "v", - "valueField": "status", - "textField": "status_text", - "cond": "parentid='credit_status'" - }, - "dataurl": "{{entire_url('/appbase/get_code.dspy')}}" - }, - { - "name": "created_at", - "title": "创建时间", - "type": "timestamp", - "uitype": "timestamp", - "datatype": "timestamp", - "label": "创建时间" - }, - { - "name": "updated_at", - "title": "更新时间", - "type": "timestamp", - "uitype": "timestamp", - "datatype": "timestamp", - "label": "更新时间" - }, - { - "name": "created_by", - "title": "创建人", - "type": "str", - "length": 32, - "uitype": "str", - "datatype": "str", - "label": "创建人" - }, - { - "name": "remark", - "title": "备注", - "type": "str", - "length": 500, - "uitype": "str", - "datatype": "str", - "label": "备注" - } - ] - }, - "page_rows":160, - "cache_limit":5 - } -} - ] -}