bugfix
This commit is contained in:
parent
3c0fd2fe0e
commit
7a97e94192
@ -22,6 +22,10 @@ bricks.FieldGroup = class {
|
||||
this.build_fields(form, dc, fields[i].fields);
|
||||
parent.add_widget(dc);
|
||||
dc = new bricks.DynamicColumn({mobile_cols:2});
|
||||
dc.set_id(fields[i].name+'_box');
|
||||
if (fields[i].disabled))
|
||||
dc.disabled(true);
|
||||
}
|
||||
} else {
|
||||
var box;
|
||||
if (! form.opts.input_layout || form.opts.input_layout == 'VBox'){
|
||||
@ -42,6 +46,10 @@ bricks.FieldGroup = class {
|
||||
height:'auto',
|
||||
i18n:true});
|
||||
box.add_widget(txt);
|
||||
box.set_id(fields[i].name + '_box')
|
||||
if (fields[i].disabled))
|
||||
box.disabled(true);
|
||||
}
|
||||
var w = Input.factory(fields[i]);
|
||||
if (w){
|
||||
box.add_widget(w);
|
||||
@ -72,6 +80,10 @@ bricks.FormBody = class extends bricks.VScrollPanel {
|
||||
},
|
||||
...
|
||||
]
|
||||
exclusionfields:[
|
||||
[a,b,c], # a,b,c互斥,a enabled,b,c必须disabled
|
||||
[x,y] # x,y互斥
|
||||
]
|
||||
}
|
||||
*/
|
||||
constructor(form, opts){
|
||||
@ -234,7 +246,28 @@ bricks.FormBase = class extends bricks.Layout {
|
||||
}
|
||||
return this.get_formdata();
|
||||
}
|
||||
|
||||
toggle_disable(field_name, flg){
|
||||
var w = bricks.getWidgetById(field_name + '_box', this);
|
||||
if (! w) return;
|
||||
w.disabled(flg);
|
||||
if (flg) return;
|
||||
this.exclusionfields.forEach(arr =>{
|
||||
if (arr.include(field_name)){
|
||||
arr.forEach(x => {
|
||||
if (x!=field_name){
|
||||
var w1 = bricks.getWidgetById(x + '_box', this);
|
||||
if (w1) w1.disabled(! flg);
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
enable_field(field_name){
|
||||
this.toggle_disable(field_name, false);
|
||||
}
|
||||
disable_field(field_name){
|
||||
this.toggle_disable(field_name, true);
|
||||
}
|
||||
get_formdata(){
|
||||
var data = new FormData();
|
||||
var changed = false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user