fix: ro whitout

This commit is contained in:
RB 2022-11-30 15:21:21 +08:00
parent ff9de2023b
commit cc9c6fcd43
3 changed files with 11 additions and 4 deletions

View file

@ -71,7 +71,7 @@ public class Application implements ApplicationListener<ApplicationStartedEvent>
/**
* Rebuild Build [MAJOR]{1}[MINOR]{2}[PATCH]{2}[BUILD]{2}
*/
public static final int BUILD = 3010310;
public static final int BUILD = 3010311;
static {
// Driver for DB

View file

@ -179,10 +179,17 @@ public class FormsBuilder extends FormsManager {
// 自动只读
Set<String> roAutos = EasyMetaFactory.getAutoReadonlyFields(entity);
Set<String> roAutosWithout = record == null ? null : Collections.emptySet();
for (Object o : elements) {
JSONObject field = (JSONObject) o;
if (roAutos.contains(field.getString("field"))) {
field.put("readonly", true);
// 前端可收集值
if (roAutosWithout == null) roAutosWithout = AutoFillinManager.instance.getAutoReadonlyFields(entity);
if (roAutosWithout.contains(field.getString("field"))) {
field.put("readonlyw", true);
}
}
}

View file

@ -438,12 +438,12 @@ class RbForm extends React.Component {
if (this.isNew) {
this.props.children.map((child) => {
let val = child.props.value
if (val && child.props.readonly !== true) {
if (val && (child.props.readonly !== true || child.props.readonlyw === true)) {
if (typeof val === 'object') {
if ($.isArray(val)) {
// [file1, file2, image1]
// eg. [file1, file2, image1]
} else {
// {id:xxx, text:xxx}
// eg. {id:xxx, text:xxx}
val = val.id
}
}