Skip to content

Commit

Permalink
be
Browse files Browse the repository at this point in the history
  • Loading branch information
getrebuild committed Nov 14, 2024
1 parent 6731c23 commit 21de121
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 29 deletions.
2 changes: 1 addition & 1 deletion @rbv
Submodule @rbv updated from 289545 to e9b0df
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ public JSONArray getTransforms(String sourceEntity, ID user) {
JSONObject item = EasyMetaFactory.toJSON(targetEntity);
item.put("transid", cb.getID("id"));
item.put("transName", cb.getString("name"));
item.put("previewMode", config.getIntValue("transformMode") == 2);
data.add(item);
}
return data;
Expand Down
10 changes: 0 additions & 10 deletions src/main/resources/web/admin/robot/transform-design.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,6 @@
<p class="form-text">[[${bundle.L('可将转换后的记录 ID 回填至源记录中')}]]</p>
</div>
</div>
<div class="form-group row">
<label class="col-md-12 col-xl-3 col-lg-4 col-form-label text-lg-right"></label>
<div class="col-md-12 col-xl-9 col-lg-8">
<label class="custom-control custom-control-sm custom-checkbox custom-control-inline mb-0">
<input class="custom-control-input" type="checkbox" id="transformMode" value="2" />
<span class="custom-control-label">[[${bundle.L('预览模式')}]] </span>
</label>
<p class="form-text">[[${bundle.L('打开新建页面而非直接转换,可在新建页面补充信息后再保存')}]]</p>
</div>
</div>
<th:block th:if="${targetIsDetail}">
<div class="form-group row">
<label class="col-md-12 col-xl-3 col-lg-4 col-form-label text-lg-right"></label>
Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/web/assets/js/admin/transform-design.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ $(document).ready(() => {
fieldsMappingDetail: fmd36,
fieldsMappingDetails: fmdList37,
fillbackField: $('#fillbackField').val(),
transformMode: $('#transformMode').prop('checked') ? 2 : 1,
useFilter: _AdvFilter_data,
importsMode: $val('#importsMode'),
importsFilter: importsFilter || null,
Expand Down Expand Up @@ -242,7 +241,6 @@ $(document).ready(() => {
_saveFilter(config.useFilter)

if (config.fillbackField) $('#fillbackField').val(config.fillbackField).trigger('change')
if (config.transformMode === 2) $('#transformMode').attr('checked', true)
if (config.importsMode) $('#importsMode').trigger('click')
if (config.importsMode2Auto === 1 || config.importsMode2Auto === 3) $('#importsMode2Auto1').prop('checked', true)
if (config.importsMode2Auto === 2 || config.importsMode2Auto === 3) $('#importsMode2Auto2').prop('checked', true)
Expand Down
28 changes: 14 additions & 14 deletions src/main/resources/web/assets/js/general/rb-assignshare.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ class DlgTransform extends RbModalHandler {

render() {
return (
<RbModal title={$L('记录转换')} className="sm-height" ref={(c) => (this._dlg = c)}>
<RbModal title={$L('记录转换')} className="sm-height" ref={(c) => (this._dlg = c)} disposeOnHide>
<div className="form">
<div className="form-group row pb-1">
<label className="col-sm-3 col-form-label text-sm-right">{$L('转换为')}</label>
Expand Down Expand Up @@ -444,13 +444,26 @@ class DlgTransform extends RbModalHandler {
entity: this.props.entity,
searchType: 'search',
})
if (this.props.existsRecord) {
$.get(`/commons/frontjs/ref-label?id=${this.props.existsRecord}`, (res) => {
const o = new Option(res.data, this.props.existsRecord, true, true)
$(this._$existsRecord).append(o).trigger('change')
this.setState({ transType: 1 })
})
}

if (this.props.mainEntity) {
$initReferenceSelect2(this._$mainRecord, {
placeholder: $L('选择'),
entity: this.props.entity,
name: `${this.props.mainEntity}Id`,
})
if (this.props.mainRecord) {
$.get(`/commons/frontjs/ref-label?id=${this.props.mainRecord}`, (res) => {
const o = new Option(res.data, this.props.mainRecord, true, true)
$(this._$mainRecord).append(o).trigger('change')
})
}
}
}

Expand Down Expand Up @@ -508,17 +521,4 @@ class DlgTransform extends RbModalHandler {
this._$existsRecord && $(this._$existsRecord).val(null).trigger('change')
this._$mainRecord && $(this._$mainRecord).val(null).trigger('change')
}

// -- Usage
/**
* @param {*} props
*/
static create(props) {
const that = this
if (that.__HOLDER2) that.__HOLDER2.show(props)
else
renderRbcomp(<DlgTransform {...props} />, function () {
that.__HOLDER2 = this
})
}
}
2 changes: 1 addition & 1 deletion src/main/resources/web/assets/js/general/rb-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ const RbViewPage = {
initTransform(config) {
config.forEach((item) => {
const $item = $(`<a class="dropdown-item"><i class="icon zmdi zmdi-${item.icon}"></i>${item.transName || item.entityLabel}</a>`)
$item.on('click', () => DlgTransform.create({ ...item, sourceRecord: this.__id }))
$item.on('click', () => renderRbcomp(<DlgTransform {...item} sourceRecord={this.__id} />))
$('.J_transform .dropdown-divider').before($item)
})
},
Expand Down

0 comments on commit 21de121

Please sign in to comment.