Skip to content

Commit

Permalink
fix: $same
Browse files Browse the repository at this point in the history
  • Loading branch information
getrebuild committed Nov 11, 2023
1 parent 0c07f63 commit 1688479
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 54 deletions.
11 changes: 1 addition & 10 deletions src/main/resources/web/assets/js/bizuser/role-privileges.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,7 @@ const loadRoles = function () {
extrasAction={(item) => {
return (
<RF>
<span
className="action"
onClick={() => {
RbFormModal.create({
title: $L('编辑角色'),
entity: 'Role',
icon: 'lock',
id: item.id,
})
}}>
<span className="action" onClick={() => RbFormModal.create({ title: $L('编辑角色'), entity: 'Role', icon: 'lock', id: item.id }, true)}>
<i className="zmdi zmdi-edit" />
</span>
<span
Expand Down
7 changes: 3 additions & 4 deletions src/main/resources/web/assets/js/rb-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,12 +390,11 @@ var $random = function (prefix, alphabetic, maxLength) {
var $same = function (a, b) {
if (Object.is(a, b)) return true
if (a && b) {
if ($.type(a) === 'object' && $.type(b) === 'object') {
var aType = $.type(a)
var bType = $.type(b)
if ((aType === 'object' && bType === 'object') || (aType === 'array' && bType === 'array')) {
a = JSON.stringify(a)
b = JSON.stringify(b)
} else if ($.type(a) === 'array' && $.type(b) === 'array') {
a = a.join(',')
b = b.join(',')
}
}
if (a === b) return true
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/web/assets/js/rb-datalist.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const RbListPage = {
$('.J_edit').on('click', () => {
const ids = this._RbList.getSelectedIds()
if (ids.length >= 1) {
RbFormModal.create({ id: ids[0], title: $L('编辑%s', entity[1]), entity: entity[0], icon: entity[2] })
RbFormModal.create({ id: ids[0], title: $L('编辑%s', entity[1]), entity: entity[0], icon: entity[2] }, true)
}
})

Expand Down
17 changes: 2 additions & 15 deletions src/main/resources/web/assets/js/rb-forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -708,12 +708,7 @@ class RbForm extends React.Component {
} else if (next === RbForm.NEXT_ADDDETAIL) {
const iv = $$$parent.props.initialValue
const dm = this.props.rawModel.entityMeta
RbFormModal.create({
title: $L('添加%s', dm.entityLabel),
entity: dm.entity,
icon: dm.icon,
initialValue: iv,
})
RbFormModal.create({ title: $L('添加%s', dm.entityLabel), entity: dm.entity, icon: dm.icon, initialValue: iv })
} else if (next === RbForm.NEXT_VIEW && window.RbViewModal) {
window.RbViewModal.create({ id: recordId, entity: this.state.entity })
if (window.RbListPage) {
Expand Down Expand Up @@ -2077,15 +2072,7 @@ class RbFormReference extends RbFormElement {

quickNew() {
const e = this.props.referenceEntity
RbFormModal.create(
{
title: $L('新建%s', e.entityLabel),
entity: e.entity,
icon: e.icon,
postAfter: (id) => this.showSearcher_call([id], this),
},
true
)
RbFormModal.create({ title: $L('新建%s', e.entityLabel), entity: e.entity, icon: e.icon, postAfter: (id) => this.showSearcher_call([id], this) }, true)
}
}

Expand Down
5 changes: 2 additions & 3 deletions src/main/resources/web/assets/js/rb-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ See LICENSE and COMMERCIAL in the project root for license information.
/* !!! KEEP IT ES5 COMPATIBLE !!! */

// GA
(function () {
;(function () {
const gaScript = document.createElement('script')
gaScript.src = 'https://www.googletagmanager.com/gtag/js?id=G-ZCZHJPMEG7'
gaScript.async = true
Expand Down Expand Up @@ -180,8 +180,7 @@ $(function () {
})
})

// __LAB
if (rb.env === 'dev' && window.sessionStorage) {
if (window.sessionStorage) {
$('.navbar .navbar-collapse>.navbar-nav a').on('click', function (e) {
sessionStorage.setItem('AppHome._InTab', e.target.href.split('?')[1])
})
Expand Down
27 changes: 6 additions & 21 deletions src/main/resources/web/assets/js/rb-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -475,12 +475,7 @@ class EntityRelatedList extends RelatedList {

_handleEdit(e, id) {
$stopEvent(e, true)
RbFormModal.create({
id: id,
entity: this.__entity,
title: $L('编辑%s', this.props.entity2[0]),
icon: this.props.entity2[1],
})
RbFormModal.create({ id: id, entity: this.__entity, title: $L('编辑%s', this.props.entity2[0]), icon: this.props.entity2[1] }, true)
}

_handleView(e) {
Expand Down Expand Up @@ -630,12 +625,7 @@ const RbViewPage = {
$('.J_edit').on('click', () => {
// 优先父页面打开?
// const m = window.parent && window.parent.RbFormModal ? window.parent.RbFormModal : RbFormModal
RbFormModal.create({
id: id,
title: $L('编辑%s', entity[1]),
entity: entity[0],
icon: entity[2],
})
RbFormModal.create({ id: id, title: $L('编辑%s', entity[1]), entity: entity[0], icon: entity[2] }, true)
})

$('.J_assign').on('click', () => DlgAssign.create({ entity: entity[0], ids: [id] }))
Expand All @@ -645,13 +635,7 @@ const RbViewPage = {
$('.J_add-details>a').on('click', function () {
const iv = { $MAINID$: id }
const $this = $(this)
RbFormModal.create({
title: $L('添加%s', $this.data('label')),
entity: $this.data('entity'),
icon: $this.data('icon'),
initialValue: iv,
_nextAddDetail: true,
})
RbFormModal.create({ title: $L('添加%s', $this.data('label')), entity: $this.data('entity'), icon: $this.data('icon'), initialValue: iv, _nextAddDetail: true })
})

if (wpc.transformTos && wpc.transformTos.length > 0) {
Expand Down Expand Up @@ -864,6 +848,7 @@ const RbViewPage = {
const entity = item.entity.split('.')
if (entity.length > 1) iv[entity[1]] = that.__id
else iv[`&${that.__entity[0]}`] = that.__id

RbFormModal.create({ title: $L('新建%s', item._entityLabel || item.entityLabel), entity: entity[0], icon: item.icon, initialValue: iv })
}
})
Expand Down Expand Up @@ -892,11 +877,11 @@ const RbViewPage = {
if (mainid === false) return

this.hide()
RbFormModal.create({ title: $L('新建%s', item.entityLabel), entity: entity[0], icon: item.icon, previewid: `${previewid}.${mainid}` })
RbFormModal.create({ title: $L('新建%s', item.entityLabel), entity: entity[0], icon: item.icon, previewid: `${previewid}.${mainid}` }, true)
},
})
} else {
RbFormModal.create({ title: $L('新建%s', item.entityLabel), entity: entity[0], icon: item.icon, previewid: previewid })
RbFormModal.create({ title: $L('新建%s', item.entityLabel), entity: entity[0], icon: item.icon, previewid: previewid }, true)
}

// end: previewMode
Expand Down

0 comments on commit 1688479

Please sign in to comment.