Skip to content

Commit

Permalink
fix: 明细未配置或出错
Browse files Browse the repository at this point in the history
  • Loading branch information
getrebuild committed Nov 18, 2023
1 parent c3778a8 commit 7a9565c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
13 changes: 5 additions & 8 deletions src/main/java/com/rebuild/core/metadata/MetadataSorter.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,11 @@ public static Entity[] sortEntities(ID user, boolean includesBizz, boolean inclu
public static Entity[] sortDetailEntities(Entity mainEntity) {
Assert.notNull(mainEntity.getDetailEntity(), "None main entity : " + mainEntity);

// SORT:CODE
return mainEntity.getDetialEntities();

// // SORT: 名称
// List<BaseMeta> entities = new ArrayList<>();
// CollectionUtils.addAll(entities, mainEntity.getDetialEntities());
// sortByLabel(entities);
// return entities.toArray(new Entity[0]);
List<BaseMeta> entities = new ArrayList<>();
CollectionUtils.addAll(entities, mainEntity.getDetialEntities());
// SORT: 名称。默认是返回按CODE大小
if (entities.size() > 1) sortByLabel(entities);
return entities.toArray(new Entity[0]);
}

/**
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/web/assets/js/rb-forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,9 @@ class RbForm extends React.Component {
const keys = Object.keys(this._ProTables)
for (let i = 0; i < keys.length; i++) {
const _ProTable = this._ProTables[keys[i]]
// 明细未配置或出错
if (!_ProTable._initModel) continue

const details = _ProTable.buildFormData()
if (!details) return

Expand Down
8 changes: 7 additions & 1 deletion src/main/resources/web/assets/js/rb-forms.protable.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ProTable extends React.Component {

render() {
if (this.state.hasError) {
$('.detail-form-table .btn-group .btn').attr('disabled', true)
// $('.detail-form-table .btn-group .btn').attr('disabled', true)
return <RbAlertBox message={this.state.hasError} />
}

Expand Down Expand Up @@ -143,6 +143,12 @@ class ProTable extends React.Component {
}

addLine(model) {
// 明细未配置或出错
if (!model) {
if (this.state.hasError) RbHighbar.create(this.state.hasError)
return
}

const lineKey = `${this.props.entity.entity}-${model.id ? model.id : $random()}`
const ref = React.createRef()
const FORM = (
Expand Down

0 comments on commit 7a9565c

Please sign in to comment.