save fixed

This commit is contained in:
devezhao-mac 2018-12-30 15:00:54 +08:00
parent db9870b928
commit 5c6112d3b7
7 changed files with 19 additions and 29 deletions

View file

@ -265,9 +265,9 @@ public class FormManager extends LayoutManager {
}
if (entityMeta.getMasterEntity() != null) {
config.put("slave", true);
config.put("isSlave", true);
} else if (entityMeta.getSlaveEntity() != null) {
config.put("master", true);
config.put("isMaster", true);
config.put("slaveMeta", EasyMeta.getEntityShows(entityMeta.getSlaveEntity()));
}

View file

@ -123,8 +123,6 @@ public class Entity2Schema extends Field2Schema {
createBuiltinField(tempEntity, primaryFiled, "ID", DisplayType.ID, null, null, null);
// 自增ID
createBuiltinField(tempEntity, EntityHelper.AutoId, "AUTOID", DisplayType.NUMBER, null, null, null);
// 助记码/搜索码
createBuiltinField(tempEntity, EntityHelper.QuickCode, "QUICKCODE", DisplayType.TEXT, null, null, null);
// 是否删除
createBuiltinField(tempEntity, EntityHelper.IsDeleted, "ISDELETED", DisplayType.BOOL, null, null, null);
@ -144,6 +142,10 @@ public class Entity2Schema extends Field2Schema {
String masterField = masterEntity + "Id";
createBuiltinField(tempEntity, masterField, masterLabel, DisplayType.REFERENCE, "引用主记录(" + masterLabel + ")", masterEntity, CascadeModel.Delete);
} else {
// 助记码/搜索码
// createBuiltinField(tempEntity, EntityHelper.QuickCode, "QUICKCODE", DisplayType.TEXT, null, null, null);
createField(tempEntity, EntityHelper.QuickCode, "QUICKCODE", DisplayType.TEXT, true, false, false, null, null, null, true);
createBuiltinField(tempEntity, EntityHelper.OwningUser, "所属用户", DisplayType.REFERENCE, null, "User", null);
createBuiltinField(tempEntity, EntityHelper.OwningDept, "所属部门", DisplayType.REFERENCE, null, "Department", null);
}
@ -208,7 +210,7 @@ public class Entity2Schema extends Field2Schema {
private Field createBuiltinField(Entity entity, String fieldName, String fieldLabel, DisplayType displayType, String comments,
String refEntity, CascadeModel cascade) {
comments = StringUtils.defaultIfBlank(comments, "系统内建");
return createField(entity, fieldName, fieldLabel, displayType, false, false, false, comments, refEntity, cascade, true);
return createField(entity, fieldName, fieldLabel, displayType, false, false, false, comments, refEntity, cascade, false);
}
/**

View file

@ -171,14 +171,11 @@ public class Field2Schema {
* @param comments
* @param refEntity
* @param cascade
* @param isBuiltin 内建字段
* @param dbNullable 在数据库中是否可为空一般系统级字段不能为空
* @return
*/
protected Field createField(Entity entity, String fieldName, String fieldLabel, DisplayType displayType,
boolean nullable, boolean creatable, boolean updatable, String comments, String refEntity, CascadeModel cascade, boolean isBuiltin) {
// 在数据库中是否可为空
boolean dbNullable = !isBuiltin;
boolean nullable, boolean creatable, boolean updatable, String comments, String refEntity, CascadeModel cascade, boolean dbNullable) {
if (displayType == DisplayType.SERIES) {
nullable = false;
creatable = false;

View file

@ -121,16 +121,6 @@
<td class="text-center"><i data-action="Z" class="priv R0"></i></td>
<td colspan="5">需具备相应实体的读取权限</td>
</tr>
<tr>
<td class="name"><a data-name="AllowCustomListColumn">允许自定义列显示</a></td>
<td class="text-center"><i data-action="Z" class="priv R0"></i></td>
<td colspan="5" class="text-muted">无</td>
</tr>
<tr>
<td class="name"><a data-name="AllowCustomQuickField">允许自定义查询字段</a></td>
<td class="text-center"><i data-action="Z" class="priv R0"></i></td>
<td colspan="5" class="text-muted">无</td>
</tr>
</tbody>
</table>
<div class="legend-warp">

View file

@ -74,7 +74,7 @@
<div class="card-body">
<p>版本 <a class="link" target="_blank" href="https://github.com/getrebuild/rebuild/releases"><%=Application.VER%></a></p>
<ul style="line-height:2">
<li><a class="link" target="_blank" href="http://getrebuild.com/">帮助文档</a></li>
<li><a class="link" target="_blank" href="https://getrebuild.com/docs/">帮助文档</a></li>
<li><a class="link" target="_blank" href="mailto:getrebuild@sina.com?subject=技术支持">技术支持</a></li>
<li><a class="link" target="_blank" href="${baseUrl}/gw/server-status">系统运行状态</a></li>
<li><a class="link" target="_blank" href="https://github.com/getrebuild/rebuild">View on GitHub</a></li>

View file

@ -133,16 +133,17 @@ class RbForm extends React.Component {
<button className="btn btn-primary" type="button" onClick={()=>this.post()}>保存</button>
<button className="btn btn-primary dropdown-toggle auto" type="button" data-toggle="dropdown"><span className="icon zmdi zmdi-chevron-up"></span></button>
<div className="dropdown-menu dropdown-menu-primary dropdown-menu-right">
{pmodel.slave == true && <a className="dropdown-item" onClick={()=>this.post(111)}>保存并继续添加</a>}
{pmodel.master == true && <a className="dropdown-item" onClick={()=>this.post(112)}>保存并添加明细</a>}
{pmodel.slave != true && <a className="dropdown-item" onClick={()=>this.post(101)}>保存并继续新建</a>}
{pmodel.isSlave === true && <a className="dropdown-item" onClick={()=>this.post(101)}>保存并继续添加</a>}
{pmodel.isMaster === true && <a className="dropdown-item" onClick={()=>this.post(102)}>保存并添加明细</a>}
{pmodel.isSlave !== true && <a className="dropdown-item" onClick={()=>this.post(101)}>保存并继续新建</a>}
</div>
</div>
)
let entity = this.state.entity
let wpc = window.__PageConfig
if (entity == 'User' || entity == 'Department' || entity == 'Role'
|| window.pageType == 'SlaveView' || window.pageType == 'SlaveList'){
|| wpc.type == 'SlaveView' || wpc.type == 'SlaveList' || this.isNew != true) {
saveBtns = <button className="btn btn-primary btn-space" type="button" onClick={()=>this.post()}>保存</button>
}
@ -201,12 +202,12 @@ class RbForm extends React.Component {
rb.notice('保存成功', 'success')
setTimeout(() => {
that.props.$$$parent.hide(true)
RbForm.postAfter(res.data, next == 111)
RbForm.postAfter(res.data, next == 101)
if (next == 101 || next == 111) {
if (next == 101) {
let pstate = that.props.$$$parent.state
rb.RbFormModal({ title: pstate.title, entity: pstate.entity, icon: pstate.icon })
} else if (next == 112) {
} else if (next == 102) {
let iv = { '$MASTER$': res.data.id }
let sm = that.props.$$$parent.state.__formModel.slaveMeta
rb.RbFormModal({ title: `添加${sm[1]}`, entity: sm[0], icon: sm[2], initialValue: iv })

View file

@ -78,7 +78,7 @@
</div>
<% } %>
<div class="block">
<div class="text-muted">&copy; 2018 <a href="https://getrebuild.com/">Rebuild</a> <a href="?check=1" style="color:transparent;">CHECK</a></div>
<div class="text-muted">&copy; 2019 <a href="https://getrebuild.com/">Rebuild</a> <a href="?check=1" style="color:transparent;">CHECK</a></div>
</div>
</body>
</html>