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": {
|
"options": {
|
||||||
"width": "100%"
|
"width": "100%",
|
||||||
|
"flex": "1"
|
||||||
},
|
},
|
||||||
"subwidgets": [
|
"subwidgets": [
|
||||||
|
{
|
||||||
|
"widgettype": "VBox",
|
||||||
|
"options": {
|
||||||
|
"width": "100%"
|
||||||
|
},
|
||||||
|
"subwidgets": [
|
||||||
{% for p in products %}
|
{% for p in products %}
|
||||||
{
|
{
|
||||||
"widgettype": "HBox",
|
"widgettype": "HBox",
|
||||||
@ -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 ''}}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -87,5 +86,7 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user