fix: JSON闭合VScrollPanel, urlwidget→script+fetch读input值
This commit is contained in:
parent
b3dabcf0f6
commit
885b915d28
@ -34,11 +34,18 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"widgettype": "VBox",
|
||||
"widgettype": "VScrollPanel",
|
||||
"options": {
|
||||
"width": "100%"
|
||||
"width": "100%",
|
||||
"flex": "1"
|
||||
},
|
||||
"subwidgets": [
|
||||
{
|
||||
"widgettype": "VBox",
|
||||
"options": {
|
||||
"width": "100%"
|
||||
},
|
||||
"subwidgets": [
|
||||
{% for p in products %}
|
||||
{
|
||||
"widgettype": "HBox",
|
||||
@ -68,17 +75,9 @@
|
||||
{
|
||||
"wid": "self",
|
||||
"event": "blur",
|
||||
"actiontype": "urlwidget",
|
||||
"target": "discount_rows",
|
||||
"options": {
|
||||
"url": "{{entire_url('./save_discount.dspy')}}",
|
||||
"params": {
|
||||
"discountid": "{{params_kw.discountid}}",
|
||||
"productid": "{{p.productid}}",
|
||||
"detail_id": "{{p.detail_id or ''}}",
|
||||
"discount": "{{p.discount or ''}}"
|
||||
}
|
||||
}
|
||||
"actiontype": "script",
|
||||
"target": "self",
|
||||
"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)})"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -87,5 +86,7 @@
|
||||
{% endfor %}
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user