fix: Form简化,margin:0,padding:0,去id,精简script
This commit is contained in:
parent
3bafa4425a
commit
3896a8145e
@ -30,7 +30,7 @@
|
||||
{"widgettype": "Text", "options": {"text": "产品分类", "width": "22%", "padding": "0 12px", "fontSize": "12px", "fontWeight": "600", "color": "#94A3B8"}},
|
||||
{"widgettype": "Text", "options": {"text": "产品名称", "width": "34%", "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": "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"}}
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -56,10 +56,10 @@
|
||||
{"widgettype": "Text", "options": {"text": "{{p.product_code or ''}}", "width": "22%", "padding": "0 12px", "fontSize": "12px", "color": "#E2E8F0"}},
|
||||
{
|
||||
"widgettype": "Form",
|
||||
"id": "discount_form_{{loop.index}}",
|
||||
"options": {
|
||||
"width": "22%",
|
||||
"padding": "0 12px",
|
||||
"padding": "0",
|
||||
"margin": "0",
|
||||
"show_label": false,
|
||||
"submit_url": "{{entire_url('./save_discount.dspy')}}",
|
||||
"fields": [
|
||||
@ -75,7 +75,7 @@
|
||||
"event": "blur",
|
||||
"actiontype": "script",
|
||||
"target": "self",
|
||||
"script": "var form = this.target; var d = form.getValue(); var old = form._last_val; if (d.discount === old) return; form._last_val = d.discount; fetch(form.options.submit_url, {method:'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify(d)}).then(function(r){ return r.json(); }).then(function(resp){ if (resp.widgettype === 'Error') bricks.show_error(resp.options); else console.log('discount saved'); }).catch(function(e){ console.error(e); });"
|
||||
"script": "var f=this.target;var d=f.getValue();var o=f._lv;if(d.discount===o)return;f._lv=d.discount;fetch(f.options.submit_url,{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(d)}).then(function(r){return r.json()}).then(function(r){if(r.widgettype==='Error')bricks.show_error(r.options)}).catch(function(e){console.error(e)})"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user