mirror of
https://github.com/getrebuild/rebuild.git
synced 2024-09-20 23:45:55 +08:00
better
This commit is contained in:
parent
927172317f
commit
b1a6b79c50
|
@ -82,7 +82,7 @@ public class EntityCreate extends BaseApi {
|
|||
}
|
||||
|
||||
Entity entity = MetadataHelper.getEntity(useEntity);
|
||||
if (!entity.isQueryable() || MetadataHelper.isBizzEntity(entity.getEntityCode())) {
|
||||
if (!entity.isQueryable() || MetadataHelper.isBizzEntity(entity)) {
|
||||
throw new ApiInvokeException(ApiInvokeException.ERR_BADPARAMS, "Unsupportted operator for entity : " + useEntity);
|
||||
}
|
||||
return entity;
|
||||
|
|
|
@ -34,7 +34,7 @@ public class EntityDelete extends BaseApi {
|
|||
public JSON execute(ApiContext context) throws ApiInvokeException {
|
||||
final ID deleteId = context.getParameterAsId("id");
|
||||
final Entity entity = MetadataHelper.getEntity(deleteId.getEntityCode());
|
||||
if (!entity.isQueryable() || MetadataHelper.isBizzEntity(entity.getEntityCode())) {
|
||||
if (!entity.isQueryable() || MetadataHelper.isBizzEntity(entity)) {
|
||||
throw new ApiInvokeException(ApiInvokeException.ERR_BADPARAMS, "Unsupportted operation for entity/id : " + deleteId);
|
||||
}
|
||||
|
||||
|
|
|
@ -316,11 +316,15 @@ public class FormsBuilder extends FormsManager {
|
|||
JSONArray options = MultiSelectManager.instance.getSelectList(fieldMeta);
|
||||
el.put("options", options);
|
||||
} else if (dt == DisplayType.DATETIME) {
|
||||
el.put(EasyFieldConfigProps.DATETIME_FORMAT,
|
||||
easyField.getExtraAttr(EasyFieldConfigProps.DATETIME_FORMAT));
|
||||
String format = StringUtils.defaultIfBlank(
|
||||
easyField.getExtraAttr(EasyFieldConfigProps.DATETIME_FORMAT),
|
||||
easyField.getDisplayType().getDefaultFormat());
|
||||
el.put(EasyFieldConfigProps.DATETIME_FORMAT, format);
|
||||
} else if (dt == DisplayType.DATE) {
|
||||
el.put(EasyFieldConfigProps.DATE_FORMAT,
|
||||
easyField.getExtraAttr(EasyFieldConfigProps.DATE_FORMAT));
|
||||
String format = StringUtils.defaultIfBlank(
|
||||
easyField.getExtraAttr(EasyFieldConfigProps.DATE_FORMAT),
|
||||
easyField.getDisplayType().getDefaultFormat());
|
||||
el.put(EasyFieldConfigProps.DATE_FORMAT, format);
|
||||
} else if (dt == DisplayType.CLASSIFICATION) {
|
||||
el.put("openLevel", ClassificationManager.instance.getOpenLevel(fieldMeta));
|
||||
}
|
||||
|
@ -376,15 +380,7 @@ public class FormsBuilder extends FormsManager {
|
|||
|
||||
// 触发器自动值
|
||||
if (roViaAuto && el.get("value") == null) {
|
||||
if (dt == DisplayType.REFERENCE || dt == DisplayType.CLASSIFICATION) {
|
||||
el.put("value", FieldValueHelper.wrapMixValue(null, autoValue));
|
||||
|
||||
} else if (dt == DisplayType.N2NREFERENCE) {
|
||||
JSONArray arrayValue = new JSONArray();
|
||||
arrayValue.add(FieldValueHelper.wrapMixValue(null, autoValue));
|
||||
el.put("value", arrayValue);
|
||||
|
||||
} else if (dt == DisplayType.EMAIL
|
||||
if (dt == DisplayType.EMAIL
|
||||
|| dt == DisplayType.PHONE
|
||||
|| dt == DisplayType.URL
|
||||
|| dt == DisplayType.DATE
|
||||
|
|
|
@ -252,12 +252,11 @@ public class MetadataHelper {
|
|||
/**
|
||||
* 是否 Bizz 实体
|
||||
*
|
||||
* @param entityName
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public static boolean isBizzEntity(String entityName) {
|
||||
return "User".equalsIgnoreCase(entityName) || "Department".equalsIgnoreCase(entityName)
|
||||
|| "Role".equalsIgnoreCase(entityName) || "Team".equalsIgnoreCase(entityName);
|
||||
public static boolean isBizzEntity(Entity entity) {
|
||||
return isBizzEntity(entity.getEntityCode());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,13 +10,12 @@ package com.rebuild.core.metadata;
|
|||
import cn.devezhao.bizz.privileges.impl.BizzPermission;
|
||||
import cn.devezhao.persist4j.Entity;
|
||||
import cn.devezhao.persist4j.Field;
|
||||
import cn.devezhao.persist4j.dialect.FieldType;
|
||||
import cn.devezhao.persist4j.engine.ID;
|
||||
import cn.devezhao.persist4j.metadata.BaseMeta;
|
||||
import com.rebuild.core.Application;
|
||||
import com.rebuild.core.metadata.easymeta.DisplayType;
|
||||
import com.rebuild.core.metadata.easymeta.EasyEntity;
|
||||
import com.rebuild.core.metadata.easymeta.EasyMetaFactory;
|
||||
import com.rebuild.core.metadata.easymeta.DisplayType;
|
||||
|
||||
import java.text.Collator;
|
||||
import java.util.ArrayList;
|
||||
|
@ -99,16 +98,14 @@ public class MetadataSorter {
|
|||
public static Field[] sortFields(Field[] fields, DisplayType... usesTypes) {
|
||||
List<BaseMeta> fieldsList = new ArrayList<>();
|
||||
for (Field field : fields) {
|
||||
if (!field.isQueryable() || field.getType() == FieldType.PRIMARY) continue;
|
||||
if (MetadataHelper.isSystemField(field)) continue;
|
||||
|
||||
if (usesTypes.length == 0) {
|
||||
fieldsList.add(field);
|
||||
} else {
|
||||
DisplayType fieldDt = EasyMetaFactory.getDisplayType(field);
|
||||
for (DisplayType dt : usesTypes) {
|
||||
if (dt == fieldDt) {
|
||||
fieldsList.add(field);
|
||||
}
|
||||
DisplayType dt = EasyMetaFactory.getDisplayType(field);
|
||||
for (DisplayType use : usesTypes) {
|
||||
if (dt == use) fieldsList.add(field);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,9 @@ See LICENSE and COMMERCIAL in the project root for license information.
|
|||
package com.rebuild.core.metadata.easymeta;
|
||||
|
||||
import cn.devezhao.persist4j.Field;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.rebuild.core.configuration.general.MultiSelectManager;
|
||||
import com.rebuild.utils.JSONUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
|
@ -61,12 +63,15 @@ public class EasyMultiSelect extends EasyField implements MixValue {
|
|||
@Override
|
||||
public Object wrapValue(Object value) {
|
||||
if (value == null || (Long) value <= 0L) return null;
|
||||
return value;
|
||||
|
||||
JSONObject mixValue = JSONUtils.toJSONObject("id", value);
|
||||
mixValue.put("text", MultiSelectManager.instance.getLabels((Long) value, getRawMeta()));
|
||||
return mixValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object unpackWrapValue(Object wrappedValue) {
|
||||
String[] multiLabel = MultiSelectManager.instance.getLabels((Long) wrappedValue, getRawMeta());
|
||||
return StringUtils.join(multiLabel, ", ");
|
||||
JSONObject mixValue = (JSONObject) wrappedValue;
|
||||
return StringUtils.join(mixValue.getJSONArray("text"), ", ");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
* @since 2020/11/17
|
||||
*/
|
||||
@Slf4j
|
||||
public class EasyPickList extends EasyReference {
|
||||
public class EasyPickList extends EasyField implements MixValue {
|
||||
private static final long serialVersionUID = 5971173892145230003L;
|
||||
|
||||
protected EasyPickList(Field field, DisplayType displayType) {
|
||||
|
@ -50,10 +50,8 @@ public class EasyPickList extends EasyReference {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object wrapValue(Object value) {
|
||||
JSONObject map = (JSONObject) super.wrapValue(value);
|
||||
if (map != null) map.remove("entity");
|
||||
return map;
|
||||
public Object unpackWrapValue(Object wrappedValue) {
|
||||
return PickListManager.instance.getLabel((ID) wrappedValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -40,7 +40,6 @@ public class EasyState extends EasyField implements MixValue {
|
|||
@Override
|
||||
public Object exprDefaultValue() {
|
||||
Class<?> stateClass = StateHelper.getSatetClass(getRawMeta());
|
||||
|
||||
for (Object c : stateClass.getEnumConstants()) {
|
||||
if (((StateSpec) c).isDefault()) {
|
||||
return ((StateSpec) c).getState();
|
||||
|
|
|
@ -16,7 +16,6 @@ import com.alibaba.fastjson.JSON;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.rebuild.core.Application;
|
||||
import com.rebuild.core.metadata.EntityHelper;
|
||||
import com.rebuild.core.metadata.MetadataHelper;
|
||||
import com.rebuild.core.metadata.easymeta.DisplayType;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.dom4j.Document;
|
||||
|
@ -142,8 +141,7 @@ public class DynamicMetadataFactory extends ConfigurationMetadataFactory {
|
|||
.addAttribute("cascade", (String) c[11]);
|
||||
}
|
||||
|
||||
if (dt == DisplayType.BARCODE || dt == DisplayType.ID
|
||||
|| MetadataHelper.isSystemField(fieldName)) {
|
||||
if (dt == DisplayType.ID) {
|
||||
field.addAttribute("queryable", "false");
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ public class RoleBaseQueryFilter implements Filter, QueryFilter {
|
|||
Entity useMain = null;
|
||||
if (!MetadataHelper.hasPrivilegesField(entity)) {
|
||||
// NOTE BIZZ 实体全部用户可见
|
||||
if (MetadataHelper.isBizzEntity(entity.getEntityCode()) || EasyMetaFactory.valueOf(entity).isPlainEntity()) {
|
||||
if (MetadataHelper.isBizzEntity(entity) || EasyMetaFactory.valueOf(entity).isPlainEntity()) {
|
||||
return ALLOWED.evaluate(null);
|
||||
} else if (entity.getMainEntity() != null) {
|
||||
useMain = entity.getMainEntity();
|
||||
|
|
|
@ -450,7 +450,7 @@ public class GeneralEntityService extends ObservableService implements EntitySer
|
|||
Assert.isNull(recordOfNew.getPrimary(), "Must be new record");
|
||||
|
||||
Entity entity = recordOfNew.getEntity();
|
||||
if (MetadataHelper.isBizzEntity(entity.getEntityCode()) || !MetadataHelper.hasPrivilegesField(entity)) {
|
||||
if (MetadataHelper.isBizzEntity(entity) || !MetadataHelper.hasPrivilegesField(entity)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ public class DataListWrapper {
|
|||
|
||||
boolean unpack = easyField.getDisplayType() == DisplayType.CLASSIFICATION
|
||||
|| easyField.getDisplayType() == DisplayType.PICKLIST
|
||||
|| easyField.getDisplayType() == DisplayType.MULTISELECT
|
||||
|| easyField.getDisplayType() == DisplayType.STATE
|
||||
|| easyField.getDisplayType() == DisplayType.BOOL;
|
||||
|
||||
return FieldValueHelper.wrapFieldValue(value, easyField, unpack);
|
||||
|
|
|
@ -11,7 +11,6 @@ import cn.devezhao.commons.CalendarUtils;
|
|||
import cn.devezhao.commons.ObjectUtils;
|
||||
import cn.devezhao.persist4j.Entity;
|
||||
import cn.devezhao.persist4j.Field;
|
||||
import cn.devezhao.persist4j.dialect.FieldType;
|
||||
import cn.devezhao.persist4j.engine.ID;
|
||||
import cn.devezhao.persist4j.metadata.MetadataException;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
@ -89,10 +88,7 @@ public class FieldValueHelper {
|
|||
* @see EasyField#wrapValue(Object)
|
||||
*/
|
||||
public static Object wrapFieldValue(Object value, EasyField field) {
|
||||
if (!field.isQueryable() &&
|
||||
(field.getRawMeta().getType() == FieldType.TEXT || field.getRawMeta().getType() == FieldType.NTEXT)) {
|
||||
return SECURE_TEXT;
|
||||
}
|
||||
if (!field.isQueryable()) return SECURE_TEXT;
|
||||
|
||||
if (value == null || StringUtils.isBlank(value.toString())) {
|
||||
// 审批
|
||||
|
@ -111,19 +107,19 @@ public class FieldValueHelper {
|
|||
/**
|
||||
* @param id
|
||||
* @param text
|
||||
* @return Returns `{ id:xxx, text:xxx, entity:xxx }`
|
||||
* @return Returns `{ id:xxx, text:xxx [, entity:xxx] }`
|
||||
*/
|
||||
public static JSONObject wrapMixValue(ID id, String text) {
|
||||
if (id != null && StringUtils.isBlank(text)) {
|
||||
text = id.getLabelRaw() == null ? null : id.getLabelRaw().toString();
|
||||
text = id.getLabel();
|
||||
}
|
||||
|
||||
JSONObject mix = JSONUtils.toJSONObject(
|
||||
JSONObject mixValue = JSONUtils.toJSONObject(
|
||||
new String[] { "id", "text" }, new Object[] { id, text });
|
||||
if (id != null) {
|
||||
mix.put("entity", MetadataHelper.getEntityName(id));
|
||||
mixValue.put("entity", MetadataHelper.getEntityName(id));
|
||||
}
|
||||
return mix;
|
||||
return mixValue;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -62,7 +62,7 @@ public class MetaEntityController extends BaseController {
|
|||
@GetMapping("entity/{entity}/base")
|
||||
public ModelAndView pageBase(@PathVariable String entity, HttpServletResponse response) throws IOException {
|
||||
Entity metaEntity = MetadataHelper.getEntity(entity);
|
||||
if (!(MetadataHelper.isBusinessEntity(metaEntity) || MetadataHelper.isBizzEntity(metaEntity.getEntityCode()))) {
|
||||
if (!(MetadataHelper.isBusinessEntity(metaEntity) || MetadataHelper.isBizzEntity(metaEntity))) {
|
||||
response.sendError(403);
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,10 @@ import org.springframework.web.bind.annotation.*;
|
|||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author zhaofang123@gmail.com
|
||||
|
@ -62,11 +65,8 @@ public class MetaFieldController extends BaseController {
|
|||
|
||||
@RequestMapping("list-field")
|
||||
public List<Map<String, Object>> listField(@EntityParam Entity entity) {
|
||||
List<Field> allFields = new ArrayList<>();
|
||||
Collections.addAll(allFields, entity.getFields());
|
||||
|
||||
List<Map<String, Object>> ret = new ArrayList<>();
|
||||
for (Field field : MetadataSorter.sortFields(allFields.toArray(new Field[0]))) {
|
||||
List<Map<String, Object>> fieldList = new ArrayList<>();
|
||||
for (Field field : MetadataSorter.sortFields(entity)) {
|
||||
if (MetadataHelper.isSystemField(field)) continue;
|
||||
|
||||
EasyField easyMeta = EasyMetaFactory.valueOf(field);
|
||||
|
@ -81,9 +81,9 @@ public class MetaFieldController extends BaseController {
|
|||
map.put("nullable", field.isNullable());
|
||||
map.put("builtin", easyMeta.isBuiltin());
|
||||
map.put("creatable", field.isCreatable());
|
||||
ret.add(map);
|
||||
fieldList.add(map);
|
||||
}
|
||||
return ret;
|
||||
return fieldList;
|
||||
}
|
||||
|
||||
@GetMapping("{entity}/field/{field}")
|
||||
|
|
|
@ -104,7 +104,7 @@ public class MetadataGetting extends BaseController {
|
|||
// 引用字段处理
|
||||
if (EasyMetaFactory.getDisplayType(field) == DisplayType.REFERENCE && filterRefField) {
|
||||
boolean isApprovalId = field.getName().equalsIgnoreCase(EntityHelper.ApprovalId);
|
||||
boolean isBizz = MetadataHelper.isBizzEntity(field.getReferenceEntity().getEntityCode());
|
||||
boolean isBizz = MetadataHelper.isBizzEntity(field.getReferenceEntity());
|
||||
if (!(isApprovalId || isBizz)) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -23,8 +23,8 @@ import com.rebuild.core.configuration.general.ShareToManager;
|
|||
import com.rebuild.core.metadata.EntityHelper;
|
||||
import com.rebuild.core.metadata.MetadataHelper;
|
||||
import com.rebuild.core.metadata.MetadataSorter;
|
||||
import com.rebuild.core.metadata.easymeta.EasyMetaFactory;
|
||||
import com.rebuild.core.metadata.easymeta.DisplayType;
|
||||
import com.rebuild.core.metadata.easymeta.EasyMetaFactory;
|
||||
import com.rebuild.core.privileges.RoleService;
|
||||
import com.rebuild.core.privileges.UserHelper;
|
||||
import com.rebuild.core.privileges.bizz.ZeroEntry;
|
||||
|
@ -173,10 +173,6 @@ public class ShowFieldsController extends BaseController implements ShareTo {
|
|||
writeSuccess(response, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param field
|
||||
* @return
|
||||
*/
|
||||
private boolean canListField(Field field) {
|
||||
return EasyMetaFactory.getDisplayType(field) != DisplayType.BARCODE;
|
||||
}
|
||||
|
|
|
@ -197,7 +197,7 @@ public class ReferenceSearchController extends EntityController {
|
|||
List<Object> result = new ArrayList<>();
|
||||
for (Object[] o : array) {
|
||||
ID recordId = (ID) o[0];
|
||||
if (MetadataHelper.isBizzEntity(entity.getEntityCode())
|
||||
if (MetadataHelper.isBizzEntity(entity)
|
||||
&& (!UserHelper.isActive(recordId) || recordId.equals(UserService.SYSTEM_USER))) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -1235,7 +1235,7 @@
|
|||
"t.DATE": "Date",
|
||||
"t.DATETIME": "Date-Time",
|
||||
"t.TEXT": "Text",
|
||||
"t.NTEXT": "Multiline-Text",
|
||||
"t.NTEXT": "Multi-Text",
|
||||
"t.EMAIL": "Email",
|
||||
"t.URL": "Link",
|
||||
"t.PHONE": "Phone",
|
||||
|
|
|
@ -681,7 +681,7 @@
|
|||
"AggregationMethod": "聚合方式",
|
||||
"AggregationFilter": "聚合数据条件",
|
||||
"AggregationFilterTips": "仅会聚合符合过滤条件的数据",
|
||||
"SetTargetFieldReadonly": "设置目标字段为只读",
|
||||
"SetTargetFieldReadonly": "自动设置目标字段为只读",
|
||||
"TargetAndSourceNotSame": "目标字段与源字段不能为同一字段",
|
||||
"PlsAdd1AggregationRuleLeast": "请至少添加 1 个聚合规则",
|
||||
"DataFilter": "数据过滤条件",
|
||||
|
@ -1244,7 +1244,7 @@
|
|||
"t.FILE": "附件",
|
||||
"t.PICKLIST": "列表",
|
||||
"t.CLASSIFICATION": "分类",
|
||||
"t.REFERENCE": "引用",
|
||||
"t.REFERENCE": "引用 (关联)",
|
||||
"t.N2NREFERENCE": "多引用",
|
||||
"t.AVATAR": "头像",
|
||||
"t.MULTISELECT": "多选",
|
||||
|
|
|
@ -1244,7 +1244,7 @@
|
|||
"t.FILE": "附件",
|
||||
"t.PICKLIST": "清單",
|
||||
"t.CLASSIFICATION": "分類",
|
||||
"t.REFERENCE": "引用",
|
||||
"t.REFERENCE": "引用 (關聯)",
|
||||
"t.N2NREFERENCE": "多引用",
|
||||
"t.AVATAR": "頭像",
|
||||
"t.MULTISELECT": "多選",
|
||||
|
|
|
@ -22,19 +22,19 @@
|
|||
<option value="PHONE">[[${bundle.L('t.PHONE')}]]</option>
|
||||
<option value="EMAIL">[[${bundle.L('t.EMAIL')}]]</option>
|
||||
<option value="URL">[[${bundle.L('t.URL')}]]</option>
|
||||
<option value="SERIES">[[${bundle.L('t.SERIES')}]]</option>
|
||||
<option value="NUMBER">[[${bundle.L('t.NUMBER')}]]</option>
|
||||
<option value="DECIMAL">[[${bundle.L('t.DECIMAL')}]]</option>
|
||||
<option value="DATE">[[${bundle.L('t.DATE')}]]</option>
|
||||
<option value="DATETIME">[[${bundle.L('t.DATETIME')}]]</option>
|
||||
<option value="PICKLIST">[[${bundle.L('t.PICKLIST')}]]</option>
|
||||
<option value="MULTISELECT">[[${bundle.L('t.MULTISELECT')}]]</option>
|
||||
<option value="CLASSIFICATION">[[${bundle.L('t.CLASSIFICATION')}]]</option>
|
||||
<option value="MULTISELECT">[[${bundle.L('t.MULTISELECT')}]]</option>
|
||||
<option value="REFERENCE">[[${bundle.L('t.REFERENCE')}]]</option>
|
||||
<option value="N2NREFERENCE">[[${bundle.L('t.N2NREFERENCE')}]]</option>
|
||||
<option value="FILE">[[${bundle.L('t.FILE')}]]</option>
|
||||
<option value="IMAGE">[[${bundle.L('t.IMAGE')}]]</option>
|
||||
<option value="AVATAR">[[${bundle.L('t.AVATAR')}]]</option>
|
||||
<option value="SERIES">[[${bundle.L('t.SERIES')}]]</option>
|
||||
<option value="BARCODE">[[${bundle.L('t.BARCODE')}]]</option>
|
||||
<option value="BOOL">[[${bundle.L('t.BOOL')}]]</option>
|
||||
<optgroup th:label="${bundle.L('ReserveType')}" class="bosskey-show">
|
||||
|
@ -67,7 +67,7 @@
|
|||
<textarea class="form-control form-control-sm row2x" id="comments" maxlength="100" th:placeholder="${bundle.L('Optional')}"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row pb-0">
|
||||
<div class="form-group row pb-1">
|
||||
<label class="col-sm-3 col-form-label text-sm-right"></label>
|
||||
<div class="col-sm-7">
|
||||
<label class="custom-control custom-control-sm custom-checkbox custom-control-inline mb-0">
|
||||
|
|
|
@ -705,21 +705,6 @@ body.view-body {
|
|||
color: #4285f4;
|
||||
}
|
||||
|
||||
.select2-container--default .select2-selection--multiple::after {
|
||||
content: '\f2f9';
|
||||
font-family: 'Material-Design-Iconic-Font';
|
||||
font-size: 1.6rem;
|
||||
font-weight: 400;
|
||||
line-height: 35px;
|
||||
color: #404040;
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
}
|
||||
|
||||
.user-selector.select2-container--default .select2-selection--multiple::after {
|
||||
content: '';
|
||||
}
|
||||
|
||||
textarea.row2x {
|
||||
height: 52px !important;
|
||||
resize: none;
|
||||
|
@ -820,6 +805,17 @@ a {
|
|||
top: 8px;
|
||||
}
|
||||
|
||||
.type-N2NREFERENCE .select2-container--default .select2-selection--multiple::after {
|
||||
content: '\f2f9';
|
||||
font-family: 'Material-Design-Iconic-Font';
|
||||
font-size: 1.6rem;
|
||||
font-weight: 400;
|
||||
line-height: 35px;
|
||||
color: #404040;
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
}
|
||||
|
||||
.type-N2NREFERENCE .form-control-plaintext > a {
|
||||
margin-right: 6px;
|
||||
}
|
||||
|
@ -3631,6 +3627,10 @@ a.avatar.x26 img {
|
|||
line-height: 1;
|
||||
}
|
||||
|
||||
.select2-container--disabled .select2-selection__clear {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.use-dropdown .dropdown-menu {
|
||||
max-width: none;
|
||||
min-width: 0;
|
||||
|
|
|
@ -118,7 +118,7 @@ class DlgRuleEdit extends RbFormHandler {
|
|||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div className="form-group row pt-1 hide">
|
||||
<div className="form-group row pt-1">
|
||||
<label className="col-sm-3 col-form-label text-sm-right pt-1"></label>
|
||||
<div className="col-sm-7">
|
||||
<label className="custom-control custom-control-sm custom-checkbox custom-control-inline mb-0">
|
||||
|
|
|
@ -62,7 +62,8 @@ $(document).ready(function () {
|
|||
|
||||
data = $cleanMap(data)
|
||||
if (Object.keys(data).length === 0) {
|
||||
location.href = '../fields'
|
||||
if (rb.env === 'dev') location.reload()
|
||||
else location.href = '../fields'
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -71,7 +72,8 @@ $(document).ready(function () {
|
|||
$btn.button('loading')
|
||||
$.post('/admin/entity/field-update', JSON.stringify(data), function (res) {
|
||||
if (res.error_code === 0) {
|
||||
location.href = '../fields'
|
||||
if (rb.env === 'dev') location.reload()
|
||||
else location.href = '../fields'
|
||||
} else {
|
||||
$btn.button('reset')
|
||||
RbHighbar.error(res.error_msg)
|
||||
|
|
|
@ -8,6 +8,7 @@ See LICENSE and COMMERCIAL in the project root for license information.
|
|||
|
||||
const wpc = window.__PageConfig
|
||||
$(document).ready(() => {
|
||||
console.log(JSON.stringify(wpc.content))
|
||||
renderRbcomp(<PreviewTable data={wpc.content} />, 'preview-table')
|
||||
})
|
||||
|
||||
|
@ -120,8 +121,7 @@ class PreviewTable extends React.Component {
|
|||
} else if (item.type === 'BOOL') {
|
||||
return $L(item.value === 'T' ? 'True' : 'False')
|
||||
} else if (item.type === 'MULTISELECT') {
|
||||
// eslint-disable-next-line no-undef
|
||||
return __findMultiTexts(item.options, item.value).join(', ')
|
||||
return (item.value.text || []).join(', ')
|
||||
} else if (item.type === 'PICKLIST' || item.type === 'STATE') {
|
||||
// eslint-disable-next-line no-undef
|
||||
return __findOptionText(item.options, item.value)
|
||||
|
|
|
@ -671,7 +671,7 @@ CellRenders.addRender('MULTISELECT', function (v, s, k) {
|
|||
return (
|
||||
<td key={k} className="td-min column-multi">
|
||||
<div style={s} title={v}>
|
||||
{v.split(', ').map((item) => {
|
||||
{(v.text || []).map((item) => {
|
||||
return (
|
||||
<span key={'opt-' + item} className="badge">
|
||||
{item}
|
||||
|
|
|
@ -437,10 +437,10 @@ class RbFormElement extends React.Component {
|
|||
const props = this.props
|
||||
if (!props.onView) {
|
||||
// 必填字段
|
||||
if (!props.nullable && !props.readonly && $empty(props.value)) props.$$$parent.setFieldValue(props.field, null, $L('SomeNotEmpty').replace('{0}', props.label))
|
||||
if (!props.nullable && $empty(props.value)) props.$$$parent.setFieldValue(props.field, null, $L('SomeNotEmpty').replace('{0}', props.label))
|
||||
props.tip && $(this._fieldLabel).find('i.zmdi').tooltip({ placement: 'right' })
|
||||
}
|
||||
if (!props.onView && !this.props.readonly) this.onEditModeChanged()
|
||||
if (!props.onView) this.onEditModeChanged()
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
|
@ -476,7 +476,7 @@ class RbFormElement extends React.Component {
|
|||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<div className="form-control-plaintext">{text || <span className="text-muted">无</span>}</div>
|
||||
<div className="form-control-plaintext">{text || <span className="text-muted">{$L('Null')}</span>}</div>
|
||||
</React.Fragment>
|
||||
)
|
||||
}
|
||||
|
@ -1014,8 +1014,6 @@ class RbFormPickList extends RbFormElement {
|
|||
}
|
||||
|
||||
renderElement() {
|
||||
if (this.props.readonly) return super.renderElement(__findOptionText(this.state.options, this.props.value))
|
||||
|
||||
const keyName = `${this.state.field}-opt-`
|
||||
return (
|
||||
<select ref={(c) => (this._fieldValue = c)} className="form-control form-control-sm" value={this.state.value || ''} onChange={this.handleChange}>
|
||||
|
@ -1050,6 +1048,8 @@ class RbFormPickList extends RbFormElement {
|
|||
that.handleChange({ target: { value: val } }, true)
|
||||
})
|
||||
.trigger('change')
|
||||
|
||||
if (this.props.readonly) $(this._fieldValue).attr('disabled', true)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1059,6 +1059,7 @@ class RbFormPickList extends RbFormElement {
|
|||
}
|
||||
|
||||
setValue(val) {
|
||||
if (typeof val === 'object') val = val.id
|
||||
this.__select2.val(val).trigger('change')
|
||||
}
|
||||
}
|
||||
|
@ -1069,17 +1070,17 @@ class RbFormReference extends RbFormElement {
|
|||
}
|
||||
|
||||
renderElement() {
|
||||
if (this.props.readonly) return super.renderElement(this.props.value ? this.props.value.text : null)
|
||||
|
||||
const hasDataFilter = this.props.referenceDataFilter && (this.props.referenceDataFilter.items || []).length > 0
|
||||
return (
|
||||
<div className="input-group has-append">
|
||||
<select ref={(c) => (this._fieldValue = c)} className="form-control form-control-sm" title={hasDataFilter ? $L('FieldUseDataFilter') : null} multiple={this._multiple === true} />
|
||||
<div className="input-group-append">
|
||||
<button className="btn btn-secondary" type="button" onClick={() => this.showSearcher()}>
|
||||
<i className="icon zmdi zmdi-search" />
|
||||
</button>
|
||||
</div>
|
||||
{!this.props.readonly && (
|
||||
<div className="input-group-append">
|
||||
<button className="btn btn-secondary" type="button" onClick={() => this.showSearcher()}>
|
||||
<i className="icon zmdi zmdi-search" />
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
@ -1143,6 +1144,8 @@ class RbFormReference extends RbFormElement {
|
|||
}
|
||||
that.handleChange({ target: { value: v } }, true)
|
||||
})
|
||||
|
||||
if (this.props.readonly) $(this._fieldValue).attr('disabled', true)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1292,16 +1295,16 @@ class RbFormClassification extends RbFormElement {
|
|||
}
|
||||
|
||||
renderElement() {
|
||||
if (this.props.readonly) return super.renderElement(this.props.value ? this.props.value.text : null)
|
||||
|
||||
return (
|
||||
<div className="input-group has-append">
|
||||
<select ref={(c) => (this._fieldValue = c)} className="form-control form-control-sm" />
|
||||
<div className="input-group-append">
|
||||
<button className="btn btn-secondary" type="button" onClick={this.showSelector}>
|
||||
<i className="icon zmdi zmdi-search" />
|
||||
</button>
|
||||
</div>
|
||||
{!this.props.readonly && (
|
||||
<div className="input-group-append">
|
||||
<button className="btn btn-secondary" type="button" onClick={this.showSelector}>
|
||||
<i className="icon zmdi zmdi-search" />
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
@ -1334,6 +1337,8 @@ class RbFormClassification extends RbFormElement {
|
|||
if (v) $.post(`/commons/search/recently-add?id=${v}&type=d${this.props.classification}`)
|
||||
this.handleChange({ target: { value: v } }, true)
|
||||
})
|
||||
|
||||
if (this.props.readonly) $(this._fieldValue).attr('disabled', true)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1382,6 +1387,7 @@ class RbFormClassification extends RbFormElement {
|
|||
class RbFormMultiSelect extends RbFormElement {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
if (props.value) this.state.value = props.value.id || 0
|
||||
}
|
||||
|
||||
renderElement() {
|
||||
|
|
Loading…
Reference in a new issue