fix: JSON闭合VScrollPanel, urlwidget→script+fetch读input值

This commit is contained in:
yumoqing 2026-06-29 16:32:02 +08:00
parent b3dabcf0f6
commit 885b915d28

View File

@ -33,6 +33,13 @@
{"widgettype": "Text", "options": {"text": "折扣", "width": "22%", "padding": "0 12px", "fontSize": "12px", "fontWeight": "600", "color": "#94A3B8"}} {"widgettype": "Text", "options": {"text": "折扣", "width": "22%", "padding": "0 12px", "fontSize": "12px", "fontWeight": "600", "color": "#94A3B8"}}
] ]
}, },
{
"widgettype": "VScrollPanel",
"options": {
"width": "100%",
"flex": "1"
},
"subwidgets": [
{ {
"widgettype": "VBox", "widgettype": "VBox",
"options": { "options": {
@ -68,17 +75,9 @@
{ {
"wid": "self", "wid": "self",
"event": "blur", "event": "blur",
"actiontype": "urlwidget", "actiontype": "script",
"target": "discount_rows", "target": "self",
"options": { "script": "var v=this.target.dom_element.querySelector('input');if(!v)return;var nv=v.value;fetch('{{entire_url(\"./save_discount.dspy\")}}',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({discountid:'{{params_kw.discountid}}',productid:'{{p.productid}}',detail_id:'{{p.detail_id or ''}}',discount:nv})}).then(function(r){return r.json()}).then(function(r){if(r.widgettype==='Error')bricks.show_error(r.options)}).catch(function(e){console.error(e)})"
"url": "{{entire_url('./save_discount.dspy')}}",
"params": {
"discountid": "{{params_kw.discountid}}",
"productid": "{{p.productid}}",
"detail_id": "{{p.detail_id or ''}}",
"discount": "{{p.discount or ''}}"
}
}
} }
] ]
} }
@ -89,3 +88,5 @@
} }
] ]
} }
]
}