fix: 修复tags标签,getTableFieldsBUG
This commit is contained in:
@@ -62,6 +62,10 @@ class Admin extends AdminController
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->jobs = Jobs::select()->toArray();
|
||||
$this->group = AdminGroupModel::select()->toArray();
|
||||
$this->department = Department::getListTree();
|
||||
|
||||
// 判断isAjax
|
||||
if (request()->isAjax()) {
|
||||
|
||||
@@ -116,13 +120,9 @@ class Admin extends AdminController
|
||||
return $this->success('查询成功', null, $list, $count);
|
||||
}
|
||||
|
||||
$this->jobs = Jobs::select()->toArray();
|
||||
$this->group = AdminGroupModel::select()->toArray();
|
||||
$this->department = Department::getListTree();
|
||||
|
||||
return view('/system/admin/index', [
|
||||
'jobs' => $this->jobs,
|
||||
'group' => $this->group,
|
||||
'jobs' => $this->jobs,
|
||||
'group' => $this->group,
|
||||
'department' => json_encode($this->department),
|
||||
]);
|
||||
}
|
||||
@@ -223,7 +223,7 @@ class Admin extends AdminController
|
||||
/**
|
||||
* 更新权限函数
|
||||
* @access protected
|
||||
* @param string $type
|
||||
* @param string $type
|
||||
* @return \support\Response|void
|
||||
*/
|
||||
protected function _update_RuleCates(string $type = AUTH_RULES)
|
||||
@@ -252,12 +252,12 @@ class Admin extends AdminController
|
||||
}
|
||||
|
||||
$rules = array_unique(array_merge($rules, $current));
|
||||
$this->model = new AdminAccessModel();
|
||||
$AdminAccessModel = new AdminAccessModel();
|
||||
$data = [
|
||||
"$type" => implode(',', $rules)
|
||||
];
|
||||
|
||||
if ($this->model->where('admin_id', $admin_id)->save($data)) {
|
||||
if ($AdminAccessModel->where('admin_id', $admin_id)->save($data)) {
|
||||
return $this->success('更新权限成功!');
|
||||
}
|
||||
|
||||
@@ -267,35 +267,28 @@ class Admin extends AdminController
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户菜单
|
||||
* 获取用户权限树
|
||||
* getAdminRules
|
||||
* @return void
|
||||
* @return mixed
|
||||
*/
|
||||
public function getUserMenu()
|
||||
public function getPermissions()
|
||||
{
|
||||
$list = [];
|
||||
if (\request()->isAjax()) {
|
||||
return $this->auth->getRulesMenu();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 权限函数接口
|
||||
* @access public
|
||||
* @return mixed|array
|
||||
*/
|
||||
public function getRuleCateTree()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$type = input('type') ?? 'rules';
|
||||
try {
|
||||
$list = $this->auth->getRuleCatesTree($type, $this->auth->authPrivate);
|
||||
} catch (\Exception $e) {
|
||||
return $this->error($e->getMessage());
|
||||
$type = input('type', 'menu');
|
||||
$group = input('group', 0);
|
||||
if ($type == 'menu') {
|
||||
return $this->auth->getRulesMenu();
|
||||
} else {
|
||||
try {
|
||||
$list = $this->auth->getRuleCatesTree($type, $group ? $this->auth->authGroup : $this->auth->authPrivate);
|
||||
} catch (\Exception $e) {
|
||||
return $this->error($e->getMessage());
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
|
||||
return [];
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -313,34 +306,34 @@ class Admin extends AdminController
|
||||
{
|
||||
// 配置消息
|
||||
$msg = [
|
||||
'msg' => [
|
||||
'msg' => [
|
||||
'0' => [
|
||||
'title' => '你收到了几份周报!',
|
||||
'type' => '周报类型',
|
||||
'title' => '你收到了几份周报!',
|
||||
'type' => '周报类型',
|
||||
'create_time' => '1周前',
|
||||
],
|
||||
'1' => [
|
||||
'title' => '你收到了来自女下属的周报',
|
||||
'type' => '周报类型',
|
||||
'title' => '你收到了来自女下属的周报',
|
||||
'type' => '周报类型',
|
||||
'create_time' => '2周前',
|
||||
]
|
||||
],
|
||||
'comment' => [
|
||||
'0' => [
|
||||
'title' => '一个领导评论了你',
|
||||
'content' => '小伙子不错,继续努力!',
|
||||
'title' => '一个领导评论了你',
|
||||
'content' => '小伙子不错,继续努力!',
|
||||
'create_time' => '1周前',
|
||||
]
|
||||
],
|
||||
'things' => [
|
||||
'things' => [
|
||||
'0' => [
|
||||
'title' => '客户说尽快修复瞟了么APP闪退的问题...',
|
||||
'type' => '0',
|
||||
'title' => '客户说尽快修复瞟了么APP闪退的问题...',
|
||||
'type' => '0',
|
||||
'create_time' => '1周前',
|
||||
],
|
||||
'1' => [
|
||||
'title' => '秦老板和经销商的下季度合同尽快签订!',
|
||||
'type' => '1',
|
||||
'title' => '秦老板和经销商的下季度合同尽快签订!',
|
||||
'type' => '1',
|
||||
'create_time' => '2周前',
|
||||
]
|
||||
],
|
||||
@@ -377,9 +370,9 @@ class Admin extends AdminController
|
||||
$data = $this->model->find($request->adminId);
|
||||
if (!empty($data['group_id'])) {
|
||||
$group = AdminGroupModel::field('title')
|
||||
->whereIn('id', $data['group_id'])
|
||||
->select()
|
||||
->toArray();
|
||||
->whereIn('id', $data['group_id'])
|
||||
->select()
|
||||
->toArray();
|
||||
foreach ($group as $key => $value) {
|
||||
$title[$key] = $value['title'];
|
||||
}
|
||||
@@ -473,7 +466,7 @@ class Admin extends AdminController
|
||||
$this->model->where($where)->update(['pwd' => encryptPwd($post['pass'])]);
|
||||
return $this->success('更改密码成功!');
|
||||
} else {
|
||||
return $this->error('原始密码输入错误');
|
||||
return $this->error('原始密码输入错误');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -106,19 +106,6 @@ class AdminGroup extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 权限函数接口
|
||||
* @access public
|
||||
* @return mixed|array
|
||||
*/
|
||||
public function getRuleCateTree()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$type = input('type') ?? 'rules';
|
||||
return $this->auth->getRuleCatesTree($type, $this->auth->authGroup);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新权限
|
||||
*/
|
||||
|
||||
@@ -305,12 +305,6 @@ class Auth
|
||||
'field' => $this->authFields
|
||||
], true);
|
||||
}
|
||||
|
||||
if (empty($list)) {
|
||||
$list = Event::emit('cmscategoryPermissions', [
|
||||
'field' => $this->authFields
|
||||
], true);
|
||||
}
|
||||
}
|
||||
|
||||
return $tree ? ($list ? json_encode(list_to_tree($list)) : json_encode([])) : $list;
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
<span class="layui-layout-right" style="margin-right: 10px;">Build {:release()}</span>
|
||||
</div>
|
||||
<!-- // 全局获取数据接口 -->
|
||||
<authorize id="authorize" data-url="{:url('/system/Admin/getUserMenu')}"></authorize>
|
||||
<authorize id="authorize" data-url="{:url('/system/Admin/getPermissions')}"></authorize>
|
||||
</div>
|
||||
<script src="__STATICADMIN__layui/layui.js?v={:release()}"></script>
|
||||
<script src="__STATICADMIN__js/common.js?v={:release()}"></script>
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
admin.callback.auth = function(clickthis,colletction,config) {
|
||||
|
||||
// 获取表格对象
|
||||
var tableThis = colletction.tableThis,checkKeys = [];
|
||||
var tableThis = colletction.tableThis, checkKeys = [];
|
||||
|
||||
// 勾选默认权限
|
||||
if (typeof (tableThis.data.rules) !== undefined && tableThis.data.rules != null) {
|
||||
@@ -164,49 +164,60 @@
|
||||
}
|
||||
}
|
||||
|
||||
// 渲染树列表
|
||||
tree.render({
|
||||
id: 'authTree'
|
||||
,elem: '#authTree'
|
||||
,data: _ajax('rules')
|
||||
,showCheckbox: true
|
||||
,checkids: checkKeys
|
||||
,oncheck: function(obj){}
|
||||
});
|
||||
|
||||
// 监听提交
|
||||
form.on("submit(submitPage)",function(post){
|
||||
// 获取提交地址
|
||||
var pageThat = jquery(this), _form = pageThat.parents('form'),
|
||||
_pageUrl = _form.attr("action") || pageThat.data('url');
|
||||
pageThat.attr("disabled",true);
|
||||
if (typeof(_pageUrl) === 'undefined') {
|
||||
layer.msg('缺少URL属性','error');
|
||||
return false;
|
||||
}
|
||||
jquery.ajax({
|
||||
url:'{:url("/system/Admin/getPermissions")}',
|
||||
type:'post',
|
||||
dataType:'json',
|
||||
data:{
|
||||
type : 'rules',
|
||||
group: true,
|
||||
},
|
||||
success(data) {
|
||||
// 渲染树列表
|
||||
tree.render({
|
||||
id: 'authTree'
|
||||
,elem: '#authTree'
|
||||
,data: data
|
||||
,showCheckbox: true
|
||||
,oncheck: function(obj){}
|
||||
});
|
||||
tree.setChecked('authTree', checkKeys);
|
||||
|
||||
// 增加角色id
|
||||
post.field.id = tableThis.data.id;
|
||||
// 增加节点数据
|
||||
post.field.rules = tree.getChecked('authTree',true);
|
||||
|
||||
// 开始POST提交数据
|
||||
jquery.post(_pageUrl,
|
||||
post.field, function(res){
|
||||
if (res.code === 200) {
|
||||
layer.msg(res.msg);
|
||||
// 更新本地规则
|
||||
tableThis.update({
|
||||
rules: tree.getChecked('authTree',true).join(',')
|
||||
});
|
||||
// 关闭当前窗口
|
||||
layer.close(colletction.index);
|
||||
}else{
|
||||
layer.error(res.msg);
|
||||
// 监听提交
|
||||
form.on("submit(submitPage)",function(post){
|
||||
// 获取提交地址
|
||||
var pageThat = jquery(this), _form = pageThat.parents('form'),
|
||||
_pageUrl = _form.attr("action") || pageThat.data('url');
|
||||
pageThat.attr("disabled",true);
|
||||
if (typeof(_pageUrl) === 'undefined') {
|
||||
layer.msg('缺少URL属性','error');
|
||||
return false;
|
||||
}
|
||||
}, 'json');
|
||||
|
||||
return false;
|
||||
// 增加角色id
|
||||
post.field.id = tableThis.data.id;
|
||||
// 增加节点数据
|
||||
post.field.rules = tree.getChecked('authTree',true);
|
||||
|
||||
// 开始POST提交数据
|
||||
jquery.post(_pageUrl,
|
||||
post.field, function(res){
|
||||
if (res.code === 200) {
|
||||
layer.msg(res.msg);
|
||||
// 更新本地规则
|
||||
tableThis.update({
|
||||
rules: tree.getChecked('authTree',true).join(',')
|
||||
});
|
||||
// 关闭当前窗口
|
||||
layer.close(colletction.index);
|
||||
}else{
|
||||
layer.error(res.msg);
|
||||
}
|
||||
}, 'json');
|
||||
|
||||
return false;
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -225,64 +236,73 @@
|
||||
}
|
||||
}
|
||||
|
||||
var rules = _ajax('cates');
|
||||
if (typeof rules.code != "undefined") {
|
||||
return layer.msg(rules.msg,'info');
|
||||
}
|
||||
jquery.ajax({
|
||||
url:'{:url("/system/Admin/getPermissions")}',
|
||||
type:'post',
|
||||
dataType:'json',
|
||||
data:{
|
||||
type : 'cates',
|
||||
group: true,
|
||||
},
|
||||
success(data) {
|
||||
|
||||
// 渲染树列表
|
||||
tree.render({
|
||||
id: 'cateTree'
|
||||
,elem: '#cateTree'
|
||||
,data: rules
|
||||
,showCheckbox: true
|
||||
,checkids: checkKeys
|
||||
,oncheck: function(obj){}
|
||||
});
|
||||
// 渲染树列表
|
||||
tree.render({
|
||||
id: 'cateTree'
|
||||
,elem: '#cateTree'
|
||||
,data: data
|
||||
,showCheckbox: true
|
||||
,oncheck: function(obj){}
|
||||
});
|
||||
|
||||
// 监听提交
|
||||
form.on("submit(submitPage)",function(post){
|
||||
// 获取提交地址
|
||||
var pageThat = jquery(this), _form = pageThat.parents('form'),
|
||||
_pageUrl = _form.attr("action") || pageThat.data('url');
|
||||
pageThat.attr("disabled",true);
|
||||
if (typeof(_pageUrl) === 'undefined') {
|
||||
layer.msg('缺少URL属性','error');
|
||||
return false;
|
||||
}
|
||||
tree.setChecked('cateTree', checkKeys);
|
||||
|
||||
// 增加角色id
|
||||
post.field.id = tableThis.data.id;
|
||||
// 增加节点数据
|
||||
post.field.cates = tree.getChecked('cateTree',true);
|
||||
|
||||
// 开始POST提交数据
|
||||
jquery.post(_pageUrl,
|
||||
post.field, function(res){
|
||||
if (res.code === 200) {
|
||||
layer.msg(res.msg);
|
||||
// 更新栏目权限
|
||||
tableThis.update({
|
||||
cates: tree.getChecked('cateTree',true).join(',')
|
||||
});
|
||||
// 关闭当前窗口
|
||||
layer.close(colletction.index);
|
||||
}else{
|
||||
layer.error(res.msg);
|
||||
// 监听提交
|
||||
form.on("submit(submitPage)",function(post){
|
||||
// 获取提交地址
|
||||
var pageThat = jquery(this), _form = pageThat.parents('form'),
|
||||
_pageUrl = _form.attr("action") || pageThat.data('url');
|
||||
pageThat.attr("disabled",true);
|
||||
if (typeof(_pageUrl) === 'undefined') {
|
||||
layer.msg('缺少URL属性','error');
|
||||
return false;
|
||||
}
|
||||
}, 'json');
|
||||
|
||||
return false;
|
||||
})
|
||||
// 增加角色id
|
||||
post.field.id = tableThis.data.id;
|
||||
// 增加节点数据
|
||||
post.field.cates = tree.getChecked('cateTree',true);
|
||||
|
||||
// 开始POST提交数据
|
||||
jquery.post(_pageUrl,
|
||||
post.field, function(res){
|
||||
if (res.code === 200) {
|
||||
layer.msg(res.msg);
|
||||
// 更新栏目权限
|
||||
tableThis.update({
|
||||
cates: tree.getChecked('cateTree',true).join(',')
|
||||
});
|
||||
// 关闭当前窗口
|
||||
layer.close(colletction.index);
|
||||
}else{
|
||||
layer.error(res.msg);
|
||||
}
|
||||
}, 'json');
|
||||
|
||||
return false;
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
// var rules = _ajax('cates');
|
||||
// if (typeof rules.code != "undefined") {
|
||||
// return layer.msg(rules.msg,'info');
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 同步加载函数
|
||||
var _ajax = function (type) {
|
||||
var func = '{:url("/system/Admin/getRuleCateTree")}';
|
||||
return admin.event.ajax(func,{
|
||||
type : type,
|
||||
},false)
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -333,7 +333,7 @@
|
||||
// 开始POST提交数据
|
||||
layui.$.post(_pageUrl,
|
||||
post.field, function(res){
|
||||
if (res.code == 200) {
|
||||
if (res.code === 200) {
|
||||
layer.msg(res.msg);
|
||||
// 关闭当前窗口
|
||||
table.reload('lay-tableList');
|
||||
@@ -351,58 +351,55 @@
|
||||
|
||||
// 编辑用户权限/栏目权限回调函数
|
||||
admin.callback.rulecates = function(clickthis,colletction,config) {
|
||||
var tableThis = colletction.tableThis,
|
||||
event = tableThis.event;
|
||||
|
||||
var tableThis = colletction.tableThis, event = tableThis.event;
|
||||
layui.$.ajax({
|
||||
url:'{:url("/system/Admin/getPermissions")}',
|
||||
type:'post',
|
||||
dataType:'json',
|
||||
data:{
|
||||
type : event,
|
||||
},
|
||||
success(data) {
|
||||
tree.render({
|
||||
id: 'authTree',
|
||||
elem: '#authTree',
|
||||
data: data,
|
||||
showCheckbox: true,
|
||||
})
|
||||
|
||||
var rules = _ajax(event);
|
||||
if (typeof rules.code != "undefined") {
|
||||
return layer.msg(rules.msg,'info');
|
||||
}
|
||||
tree.setChecked('authTree', tableThis.data[event].length ? tableThis.data[event].map(Number): []);
|
||||
|
||||
// 创建实例
|
||||
tree.render({
|
||||
id: 'authTree',
|
||||
elem: '#authTree',
|
||||
data: rules,
|
||||
showCheckbox: true,
|
||||
checkids: tableThis.data[event].map(Number)
|
||||
// 监听权限提交
|
||||
form.on("submit(submitPage)", function (post) {
|
||||
|
||||
// 获取用户id
|
||||
post.field.admin_id = tableThis.data.id;
|
||||
// 增加节点数据
|
||||
post.field[event] = tree.getChecked('authTree', true);
|
||||
// 开始POST提交数据
|
||||
clickthis.attr("disabled", true);
|
||||
layui.$.post("{:url('/system/admin/edit" + event + "')}",
|
||||
post.field, function (res) {
|
||||
if (res.code === 200) {
|
||||
// 更新本地规则
|
||||
tableThis.update({
|
||||
[event]: post.field[event]
|
||||
});
|
||||
|
||||
// 关闭当前窗口
|
||||
layer.msg(res.msg);
|
||||
layer.close(colletction.index);
|
||||
} else {
|
||||
layer.error(res.msg);
|
||||
}
|
||||
}, 'json');
|
||||
|
||||
return false;
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
// 监听权限提交
|
||||
form.on("submit(submitPage)", function (post) {
|
||||
|
||||
// 获取用户id
|
||||
post.field.admin_id = tableThis.data.id;
|
||||
// 增加节点数据
|
||||
post.field[event] = tree.getChecked('authTree', true);
|
||||
// 开始POST提交数据
|
||||
clickthis.attr("disabled", true);
|
||||
layui.$.post("{:url('/system/admin/edit" + event + "')}",
|
||||
post.field, function (res) {
|
||||
if (res.code === 200) {
|
||||
// 更新本地规则
|
||||
tableThis.update({
|
||||
[event]: post.field[event]
|
||||
});
|
||||
|
||||
// 关闭当前窗口
|
||||
layer.msg(res.msg);
|
||||
layer.close(colletction.index);
|
||||
} else {
|
||||
layer.error(res.msg);
|
||||
}
|
||||
}, 'json');
|
||||
|
||||
return false;
|
||||
})
|
||||
}
|
||||
|
||||
// 同步加载函数
|
||||
var _ajax = function (type) {
|
||||
var func = '{:url("/system/Admin/getRuleCateTree")}';
|
||||
return admin.event.ajax(func,{
|
||||
type : type,
|
||||
},false)
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -301,7 +301,7 @@
|
||||
return layui.layer.error('路由必须以/符号开始');
|
||||
}
|
||||
router = router.substring(1);
|
||||
jquery('.alias').val(router.replace('/',':'));
|
||||
jquery('.alias').val(router.replaceAll('/',':'));
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@
|
||||
{field: 'email', align: 'center',title: '{:__("邮箱")}'},
|
||||
{field: 'address', width: 220,title: '{:__("部门地址")}'},
|
||||
{field: 'sort', width: 80, align: 'center',title: '{:__("排序")}'},
|
||||
{field: 'create_time', align: 'center',width: 160,title: '{:__("创建时间")}'},
|
||||
{field: 'create_time', align: 'center',width: 180,title: '{:__("创建时间")}'},
|
||||
{align: 'center', toolbar: '#tableBar', width: 160,title: '{:__("操作")}'},
|
||||
]]
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user