slave entity

This commit is contained in:
FangfangZhao 2018-11-22 23:17:51 +08:00
parent f24c4fa941
commit d11ed6493c
39 changed files with 464 additions and 218 deletions

1
.gitignore vendored
View file

@ -33,3 +33,4 @@ hs_err_pid*
/.production/package-lock.json
/.production/_temp/
/.production/build/
/.production/

16
pom.xml
View file

@ -103,6 +103,11 @@
<artifactId>spring-websocket</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>2.1.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
@ -144,9 +149,14 @@
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>2.1.2.RELEASE</version>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
</dependencies>
</project>

View file

@ -73,6 +73,11 @@ public class Entity2Schema extends Field2Schema {
}
}
final boolean isSlave = StringUtils.isNotBlank(masterEntity);
if (isSlave && !MetadataHelper.containsEntity(masterEntity)) {
throw new ModificationMetadataException("无效主实体 : " + masterEntity);
}
String physicalName = "T__" + entityName.toUpperCase();
Object maxTypeCode[] = Application.createQueryNoFilter(
@ -88,7 +93,7 @@ public class Entity2Schema extends Field2Schema {
if (StringUtils.isNotBlank(comments)) {
record.setString("comments", comments);
}
if (StringUtils.isNotBlank(masterEntity)) {
if (isSlave) {
record.setString("masterEntity", masterEntity);
}
record.setString("nameField", EntityHelper.createdOn);
@ -103,14 +108,16 @@ public class Entity2Schema extends Field2Schema {
createBuiltinField(tempEntity, EntityHelper.createdOn, "创建时间", DisplayType.DATETIME, null, null, null);
createBuiltinField(tempEntity, EntityHelper.modifiedBy, "修改人", DisplayType.REFERENCE, null, "User", null);
createBuiltinField(tempEntity, EntityHelper.modifiedOn, "修改时间", DisplayType.DATETIME, null, null, null);
createBuiltinField(tempEntity, EntityHelper.owningUser, "所属用户", DisplayType.REFERENCE, null, "User", null);
createBuiltinField(tempEntity, EntityHelper.owningDept, "所属部门", DisplayType.REFERENCE, null, "Department", null);
// 明细实体关联字段
if (masterEntity != null) {
// 明细实体无所属用户或部门使用主实体的
if (isSlave) {
String masterLabel = EasyMeta.valueOf(masterEntity).getLabel();
String masterField = masterEntity + "Id";
createBuiltinField(tempEntity, masterField, masterLabel, DisplayType.REFERENCE, "引用主记录(" + masterLabel + ")", masterEntity, CascadeModel.Delete);
} else {
createBuiltinField(tempEntity, EntityHelper.owningUser, "所属用户", DisplayType.REFERENCE, null, "User", null);
createBuiltinField(tempEntity, EntityHelper.owningDept, "所属部门", DisplayType.REFERENCE, null, "Department", null);
}
boolean schemaReady = schema2Database(tempEntity);

View file

@ -28,6 +28,8 @@ import org.apache.commons.logging.LogFactory;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.rebuild.server.entityhub.DisplayType;
import com.rebuild.server.entityhub.EasyMeta;
import com.rebuild.server.metadata.MetadataHelper;
import cn.devezhao.persist4j.Entity;
@ -50,8 +52,15 @@ public class DefaultValueManager {
* @param defaultVals
*/
public static void setFieldsValue(Entity entity, JSON formModel, JSON defaultVals) {
Map<String, Object> valueReady = new HashMap<>();
final JSONArray elements = ((JSONObject) formModel).getJSONArray("elements");
// Invalid Model
if (elements == null) {
return;
}
Map<String, Object> valuesReady = new HashMap<>();
// 客户端传递
JSONObject fromClient = (JSONObject) defaultVals;
for (Map.Entry<String, Object> e : fromClient.entrySet()) {
String field = e.getKey();
@ -61,38 +70,58 @@ public class DefaultValueManager {
continue;
}
// 引用字段实体
// 引用字段实体&EntityName
if (field.startsWith("&")) {
if (!ID.isId(value.toString())) {
final Object idLabel[] = readyReferenceValue(value);
if (idLabel == null) {
continue;
}
ID sourceRecord = ID.valueOf(value.toString());
String recordLabel = FieldValueWrapper.getLabel(sourceRecord);
final Object idLabel[] = new Object[] { sourceRecord.toLiteral(), recordLabel };
Entity source = MetadataHelper.getEntity(field.substring(1));
Field[] reftoFields = MetadataHelper.getReferenceToFields(source, entity);
for (Field rtf : reftoFields) {
valueReady.put(rtf.getName(), idLabel);
valuesReady.put(rtf.getName(), idLabel);
}
} else if (entity.containsField(field)) {
// TODO ...
EasyMeta fieldMeta = EasyMeta.valueOf(entity.getField(field));
if (fieldMeta.getDisplayType() == DisplayType.REFERENCE) {
final Object idLabel[] = readyReferenceValue(value);
if (idLabel != null) {
valuesReady.put(field, idLabel);
}
}
// TODO 填充其他字段值 ...
}
}
if (valueReady.isEmpty()) {
// TODO 后台设置的应该在后台处理 ???
if (valuesReady.isEmpty()) {
return;
}
JSONArray elements = ((JSONObject) formModel).getJSONArray("elements");
for (Object o : elements) {
JSONObject item = (JSONObject) o;
String field = item.getString("field");
if (valueReady.containsKey(field)) {
item.put("value", valueReady.get(field));
if (valuesReady.containsKey(field)) {
item.put("value", valuesReady.get(field));
valuesReady.remove(field);
}
}
}
/**
* @param value
* @return
*/
private static Object[] readyReferenceValue(Object value) {
if (!ID.isId(value.toString())) {
return null;
}
ID id = ID.valueOf(value.toString());
String label = FieldValueWrapper.getLabel(id);
return new Object[] { id.toLiteral(), label };
}
}

View file

@ -19,6 +19,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
package com.rebuild.server.helper.manager;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@ -54,7 +55,17 @@ public class ViewFeatManager {
* @return
*/
public static JSON getViewTab(String entity, ID user) {
return getViewFeat(entity, TYPE_TAB, user);
JSON tabs = getViewFeat(entity, TYPE_TAB, user);
// 明细实体如有
Entity entityMeta = MetadataHelper.getEntity(entity);
if (entityMeta.getSlaveEntity() != null) {
String shows[] = EasyMeta.getEntityShows(entityMeta.getSlaveEntity());
JSON tabsAll = (JSON) JSON.toJSON(new String[][] { shows });
((JSONArray) tabsAll).fluentAddAll((Collection<?>) tabs);
tabs = tabsAll;
}
return tabs;
}
/**
@ -76,12 +87,17 @@ public class ViewFeatManager {
final Object FEAT[] = getRaw(entity, type);
final Permission RoC = TYPE_TAB.equals(type) ? BizzPermission.READ : BizzPermission.CREATE;
// TODO 未配置则使用全部相关项 ???
// 未配置则使用全部相关项
if (FEAT == null) {
Entity entityMeta = MetadataHelper.getEntity(entity);
Set<String[]> refs = new HashSet<>();
for (Field field : entityMeta.getReferenceToFields()) {
Entity e = field.getOwnEntity();
// 过滤明细实体
if (e.getMasterEntity() != null) {
continue;
}
if (Application.getSecurityManager().allowed(user, e.getEntityCode(), RoC)) {
refs.add(EasyMeta.getEntityShows(e));
}

View file

@ -37,6 +37,8 @@ import com.alibaba.fastjson.JSONObject;
import com.rebuild.server.Application;
import com.rebuild.server.bizz.UserHelper;
import com.rebuild.server.bizz.privileges.Department;
import com.rebuild.server.entityhub.DisplayType;
import com.rebuild.server.entityhub.EasyMeta;
import com.rebuild.server.metadata.EntityHelper;
import com.rebuild.server.metadata.MetadataHelper;
@ -138,6 +140,9 @@ public class AdvFilterParser {
}
final Field fieldMeta = rootEntity.getField(field); // TODO 级联字段
if (EasyMeta.valueOf(fieldMeta).getDisplayType() == DisplayType.PICKLIST) {
field = "&" + field;
}
final String op = item.getString("op");
StringBuffer sb = new StringBuffer(field)
@ -187,7 +192,7 @@ public class AdvFilterParser {
// 占位 {1}
if (value.matches("\\{\\d+\\}")) {
if (values == null) {
LOG.warn("Invalid item of advfilter : " + item.toJSONString());
LOG.warn("Invalid item of AdvFilter : " + item.toJSONString());
return null;
}

View file

@ -75,12 +75,8 @@ public abstract class PageControll {
*/
protected ModelAndView createModelAndView(String page, String entity, ID user) {
ModelAndView mv = createModelAndView(page);
Entity entityMeta = MetadataHelper.getEntity(entity);
EasyMeta easy = new EasyMeta(entityMeta);
mv.getModel().put("entityName", easy.getName());
mv.getModel().put("entityLabel", easy.getLabel());
mv.getModel().put("entityIcon", easy.getIcon());
putEntityMeta(mv, entityMeta);
if (EntityHelper.hasPrivilegesField(entityMeta)) {
Privileges priv = Application.getSecurityManager().getPrivileges(user, entityMeta.getEntityCode());
@ -111,16 +107,10 @@ public abstract class PageControll {
*/
protected ModelAndView createModelAndView(String page, ID record, ID user) {
ModelAndView mv = createModelAndView(page);
Entity entity = MetadataHelper.getEntity(record.getEntityCode());
putEntityMeta(mv, entity);
Entity entityMeta = MetadataHelper.getEntity(record.getEntityCode());
EasyMeta easy = new EasyMeta(entityMeta);
mv.getModel().put("entityName", easy.getName());
mv.getModel().put("entityLabel", easy.getLabel());
mv.getModel().put("entityIcon", easy.getIcon());
// TODO 验证记录权限
if (EntityHelper.hasPrivilegesField(entityMeta)) {
if (EntityHelper.hasPrivilegesField(entity)) {
Permission[] actions = new Permission[] {
BizzPermission.CREATE,
BizzPermission.DELETE,
@ -140,6 +130,38 @@ public abstract class PageControll {
return mv;
}
/**
* @param into
* @param entity
*/
protected void putEntityMeta(ModelAndView into, Entity entity) {
EasyMeta easyMeta = EasyMeta.valueOf(entity);
into.getModel().put("entityName", easyMeta.getName());
into.getModel().put("entityLabel", easyMeta.getLabel());
into.getModel().put("entityIcon", easyMeta.getIcon());
EasyMeta master = null;
EasyMeta slave = null;
if (entity.getMasterEntity() != null) {
master = EasyMeta.valueOf(entity.getMasterEntity());
slave = EasyMeta.valueOf(entity);
} else if (entity.getSlaveEntity() != null) {
master = EasyMeta.valueOf(entity);
slave = EasyMeta.valueOf(entity.getSlaveEntity());
} else {
into.getModel().put("masterEntity", easyMeta.getName());
}
if (master != null && slave != null) {
into.getModel().put("masterEntity", master.getName());
into.getModel().put("masterEntityLabel", master.getLabel());
into.getModel().put("masterEntityIcon", master.getIcon());
into.getModel().put("slaveEntity", slave.getName());
into.getModel().put("slaveEntityLabel", slave.getLabel());
into.getModel().put("slaveEntityIcon", slave.getIcon());
}
}
// --
/**
@ -156,7 +178,7 @@ public abstract class PageControll {
*
* @param request
*/
public static void setPageAttribute(ModelAndView modelAndView) {
modelAndView.getModel().put("baseUrl", ServerListener.getContextPath());
public static void setPageAttribute(ModelAndView into) {
into.getModel().put("baseUrl", ServerListener.getContextPath());
}
}

View file

@ -69,12 +69,13 @@ public class MetaEntityControll extends BaseControll {
Entity entityMeta = MetadataHelper.getEntity(entity);
mv.getModel().put("nameField", entityMeta.getNameField().getName());
if (entityMeta.getMasterEntity() != null) {
mv.getModel().put("masterEntity", entityMeta.getMasterEntity().getName());
mv.getModel().put("masterEntityLabel", EasyMeta.getLabel(entityMeta.getMasterEntity()));
mv.getModel().put("slaveEntity", entityMeta.getName());
} else if (entityMeta.getSlaveEntity() != null) {
mv.getModel().put("masterEntity", entityMeta.getName());
mv.getModel().put("slaveEntity", entityMeta.getSlaveEntity().getName());
mv.getModel().put("slaveEntityLabel", EasyMeta.getLabel(entityMeta.getSlaveEntity()));
}
return mv;
@ -90,6 +91,10 @@ public class MetaEntityControll extends BaseControll {
public void listEntity(HttpServletRequest request, HttpServletResponse response) throws IOException {
List<Map<String, Object>> ret = new ArrayList<>();
for (Entity entity : MetadataSorter.sortEntities(true)) {
if (entity.getMasterEntity() != null) {
continue;
}
EasyMeta easyMeta = new EasyMeta(entity);
Map<String, Object> map = new HashMap<>();
map.put("entityName", easyMeta.getName());
@ -97,9 +102,8 @@ public class MetaEntityControll extends BaseControll {
map.put("comments", easyMeta.getComments());
map.put("icon", easyMeta.getIcon());
map.put("builtin", easyMeta.isBuiltin());
if (entity.getMasterEntity() != null) {
map.put("masterEntity", entity.getMasterEntity());
map.put("masterEntityLabel", EasyMeta.getLabel(entity.getMasterEntity()));
if (entity.getSlaveEntity() != null) {
map.put("slaveEntity", entity.getSlaveEntity().getName());
}
ret.add(map);
}
@ -114,9 +118,20 @@ public class MetaEntityControll extends BaseControll {
String label = reqJson.getString("label");
String comments = reqJson.getString("comments");
String masterEntity = reqJson.getString("masterEntity");
if (StringUtils.isNotBlank(masterEntity) && !MetadataHelper.containsEntity(masterEntity)) {
writeFailure(response, "无效主实体 : " + masterEntity);
return;
if (StringUtils.isNotBlank(masterEntity)) {
if (!MetadataHelper.containsEntity(masterEntity)) {
writeFailure(response, "无效主实体 : " + masterEntity);
return;
}
Entity master = MetadataHelper.getEntity(masterEntity);
if (master.getMasterEntity() != null) {
writeFailure(response, "明细实体不能作为主实体");
return;
} else if (master.getSlaveEntity() != null) {
writeFailure(response, "选择的主实体已被 " + EasyMeta.getLabel(master.getSlaveEntity()) + " 使用");
return;
}
}
String entityName = null;

View file

@ -90,6 +90,10 @@ public class ViewFeatControll extends BaseControll implements LayoutConfig {
Set<String[]> refs = new HashSet<>();
for (Field field : entityMeta.getReferenceToFields()) {
Entity e = field.getOwnEntity();
// 过滤明细实体因为明细实体会默认就有
if (e.getMasterEntity() != null) {
continue;
}
refs.add(new String[] { e.getName(), EasyMeta.getLabel(e) });
}

View file

@ -36,6 +36,7 @@ import com.rebuild.server.metadata.MetadataHelper;
import com.rebuild.web.BaseControll;
import cn.devezhao.commons.web.ServletUtils;
import cn.devezhao.persist4j.Entity;
import cn.devezhao.persist4j.engine.ID;
/**
@ -52,16 +53,22 @@ public class GeneralEntityControll extends BaseControll {
public ModelAndView pageView(@PathVariable String entity, @PathVariable String id,
HttpServletRequest request) throws IOException {
ID user = getRequestUser(request);
Entity thatEntity = MetadataHelper.getEntity(entity);
ID record = ID.valueOf(id);
ModelAndView mv = createModelAndView("/general-entity/record-view.jsp", record, user);
ModelAndView mv = null;
if (thatEntity.getMasterEntity() != null) {
mv = createModelAndView("/general-entity/slave-view.jsp", record, user);
} else {
mv = createModelAndView("/general-entity/record-view.jsp", record, user);
JSON vtab = ViewFeatManager.getViewTab(entity, user);
mv.getModel().put("ViewTabs", vtab);
JSON vadd = ViewFeatManager.getViewAdd(entity, user);
mv.getModel().put("ViewAdds", vadd);
}
mv.getModel().put("id", record);
JSON vtab = ViewFeatManager.getViewTab(entity, user);
mv.getModel().put("ViewTabs", vtab);
JSON vadd = ViewFeatManager.getViewAdd(entity, user);
mv.getModel().put("ViewAdds", vadd);
return mv;
}

View file

@ -37,7 +37,6 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.rebuild.server.Application;
import com.rebuild.server.entityhub.EasyMeta;
import com.rebuild.server.helper.manager.DataListManager;
import com.rebuild.server.helper.manager.LayoutManager;
import com.rebuild.server.metadata.EntityHelper;
@ -67,32 +66,18 @@ public class GeneralListControll extends BaseControll implements LayoutConfig {
@RequestMapping("list")
public ModelAndView pageList(@PathVariable String entity, HttpServletRequest request) throws IOException {
ID user = getRequestUser(request);
ModelAndView mv = createModelAndView("/general-entity/record-list.jsp", entity, user);
Entity thatEntity = MetadataHelper.getEntity(entity);
ModelAndView mv = null;
if (thatEntity.getMasterEntity() != null) {
mv = createModelAndView("/general-entity/slave-list.jsp", entity, user);
} else {
mv = createModelAndView("/general-entity/record-list.jsp", entity, user);
}
JSON config = DataListManager.getColumnLayout(entity, getRequestUser(request));
mv.getModel().put("DataListConfig", JSON.toJSONString(config));
EasyMeta master = null;
EasyMeta slave = null;
Entity that = MetadataHelper.getEntity(entity);
if (that.getMasterEntity() != null) {
master = EasyMeta.valueOf(that.getMasterEntity());
slave = EasyMeta.valueOf(that);
} else if (that.getSlaveEntity() != null) {
master = EasyMeta.valueOf(that);
slave = EasyMeta.valueOf(that.getSlaveEntity());
} else {
mv.getModel().put("masterEntity", that.getName());
}
if (master != null && slave != null) {
mv.getModel().put("masterEntity", master.getName());
mv.getModel().put("masterEntityLabel", master.getLabel());
mv.getModel().put("masterEntityIcon", master.getIcon());
mv.getModel().put("slaveEntity", slave.getName());
mv.getModel().put("slaveEntityLabel", slave.getLabel());
mv.getModel().put("slaveEntityIcon", slave.getIcon());
}
return mv;
}

View file

@ -1,5 +1,4 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.rebuild.web.admin.AdminEntryControll"%>
<%@ page import="com.rebuild.server.helper.SystemConfiguration"%>
<%@ page import="com.rebuild.utils.AppUtils"%>
<meta charset="utf-8">

View file

@ -1,12 +1,10 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="cn.devezhao.commons.CodecUtils"%>
<%@ page import="org.apache.commons.lang.StringUtils"%>
<%@ page import="com.rebuild.server.ServerListener"%>
<%@ page import="com.alibaba.fastjson.JSONObject"%>
<%@ page import="com.alibaba.fastjson.JSONArray"%>
<%@ page import="com.rebuild.server.helper.manager.NavManager"%>
<%
final String activeNav = request.getParameter("activeNav");
final JSONArray navArray = NavManager.getNavForPortal(request);
%>
<div class="rb-left-sidebar">
<div class="left-sidebar-wrapper">
@ -16,10 +14,7 @@ final String activeNav = request.getParameter("activeNav");
<div class="left-sidebar-content no-divider">
<ul class="sidebar-elements">
<li class="<%="dashboard-home".equals(activeNav) ? "active" : ""%>" id="nav_dashboard-home"><a href="${baseUrl}/dashboard/home"><i class="icon zmdi zmdi-home"></i><span>首页</span></a></li>
<%JSONArray navArray = NavManager.getNavForPortal(request);
for (Object o : navArray) {
out.print(NavManager.renderNavItem((JSONObject) o, activeNav, true));
}%>
<% for (Object o : navArray) { out.print(NavManager.renderNavItem((JSONObject) o, activeNav, true)); } %>
</ul>
</div>
</div>

View file

@ -1,5 +1,4 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<% final String activeNav = request.getParameter("activeNav"); %>
<div class="rb-left-sidebar">
<div class="left-sidebar-wrapper">
<a class="left-sidebar-toggle">MIN</a>
@ -8,19 +7,19 @@
<div class="left-sidebar-content">
<ul class="sidebar-elements">
<li class="divider">系统</li>
<li class="<%="systems".equals(activeNav) ? "active" : ""%>" id="nav_systems"><a href="${baseUrl}/admin/systems"><i class="icon zmdi zmdi-settings"></i><span>通用配置</span></a></li>
<li class="${param['activeNav'] == 'systems' ? 'active' : ''}" id="nav_systems"><a href="${baseUrl}/admin/systems"><i class="icon zmdi zmdi-settings"></i><span>通用配置</span></a></li>
<li class="parent">
<a href="javascript:;"><i class="icon zmdi zmdi-cloud-done"></i><span>第三方服务集成</span></a>
<a><i class="icon zmdi zmdi-cloud-done"></i><span>第三方服务集成</span></a>
<ul class="sub-menu">
<li class="title">第三方服务集成</li>
<li class="nav-items">
<div class="rb-scroller">
<div class="content">
<ul>
<li class="<%="plugins-storage".equals(activeNav) ? "active" : ""%>" id="nav_plugins-storage"><a href="${baseUrl}/admin/plugins/storage">云存储</a></li>
<li class="<%="plugins-cache".equals(activeNav) ? "active" : ""%>" id="nav_plugins-cache"><a href="${baseUrl}/admin/plugins/cache">缓存系统</a></li>
<li class="<%="plugins-sms".equals(activeNav) ? "active" : ""%>" id="nav_plugins-sms"><a href="${baseUrl}/admin/plugins/sms">短信服务</a></li>
<li class="<%="plugins-mail".equals(activeNav) ? "active" : ""%>" id="nav_plugins-mail"><a href="${baseUrl}/admin/plugins/mail">邮件服务</a></li>
<li class="${param['activeNav'] == 'plugins-storage' ? 'active' : ''}" id="nav_plugins-storage"><a href="${baseUrl}/admin/plugins/storage">云存储</a></li>
<li class="${param['activeNav'] == 'plugins-cache' ? 'active' : ''}" id="nav_plugins-cache"><a href="${baseUrl}/admin/plugins/cache">缓存系统</a></li>
<li class="${param['activeNav'] == 'plugins-sms' ? 'active' : ''}" id="nav_plugins-sms"><a href="${baseUrl}/admin/plugins/sms">短信服务</a></li>
<li class="${param['activeNav'] == 'plugins-mail' ? 'active' : ''}" id="nav_plugins-mail"><a href="${baseUrl}/admin/plugins/mail">邮件服务</a></li>
</ul>
</div>
</div>
@ -28,11 +27,11 @@
</ul>
</li>
<li class="divider">业务/实体</li>
<li class="<%="entities".equals(activeNav) ? "active" : ""%>" id="nav_entities"><a href="${baseUrl}/admin/entities"><i class="icon zmdi zmdi-widgets"></i><span>实体管理</span></a></li>
<li class="<%="audit-logging".equals(activeNav) ? "active" : ""%>" id="nav_audit-logging"><a href="${baseUrl}/admin/audit-logging"><i class="icon zmdi zmdi-assignment-check"></i><span>审计日志</span></a></li>
<li class="${param['activeNav'] == 'entities' ? 'active' : ''}" id="nav_entities"><a href="${baseUrl}/admin/entities"><i class="icon zmdi zmdi-widgets"></i><span>实体管理</span></a></li>
<li class="${param['activeNav'] == 'audit-logging' ? 'active' : ''}" id="nav_audit-logging"><a href="${baseUrl}/admin/audit-logging"><i class="icon zmdi zmdi-assignment-check"></i><span>审计日志</span></a></li>
<li class="divider">用户</li>
<li class="<%="users".equals(activeNav) ? "active" : ""%>" id="nav_user-list"><a href="${baseUrl}/admin/bizuser/users"><i class="icon zmdi zmdi-accounts"></i><span>部门用户</span></a></li>
<li class="<%="role-privileges".equals(activeNav) ? "active" : ""%>" id="nav_role-list"><a href="${baseUrl}/admin/bizuser/role-privileges"><i class="icon zmdi zmdi-lock"></i><span>角色权限</span></a></li>
<li class="${param['activeNav'] == 'users' ? 'active' : ''}" id="nav_user-list"><a href="${baseUrl}/admin/bizuser/users"><i class="icon zmdi zmdi-accounts"></i><span>部门用户</span></a></li>
<li class="${param['activeNav'] == 'role-privileges' ? 'active' : ''}" id="nav_role-list"><a href="${baseUrl}/admin/bizuser/role-privileges"><i class="icon zmdi zmdi-lock"></i><span>角色权限</span></a></li>
</ul>
</div>
</div>

View file

@ -1,4 +1,5 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page import="com.rebuild.web.admin.AdminEntryControll"%>
<%@ page import="com.rebuild.utils.AppUtils"%>
<%@ page import="com.rebuild.server.Application"%>
@ -8,6 +9,7 @@
<%
final User currentUser = Application.getUserStore().getUser(AppUtils.getRequestUser(request));
final String showName = UserHelper.getShowName(currentUser);
final boolean isAdmin = currentUser.isAdmin();
%>
<nav class="navbar navbar-expand fixed-top rb-top-header">
<div class="container-fluid">
@ -20,11 +22,11 @@ final String showName = UserHelper.getShowName(currentUser);
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="${baseUrl}/me/profile" data-toggle="dropdown">
<img src="<%=currentUser.getAvatarUrl(true)%>" alt="Avatar">
<span class="user-name"><%=showName%></span>
<span class="user-name">${showName}</span>
</a>
<div class="dropdown-menu">
<div class="user-info">
<div class="user-name"><%=showName%></div>
<div class="user-name">${showName}</div>
<div class="user-id"><%=StringUtils.defaultIfBlank(currentUser.getEmail(), "邮箱未设置")%></div>
</div>
<a class="dropdown-item" href="${baseUrl}/settings/account"><i class="icon zmdi zmdi-account-box"></i>个人设置</a>
@ -32,13 +34,13 @@ final String showName = UserHelper.getShowName(currentUser);
</div>
</li>
</ul>
<div class="page-title"><span><%=request.getParameter("pageTitle")%></span></div>
<div class="page-title"><span>${param['pageTitle']}</span></div>
<ul class="nav navbar-nav float-right rb-icons-nav">
<% if (currentUser.isAdmin()) { %>
<c:if test="${!isAdmin}">
<li class="nav-item dropdown J_admin-settings">
<a class="nav-link" href="${baseUrl}/admin/systems"><i class="icon zmdi zmdi-settings"></i></a>
</li>
<%} %>
</c:if>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown--disable" href="${baseUrl}/app/notifications"><i class="icon zmdi zmdi-notifications"></i><span class="indicator hide"></span></a>
<ul class="dropdown-menu rb-notifications">
@ -52,8 +54,8 @@ final String showName = UserHelper.getShowName(currentUser);
<a href="${baseUrl}/app/notification/123">
<div class="image"><img src="${baseUrl}/assets/img/avatar.png" alt="Avatar"></div>
<div class="notification-info">
<div class="text"><span class="user-name">Jessica Caruso</span> accepted your invitation to join the team.</div>
<span class="date">2 min ago</span>
<div class="text"><span class="user-name">USER</span> MESSAGE.</div>
<span class="date">TIME</span>
</div>
</a>
</li>

View file

@ -18,11 +18,11 @@ final String showName = UserHelper.getShowName(currentUser);
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="${baseUrl}/me/profile" data-toggle="dropdown">
<img src="<%=currentUser.getAvatarUrl(true)%>" alt="Avatar">
<span class="user-name"><%=showName%></span>
<span class="user-name">${showName}</span>
</a>
<div class="dropdown-menu">
<div class="user-info">
<div class="user-name"><%=showName%></div>
<div class="user-name">${showName}</div>
<div class="user-id"><%=StringUtils.defaultIfBlank(currentUser.getEmail(), "邮箱未设置")%></div>
</div>
<a class="dropdown-item" href="${baseUrl}/me/profile"><span class="icon zmdi zmdi-account-box"></span>个人设置</a>

View file

@ -62,7 +62,7 @@ $(document).ready(function(){
})
})
})
const deleteDept = function(){
let deleteDept = function(){
$.post(rb.baseUrl + '/admin/bizuser/dept-delete?transfer=&id=${id}', function(res){
if (res.error_code == 0) parent.location.reload()
else rb.notice(res.error_msg, 'danger')

View file

@ -1,6 +1,5 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.Map"%>
<%@ page import="java.util.List"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
@ -64,26 +63,17 @@
</tr>
</thead>
<tbody>
<%
List<String[]> entities = (List<String[]>) request.getAttribute("Entities");
for (String[] e : entities) {
boolean noas = "/User/Department/Role/".contains("/" + e[0] + "/");
%>
<c:forEach items="${Entities}" var="e">
<tr>
<td class="name"><a data-name="<%=e[0]%>"><%=e[1]%></a></td>
<td class="name"><a data-name="${e[0]}">${e[1]}</a></td>
<td class="text-center"><i data-action="C" class="priv R0"></i></td>
<td class="text-center"><i data-action="R" class="priv R0"></i></td>
<td class="text-center"><i data-action="U" class="priv R0"></i></td>
<td class="text-center"><i data-action="D" class="priv R0"></i></td>
<% if (noas) { %>
<td class="text-center text-muted">-</td>
<td class="text-center text-muted">-</td>
<%} else { %>
<td class="text-center"><i data-action="A" class="priv R0"></i></td>
<td class="text-center"><i data-action="S" class="priv R0"></i></td>
<%} %>
</tr>
<%} %>
</c:forEach>
</tbody>
</table>
<div class="legend-warp">
@ -163,7 +153,7 @@
RbForm.postAfter = function(data){
location.href = rb.baseUrl + '/admin/bizuser/role/' + data.id
}
var currentRoleId
let currentRoleId
$(document).ready(function(){
$('.J_new-role').click(function(){
rb.RbFormModal({ title: '新建角色', entity: 'Role', icon: 'lock' })
@ -257,7 +247,6 @@ const loadRoles = function() {
})
})
}
const loadPrivileges = function() {
$.get(rb.baseUrl + '/admin/bizuser/privileges-list?role=' + currentRoleId, function(res){
if (res.error_code == 0){
@ -306,12 +295,11 @@ const updatePrivileges = function() {
rb.notice('保存成功', 'success')
})
}
const deleteRole = function(id){
$.post(rb.baseUrl + '/admin/bizuser/role-delete?transfer=&id=' + id, function(res){
if (res.error_code == 0) location.replace(rb.baseUrl + '/admin/bizuser/role-privileges')
else rb.notice(res.error_msg, 'danger')
});
})
}
</script>
</body>

View file

@ -31,8 +31,6 @@
<div class="col-6 pr-1 mb-2">
<button class="btn btn-secondary J_edit" type="button"><i class="icon zmdi zmdi-border-color"></i> 编辑</button>
</div>
<div class="col-6 pl-1 mb-2 btn-group J_action">
</div>
</div>
</div>
</div>
@ -45,7 +43,7 @@
$(document).ready(function(){
RbViewPage.init('${id}', ['Role','${entityLabel}','${entityIcon}'])
if (rb.isAdminUser == false || rb.isAdminVerified == false) $('.view-action').remove()
});
})
</script>
</body>
</html>

View file

@ -69,7 +69,6 @@
</div>
</div>
</div>
<%@ include file="/_include/Foot.jsp"%>
<script src="${baseUrl}/assets/js/rb-list.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-forms.jsx" type="text/babel"></script>

View file

@ -1,4 +1,5 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
@ -44,6 +45,12 @@ a#entityIcon:hover{opacity:0.8}
<div class="page-head-title">基本信息</div>
</div>
<div class="main-content container-fluid pt-1">
<c:if test="${slaveEntity != null}">
<ul class="nav nav-tabs nav-tabs-classic">
<li class="nav-item J_tab-${masterEntity}"><a href="../${masterEntity}/base" class="nav-link">主实体</a></li>
<li class="nav-item J_tab-${slaveEntity}"><a href="../${slaveEntity}/base" class="nav-link">明细实体</a></li>
</ul>
</c:if>
<div class="card mb-0">
<div class="card-body pt-4">
<form>
@ -73,18 +80,6 @@ a#entityIcon:hover{opacity:0.8}
<p class="form-text mb-0">好的主显字段应能够清晰的表示记录本身,如客户中的客户名称或订单中的订单编号</p>
</div>
</div>
<div class="form-group row text ${masterEntity == null ? "hide" : ""}">
<label class="col-sm-2 col-form-label text-sm-right">主实体</label>
<div class="col-lg-5 col-sm-10">
<div class="form-control-plaintext"><a href="../${masterEntity}/base">${masterEntityLabel} (${masterEntity})</a></div>
</div>
</div>
<div class="form-group row text ${slaveEntity == null ? "hide" : ""}">
<label class="col-sm-2 col-form-label text-sm-right">明细实体</label>
<div class="col-lg-5 col-sm-10">
<div class="form-control-plaintext"><a href="../${slaveEntity}/base">${slaveEntityLabel} (${slaveEntity})</a></div>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label text-sm-right">备注</label>
<div class="col-lg-5 col-sm-10">
@ -118,7 +113,8 @@ $(document).ready(function(){
const metaId = '${entityMetaId}'
if (!!!metaId) $('.footer .alert').removeClass('hide')
else $('.footer .J_action').removeClass('hide')
if (!!'${masterEntity}') $('.J_masterEntity').removeClass('hide')
$('.J_tab-${entityName} a').addClass('active')
let _btn = $('.J_save').click(function(){
if (!!!metaId) return
@ -151,7 +147,7 @@ $(document).ready(function(){
disabled: not,
title: not ? '此字段(类型)不能作为主显字段' : ''
}
});
})
$('#nameField').select2({
language: 'zh-CN',
placeholder: '选择字段',

View file

@ -60,7 +60,7 @@ let render_entity = function(item){
tmp.find('span').text(item.entityLabel)
tmp.find('p').text(item.comments || '-')
if (item.builtin == true) $('<i class="badge badge-pill badge-secondary thin text-muted">内建</i>').appendTo(tmp.find('a.card'))
if (!!item.masterEntity) $('<i class="badge badge-pill badge-secondary thin text-muted">明细</i>').appendTo(tmp.find('a.card'))
if (!!item.slaveEntity) $('<i class="badge badge-pill badge-secondary thin text-muted">明细</i>').appendTo(tmp.find('a.card'))
return tmp
}
</script>

View file

@ -61,7 +61,7 @@ $(document).ready(function(){
sbtn.button('loading')
$.post(rb.baseUrl + '/admin/entity/entity-new', _data, function(res){
if (res.error_code == 0) parent.location.href = rb.baseUrl + '/admin/entity/' +res.data + '/base'
else { sbrn.button('reset'); rb.notice(res.error_msg, 'danger') }
else { sbtn.button('reset'); rb.notice(res.error_msg, 'danger') }
})
})

View file

@ -1,5 +1,4 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.rebuild.server.entityhub.DisplayType"%>
<!DOCTYPE html>
<html>
<head>

View file

@ -26,6 +26,9 @@
.btn.btn-link:hover {
color: #0d5bdd !important;
}
.btn .icon.x14{
font-size: 1.431rem
}
.navbar-nav .dropdown>.nav-link:hover>.icon, .bottom-widget>a:hover>.icon {
opacity: 0.8;
}
@ -215,6 +218,9 @@ a {
.hide {
display: none !important;
}
.clearfix {
clear: both;
}
.mlr-auto {
margin-left: auto !important;
margin-right: auto !important;
@ -578,9 +584,12 @@ i.split.ui-draggable-dragging {
-ms-user-select: none;
user-select: none;
}
.main-content>.nav-tabs-classic+.card.card-table {
.main-content>.nav-tabs-classic+.card {
border-top-left-radius: 0;
border-top-right-radius: 0;
border-top: 2px solid #fff;
}
.main-content>.nav-tabs-classic+.card.card-table{
border-top: 2px solid #4285f4;
}
.main-content>.nav-tabs-classic>li.nav-item a.nav-link {
@ -953,7 +962,8 @@ i.split.ui-draggable-dragging {
}
.adv-filter .item.dialog-footer {
margin: 0 -30px;
margin-bottom: -10px;
margin-bottom: -5px;
padding-top: 20px;
}
/* height = 34px
.adv-filter .select2-container--default .select2-selection--single, .adv-filter .select2-container--default .select2-selection--multiple {

View file

@ -95,22 +95,31 @@ html, body {
color: #aaa;
cursor: help;
}
.view-metas {
.view-operating {
padding-left: 30px;
}
.view-metas>div {
.view-operating>div {
margin-bottom: 15px !important;
}
.view-metas .row, .view-metas .form-line {
.view-operating .row, .view-operating .form-line {
margin-bottom: 10px;
}
.view-metas dt {
.view-operating dt {
font-weight: normal;
}
.view-action {
margin-top: 33px;
}
.view-action .btn {
.view-action .col-6 {
margin-bottom: .769231rem;
}
.view-action .col-6:nth-child(odd) {
padding-right: 0.384615rem;
}
.view-action .col-6:nth-child(even) {
padding-left: 0.384615rem;
}
.view-action .col-6 .btn {
width: 100%
}
.view-action.noaction {

View file

@ -51,16 +51,17 @@ class AdvFilter extends React.Component {
<div className="item dialog-footer">
{rb.isAdminUser !== true ? null :
<div className="float-left">
<label className="custom-control custom-checkbox custom-control-inline">
<div className="float-left input">
<input className="form-control form-control-sm text" maxLength="20" value={this.state.filterName || ''} data-id="filterName" onChange={this.handleChange} placeholder="输入过滤项名称" />
<i className="zmdi zmdi-border-color float-right"></i>
</div>
<label className="custom-control custom-control-sm custom-checkbox custom-control-inline ml-4 mt-2">
<input className="custom-control-input" type="checkbox" checked={this.state.applyToAll == true} data-id="applyToAll" onChange={this.handleChange} />
<span className="custom-control-label">共享给全部用户</span>
</label>
</div>}
{OperBtns}
<div className="float-right input mr-3">
<input className="form-control form-control-sm text" maxLength="20" value={this.state.filterName || ''} data-id="filterName" onChange={this.handleChange} placeholder="输入过滤项名称" />
<i className="zmdi zmdi-border-color float-right"></i>
</div>
<div className="clearfix"/>
</div>
: (<div>{OperBtns}</div>) }
</div>

View file

@ -198,4 +198,26 @@ const $storage = {
let random_times = 0
const $random = function(){
return new Date().getTime() + '-' + random_times++
}
// 计算分页
//@tp 总计页面
//@cp 当前页面
const $pages = function(tp, cp){
let pages = []
if (tp <= 8){
for (var i = 1; i <= tp; i++) pages.push(i)
return pages
}
if (cp > tp) cp = tp
if (cp <= 4) cp = 4
var begin = cp - 2, end = cp + 3
if (begin < 1) begin = 1
if (end > tp) end = tp
if (begin > 1) pages.push(1)
if (begin > 2) pages.push('.')
for (var i = begin; i < end; i++) pages.push(i)
if (end <= tp - 1) pages.push('.')
if (end <= tp) pages.push(tp)
return pages
}

View file

@ -101,9 +101,7 @@ class RbForm extends React.Component {
constructor(props) {
super(props)
this.state = { ...props }
this.isNew = !!!props.$$$parent.state.id
this.__FormData = {}
this.setFieldValue = this.setFieldValue.bind(this)
}
@ -396,6 +394,8 @@ class RbFormDateTime extends RbFormElement {
}
componentDidMount() {
super.componentDidMount()
if (this.state.viewMode == true) return
let format = (this.props.datetimeFormat || this.props.dateFormat).replace('mm', 'ii').toLowerCase()
let minView = 0
switch (format.length) {
@ -465,6 +465,8 @@ class RbFormImage extends RbFormElement {
}
componentDidMount() {
super.componentDidMount()
if (this.state.viewMode == true) return
let that = this
let mprogress
$(that.refs['upload-input']).html5Uploader({
@ -530,6 +532,8 @@ class RbFormFile extends RbFormElement {
}
componentDidMount() {
super.componentDidMount()
if (this.state.viewMode == true) return
let that = this
let mprogress
$(that.refs['upload-input']).html5Uploader({
@ -575,6 +579,8 @@ class RbFormPickList extends RbFormElement {
}
componentDidMount() {
super.componentDidMount()
if (this.state.viewMode == true) return
let select2 = $(this.refs['field-value']).select2({
language: 'zh-CN',
placeholder: '选择' + this.props.label,
@ -618,6 +624,8 @@ class RbFormReference extends RbFormElement {
}
componentDidMount() {
super.componentDidMount()
if (this.state.viewMode == true) return
let that = this
let select2 = $(this.refs['field-value']).select2({
language: 'zh-CN',

View file

@ -292,7 +292,7 @@ class RbListPagination extends React.Component {
let props = this.props
this.pageTotal = Math.ceil(props.rowTotal / props.pageSize)
if (this.pageTotal <= 0) this.pageTotal = 1
const pages = $calcPages(this.pageTotal, props.pageNo)
const pages = $pages(this.pageTotal, props.pageNo)
return (
<div className="row rb-datatable-footer">
<div className="col-sm-5">

View file

@ -41,6 +41,7 @@ $(function(){
}
})
// 导航菜单
const __initNavs = function(){
let isOffcanvas = $('.rb-offcanvas-menu').length > 0
@ -133,35 +134,10 @@ const __checkMessage = function(){
$('.rb-notifications span.badge').text('0')
__checkMessage_status = 0
}
setTimeout(__checkMessage, 3000)
setTimeout(__checkMessage, 3000 * (rb.env == 'dev' ? 10 : 1))
})
}
// 是否在管理员页
const $inAdminPage = location.href.indexOf('/admin/') > -1
// 计算分页
// @tp 总计页面
// @cp 当前页面
const $calcPages = function(tp, cp){
let pages = []
if (tp <= 8){
for (var i = 1; i <= tp; i++) pages.push(i)
return pages
}
if (cp > tp) cp = tp
if (cp <= 4) cp = 4
var begin = cp - 2, end = cp + 3
if (begin < 1) begin = 1
if (end > tp) end = tp
if (begin > 1) pages.push(1)
if (begin > 2) pages.push('.')
for (var i = begin; i < end; i++) pages.push(i)
if (end <= tp - 1) pages.push('.')
if (end <= tp) pages.push(tp)
return pages
}
// @mbg = .btn-group
const $cleanMenu = function(mbg){
mbg = $(mbg)

View file

@ -91,13 +91,18 @@ const RbViewPage = {
$('.J_edit').click(function(){
rb.RbFormModal({ id: id, title: `编辑${entity[1]}`, entity: entity[0], icon: entity[2] })
})
$('.J_assign').click(function(){
rb.AssignDialog({ entity: entity[0], ids: [id] })
})
$('.J_share').click(function(){
rb.ShareDialog({ entity: entity[0], ids: [id] })
})
$('.J_adds-slave').click(function(){
let defaultValues = {}
defaultValues['&' + entity[0]] = id
let _this = $(this)
rb.RbFormModal({ title: '添加明细', entity: _this.data('entity'), icon: _this.data('icon'), defaultValues: defaultValues })
})
// Privileges
if (ep) {
@ -128,7 +133,7 @@ const RbViewPage = {
if (k == 'owningUser'){
$('<a href="#!/View/User/' + _data[k][0] + '" onclick="RbViewPage.clickView(this)">' + _data[k][1] + '</a>').appendTo('.J_' + k)
} else if (k == 'shareTo'){
$('<a>' + (_data[k] == 0 ? '无' : ('已共享给' + _data[k] + '位用户')) + '</a>').appendTo('.J_' + k)
$('<a>' + (_data[k] == 0 ? '无' : ('已共享给 <a>' + _data[k] + '</a> 位用户')) + '</a>').appendTo('.J_' + k)
} else {
$('<span>' + _data[k] + '</span>').appendTo('.J_' + k)
}

View file

@ -19,7 +19,7 @@
<script src="${baseUrl}/assets/js/zmdi-icons.js"></script>
<script type="text/babel">
$(document).ready(function(){
let call = parent.clickIcon || function(icon){ console.log('请复写 clickIcon 方法') }
let call = parent.clickIcon || function(icon){ console.log(icon) }
$(ZMDI_ICONS).each(function(){
if (ZMDI_ICONS_IGNORE.contains(this + '') == false) {
let a = $('<a data-icon="' + this + '" title="' + this.toUpperCase() + '"><i class="zmdi zmdi-' + this + '"></a>').appendTo('#icons')

View file

@ -1,11 +1,10 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/_include/Head.jsp"%>
<title>${entityLabel}列表</title>
<style type="text/css">
</style>
</head>
<body>
<div class="rb-wrapper rb-fixed-sidebar rb-collapsible-sidebar rb-collapsible-sidebar-hide-logo">
@ -17,16 +16,12 @@
</jsp:include>
<div class="rb-content">
<div class="main-content container-fluid">
<%
String slaveEntity = (String) request.getAttribute("slaveEntity");
if (slaveEntity != null) {
boolean isSlave = slaveEntity.equals(request.getAttribute("entityName"));
%>
<c:if test="${slaveEntity != null}">
<ul class="nav nav-tabs nav-tabs-classic">
<li class="nav-item"><a href="../${masterEntity}/list" class="nav-link <%=isSlave ? "":"active"%>"><span class="icon zmdi zmdi-${masterEntityIcon}"></span> ${masterEntityLabel}</a></li>
<li class="nav-item"><a href="../${slaveEntity}/list" class="nav-link <%=isSlave ? "active":""%>"><span class="icon zmdi zmdi-${slaveEntityIcon}"></span> ${slaveEntityLabel}</a></li>
<li class="nav-item"><a class="nav-link active"><span class="icon zmdi zmdi-${masterEntityIcon}"></span> ${masterEntityLabel}</a></li>
<li class="nav-item"><a href="../${slaveEntity}/list" class="nav-link"><span class="icon zmdi zmdi-${slaveEntityIcon}"></span> ${slaveEntityLabel}</a></li>
</ul>
<%} %>
</c:if>
<div class="card card-table">
<div class="card-body">
<div class="dataTables_wrapper container-fluid">
@ -39,14 +34,14 @@
<div class="dropdown-menu rb-scroller">
<div class="dropdown-item" data-id="$ALL$"><a>所有数据</a></div>
<div class="dropdown-divider"></div>
<div class="dropdown-item J_advfilter"><i class="icon zmdi zmdi-playlist-plus"></i>添加过滤项</div>
<div class="dropdown-item J_advfilter"><i class="icon zmdi zmdi-plus-circle-o"></i>添加过滤项</div>
</div>
</div>
</div>
<div class="input-group input-search">
<input class="form-control rounded-left J_search-text" placeholder="搜索 ..." type="text">
<span class="input-group-btn"><button class="btn btn-secondary J_search-btn" type="button"><i class="icon zmdi zmdi-search"></i></button></span>
<span class="input-group-btn plus"><button class="btn btn-secondary J_qfields" type="button" title="设置查询字段"><i class="icon zmdi zmdi-playlist-plus"></i></button></span>
<span class="input-group-btn plus"><button class="btn btn-secondary J_qfields" type="button" title="设置查询字段"><i class="icon zmdi zmdi-plus-circle-o"></i></button></span>
</div>
</div>
</div>
@ -81,7 +76,6 @@
</div>
</div>
</div>
<%@ include file="/_include/Foot.jsp"%>
<script src="${baseUrl}/assets/js/rb-list.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-forms.jsx" type="text/babel"></script>
@ -89,9 +83,9 @@
<script src="${baseUrl}/assets/js/assign-share.jsx" type="text/babel"></script>
<script type="text/babel">
$(document).ready(function(){
RbListPage.init($.parseJSON('${DataListConfig}'), [ '${entityName}', '${entityLabel}', '${entityIcon}' ], $.parseJSON('${entityPrivileges}'))
RbListPage.init($.parseJSON('${DataListConfig}'), ['${entityName}','${entityLabel}','${entityIcon}'], $.parseJSON('${entityPrivileges}'))
rb.AdvFilter.init('.adv-search', '${entityName}')
});
})
</script>
</body>
</html>

View file

@ -1,4 +1,5 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
@ -30,12 +31,12 @@
</div>
</div>
</div>
<div class="col-sm-3 view-metas">
<div class="col-sm-3 view-operating">
<div class="view-action row">
<div class="col-6 pr-1 mb-2">
<div class="col-6">
<button class="btn btn-secondary J_edit" type="button"><i class="icon zmdi zmdi-border-color"></i> 编辑</button>
</div>
<div class="col-6 pl-1 mb-2 btn-group J_action">
<div class="col-6 btn-group J_action">
<button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown"><i class="icon zmdi zmdi-more-vert"></i> 更多</button>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item J_delete"><i class="icon zmdi zmdi-delete"></i> 删除</a>
@ -43,9 +44,14 @@
<a class="dropdown-item J_share"><i class="icon zmdi zmdi-slideshare"></i> 共享</a>
</div>
</div>
<div class="col-6 pr-1 mb-2 btn-group J_adds">
<c:if test="${slaveEntity != null}">
<div class="col-6">
<button class="btn btn-secondary J_adds-slave" type="button" data-entity="${slaveEntity}" data-label="${slaveEntityLabel}" data-icon="${slaveEntityIcon}"><i class="icon x14 zmdi zmdi-playlist-plus"></i> 添加明细</button>
</div>
</c:if>
<div class="col-6 btn-group J_adds">
<button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown"><i class="icon zmdi zmdi-plus"></i> 新建相关</button>
<div class="dropdown-menu">
<div class="dropdown-menu dropdown-menu-right">
<div class="dropdown-divider"></div>
<a class="dropdown-item J_for-admin J_view-feat" data-feat="ADD"><i class="icon zmdi zmdi-settings"></i> 配置新建项</a>
</div>
@ -82,11 +88,11 @@
<script src="${baseUrl}/assets/js/assign-share.jsx" type="text/babel"></script>
<script type="text/babel">
$(document).ready(function(){
RbViewPage.init('${id}', [ '${entityName}', '${entityLabel}', '${entityIcon}' ], $.parseJSON('${entityPrivileges}'))
RbViewPage.init('${id}', ['${entityName}','${entityLabel}','${entityIcon}'], $.parseJSON('${entityPrivileges}'))
RbViewPage.initRecordMeta()
RbViewPage.initVTabs($.parseJSON('${ViewTabs}'))
RbViewPage.initVAdds($.parseJSON('${ViewAdds}'))
});
})
</script>
</body>
</html>

View file

@ -43,7 +43,7 @@ $(document).ready(function(){
$(res.data['fieldList']).each(function(){ render_unset([this.field, this.label]) })
$(res.data['configList']).each(function(){ $('.unset-list li[data-key="' + this.field + '"]').trigger('click') })
cfgid = res.data['configId'] || ''
});
})
$('.J_save').click(function(){
let config = [];

View file

@ -0,0 +1,85 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/_include/Head.jsp"%>
<title>${entityLabel}列表</title>
</head>
<body>
<div class="rb-wrapper rb-fixed-sidebar rb-collapsible-sidebar rb-collapsible-sidebar-hide-logo">
<jsp:include page="/_include/NavTop.jsp">
<jsp:param value="${entityLabel}列表" name="pageTitle"/>
</jsp:include>
<jsp:include page="/_include/NavLeft.jsp">
<jsp:param value="nav_entity-${masterEntity}" name="activeNav"/>
</jsp:include>
<div class="rb-content">
<div class="main-content container-fluid">
<ul class="nav nav-tabs nav-tabs-classic">
<li class="nav-item"><a href="../${masterEntity}/list" class="nav-link"><span class="icon zmdi zmdi-${masterEntityIcon}"></span> ${masterEntityLabel}</a></li>
<li class="nav-item"><a class="nav-link active"><span class="icon zmdi zmdi-${slaveEntityIcon}"></span> ${slaveEntityLabel}</a></li>
</ul>
<div class="card card-table">
<div class="card-body">
<div class="dataTables_wrapper container-fluid">
<div class="row rb-datatable-header">
<div class="col-12 col-sm-6">
<div class="dataTables_filter">
<div class="adv-search float-left">
<div class="btn-group">
<button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown"><span class="text-truncate J_name">所有数据</span><i class="icon zmdi zmdi-caret-down"></i></button>
<div class="dropdown-menu rb-scroller">
<div class="dropdown-item" data-id="$ALL$"><a>所有数据</a></div>
<div class="dropdown-divider"></div>
<div class="dropdown-item J_advfilter"><i class="icon zmdi zmdi-playlist-plus"></i>添加过滤项</div>
</div>
</div>
</div>
<div class="input-group input-search">
<input class="form-control rounded-left J_search-text" placeholder="搜索 ..." type="text">
<span class="input-group-btn"><button class="btn btn-secondary J_search-btn" type="button"><i class="icon zmdi zmdi-search"></i></button></span>
<span class="input-group-btn plus"><button class="btn btn-secondary J_qfields" type="button" title="设置查询字段"><i class="icon zmdi zmdi-playlist-plus"></i></button></span>
</div>
</div>
</div>
<div class="col-12 col-sm-6">
<div class="dataTables_oper">
<button class="btn btn-space btn-secondary J_view" disabled="disabled"><i class="icon zmdi zmdi-folder"></i> 打开</button>
<button class="btn btn-space btn-secondary J_edit" disabled="disabled"><i class="icon zmdi zmdi-border-color"></i> 编辑</button>
<div class="btn-group btn-space J_action">
<button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown">更多 <i class="icon zmdi zmdi-more-vert"></i></button>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item J_delete"><i class="icon zmdi zmdi-delete"></i> 删除</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item J_columns"><i class="icon zmdi zmdi-sort-amount-asc"></i> 列显示</a>
</div>
</div>
</div>
</div>
</div>
<div id="react-list" class="rb-loading rb-loading-active data-list">
<div class="rb-spinner">
<svg width="40px" height="40px" viewBox="0 0 66 66" xmlns="http://-www.w3.org/2000/svg">
<circle fill="none" stroke-width="4" stroke-linecap="round" cx="33" cy="33" r="30" class="circle"></circle>
</svg>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<%@ include file="/_include/Foot.jsp"%>
<script src="${baseUrl}/assets/js/rb-list.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-forms.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-advfilter.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/assign-share.jsx" type="text/babel"></script>
<script type="text/babel">
$(document).ready(function(){
RbListPage.init($.parseJSON('${DataListConfig}'), ['${entityName}','${entityLabel}','${entityIcon}'], $.parseJSON('${entityPrivileges}'))
rb.AdvFilter.init('.adv-search', '${entityName}')
})
</script>
</body>
</html>

View file

@ -0,0 +1,56 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/_include/Head.jsp"%>
<link rel="stylesheet" type="text/css" href="${baseUrl}/assets/css/view-page.css">
<title>${entityLabel}视图</title>
<style type="text/css">
</style>
</head>
<body class="view-body">
<div class="view-header">
<i class="header-icon zmdi zmdi-${entityIcon}"></i>
<h3 class="title">${entityLabel}视图</h3>
<span>
<a class="close J_close"><i class="zmdi zmdi-close"></i></a>
<a class="close s J_for-admin" href="${baseUrl}/admin/entity/${entityName}/form-design" title="配置布局" target="_blank"><i class="zmdi zmdi-settings"></i></a>
</span>
</div>
<div class="main-content container-fluid">
<div class="row">
<div class="col-sm-9 pr-0">
<div class="tab-container">
<ul class="nav nav-tabs">
<li class="nav-item"><a class="nav-link active" href="#tab-rbview" data-toggle="tab">明细视图</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab-rbview"></div>
</div>
</div>
</div>
<div class="col-sm-3 view-metas">
<div class="view-action row">
<div class="col-6 pr-1 mb-2">
<button class="btn btn-secondary J_edit" type="button"><i class="icon zmdi zmdi-border-color"></i> 编辑</button>
</div>
<div class="col-6 pl-1 mb-2 btn-group J_action">
<button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown"><i class="icon zmdi zmdi-more-vert"></i> 更多</button>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item J_delete"><i class="icon zmdi zmdi-delete"></i> 删除</a>
</div>
</div>
</div>
</div>
</div>
</div>
<%@ include file="/_include/Foot.jsp"%>
<script src="${baseUrl}/assets/js/rb-forms.jsx" type="text/babel"></script>
<script src="${baseUrl}/assets/js/rb-view.jsx" type="text/babel"></script>
<script type="text/babel">
$(document).ready(function(){
RbViewPage.init('${id}', ['${entityName}','${entityLabel}','${entityIcon}'], $.parseJSON('${entityPrivileges}'))
})
</script>
</body>
</html>

View file

@ -2,13 +2,11 @@
<!DOCTYPE html>
<html>
<head>
<title>Rebuild</title>
<title>Loading</title>
</head>
<body>
<script>
(function(){
location.href = 'user/login'
})()
(function(){ location.href = 'user/login' })()
</script>
</body>
</html>