diff --git a/.eslintrc.js b/.eslintrc.js index cf9fa6cb3..be31d6a51 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -159,5 +159,6 @@ module.exports = { marked: true, $focus2End: true, RecordSelectorModal: true, + $fetchMetaInfo: true, }, } diff --git a/@rbv b/@rbv index ffe18eeaa..34e48060b 160000 --- a/@rbv +++ b/@rbv @@ -1 +1 @@ -Subproject commit ffe18eeaa8ae3a8acd3de09e1dbed1dbf994e9b4 +Subproject commit 34e48060b157be1bfbfb69d05506816ccccfbd48 diff --git a/src/main/java/com/rebuild/core/configuration/general/FormsBuilder.java b/src/main/java/com/rebuild/core/configuration/general/FormsBuilder.java index f3eead174..0b0b0facd 100644 --- a/src/main/java/com/rebuild/core/configuration/general/FormsBuilder.java +++ b/src/main/java/com/rebuild/core/configuration/general/FormsBuilder.java @@ -34,6 +34,7 @@ import com.rebuild.core.privileges.UserService; import com.rebuild.core.privileges.bizz.Department; import com.rebuild.core.privileges.bizz.User; import com.rebuild.core.service.NoRecordFoundException; +import com.rebuild.core.service.approval.ApprovalHelper; import com.rebuild.core.service.approval.ApprovalState; import com.rebuild.core.service.approval.RobotApprovalManager; import com.rebuild.core.service.general.GeneralEntityService; @@ -143,6 +144,7 @@ public class FormsBuilder extends FormsManager { ApprovalState approvalState; // 提示 String readonlyMessage = null; + String readonlywMessage = null; // 可强制编辑 // 判断表单权限 @@ -153,10 +155,15 @@ public class FormsBuilder extends FormsManager { Assert.notNull(mainid, "CALL `FormBuilderContextHolder#setMainIdOfDetail` FIRST!"); approvalState = EntityHelper.isUnsavedId(mainid) ? null : getHadApproval(hasMainEntity, mainid); - if ((approvalState == ApprovalState.PROCESSING || approvalState == ApprovalState.APPROVED)) { - readonlyMessage = approvalState == ApprovalState.APPROVED - ? Language.L("主记录已审批完成,不能添加明细") - : Language.L("主记录正在审批中,不能添加明细"); + if (approvalState == ApprovalState.APPROVED) { + readonlyMessage = Language.L("主记录已审批完成,不能添加明细"); + } else if (approvalState == ApprovalState.PROCESSING) { + boolean allow42 = ApprovalHelper.isAllowEditableRecord(mainid, user); + if (allow42) { + readonlywMessage = Language.L("主记录正在审批中,审批人允许编辑"); + } else { + readonlyMessage = Language.L("主记录正在审批中,不能添加明细"); + } } // 明细无需审批 approvalState = null; @@ -193,7 +200,13 @@ public class FormsBuilder extends FormsManager { if (approvalState == ApprovalState.APPROVED) { readonlyMessage = Language.L("%s已审批完成,不能编辑", recordType); } else if (approvalState == ApprovalState.PROCESSING) { - readonlyMessage = Language.L("%s正在审批中,不能编辑", recordType); + // v4.2 + boolean allow42 = ApprovalHelper.isAllowEditableRecord(recordId, user); + if (allow42) { + readonlywMessage = Language.L("%s正在审批中,审批人允许编辑", recordType); + } else { + readonlyMessage = Language.L("%s正在审批中,不能编辑", recordType); + } } } } @@ -311,7 +324,8 @@ public class FormsBuilder extends FormsManager { } } - if (readonlyMessage != null) model.set("readonlyMessage", readonlyMessage); + if (readonlywMessage != null) model.set("readonlywMessage", readonlywMessage); + else if (readonlyMessage != null) model.set("readonlyMessage", readonlyMessage); // v3.4 String disabledViewEditable = EasyMetaFactory.valueOf(entityMeta) diff --git a/src/main/java/com/rebuild/core/service/approval/ApprovalHelper.java b/src/main/java/com/rebuild/core/service/approval/ApprovalHelper.java index db0588638..b545931b5 100644 --- a/src/main/java/com/rebuild/core/service/approval/ApprovalHelper.java +++ b/src/main/java/com/rebuild/core/service/approval/ApprovalHelper.java @@ -12,6 +12,7 @@ import cn.devezhao.commons.ObjectUtils; import cn.devezhao.persist4j.Entity; import cn.devezhao.persist4j.Field; import cn.devezhao.persist4j.engine.ID; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.rebuild.core.Application; import com.rebuild.core.configuration.ConfigurationException; @@ -237,6 +238,38 @@ public class ApprovalHelper { return null; } + /** + * @param recordId + * @return + */ + public static FlowNode getCurrentFlowNode(ID recordId) { + ApprovalStatus s = getApprovalStatus(recordId); + return getFlowNode(s.getApprovalId(), s.getCurrentStepNode()); + } + + /** + * @param recordId + * @param user + * @return + */ + public static boolean isAllowEditableRecord(ID recordId, ID user) { + // 明细需要使用主记录判断 + if (MetadataHelper.getEntity(recordId.getEntityCode()).getMainEntity() != null) { + recordId = QueryHelper.getMainIdByDetail(recordId); + } + + ApprovalStatus s = getApprovalStatus(recordId); + FlowNode node = getFlowNode(s.getApprovalId(), s.getCurrentStepNode()); + if (node == null || node.getEditableMode() != FlowNode.EDITABLE_MODE_RECORD) return false; + + JSONArray current = new ApprovalProcessor(recordId, s.getApprovalId()).getCurrentStep(s); + for (Object o : current) { + JSONObject step = (JSONObject) o; + if (StringUtils.equalsIgnoreCase(user.toLiteral(), step.getString("approver"))) return true; + } + return false; + } + /** * 获取审批超时时间 * diff --git a/src/main/java/com/rebuild/core/service/approval/FlowNode.java b/src/main/java/com/rebuild/core/service/approval/FlowNode.java index a2261a036..f87d6cfc9 100644 --- a/src/main/java/com/rebuild/core/service/approval/FlowNode.java +++ b/src/main/java/com/rebuild/core/service/approval/FlowNode.java @@ -20,6 +20,7 @@ import com.rebuild.core.privileges.UserHelper; import com.rebuild.core.privileges.bizz.Department; import com.rebuild.utils.JSONUtils; import lombok.Getter; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang.StringUtils; import java.util.ArrayList; @@ -66,6 +67,12 @@ public class FlowNode { public static final String SIGN_OR = "OR"; // 或签 public static final String SIGN_ALL = "ALL"; // 逐个审批(暂未用) + // 可修改记录 + + public static final int EDITABLE_MODE_NONE = 0; + public static final int EDITABLE_MODE_RECORD = 1; + public static final int EDITABLE_MODE_FIELDS = 10; + // -- @Getter @@ -153,8 +160,9 @@ public class FlowNode { * @return */ public boolean allowBatch() { - Boolean b = getDataMap().getBoolean("allowBatch"); - return b != null && b; +// Boolean b = getDataMap().getBoolean("allowBatch"); +// return b != null && b; + return true; // v4.2 全面允许 } /** @@ -166,7 +174,7 @@ public class FlowNode { */ public Set getSpecUsers(ID operator, ID record) { JSONArray userDefs = getDataMap().getJSONArray("users"); - if (userDefs == null || userDefs.isEmpty()) return Collections.emptySet(); + if (CollectionUtils.isEmpty(userDefs)) return Collections.emptySet(); String userType = userDefs.getString(0); if (USER_SELF.equalsIgnoreCase(userType)) { @@ -247,7 +255,7 @@ public class FlowNode { */ public Set getCcAccounts(ID record) { JSONArray accountFields = getDataMap().getJSONArray("accounts"); - if (accountFields == null || accountFields.isEmpty()) return Collections.emptySet(); + if (CollectionUtils.isEmpty(accountFields)) return Collections.emptySet(); Entity useEntity = MetadataHelper.getEntity(record.getEntityCode()); List useFields = new ArrayList<>(); @@ -291,20 +299,32 @@ public class FlowNode { @Override public boolean equals(Object obj) { - if (obj == null) { - return false; - } + if (obj == null) return false; return obj instanceof FlowNode && obj.hashCode() == this.hashCode(); } + /** + * 节点可修改记录 + * + * @return 0=不可修改, 1=可修改, 10=可修改字段 + * @see #getEditableFields() + */ + public int getEditableMode() { + if (getDataMap().containsKey("editableMode")) { + return getDataMap().getIntValue("editableMode"); + } + // v4.2 兼容 + return CollectionUtils.isEmpty(getEditableFields()) ? EDITABLE_MODE_NONE : EDITABLE_MODE_FIELDS; + } + /** * 节点可编辑字段 * * @return */ public JSONArray getEditableFields() { - JSONArray editableFields = dataMap == null ? null : dataMap.getJSONArray("editableFields"); - if (editableFields == null) return null; + JSONArray editableFields = getDataMap().getJSONArray("editableFields"); + if (CollectionUtils.isEmpty(editableFields)) return JSONUtils.EMPTY_ARRAY; editableFields = (JSONArray) JSONUtils.clone(editableFields); for (Object o : editableFields) { @@ -321,7 +341,7 @@ public class FlowNode { * @return */ public JSONObject getExpiresAuto() { - JSONObject expiresAuto = dataMap == null ? null : dataMap.getJSONObject("expiresAuto"); + JSONObject expiresAuto = getDataMap().getJSONObject("expiresAuto"); if (expiresAuto == null) return null; if (expiresAuto.getIntValue("expiresAuto") <= 0) return null; return expiresAuto; diff --git a/src/main/java/com/rebuild/core/service/approval/RobotApprovalManager.java b/src/main/java/com/rebuild/core/service/approval/RobotApprovalManager.java index 158890ade..6c297e9d5 100644 --- a/src/main/java/com/rebuild/core/service/approval/RobotApprovalManager.java +++ b/src/main/java/com/rebuild/core/service/approval/RobotApprovalManager.java @@ -68,16 +68,12 @@ public class RobotApprovalManager implements ConfigManager { // 实体的 FlowDefinition[] defs = getFlowDefinitions(entity); - for (FlowDefinition def : defs) { - if (!def.isDisabled()) { - return ApprovalState.DRAFT; - } + for (FlowDefinition d : defs) { + if (!d.isDisabled()) return ApprovalState.DRAFT; } - return null; } - /** * 获取实体是否有流程 * diff --git a/src/main/java/com/rebuild/core/service/dashboard/charts/TableChart.java b/src/main/java/com/rebuild/core/service/dashboard/charts/TableChart.java index 372d48510..336ac3f9d 100644 --- a/src/main/java/com/rebuild/core/service/dashboard/charts/TableChart.java +++ b/src/main/java/com/rebuild/core/service/dashboard/charts/TableChart.java @@ -19,7 +19,6 @@ import org.apache.commons.lang3.ArrayUtils; import java.math.BigDecimal; import java.text.MessageFormat; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; /** @@ -113,7 +112,13 @@ public class TableChart extends ChartData { } String tableHtml = new TableBuilder(this, dataRaw).toHTML(); - return JSONUtils.toJSONObject("html", tableHtml); + + JSONObject renderOption = config.getJSONObject("option"); + if (renderOption == null) renderOption = new JSONObject(); + + return JSONUtils.toJSONObject( + new String[]{"html", "_renderOption"}, + new Object[]{tableHtml, renderOption}); } protected boolean isShowLineNumber() { diff --git a/src/main/java/com/rebuild/core/service/dashboard/charts/TreemapChart.java b/src/main/java/com/rebuild/core/service/dashboard/charts/TreemapChart.java index 7bcc7cb11..a6bd6c6e9 100644 --- a/src/main/java/com/rebuild/core/service/dashboard/charts/TreemapChart.java +++ b/src/main/java/com/rebuild/core/service/dashboard/charts/TreemapChart.java @@ -48,7 +48,8 @@ public class TreemapChart extends ChartData { JSONObject renderOption = config.getJSONObject("option"); if (renderOption == null) renderOption = new JSONObject(); - renderOption.put("dataFlags", new String[] { getNumericalFlag(num1) }); + renderOption.put("dataFlags", new String[]{getNumericalFlag(num1)}); + renderOption.remove("useBgcolor"); return JSONUtils.toJSONObject( new String[]{"data", "xLabel", "xAmount", "_renderOption"}, diff --git a/src/main/java/com/rebuild/core/service/general/GeneralEntityService.java b/src/main/java/com/rebuild/core/service/general/GeneralEntityService.java index e871dbdaa..585c10aeb 100644 --- a/src/main/java/com/rebuild/core/service/general/GeneralEntityService.java +++ b/src/main/java/com/rebuild/core/service/general/GeneralEntityService.java @@ -610,10 +610,13 @@ public class GeneralEntityService extends ObservableService implements EntitySer } ApprovalState state = ApprovalHelper.getApprovalState(dtmFieldValue); - if (state == ApprovalState.APPROVED || state == ApprovalState.PROCESSING) { - throw new DataSpecificationException(state == ApprovalState.APPROVED - ? Language.L("主记录已审批完成,不能添加明细") - : Language.L("主记录正在审批中,不能添加明细")); + if (state == ApprovalState.APPROVED) { + throw new DataSpecificationException(Language.L("主记录已审批完成,不能添加明细")); + } else if (state == ApprovalState.PROCESSING) { + boolean allow42 = ApprovalHelper.isAllowEditableRecord(dtmFieldValue, getCurrentUser()); + if (!allow42) { + throw new DataSpecificationException(Language.L("主记录正在审批中,不能添加明细")); + } } } @@ -645,6 +648,13 @@ public class GeneralEntityService extends ObservableService implements EntitySer boolean unallow = false; if (action == BizzPermission.DELETE) { unallow = currentState == ApprovalState.APPROVED || currentState == ApprovalState.PROCESSING; + + // v4.2 允许修改记录 + if (unallow && currentState == ApprovalState.PROCESSING) { + boolean allow42 = ApprovalHelper.isAllowEditableRecord(checkRecordId, getCurrentUser()); + if (allow42) unallow = false; + } + } else if (action == BizzPermission.UPDATE) { unallow = currentState == ApprovalState.APPROVED || currentState == ApprovalState.PROCESSING; @@ -659,6 +669,15 @@ public class GeneralEntityService extends ObservableService implements EntitySer boolean forceUpdate = GeneralEntityServiceContextHolder.isAllowForceUpdate(false); if (forceUpdate) unallow = false; } + + // v4.2 允许修改记录 + if (unallow) { + boolean is = ApprovalHelper.isAllowEditableRecord(checkRecordId, getCurrentUser()); + if (is) { + unallow = false; + GeneralEntityServiceContextHolder.setAllowForceUpdate(checkRecordId); + } + } } if (unallow) { diff --git a/src/main/java/com/rebuild/web/robot/approval/ApprovalController.java b/src/main/java/com/rebuild/web/robot/approval/ApprovalController.java index f81f42e38..c78c24679 100644 --- a/src/main/java/com/rebuild/web/robot/approval/ApprovalController.java +++ b/src/main/java/com/rebuild/web/robot/approval/ApprovalController.java @@ -38,6 +38,7 @@ import com.rebuild.core.service.trigger.DataValidateException; import com.rebuild.core.support.RbvFunction; import com.rebuild.utils.JSONUtils; import com.rebuild.web.BaseController; +import com.rebuild.web.EntityParam; import com.rebuild.web.IdParam; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; @@ -85,11 +86,28 @@ public class ApprovalController extends BaseController { return res; } + @GetMapping("alist") + public RespBody getApprovalList(HttpServletRequest request, @EntityParam Entity entity) { + boolean valid = getBoolParameter(request, "valid"); + + FlowDefinition[] defs = RobotApprovalManager.instance.getFlowDefinitions(entity); + List res = new ArrayList<>(); + for (FlowDefinition d : defs) { + if (d.isDisabled()) continue; + // 仅返回可用的 + if (valid && !d.isWorkable()) continue; + + res.add(JSONUtils.toJSONObject(new String[]{"id", "text"}, + new Object[]{d.getID("id"), d.getString("name")})); + } + return RespBody.ok(res); + } + @GetMapping("state") public RespBody getApprovalState(HttpServletRequest request, @IdParam(name = "record") ID recordId) { final Entity approvalEntity = MetadataHelper.getEntity(recordId.getEntityCode()); if (!MetadataHelper.hasApprovalField(approvalEntity)) { - return RespBody.error("NOT AN APPROVAL ENTITY"); + return RespBody.error("NONE APPROVAL ENTITY"); } final ID user = getRequestUser(request); @@ -189,10 +207,14 @@ public class ApprovalController extends BaseController { if (reqType < 2) data.put("remarkReq", reqType); else data.put("remarkReq", expTime == null || expTime < 0 ? 0 : 1); - // 可修改字段 - JSONArray editableFields = currentFlowNode.getEditableFields(); - if (editableFields != null && !editableFields.isEmpty()) { - data.putAll(new EditableFields(editableFields).buildForms(recordId, user)); + // 可修改记录 + int editableMode = currentFlowNode.getEditableMode(); + data.put("editableMode", editableMode); + if (editableMode ==FlowNode.EDITABLE_MODE_FIELDS) { + JSONArray editableFields = currentFlowNode.getEditableFields(); + if (!CollectionUtils.isEmpty(editableFields)) { + data.putAll(new EditableFields(editableFields).buildForms(recordId, user)); + } } return data; diff --git a/src/main/java/com/rebuild/web/robot/trigger/AutoApprovalController.java b/src/main/java/com/rebuild/web/robot/trigger/AutoApprovalController.java deleted file mode 100644 index cb04e6df7..000000000 --- a/src/main/java/com/rebuild/web/robot/trigger/AutoApprovalController.java +++ /dev/null @@ -1,36 +0,0 @@ -/*Copyright (c) REBUILD and/or its owners. All rights reserved. - -rebuild is dual-licensed under commercial and open source licenses (GPLv3). -See LICENSE and COMMERCIAL in the project root for license information. -*/ - -package com.rebuild.web.robot.trigger; - -import com.alibaba.fastjson.JSON; -import com.rebuild.core.Application; -import com.rebuild.utils.JSONUtils; -import com.rebuild.web.BaseController; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import javax.servlet.http.HttpServletRequest; - -/** - * @author devezhao - * @since 2019/05/25 - */ -@RestController -@RequestMapping("/admin/robot/trigger/") -public class AutoApprovalController extends BaseController { - - @RequestMapping("auto-approval-alist") - public JSON approvalList(HttpServletRequest request) { - Object[][] array = Application.createQueryNoFilter( - "select configId,name from RobotApprovalConfig where belongEntity = ? and isDisabled = ? order by name") - .setParameter(1, getParameterNotNull(request, "entity")) - .setParameter(2, false) - .array(); - - return JSONUtils.toJSONObjectArray(new String[] { "id", "text" }, array); - } -} diff --git a/src/main/resources/web/assets/css/approvals.css b/src/main/resources/web/assets/css/approvals.css index e0f6de287..34107fb8e 100644 --- a/src/main/resources/web/assets/css/approvals.css +++ b/src/main/resources/web/assets/css/approvals.css @@ -714,7 +714,8 @@ See LICENSE and COMMERCIAL in the project root for license information. width: 100%; } -.expires-notify-set { +.expires-notify-set, +.editable-mode-set { background-color: #eee; padding: 20px; padding-top: 15px; diff --git a/src/main/resources/web/assets/css/charts.css b/src/main/resources/web/assets/css/charts.css index 6074f130c..b44dad872 100644 --- a/src/main/resources/web/assets/css/charts.css +++ b/src/main/resources/web/assets/css/charts.css @@ -233,6 +233,7 @@ See LICENSE and COMMERCIAL in the project root for license information. background-color: #eceff1; border-width: 1px; font-weight: normal; + font-weight: bold; } .chart.ctable .table.line-number thead th:first-child, @@ -309,6 +310,7 @@ See LICENSE and COMMERCIAL in the project root for license information. padding-top: 0; padding-bottom: 6px; font-weight: normal; + font-weight: bold; } .chart.ApprovalList .table td, @@ -744,6 +746,14 @@ See LICENSE and COMMERCIAL in the project root for license information. right: 0; } +.chart-box.TABLE .chart.ctable .table { + background-color: transparent; +} + +.chart-box.TABLE.gradient-bg .chart.ctable .table th { + background-color: rgba(255, 255, 255, 0.2); +} + /* gradient-backgrounds.css */ .gradient-bg-1 { diff --git a/src/main/resources/web/assets/css/rb-page.css b/src/main/resources/web/assets/css/rb-page.css index b5cdef0a6..fe576ac72 100644 --- a/src/main/resources/web/assets/css/rb-page.css +++ b/src/main/resources/web/assets/css/rb-page.css @@ -918,6 +918,7 @@ body.view-body { textarea.row1x { height: 37px !important; resize: none; + padding-top: 7px; } textarea.row2x { diff --git a/src/main/resources/web/assets/js/admin/approval-design.js b/src/main/resources/web/assets/js/admin/approval-design.js index 6ab6f39ea..19f63f46c 100644 --- a/src/main/resources/web/assets/js/admin/approval-design.js +++ b/src/main/resources/web/assets/js/admin/approval-design.js @@ -221,10 +221,10 @@ class SimpleNode extends NodeSpec { if (this.nodeType === 'approver') { if (data.allowReferral) descs.push($L('允许转审')) if (data.allowCountersign) descs.push($L('允许加签')) - if (data.allowBatch) descs.push($L('允许批量')) + // if (data.allowBatch) descs.push($L('允许批量')) descs.push(data.signMode === 'AND' ? $L('会签') : data.signMode === 'ALL' ? $L('依次审批') : $L('或签')) if (data.expiresAuto && ~~data.expiresAuto.expiresAuto > 0) descs.push($L('限时审批')) - if (data.editableFields && data.editableFields.length > 0) descs.push($L('可修改字段')) + if (~~data.editableMode > 0) descs.push($L('可修改记录')) } else if (this.nodeType === 'start') { if (data.unallowCancel) descs.push($L('禁止撤回')) } @@ -635,6 +635,10 @@ class ApproverNodeConfig extends StartNodeConfig { if (!props.users || props.users.length === 0) this.state.users = 'SPEC' else if (props.users[0] === 'SELF') this.state.users = 'SELF' else this.state.users = 'SPEC' + // v4.2 兼容 + if (props.editableFields && props.editableFields.length > 0 && !props.editableMode) { + this.state.editableMode = '10' + } } render() { @@ -682,7 +686,7 @@ class ApproverNodeConfig extends StartNodeConfig { -
+
-
- -
- - (this._$editableFields = c)}> - {(this.state.editableFields || []).map((item) => { - return ( - - - - - - ) - })} - -
{this.__fieldLabel(item.field)} - - - - this.removeEditableField(item.field)}> - - -
-
- +
+ +
+
+ +
+
+
+
+ +
+ + (this._$editableFields = c)}> + {(this.state.editableFields || []).map((item) => { + return ( + + + + + + ) + })} + +
{this.__fieldLabel(item.field)} + + + + this.removeEditableField(item.field)}> + + +
+
+ +
+ {this.renderButton()}
) @@ -907,14 +925,6 @@ class ApproverNodeConfig extends StartNodeConfig { } save = () => { - const editableFields = [] - $(this._$editableFields) - .find('td[data-field]') - .each(function () { - const $this = $(this) - editableFields.push({ field: $this.data('field'), notNull: $this.find('input:eq(0)').prop('checked'), readOnly: $this.find('input:eq(1)').prop('checked') }) - }) - const expiresAuto = {} $(this._$expiresAuto) .find('input, select, textarea') @@ -929,11 +939,27 @@ class ApproverNodeConfig extends StartNodeConfig { return } + const editableFields = [] + if (~~this.state.editableMode === 10) { + $(this._$editableFields) + .find('td[data-field]') + .each(function () { + const $this = $(this) + editableFields.push({ field: $this.data('field'), notNull: $this.find('input:eq(0)').prop('checked'), readOnly: $this.find('input:eq(1)').prop('checked') }) + }) + + if (editableFields.length === 0) { + RbHighbar.create($L('请指定可修改字段')) + return + } + } + const d = { nodeName: this.state.nodeName, users: this.state.users === 'SPEC' ? this._UserSelector.getSelected() : [this.state.users], signMode: this.state.signMode, selfSelecting: this.state.selfSelecting, + editableMode: this.state.editableMode, editableFields: editableFields, allowReferral: this.state.allowReferral, allowCountersign: this.state.allowCountersign, diff --git a/src/main/resources/web/assets/js/charts/charts.js b/src/main/resources/web/assets/js/charts/charts.js index c0d9e10f4..62f2d59e8 100644 --- a/src/main/resources/web/assets/js/charts/charts.js +++ b/src/main/resources/web/assets/js/charts/charts.js @@ -52,7 +52,9 @@ class BaseChart extends React.Component { ) return ( -
(this._$box = c)}> +
(this._$box = c)}>
{this.state.title}
{opActions} diff --git a/src/main/resources/web/assets/js/general/rb-approval.js b/src/main/resources/web/assets/js/general/rb-approval.js index 59c0a0b9b..fe5fde213 100644 --- a/src/main/resources/web/assets/js/general/rb-approval.js +++ b/src/main/resources/web/assets/js/general/rb-approval.js @@ -484,6 +484,7 @@ class ApprovalApproveForm extends ApprovalUsersForm { )} {(this.state.aform || this.state.aform_details) && this.renderLiteForm()} + {this.state.editableMode === 1 && this.renderEditable()}
- {BUE_OPTYPES[item.op]} + {BU_OPS[item.op]}
{item.op !== 'NULL' && {FieldValueSet.formatFieldText(item.value, field)}} @@ -433,7 +433,7 @@ class BatchUpdate extends BatchOperator { })}
- {this.state.fields && (this._editor = c)} fields={this.state.fields} entity={this.props.entity} />} + {this.state.fields && (this._buEntry = c)} fields={this.state.fields} entity={this.props.entity} />}
{$L('修改方式')}
@@ -636,7 +639,10 @@ class BatchUpdateEditor extends React.Component { } data.value = this._FieldValue.val() - if (!data.value) { + if (data.value === false) { + // 格式不正确 + return null + } else if (!data.value) { RbHighbar.create($L('请填写新值')) return null } else { @@ -661,10 +667,11 @@ class BatchApprove extends BatchOperator { } renderOperator() { + const approveState = ~~this.state.approveState return (
- +
+
-
+ +
= 10 ? '' : 'hide'}`}> - + } + return (this._$value = c)} key={field.name} maxLength="255" /> } diff --git a/src/main/resources/web/assets/js/rb-page.js b/src/main/resources/web/assets/js/rb-page.js index 23302b3ba..841127c88 100644 --- a/src/main/resources/web/assets/js/rb-page.js +++ b/src/main/resources/web/assets/js/rb-page.js @@ -610,7 +610,7 @@ var _initGlobalCreate = function () { var $item = $('' + this.entityLabel + '').appendTo($gc) var _this = this $item.on('click', function () { - RbFormModal.create({ title: $L('新建%s', _this.entityLabel), entity: _this.entity, icon: _this.icon }) + RbFormModal.create({ title: $L('新建%s', _this.entityLabel), entity: _this.entity, icon: _this.icon, showExtraButton: true }) }) }) } @@ -1479,3 +1479,14 @@ function $focus2End(el, delay) { el.setSelectionRange(len, len) }, delay || 100) } + +// 获取实体元数据 +function $fetchMetaInfo(name, cb) { + $.get('/commons/metadata/meta-info?name=' + $encode(name), function (res) { + if (res.error_code === 0) { + typeof cb === 'function' && cb(res.data || {}) + } else { + RbHighbar.error(res.error_msg) + } + }) +} diff --git a/src/main/resources/web/dashboard/chart-design.html b/src/main/resources/web/dashboard/chart-design.html index 5a6b2c1a7..91bb323af 100644 --- a/src/main/resources/web/dashboard/chart-design.html +++ b/src/main/resources/web/dashboard/chart-design.html @@ -211,7 +211,7 @@
-
+