2.9 beta3 (#464)

* fix autofill

* sort reports, approvals

* fix wpc of frontjs
This commit is contained in:
RB 2022-05-13 10:45:40 +08:00 committed by GitHub
parent 0bf3d18d1d
commit b4a005277d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 56 additions and 48 deletions

2
@rbv

@ -1 +1 @@
Subproject commit e9a9fb7c0cc142b3c7939c98e4e36d6feffe1be1
Subproject commit ab1d26ce623c3f437cbf8094848ffe1914e783a4

View file

@ -160,9 +160,16 @@ public class AutoFillinManager implements ConfigManager {
*/
protected Object conversionCompatibleValue(Field source, Field target, Object value) {
EasyField sourceEasy = EasyMetaFactory.valueOf(source);
Object newValue = sourceEasy.convertCompatibleValue(value, EasyMetaFactory.valueOf(target));
EasyField targetEasy = EasyMetaFactory.valueOf(target);
Object newValue = sourceEasy.convertCompatibleValue(value, targetEasy);
// 转换成前端可接受的值
if (sourceEasy.getDisplayType() == targetEasy.getDisplayType()
&& sourceEasy.getDisplayType() == DisplayType.MULTISELECT) {
return newValue; // Long
}
if (sourceEasy instanceof MixValue) {
if (!(newValue instanceof String) || sourceEasy instanceof EasyFile) {
newValue = sourceEasy.wrapValue(newValue);

View file

@ -11,6 +11,7 @@ import cn.devezhao.commons.CalendarUtils;
import cn.devezhao.commons.web.ServletUtils;
import cn.devezhao.persist4j.engine.ID;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.rebuild.api.RespBody;
import com.rebuild.core.Application;
@ -52,9 +53,17 @@ public class ReportsController extends BaseController {
@RequestMapping("report/available")
public JSON availableReports(@PathVariable String entity, HttpServletRequest request) {
return DataReportManager.instance.getReports(
JSONArray res = DataReportManager.instance.getReports(
MetadataHelper.getEntity(entity),
getIntParameter(request, "type", DataReportManager.TYPE_RECORD));
// 名称排序
res.sort((o1, o2) -> {
JSONObject j1 = (JSONObject) o1;
JSONObject j2 = (JSONObject) o2;
return j1.getString("name").compareTo(j2.getString("name"));
});
return res;
}
@RequestMapping({"report/generate", "report/export"})

View file

@ -45,11 +45,18 @@ public class ApprovalController extends BaseController {
final ID user = getRequestUser(request);
FlowDefinition[] defs = RobotApprovalManager.instance.getFlowDefinitions(recordId, user);
JSONArray data = new JSONArray();
JSONArray res = new JSONArray();
for (FlowDefinition d : defs) {
data.add(d.toJSON("id", "name"));
res.add(d.toJSON("id", "name"));
}
return data;
// 名称排序
res.sort((o1, o2) -> {
JSONObject j1 = (JSONObject) o1;
JSONObject j2 = (JSONObject) o2;
return j1.getString("name").compareTo(j2.getString("name"));
});
return res;
}
@GetMapping("state")

View file

@ -21,16 +21,18 @@ const loadRules = () => {
$(`<td><div>${this.targetFieldLabel}</div></td>`).appendTo($tr)
$(`<td>${this.sourceFieldLabel}</div></td>`).appendTo($tr)
if (!this.extConfig.whenCreate && !this.extConfig.whenUpdate) {
$(`<td class="text-warning">(${$L('未启用')})</div></td>`).appendTo($tr)
} else {
const ruleLabels = []
if (this.extConfig.whenCreate) ruleLabels.push($L('新建时'))
if (this.extConfig.whenUpdate) ruleLabels.push($L('编辑时'))
if (this.extConfig.fillinForce) ruleLabels.push($L('强制回填'))
if (this.extConfig.readonlyTargetField) ruleLabels.push($L('自动设置目标字段为只读'))
$(`<td>${ruleLabels.join(', ')}</div></td>`).appendTo($tr)
}
const $btns = $(
'<td class="actions"><a class="icon"><i class="zmdi zmdi-settings"></i></a><a class="icon danger-hover"><i class="zmdi zmdi-delete"></i></a></td>'
).appendTo($tr)
const $btns = $('<td class="actions"><a class="icon"><i class="zmdi zmdi-settings"></i></a><a class="icon danger-hover"><i class="zmdi zmdi-delete"></i></a></td>').appendTo($tr)
$btns.find('a:eq(0)').click(() => {
renderRbcomp(<DlgRuleEdit {...bProps} {...this.extConfig} id={this.id} sourceField={this.sourceField} targetField={this.targetField} />)
})
@ -103,23 +105,11 @@ class DlgRuleEdit extends RbFormHandler {
<label className="col-sm-3 col-form-label text-sm-right pt-1">{$L('何时回填')}</label>
<div className="col-sm-7">
<label className="custom-control custom-control-sm custom-checkbox custom-control-inline mb-0">
<input
className="custom-control-input"
type="checkbox"
checked={this.state.whenCreate === true}
data-id="whenCreate"
onChange={this.handleChange}
/>
<input className="custom-control-input" type="checkbox" checked={this.state.whenCreate === true} data-id="whenCreate" onChange={this.handleChange} />
<span className="custom-control-label">{$L('新建时')}</span>
</label>
<label className="custom-control custom-control-sm custom-checkbox custom-control-inline mb-0">
<input
className="custom-control-input"
type="checkbox"
checked={this.state.whenUpdate === true}
data-id="whenUpdate"
onChange={this.handleChange}
/>
<input className="custom-control-input" type="checkbox" checked={this.state.whenUpdate === true} data-id="whenUpdate" onChange={this.handleChange} />
<span className="custom-control-label">{$L('编辑时')}</span>
</label>
</div>
@ -128,13 +118,7 @@ class DlgRuleEdit extends RbFormHandler {
<label className="col-sm-3 col-form-label text-sm-right pt-1">{$L('当目标字段非空时')}</label>
<div className="col-sm-7">
<label className="custom-control custom-control-sm custom-checkbox custom-control-inline mb-0">
<input
className="custom-control-input"
type="checkbox"
checked={this.state.fillinForce === true}
data-id="fillinForce"
onChange={this.handleChange}
/>
<input className="custom-control-input" type="checkbox" checked={this.state.fillinForce === true} data-id="fillinForce" onChange={this.handleChange} />
<span className="custom-control-label">{$L('强制回填')}</span>
</label>
</div>
@ -143,13 +127,7 @@ class DlgRuleEdit extends RbFormHandler {
<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">
<input
className="custom-control-input"
type="checkbox"
checked={this.state.readonlyTargetField === true}
data-id="readonlyTargetField"
onChange={this.handleChange}
/>
<input className="custom-control-input" type="checkbox" checked={this.state.readonlyTargetField === true} data-id="readonlyTargetField" onChange={this.handleChange} />
<span className="custom-control-label">
{$L('自动设置目标字段为只读')}
<i className="zmdi zmdi-help zicon down-1" data-toggle="tooltip" title={$L('本选项仅针对表单有效')} />

View file

@ -1537,12 +1537,19 @@ class RbFormN2NReference extends RbFormReference {
this.setState({ value: val }, () => checkValue === true && this.checkValue())
}
setValue(val, isAppend) {
// @append = 追加模式
setValue(val, append) {
if (val && val.length > 0) {
const currentValue = this.state.value || ''
let currentIds = this.state.value || '' // init is Object
if (!append) {
this.__select2.val(null).trigger('change')
currentIds = ''
}
const ids = []
val.forEach((item) => {
if (!currentValue.includes(item.id)) {
if (!currentIds.includes(item.id)) {
const o = new Option(item.text, item.id, true, true)
this.__select2.append(o)
ids.push(item.id)
@ -1551,7 +1558,7 @@ class RbFormN2NReference extends RbFormReference {
if (ids.length > 0) {
let ss = ids.join(',')
if (isAppend && currentValue && currentValue !== '') ss = currentValue + ',' + ss
if (append && currentIds && currentIds !== '') ss = currentIds + ',' + ss
this.handleChange({ target: { value: ss } }, true)
}
} else {