refactor: failed_accounting.ui改用InlineForm简化过滤栏

This commit is contained in:
yumoqing 2026-06-13 18:41:04 +08:00
parent a70933c44c
commit 335a06d5ea

View File

@ -18,92 +18,71 @@
"widgettype": "HBox", "widgettype": "HBox",
"options": { "options": {
"width": "100%", "width": "100%",
"spacing": 12, "spacing": 8,
"alignItems": "flex-end" "alignItems": "flex-end"
}, },
"subwidgets": [ "subwidgets": [
{ {
"widgettype": "VBox", "widgettype": "InlineForm",
"options": {"spacing": 4}, "id": "filter_form",
"subwidgets": [ "options": {
{"widgettype": "Text", "options": {"text": "开始日期", "fontSize": "12px"}}, "css": "card",
{"widgettype": "UiDate", "id": "start_date", "options": {"cwidth": 10}} "padding": "8px",
] "show_label": true,
}, "submit_label": "查询",
{ "submit_css": "primary",
"widgettype": "VBox", "fields": [
"options": {"spacing": 4}, {
"subwidgets": [ "name": "start_date",
{"widgettype": "Text", "options": {"text": "结束日期", "fontSize": "12px"}}, "label": "开始日期",
{"widgettype": "UiDate", "id": "end_date", "options": {"cwidth": 10}} "uitype": "date",
] "cwidth": 10
}, },
{ {
"widgettype": "VBox", "name": "end_date",
"options": {"spacing": 4}, "label": "结束日期",
"subwidgets": [ "uitype": "date",
{"widgettype": "Text", "options": {"text": "处理状态", "fontSize": "12px"}}, "cwidth": 10
{ },
"widgettype": "UiCode", {
"id": "handled_filter", "name": "handled",
"options": { "label": "处理状态",
"uitype": "code",
"cwidth": 8, "cwidth": 8,
"data": [ "codes": [
{"value": "", "text": "全部"}, {"value": "", "text": "全部"},
{"value": "0", "text": "未处理"}, {"value": "0", "text": "未处理"},
{"value": "1", "text": "已处理"} {"value": "1", "text": "已处理"}
] ]
} }
]
},
"binds": [
{
"wid": "self",
"event": "submit",
"actiontype": "method",
"target": "failed_table",
"method": "render"
} }
] ]
}, },
{ {
"widgettype": "VBox", "widgettype": "Button",
"options": {"spacing": 4}, "id": "retry_btn",
"subwidgets": [ "options": {
{"widgettype": "Text", "options": {"text": "", "fontSize": "12px"}}, "label": "重试记账",
{ "bgcolor": "#4caf50",
"widgettype": "Button", "color": "#ffffff",
"id": "search_btn", "cwidth": 6
"options": { },
"label": "查询", "binds": [{
"bgcolor": "#1976d2", "wid": "self",
"color": "#ffffff", "event": "click",
"cwidth": 5 "actiontype": "script",
}, "target": "self",
"binds": [{ "script": "var dv = bricks.getWidgetById('failed_table', bricks.app.root); if(!dv || !dv.select_row || !dv.select_row.user_data) { alert('请先选中一条记录'); return; } var row = dv.select_row.user_data; if(!row.llmusageid) { alert('记录缺少llmusageid'); return; } var resp = await fetch('{{entire_url('/llmage/api/retry_accounting.dspy')}}?id=' + row.llmusageid); var d = await resp.json(); if(d.success) { alert(d.message); await dv.render({}); } else { alert('失败: ' + d.message); }"
"wid": "self", }]
"event": "click",
"actiontype": "script",
"target": "body.failed_table",
"script": "var root = bricks.app.root; var sd = bricks.getWidgetById('start_date', root); var ed = bricks.getWidgetById('end_date', root); var hf = bricks.getWidgetById('handled_filter', root); var params = {}; if(hf && hf.getValue()) params.handled = hf.getValue(); if(sd && sd.getValue()) params.start_date = sd.getValue(); if(ed && ed.getValue()) params.end_date = ed.getValue(); await this.render(params);"
}]
}
]
},
{
"widgettype": "VBox",
"options": {"spacing": 4},
"subwidgets": [
{"widgettype": "Text", "options": {"text": "", "fontSize": "12px"}},
{
"widgettype": "Button",
"id": "retry_btn",
"options": {
"label": "重试",
"bgcolor": "#4caf50",
"color": "#ffffff",
"cwidth": 5
},
"binds": [{
"wid": "self",
"event": "click",
"actiontype": "script",
"target": "self",
"script": "var dv = bricks.getWidgetById('failed_table', bricks.app.root); if(!dv || !dv.select_row || !dv.select_row.user_data) { alert('请先选中一条记录'); return; } var row = dv.select_row.user_data; if(!row.llmusageid) { alert('记录缺少llmusageid'); return; } var resp = await fetch('{{entire_url('/llmage/api/retry_accounting.dspy')}}?id=' + row.llmusageid); var d = await resp.json(); if(d.success) { alert(d.message); await dv.render({}); } else { alert('失败: ' + d.message); }"
}]
}
]
} }
] ]
}, },