优化系统管理模块的各个页面体验,权限删除添加限制:还在使用的权限组限制删除
This commit is contained in:
parent
6d083d9405
commit
87c526ae38
@ -106,17 +106,17 @@ class Conf extends BaseController
|
||||
$module = strtolower(app('http')->getName());
|
||||
$class = strtolower(app('request')->controller());
|
||||
$action = strtolower(app('request')->action());
|
||||
$template = $module . '/view/'. $class .'/'.$conf['name'].'.html';
|
||||
$template = $module . '/view/' . $class . '/' . $conf['name'] . '.html';
|
||||
$config = [];
|
||||
if ($conf['content']) {
|
||||
$config = unserialize($conf['content']);
|
||||
}
|
||||
View::assign('id', $id);
|
||||
View::assign('config', $config);
|
||||
if(isTemplate($template)){
|
||||
if (isTemplate($template)) {
|
||||
return view($conf['name']);
|
||||
}else{
|
||||
return view('../../base/view/common/errortemplate',['file' =>$template]);
|
||||
} else {
|
||||
return view('../../base/view/common/errortemplate', ['file' => $template]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,129 +12,127 @@ namespace app\home\controller;
|
||||
use app\base\BaseController;
|
||||
use backup\Backup;
|
||||
use think\facade\Session;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Database extends BaseController
|
||||
{
|
||||
//数据表列表
|
||||
public function database()
|
||||
//数据表列表
|
||||
public function database()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
// 数据信息
|
||||
$db = new Backup();
|
||||
$list = $db->dataList();
|
||||
// 计算总大小
|
||||
$total = 0;
|
||||
foreach ($list as $k => $v) {
|
||||
$total += $v['data_length'];
|
||||
$list[$k]['data_size'] = $v['data_length'];
|
||||
$list[$k]['data_length'] = format_bytes($v['data_length']);
|
||||
}
|
||||
// 提示信息
|
||||
$dataTips = '数据库中共有<strong> ' . count($list) . '</strong> 张表,共计 <strong>' . format_bytes($total) . '</strong>大小。';
|
||||
$data['data'] = $list;
|
||||
return table_assign(0, $dataTips, $data);
|
||||
}
|
||||
return view();
|
||||
}
|
||||
|
||||
//备份数据
|
||||
public function backup()
|
||||
{
|
||||
$db= new Backup();
|
||||
if(request()->isPost()){
|
||||
$tables=get_params('tables');
|
||||
$fileinfo =$db->getFile();
|
||||
//检查是否有正在执行的任务
|
||||
$lock = "{$fileinfo['filepath']}backup.lock";
|
||||
if(is_file($lock)){
|
||||
return to_assign(2, '检测到有一个备份任务未完成');
|
||||
} else {
|
||||
//创建锁文件
|
||||
file_put_contents($lock,time());
|
||||
if (request()->isAjax()) {
|
||||
// 数据信息
|
||||
$db = new Backup();
|
||||
$list = $db->dataList();
|
||||
// 计算总大小
|
||||
$total = 0;
|
||||
foreach ($list as $k => $v) {
|
||||
$total += $v['data_length'];
|
||||
$list[$k]['data_size'] = $v['data_length'];
|
||||
$list[$k]['data_length'] = format_bytes($v['data_length']);
|
||||
}
|
||||
// 提示信息
|
||||
$dataTips = '数据库中共有<strong> ' . count($list) . '</strong> 张表,共计 <strong>' . format_bytes($total) . '</strong>大小。';
|
||||
$data['data'] = $list;
|
||||
return table_assign(0, $dataTips, $data);
|
||||
}
|
||||
return view();
|
||||
}
|
||||
|
||||
//备份数据
|
||||
public function backup()
|
||||
{
|
||||
$db = new Backup();
|
||||
if (request()->isPost()) {
|
||||
$tables = get_params('tables');
|
||||
$fileinfo = $db->getFile();
|
||||
//检查是否有正在执行的任务
|
||||
$lock = "{$fileinfo['filepath']}backup.lock";
|
||||
if (is_file($lock)) {
|
||||
return to_assign(2, '检测到有一个备份任务未完成');
|
||||
} else {
|
||||
//创建锁文件
|
||||
file_put_contents($lock, time());
|
||||
}
|
||||
// 检查备份目录是否可写
|
||||
if(!is_writeable($fileinfo['filepath'])){
|
||||
return to_assign(1, '备份目录不存在或不可写,请检查后重试');
|
||||
if (!is_writeable($fileinfo['filepath'])) {
|
||||
return to_assign(1, '备份目录不存在或不可写,请检查后重试');
|
||||
}
|
||||
|
||||
//缓存锁文件
|
||||
Session::set('lock', $lock);
|
||||
//缓存备份文件信息
|
||||
Session::set('backup_file', $fileinfo['file']);
|
||||
//缓存要备份的表
|
||||
Session::set('backup_tables', $tables);
|
||||
//创建备份文件
|
||||
if(false !== $db->Backup_Init()){
|
||||
return to_assign(0, '初始化成功,开始备份...',['tab'=>['id' => 0, 'start' => 0,'table'=>$tables[0]]]);
|
||||
}else{
|
||||
return to_assign(1, '初始化失败,备份文件创建失败');
|
||||
}
|
||||
}else if(request()->isGet()){
|
||||
$tables = Session::get('backup_tables');
|
||||
$file=Session::get('backup_file');
|
||||
$id=get_params('id');
|
||||
$start=get_params('start');
|
||||
$start= $db->setFile($file)->backup($tables[$id], $start);
|
||||
if(false === $start){
|
||||
return to_assign(1, '备份出错');
|
||||
}else if(0 === $start){
|
||||
if(isset($tables[++$id])){
|
||||
return to_assign(0, '备份完成',['tab'=>['id' => $id, 'start' => 0,'table'=>$tables[$id-1]]]);
|
||||
} else { //备份完成,清空缓存
|
||||
unlink(Session::get('lock'));
|
||||
Session::delete('backup_tables');
|
||||
Session::delete('backup_file');
|
||||
add_log('bak');
|
||||
return to_assign(0, '备份完成',['tab'=>['start' => 'ok','table'=>$tables[$id-1]]]);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
return to_assign(1, '参数错误!');
|
||||
}
|
||||
}
|
||||
|
||||
//优化表
|
||||
public function optimize($tables= null)
|
||||
{
|
||||
$db= new Backup();
|
||||
//return to_assign(0, $db->optimize($tables));
|
||||
if($db->optimize($tables)){
|
||||
add_log('optimize');
|
||||
return to_assign(0, '数据表优化完成');
|
||||
}else{
|
||||
return to_assign(1, '数据表优化出错请重试');
|
||||
//缓存锁文件
|
||||
Session::set('lock', $lock);
|
||||
//缓存备份文件信息
|
||||
Session::set('backup_file', $fileinfo['file']);
|
||||
//缓存要备份的表
|
||||
Session::set('backup_tables', $tables);
|
||||
//创建备份文件
|
||||
if (false !== $db->Backup_Init()) {
|
||||
return to_assign(0, '初始化成功,开始备份...', ['tab' => ['id' => 0, 'start' => 0, 'table' => $tables[0]]]);
|
||||
} else {
|
||||
return to_assign(1, '初始化失败,备份文件创建失败');
|
||||
}
|
||||
} else if (request()->isGet()) {
|
||||
$tables = Session::get('backup_tables');
|
||||
$file = Session::get('backup_file');
|
||||
$id = get_params('id');
|
||||
$start = get_params('start');
|
||||
$start = $db->setFile($file)->backup($tables[$id], $start);
|
||||
if (false === $start) {
|
||||
return to_assign(1, '备份出错');
|
||||
} else if (0 === $start) {
|
||||
if (isset($tables[++$id])) {
|
||||
return to_assign(0, '备份完成', ['tab' => ['id' => $id, 'start' => 0, 'table' => $tables[$id - 1]]]);
|
||||
} else { //备份完成,清空缓存
|
||||
unlink(Session::get('lock'));
|
||||
Session::delete('backup_tables');
|
||||
Session::delete('backup_file');
|
||||
add_log('bak');
|
||||
return to_assign(0, '备份完成', ['tab' => ['start' => 'ok', 'table' => $tables[$id - 1]]]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return to_assign(1, '参数错误!');
|
||||
}
|
||||
}
|
||||
|
||||
//修复表
|
||||
public function repair($tables= null)
|
||||
{
|
||||
$db= new Backup();
|
||||
//return to_assign(0, $db->repair($tables));
|
||||
if($db->repair($tables)){
|
||||
add_log('repair');
|
||||
return to_assign(0, '数据表修复完成');
|
||||
}else{
|
||||
return to_assign(1, '数据表修复出错请重试');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//备份文件列表
|
||||
public function backuplist()
|
||||
{
|
||||
$db= new Backup();
|
||||
$list = $db->fileList();
|
||||
$fileinfo =$db->getFile();
|
||||
$lock = "{$fileinfo['filepath']}backup.lock";
|
||||
$lock_time = 0;
|
||||
if(is_file($lock)){
|
||||
$lock_time = file_get_contents($lock);
|
||||
}
|
||||
$listNew = [];
|
||||
$indx = 0;
|
||||
}
|
||||
|
||||
//优化表
|
||||
public function optimize($tables = null)
|
||||
{
|
||||
$db = new Backup();
|
||||
//return to_assign(0, $db->optimize($tables));
|
||||
if ($db->optimize($tables)) {
|
||||
add_log('optimize');
|
||||
return to_assign(0, '数据表优化完成');
|
||||
} else {
|
||||
return to_assign(1, '数据表优化出错请重试');
|
||||
}
|
||||
}
|
||||
|
||||
//修复表
|
||||
public function repair($tables = null)
|
||||
{
|
||||
$db = new Backup();
|
||||
//return to_assign(0, $db->repair($tables));
|
||||
if ($db->repair($tables)) {
|
||||
add_log('repair');
|
||||
return to_assign(0, '数据表修复完成');
|
||||
} else {
|
||||
return to_assign(1, '数据表修复出错请重试');
|
||||
}
|
||||
}
|
||||
|
||||
//备份文件列表
|
||||
public function backuplist()
|
||||
{
|
||||
$db = new Backup();
|
||||
$list = $db->fileList();
|
||||
$fileinfo = $db->getFile();
|
||||
$lock = "{$fileinfo['filepath']}backup.lock";
|
||||
$lock_time = 0;
|
||||
if (is_file($lock)) {
|
||||
$lock_time = file_get_contents($lock);
|
||||
}
|
||||
$listNew = [];
|
||||
$indx = 0;
|
||||
foreach ($list as $k => $v) {
|
||||
$listNew[$indx]['time'] = $k;
|
||||
$listNew[$indx]['timespan'] = $v['time'];
|
||||
@ -143,79 +141,81 @@ class Database extends BaseController
|
||||
}
|
||||
$list = $listNew;
|
||||
array_multisort(array_column($list, 'time'), SORT_DESC, $list);
|
||||
return view('',['list'=>$list,'lock_time' => $lock_time]);
|
||||
}
|
||||
|
||||
//数据还原
|
||||
public function import($time = 0, $part = null, $start = null)
|
||||
{
|
||||
$db= new Backup();
|
||||
$time =(int)$time;
|
||||
if(is_numeric($time) && is_null($part) && is_null($start)){
|
||||
$list = $db->getFile('timeverif',$time);
|
||||
if(is_array($list)){
|
||||
Session::set('backup_list', $list);
|
||||
return to_assign(0, '初始化完成,开始还原...',array('part' => 1, 'start' => 0,'time' => $time));
|
||||
}else{
|
||||
return to_assign(1, '备份文件可能已经损坏,请检查');
|
||||
}
|
||||
}else if(is_numeric($part) && is_numeric($start)){
|
||||
$list=Session::get('backup_list');
|
||||
$part =(int)$part;
|
||||
$start =(int)$start;
|
||||
$start= $db->setFile($list)->import($start,$time,$part);
|
||||
if(false===$start){
|
||||
return to_assign(1, '还原数据出错,请重试');
|
||||
}elseif(0 === $start){
|
||||
if(isset($list[++$part])){
|
||||
$data = array('part' => $part, 'start' => 0,'time' => $time);
|
||||
return to_assign(0, "正在还原...卷{$part},请勿关闭当前页面",$data);
|
||||
return view('', ['list' => $list, 'lock_time' => $lock_time]);
|
||||
}
|
||||
|
||||
//数据还原
|
||||
public function import($time = 0, $part = null, $start = null)
|
||||
{
|
||||
$db = new Backup();
|
||||
$time = (int) $time;
|
||||
if (is_numeric($time) && is_null($part) && is_null($start)) {
|
||||
$list = $db->getFile('timeverif', $time);
|
||||
if (is_array($list)) {
|
||||
Session::set('backup_list', $list);
|
||||
return to_assign(0, '初始化完成,开始还原...', array('part' => 1, 'start' => 0, 'time' => $time));
|
||||
} else {
|
||||
return to_assign(1, '备份文件可能已经损坏,请检查');
|
||||
}
|
||||
} else if (is_numeric($part) && is_numeric($start)) {
|
||||
$list = Session::get('backup_list');
|
||||
$part = (int) $part;
|
||||
$start = (int) $start;
|
||||
$start = $db->setFile($list)->import($start, $time, $part);
|
||||
if (false === $start) {
|
||||
return to_assign(1, '还原数据出错,请重试');
|
||||
} elseif (0 === $start) {
|
||||
if (isset($list[++$part])) {
|
||||
$data = array('part' => $part, 'start' => 0, 'time' => $time);
|
||||
return to_assign(0, "正在还原...卷{$part},请勿关闭当前页面", $data);
|
||||
} else {
|
||||
Session::delete('backup_list');
|
||||
return to_assign(0, '还原数据成功');
|
||||
return to_assign(0, '还原数据成功');
|
||||
}
|
||||
}else{
|
||||
$data = array('part' => $part, 'start' => $start[0],'time' => $time);
|
||||
if($start[1]){
|
||||
} else {
|
||||
$data = array('part' => $part, 'start' => $start[0], 'time' => $time);
|
||||
if ($start[1]) {
|
||||
$rate = floor(100 * ($start[0] / $start[1]));
|
||||
return to_assign(0, "正在还原...卷{$part} ({$rate}%),请勿关闭当前页面",$data);
|
||||
return to_assign(0, "正在还原...卷{$part} ({$rate}%),请勿关闭当前页面", $data);
|
||||
} else {
|
||||
$data['gz'] = 1;
|
||||
return to_assign(0, "正在还原...卷{$part},请勿关闭当前页面",$data);
|
||||
return to_assign(0, "正在还原...卷{$part},请勿关闭当前页面", $data);
|
||||
}
|
||||
return to_assign(0, "正在还原...卷{$part},请勿关闭当前页面");
|
||||
}
|
||||
}else{
|
||||
return to_assign(1, "参数错误");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 删除备份文件
|
||||
*/
|
||||
public function del($time = 0,$lock=0){
|
||||
$db= new Backup();
|
||||
if($lock==1){
|
||||
$fileinfo =$db->getFile();
|
||||
$lock = "{$fileinfo['filepath']}backup.lock";
|
||||
if(is_file($lock)){
|
||||
$time = file_get_contents($lock);
|
||||
unlink($lock);
|
||||
}
|
||||
}
|
||||
if($db->delFile((int)$time)){
|
||||
add_log('delete');
|
||||
return to_assign(0, '删除成功');
|
||||
}else{
|
||||
return to_assign(0, '删除失败,请检查权限');
|
||||
}
|
||||
}
|
||||
return to_assign(0, "正在还原...卷{$part},请勿关闭当前页面");
|
||||
}
|
||||
} else {
|
||||
return to_assign(1, "参数错误");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 下载备份文件
|
||||
*/
|
||||
public function downfile($time = 0,$part=0){
|
||||
$db= new Backup();
|
||||
add_log('down');
|
||||
$db->downloadFile((int)$time,$part-1);
|
||||
}
|
||||
|
||||
}
|
||||
* 删除备份文件
|
||||
*/
|
||||
public function del($time = 0, $lock = 0)
|
||||
{
|
||||
$db = new Backup();
|
||||
if ($lock == 1) {
|
||||
$fileinfo = $db->getFile();
|
||||
$lock = "{$fileinfo['filepath']}backup.lock";
|
||||
if (is_file($lock)) {
|
||||
$time = file_get_contents($lock);
|
||||
unlink($lock);
|
||||
}
|
||||
}
|
||||
if ($db->delFile((int) $time)) {
|
||||
add_log('delete');
|
||||
return to_assign(0, '删除成功');
|
||||
} else {
|
||||
return to_assign(0, '删除失败,请检查权限');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 下载备份文件
|
||||
*/
|
||||
public function downfile($time = 0, $part = 0)
|
||||
{
|
||||
$db = new Backup();
|
||||
add_log('down');
|
||||
$db->downloadFile((int) $time, $part - 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ class Log extends BaseController
|
||||
$param = get_params();
|
||||
$where = array();
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['name|content|param_id', 'like', '%' . $param['keywords'] . '%'];
|
||||
$where[] = ['name|content|param_id|uid', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
if (!empty($param['action'])) {
|
||||
$where[] = ['action','=',$param['action']];
|
||||
|
@ -89,15 +89,23 @@ class Role extends BaseController
|
||||
//删除
|
||||
public function delete()
|
||||
{
|
||||
$id = get_params("id");
|
||||
if ($id == 1) {
|
||||
return to_assign(1, "该组是系统所有者,无法删除");
|
||||
}
|
||||
if (Db::name('AdminGroup')->delete($id) !== false) {
|
||||
add_log('delete', $id, []);
|
||||
return to_assign(0, "删除角色成功");
|
||||
if (request()->isDelete()) {
|
||||
$id = get_params("id");
|
||||
if ($id == 1) {
|
||||
return to_assign(1, "该组是系统所有者,无法删除");
|
||||
}
|
||||
$count = Db::name('PositionGroup')->where(["group_id" => $id])->count();
|
||||
if ($count > 0) {
|
||||
return to_assign(1, "该权限组还在使用,请去除使用者关联再删除");
|
||||
}
|
||||
if (Db::name('AdminGroup')->delete($id) !== false) {
|
||||
add_log('delete', $id, []);
|
||||
return to_assign(0, "删除权限组成功");
|
||||
} else {
|
||||
return to_assign(1, "删除失败");
|
||||
}
|
||||
} else {
|
||||
return to_assign(1, "删除失败");
|
||||
return to_assign(1, "错误的请求");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,11 +21,11 @@ class Rule extends BaseController
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$rule = Db::name('adminRule')
|
||||
->field('a.*,m.title as module_title')
|
||||
->alias('a')
|
||||
->leftJoin('adminModule m','a.module = m.name')
|
||||
->order('a.sort asc,a.id asc')
|
||||
->select();
|
||||
->field('a.*,m.title as module_title')
|
||||
->alias('a')
|
||||
->leftJoin('adminModule m', 'a.module = m.name')
|
||||
->order('a.sort asc,a.id asc')
|
||||
->select();
|
||||
return to_assign(0, '', $rule);
|
||||
} else {
|
||||
return view();
|
||||
@ -37,7 +37,7 @@ class Rule extends BaseController
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isAjax()) {
|
||||
$param['src'] = preg_replace('# #','',$param['src']);
|
||||
$param['src'] = preg_replace('# #', '', $param['src']);
|
||||
if ($param['id'] > 0) {
|
||||
try {
|
||||
validate(RuleCheck::class)->scene('edit')->check($param);
|
||||
@ -71,8 +71,8 @@ class Rule extends BaseController
|
||||
} else {
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$pid = isset($param['pid']) ? $param['pid'] : 0;
|
||||
if($id>0){
|
||||
$detail = Db::name('AdminRule')->where('id',$id)->find();
|
||||
if ($id > 0) {
|
||||
$detail = Db::name('AdminRule')->where('id', $id)->find();
|
||||
View::assign('detail', $detail);
|
||||
}
|
||||
View::assign('id', $id);
|
||||
@ -83,17 +83,21 @@ class Rule extends BaseController
|
||||
//删除
|
||||
public function delete()
|
||||
{
|
||||
$id = get_params("id");
|
||||
$count = Db::name('AdminRule')->where(["pid" => $id])->count();
|
||||
if ($count > 0) {
|
||||
return to_assign(1, "该节点下还有子节点,无法删除");
|
||||
}
|
||||
if (Db::name('AdminRule')->delete($id) !== false) {
|
||||
clear_cache('adminRules');
|
||||
add_log('delete', $id, []);
|
||||
return to_assign(0, "删除节点成功");
|
||||
if (request()->isDelete()) {
|
||||
$id = get_params("id");
|
||||
$count = Db::name('AdminRule')->where(["pid" => $id])->count();
|
||||
if ($count > 0) {
|
||||
return to_assign(1, "该节点下还有子节点,无法删除");
|
||||
}
|
||||
if (Db::name('AdminRule')->delete($id) !== false) {
|
||||
clear_cache('adminRules');
|
||||
add_log('delete', $id, []);
|
||||
return to_assign(0, "删除节点成功");
|
||||
} else {
|
||||
return to_assign(1, "删除失败");
|
||||
}
|
||||
} else {
|
||||
return to_assign(1, "删除失败");
|
||||
return to_assign(1, "错误的请求");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@
|
||||
<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="reset">清除不完整的备份</a>
|
||||
{else/}
|
||||
<a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="import">数据还原</a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">备份删除</a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除备份</a>
|
||||
{/if}
|
||||
</div>
|
||||
</td>
|
||||
|
@ -29,7 +29,6 @@
|
||||
var tableIns = table.render({
|
||||
elem: '#log',
|
||||
title: '操作日志列表',
|
||||
toolbar: '#toolbarDemo',
|
||||
url: "/home/log/index", //数据接口
|
||||
page: true, //开启分页
|
||||
limit: 20,
|
||||
|
@ -1,23 +1,28 @@
|
||||
{extend name="../../base/view/common/base" /}
|
||||
{block name="style"}
|
||||
<style>
|
||||
.checkbox16 .layui-form-checkbox span{font-size:15px;font-weight:800;}
|
||||
#rule .layui-checkbox-disabled span {color: #666666!important;}
|
||||
.left-note{font-weight:800; vertical-align:top; padding-top:28px!important; text-align:center}
|
||||
.left-note .layui-form-checkbox span{background-color: #969696;}
|
||||
.left-note .layui-form-checkbox:hover span{background-color: #808080;}
|
||||
|
||||
.left-note .layui-form-checked span, .left-note .layui-form-checked:hover span { background-color: #5fb878;}
|
||||
.checkbox14 .layui-form-checkbox span{font-size:15px;font-weight:800;}
|
||||
.right-note .layui-checkbox-disabled span {color: #666666!important;}
|
||||
</style>
|
||||
{/block}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
|
||||
<form class="layui-form p-4">
|
||||
<h3 class="pb-3">权限角色</h3>
|
||||
<h3 class="pb-3">权限组</h3>
|
||||
<table class="layui-table layui-table-form">
|
||||
<tr>
|
||||
<td class="layui-td-gray">角色名称<font>*</font>
|
||||
<td class="layui-td-gray-2">权限组名称<font>*</font>
|
||||
</td>
|
||||
<td>
|
||||
<input type="hidden" name="id" value="{$id}" />
|
||||
<input class="layui-input" type="text" name="title" lay-verify="required" lay-reqText="请输入角色名称" {notempty name="$role.title"
|
||||
}value="{$role.title}" {/notempty} placeholder="请输入角色名称" autocomplete="off" />
|
||||
<input class="layui-input" type="text" name="title" lay-verify="required" lay-reqText="请输入权限组名称" {notempty name="$role.title"
|
||||
}value="{$role.title}" {/notempty} placeholder="请输入权限组名称" autocomplete="off" />
|
||||
</td>
|
||||
<td class="layui-td-gray">状态<font>*</font>
|
||||
</td>
|
||||
@ -32,23 +37,26 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray" style="vertical-align:top">权限配置<font>*</font></td>
|
||||
<td colspan="3">
|
||||
<td class="layui-td-gray">权限配置说明<font>*</font></td>
|
||||
<td colspan="3"><strong class="red">注意:如果右侧子级权限有节点被勾选了,左侧的顶级权限就必须勾选,否则无法查看右侧的子级菜单。</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<table style="width:100%" id="rule">
|
||||
<tr>
|
||||
<td style="text-align:left; background-color:#f8f8f8; width:160px;">选择可操作的顶级权限 <font style="color:red">↓</font></td>
|
||||
<td style="text-align:center; background-color:#f8f8f8; width:160px;">选择可操作的顶级权限 <font style="color:red">↓</font></td>
|
||||
<td style="text-align:left; background-color:#f8f8f8;">选择可操作的子级权限 <font style="color:red">↓</font></td>
|
||||
</tr>
|
||||
{volist name="role_rule" id="vo"}
|
||||
<tr>
|
||||
<td style="font-weight:800;">
|
||||
<input type="checkbox" name="rule[]" value="{$vo.id}" title="{$vo.title}" {eq name="$vo.checked" value="true" }checked{/eq}>
|
||||
<td class="left-note">
|
||||
<input type="checkbox" name="rule[]" value="{$vo.id}" title="{$vo.title}" class="aaa" {eq name="$vo.checked" value="true" }checked{/eq}>
|
||||
</td>
|
||||
{notempty name="vo.children"}
|
||||
<td>
|
||||
<td class="right-note">
|
||||
<div style="padding:0 0 0 10px;">
|
||||
{volist name="vo.children" key="k" id="voo"}
|
||||
<div class="checkbox16" style="padding:10px 0;">
|
||||
<div class="checkbox15" style="padding:10px 0;">
|
||||
<input type="checkbox" lay-filter="rule" name="rule[]" value="{$voo.id}" lay-skin="primary" title="{$voo.title}" {eq name="$voo.checked" value="true" }checked{/eq}>
|
||||
</div>
|
||||
{notempty name="voo.children"}
|
||||
|
@ -16,7 +16,7 @@
|
||||
</script>
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container">
|
||||
<button class="layui-btn layui-btn-normal layui-btn-sm" lay-event="add">+ 添加权限组</button>
|
||||
<button class="layui-btn layui-btn-sm" lay-event="add">+ 添加权限组</button>
|
||||
</div>
|
||||
</script>
|
||||
{/block}
|
||||
@ -40,7 +40,7 @@
|
||||
, { field: 'desc', title: '备注' }
|
||||
, { field: 'status', title: '状态', toolbar: '#status', align: 'center', width: 80 }
|
||||
, { width: 100,title: '操作',align: 'center',templet: function (d) {
|
||||
var html = '<div class="layui-btn-group"><button class="layui-btn layui-btn-xs" lay-event="edit">编辑</button><button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</button></div>';
|
||||
var html = '<div class="layui-btn-group"><button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">编辑</button><button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</button></div>';
|
||||
return html;
|
||||
}
|
||||
}
|
||||
@ -62,15 +62,12 @@
|
||||
return;
|
||||
}
|
||||
if (obj.event === 'del') {
|
||||
layer.confirm('确定要删除该权限角色吗?', { icon: 3, title: '提示' }, function (index) {
|
||||
layer.confirm('确定要删除该权限组吗?', { icon: 3, title: '提示' }, function (index) {
|
||||
let callback = function (e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
layer.msg(res.msg);
|
||||
if (res.code == 0) {
|
||||
obj.del();
|
||||
layer.close(index);
|
||||
}
|
||||
obj.del();
|
||||
}
|
||||
}
|
||||
tool.delete("/home/role/delete", { id: obj.data.id }, callback);
|
||||
|
@ -3,7 +3,7 @@
|
||||
{block name="body"}
|
||||
<div class="p-3">
|
||||
<div class="gg-form-bar border-t border-x">
|
||||
<button class="layui-btn layui-btn-normal layui-btn-sm add-menu">+ 添加菜单/节点</button>
|
||||
<button class="layui-btn layui-btn-sm add-menu">+ 添加菜单/节点</button>
|
||||
</div>
|
||||
<div>
|
||||
<table class="layui-hide" id="treeTable" lay-filter="treeTable"></table>
|
||||
@ -23,7 +23,7 @@
|
||||
, elem: '#treeTable'
|
||||
, idField: 'id'
|
||||
, url: "/home/rule/index"
|
||||
, cellMinWidth: 80
|
||||
, cellMinWidth: 150
|
||||
, treeId: 'id'//树形id字段名称
|
||||
, treeUpId: 'pid'//树形父id字段名称
|
||||
, treeShowName: 'title'//以树形式显示的字段
|
||||
@ -46,7 +46,7 @@
|
||||
, {
|
||||
width: 188, title: '操作', align: 'center'
|
||||
, templet: function (d) {
|
||||
var html = '<span class="layui-btn-group"><button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="add">添加子菜单/节点</button><button class="layui-btn layui-btn-xs" lay-event="edit">编辑</button><button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</button>';
|
||||
var html = '<span class="layui-btn-group"><button class="layui-btn layui-btn-xs" lay-event="add">添加子菜单/节点</button><button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">编辑</button><button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</button>';
|
||||
return html;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user