mirror of
https://github.com/getrebuild/rebuild.git
synced 2024-11-10 17:04:33 +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 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>
|
||||
<div class="btn-group btn-space">
|
||||
<button class="btn btn-primary J_save" type="button" disabled="disabled">[[${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-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 ml-1" th:if="${id != null}">
|
||||
<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"><i class="icon zmdi zmdi-chevron-down"></i></button>
|
||||
<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>
|
||||
</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.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
RbForm.postAfter = function (data) {
|
||||
location.href = `${rb.baseUrl}/admin/bizuser/role/${data.id}`
|
||||
}
|
||||
|
||||
const roleId = window.__PageConfig.recordId
|
||||
|
||||
// 自定义
|
||||
|
@ -22,15 +17,22 @@ let fieldpSettings = {}
|
|||
$(document).ready(() => {
|
||||
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) {
|
||||
$('.J_save').attr('disabled', false)
|
||||
$('.J_save').next().attr('disabled', false)
|
||||
|
||||
loadPrivileges()
|
||||
|
||||
$('.J_save').on('click', updatePrivileges)
|
||||
$('.J_save').on('click', () => updatePrivileges())
|
||||
$('.J_copy-role').on('click', () => renderRbcomp(<CopyRoleTo roleId={roleId} />))
|
||||
|
||||
$('.nav-tabs li:eq(2)').removeClass('hide')
|
||||
|
@ -256,7 +258,7 @@ const loadPrivileges = function () {
|
|||
})
|
||||
}
|
||||
|
||||
const updatePrivileges = function () {
|
||||
const updatePrivileges = function (newId) {
|
||||
const privEntity = {}
|
||||
$('#priv-entity tbody>tr').each(function () {
|
||||
const $tr = $(this)
|
||||
|
@ -297,9 +299,13 @@ const updatePrivileges = function () {
|
|||
zero: privZero,
|
||||
}
|
||||
|
||||
$.post(`/admin/bizuser/privileges-update?role=${roleId}`, JSON.stringify(_data), (res) => {
|
||||
if (res.error_code === 0) location.reload()
|
||||
else RbHighbar.error(res.error_msg)
|
||||
$.post(`/admin/bizuser/privileges-update?role=${newId || roleId}`, JSON.stringify(_data), (res) => {
|
||||
if (res.error_code === 0) {
|
||||
if (newId) location.href = `${rb.baseUrl}/admin/bizuser/role/${newId}`
|
||||
else location.reload()
|
||||
} else {
|
||||
RbHighbar.error(res.error_msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue