mirror of
https://github.com/getrebuild/rebuild.git
synced 2025-09-18 04:28:35 +08:00
be
This commit is contained in:
parent
2aef832ac4
commit
9dc43e235a
2 changed files with 24 additions and 18 deletions
|
@ -145,10 +145,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="float-right">
|
<div class="float-right">
|
||||||
<button class="btn btn-secondary btn-space J_new-role" type="button"><i class="icon mdi mdi-lock-plus"></i> [[${bundle.L('新建角色')}]]</button>
|
<button class="btn btn-secondary btn-space J_new-role mr-0" type="button"><i class="icon mdi mdi-lock-plus"></i> [[${bundle.L('新建角色')}]]</button>
|
||||||
<div class="btn-group btn-space">
|
<div class="btn-group btn-space ml-1" th:if="${id != null}">
|
||||||
<button class="btn btn-primary J_save" type="button" disabled="disabled">[[${bundle.L('保存')}]]</button>
|
<button class="btn btn-primary J_save" type="button">[[${bundle.L('保存')}]]</button>
|
||||||
<button class="btn btn-primary dropdown-toggle w-auto" type="button" data-toggle="dropdown" disabled="disabled"><i class="icon zmdi zmdi-chevron-down"></i></button>
|
<button class="btn btn-primary dropdown-toggle w-auto" type="button" data-toggle="dropdown"><i class="icon zmdi zmdi-chevron-down"></i></button>
|
||||||
<div class="dropdown-menu dropdown-menu-primary dropdown-menu-right">
|
<div class="dropdown-menu dropdown-menu-primary dropdown-menu-right">
|
||||||
<a class="dropdown-item J_copy-role"><i class="icon zmdi zmdi-copy"></i> [[${bundle.L('复制角色')}]]</a>
|
<a class="dropdown-item J_copy-role"><i class="icon zmdi zmdi-copy"></i> [[${bundle.L('复制角色')}]]</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -5,11 +5,6 @@ rebuild is dual-licensed under commercial and open source licenses (GPLv3).
|
||||||
See LICENSE and COMMERCIAL in the project root for license information.
|
See LICENSE and COMMERCIAL in the project root for license information.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
RbForm.postAfter = function (data) {
|
|
||||||
location.href = `${rb.baseUrl}/admin/bizuser/role/${data.id}`
|
|
||||||
}
|
|
||||||
|
|
||||||
const roleId = window.__PageConfig.recordId
|
const roleId = window.__PageConfig.recordId
|
||||||
|
|
||||||
// 自定义
|
// 自定义
|
||||||
|
@ -22,15 +17,22 @@ let fieldpSettings = {}
|
||||||
$(document).ready(() => {
|
$(document).ready(() => {
|
||||||
loadRoles()
|
loadRoles()
|
||||||
|
|
||||||
$('.J_new-role').on('click', () => RbFormModal.create({ title: $L('新建角色'), entity: 'Role', icon: 'lock' }))
|
$('.J_new-role').on('click', () =>
|
||||||
|
RbFormModal.create({
|
||||||
|
title: $L('新建角色'),
|
||||||
|
entity: 'Role',
|
||||||
|
icon: 'lock',
|
||||||
|
postAfter: function (id) {
|
||||||
|
if (roleId) location.href = `${rb.baseUrl}/admin/bizuser/role/${id}`
|
||||||
|
else updatePrivileges(id) // 新的
|
||||||
|
},
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
if (roleId) {
|
if (roleId) {
|
||||||
$('.J_save').attr('disabled', false)
|
|
||||||
$('.J_save').next().attr('disabled', false)
|
|
||||||
|
|
||||||
loadPrivileges()
|
loadPrivileges()
|
||||||
|
|
||||||
$('.J_save').on('click', updatePrivileges)
|
$('.J_save').on('click', () => updatePrivileges())
|
||||||
$('.J_copy-role').on('click', () => renderRbcomp(<CopyRoleTo roleId={roleId} />))
|
$('.J_copy-role').on('click', () => renderRbcomp(<CopyRoleTo roleId={roleId} />))
|
||||||
|
|
||||||
$('.nav-tabs li:eq(2)').removeClass('hide')
|
$('.nav-tabs li:eq(2)').removeClass('hide')
|
||||||
|
@ -256,7 +258,7 @@ const loadPrivileges = function () {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const updatePrivileges = function () {
|
const updatePrivileges = function (newId) {
|
||||||
const privEntity = {}
|
const privEntity = {}
|
||||||
$('#priv-entity tbody>tr').each(function () {
|
$('#priv-entity tbody>tr').each(function () {
|
||||||
const $tr = $(this)
|
const $tr = $(this)
|
||||||
|
@ -297,9 +299,13 @@ const updatePrivileges = function () {
|
||||||
zero: privZero,
|
zero: privZero,
|
||||||
}
|
}
|
||||||
|
|
||||||
$.post(`/admin/bizuser/privileges-update?role=${roleId}`, JSON.stringify(_data), (res) => {
|
$.post(`/admin/bizuser/privileges-update?role=${newId || roleId}`, JSON.stringify(_data), (res) => {
|
||||||
if (res.error_code === 0) location.reload()
|
if (res.error_code === 0) {
|
||||||
else RbHighbar.error(res.error_msg)
|
if (newId) location.href = `${rb.baseUrl}/admin/bizuser/role/${newId}`
|
||||||
|
else location.reload()
|
||||||
|
} else {
|
||||||
|
RbHighbar.error(res.error_msg)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue