mirror of https://gitee.com/karson/fastadmin.git
更新权限管理语言包
parent
d2752716dc
commit
a18ace7cf5
|
|
@ -84,12 +84,13 @@ class Group extends Backend
|
|||
if (!in_array($params['pid'], $this->childrenIds))
|
||||
{
|
||||
$this->code = -1;
|
||||
$this->msg = __('');
|
||||
return;
|
||||
}
|
||||
$parentmodel = model("AuthGroup")->get($params['pid']);
|
||||
if (!$parentmodel)
|
||||
{
|
||||
$this->code = -1;
|
||||
$this->msg = __('The parent group can not found');
|
||||
return;
|
||||
}
|
||||
// 父级别的规则节点
|
||||
|
|
@ -126,10 +127,10 @@ class Group extends Backend
|
|||
{
|
||||
$this->code = -1;
|
||||
$params = $this->request->post("row/a");
|
||||
// 复节点不能是它自身的子节点
|
||||
// 父节点不能是它自身的子节点
|
||||
if (!in_array($params['pid'], $this->childrenIds))
|
||||
{
|
||||
$this->code = -1;
|
||||
$this->msg = __('The parent group can not be its own child');
|
||||
return;
|
||||
}
|
||||
$params['rules'] = explode(',', $params['rules']);
|
||||
|
|
@ -137,7 +138,7 @@ class Group extends Backend
|
|||
$parentmodel = model("AuthGroup")->get($params['pid']);
|
||||
if (!$parentmodel)
|
||||
{
|
||||
$this->code = -1;
|
||||
$this->msg = __('The parent group can not found');
|
||||
return;
|
||||
}
|
||||
// 父级别的规则节点
|
||||
|
|
@ -200,6 +201,11 @@ class Group extends Backend
|
|||
continue;
|
||||
}
|
||||
}
|
||||
if (!$ids)
|
||||
{
|
||||
$this->msg = __('You can not delete group that contain child group and administrators');
|
||||
return;
|
||||
}
|
||||
$count = $this->model->where('id', 'in', $ids)->delete();
|
||||
if ($count)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'Group' => '所属组别',
|
||||
'Login time' => '最后登录',
|
||||
];
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'The parent group can not be its own child' => '父组别不能是自身的子组别',
|
||||
'The parent group can not found' => '父组别未找到',
|
||||
'You can not delete group that contain child group and administrators' => '你不能删除含有子组和管理员的组',
|
||||
];
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'Toggle all' => '显示全部',
|
||||
'Condition' => '条件',
|
||||
'Remark' => '备注',
|
||||
'Icon' => '图标',
|
||||
'Alert' => '警告',
|
||||
'If not necessary, use the command line to build rule' => '非必要情况下请使用命令行来生成',
|
||||
];
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<div class="callout callout-info">
|
||||
<h4>{:__('Alert')}!</h4>
|
||||
{:__('If not necessary, use the rebuild node feature directly')}
|
||||
{:__('If not necessary, use the command line to build rule')}
|
||||
</div>
|
||||
<form id="add-form" class="form-horizontal form-ajax" role="form" data-toggle="validator" method="POST" action="">
|
||||
<div class="form-group">
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
<div id="toolbar" class="toolbar">
|
||||
{:build_toolbar()}
|
||||
<a href="javascript:;" class="btn btn-danger btn-toggle-all"><i class="fa fa-plus"></i> {:__('Toggle all')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-rebuild">{:__('Rebuild node')}</a>
|
||||
</div>
|
||||
<table id="table" class="table table-bordered table-hover" width="100%">
|
||||
|
||||
|
|
|
|||
|
|
@ -41,69 +41,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
|
|||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);//当内容渲染完成后
|
||||
|
||||
$(document).on("click", ".btn-rebuild", function () {
|
||||
Backend.api.layer.confirm(
|
||||
__('Are you sure you want to rebuild node?'),
|
||||
{icon: 3, title: __('Warning'), offset: 0},
|
||||
function (index) {
|
||||
Backend.api.layer.close(index);
|
||||
Backend.api.ajax({url: "auth/rule/rebuild", data: {step: 1}}, function (content) {
|
||||
table.bootstrapTable('refresh');
|
||||
var msg = '<div style="padding:20px;"><div class="alert alert-warning alert-light">' + __('You can change the node name if you want to') + '</div><label>' + __('Node list') + '</label><div id="treeview"></div></div>';
|
||||
Backend.api.layer.open({
|
||||
type: 1,
|
||||
content: msg,
|
||||
area: ['600px', '400px'],
|
||||
scrollbar: false,
|
||||
success: function (layero, index) {
|
||||
require(['jstree'], function () {
|
||||
$("#treeview", $(layero)).jstree({
|
||||
"themes": {"stripes": true},
|
||||
"types": {
|
||||
"menu": {
|
||||
"icon": "fa fa-folder-open",
|
||||
"valid_children": []
|
||||
},
|
||||
"file": {
|
||||
"icon": "fa fa-file-o",
|
||||
"valid_children": []
|
||||
}
|
||||
},
|
||||
"plugins": ["types"],
|
||||
"core": {
|
||||
'check_callback': true,
|
||||
"data": content
|
||||
}
|
||||
}).bind("select_node.jstree", function (e, data) {
|
||||
var ref = $("#treeview", layero).jstree(true);
|
||||
ref.edit(data.node);
|
||||
});
|
||||
});
|
||||
}
|
||||
,
|
||||
btn: [__('OK'), __('Cancel')],
|
||||
yes: function (index, layero) {
|
||||
//递归获取所有节点信息
|
||||
var get_children = function (node) {
|
||||
var data = [];
|
||||
$.each(node, function (i, j) {
|
||||
data.push({id: j.id, name: j.text});
|
||||
data = data.concat(get_children(j.children));
|
||||
});
|
||||
return data;
|
||||
};
|
||||
var data = get_children($("#treeview").jstree('get_json'));
|
||||
Backend.api.ajax({url: "auth/rule/rebuild", data: {step: 2, data: data}}, function (content) {
|
||||
Backend.api.layer.close(index);
|
||||
top.location.reload();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
//默认隐藏所有子节点
|
||||
table.on('post-body.bs.table', function (e, settings, json, xhr) {
|
||||
$("a.btn[data-id][data-pid][data-pid!=0]").closest("tr").hide();
|
||||
|
|
|
|||
Loading…
Reference in New Issue