From 05131e9941be89e38f5ef1c58eb60ef892f2aabd Mon Sep 17 00:00:00 2001 From: RB <42044143+getrebuild@users.noreply.github.com> Date: Fri, 15 Aug 2025 13:49:55 +0800 Subject: [PATCH] Refactor form modal creation and extra button logic --- .../web/assets/js/general/rb-approval.js | 4 +-- .../assets/js/general/rb-datalist.common.js | 6 ++-- .../web/assets/js/general/rb-datalist.js | 16 +++++---- .../web/assets/js/general/rb-forms.js | 14 +++++--- .../web/assets/js/general/rb-view.js | 36 ++++++++----------- src/main/resources/web/assets/js/rb-page.js | 2 +- 6 files changed, 38 insertions(+), 40 deletions(-) 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 db7e1f4a2..fe5fde213 100644 --- a/src/main/resources/web/assets/js/general/rb-approval.js +++ b/src/main/resources/web/assets/js/general/rb-approval.js @@ -575,7 +575,6 @@ class ApprovalApproveForm extends ApprovalUsersForm { title: $L('编辑%s', res.entityLabel), icon: res.icon, id: this.props.id, - noExtraButton: true, postAfter: (recordId, next, formObject) => { // 刷新列表 const rlp = window.RbListPage || parent.RbListPage @@ -588,8 +587,7 @@ class ApprovalApproveForm extends ApprovalUsersForm { }) }, } - if ((window.__LAB40_EDIT_PROVIDERS || {})[this.props.entity]) window.__LAB40_EDIT_PROVIDERS[this.props.entity](editProps) - else RbFormModal.create(editProps, true) + RbFormModal.create(editProps, true) }) }}> diff --git a/src/main/resources/web/assets/js/general/rb-datalist.common.js b/src/main/resources/web/assets/js/general/rb-datalist.common.js index 206b89d8b..51763e7fb 100644 --- a/src/main/resources/web/assets/js/general/rb-datalist.common.js +++ b/src/main/resources/web/assets/js/general/rb-datalist.common.js @@ -883,16 +883,16 @@ const RbListCommon = { RbListPage.init(wpc.listConfig, entity, wpc.privileges) if (wpc.advFilter !== false) AdvFilters.init('.adv-search', entity[0]) - const newProps = { title: $L('新建%s', entity[1]), entity: entity[0], icon: entity[2] } + const newProps = { title: $L('新建%s', entity[1]), entity: entity[0], icon: entity[2], showExtraButton: true } const $new = $('.J_new') .attr('disabled', false) .on('click', () => RbFormModal.create(newProps)) if (wpc.formsAttr) { $new.next().removeClass('hide') - const $nn = $new.next().next() + const $next = $new.next().next() wpc.formsAttr.map((n) => { $(`${n.name || $L('默认布局')}`) - .appendTo($nn) + .appendTo($next) .on('click', () => RbFormModal.create({ ...newProps, specLayout: n.id }, true)) }) } else { diff --git a/src/main/resources/web/assets/js/general/rb-datalist.js b/src/main/resources/web/assets/js/general/rb-datalist.js index 52f8509de..678b69fc7 100644 --- a/src/main/resources/web/assets/js/general/rb-datalist.js +++ b/src/main/resources/web/assets/js/general/rb-datalist.js @@ -39,10 +39,7 @@ const RbListPage = { $('.J_edit').on('click', () => { const ids = this._RbList.getSelectedIds() if (ids.length >= 1) { - const _entity = entity[0] - const editProps = { id: ids[0], title: $L('编辑%s', entity[1]), entity: _entity, icon: entity[2] } - if ((window.__LAB40_EDIT_PROVIDERS || {})[_entity]) window.__LAB40_EDIT_PROVIDERS[_entity](editProps) - else RbFormModal.create(editProps, true) + RbFormModal.create({ id: ids[0], title: $L('编辑%s', entity[1]), entity: entity[0], icon: entity[2], showExtraButton: true }, true) } }) $('.J_delete').on('click', () => { @@ -111,7 +108,7 @@ class RbViewModal extends React.Component { super(props) this.state = { ...props, inLoad: true, isHide: true, destroy: false } - this._mcWidth = this.props.subView === true ? 1344 : 1404 + this._mcWidth = props.subView === true ? 1344 : 1404 if ($(window).width() < 1464) this._mcWidth -= 184 } @@ -122,7 +119,14 @@ class RbViewModal extends React.Component {
-