This commit is contained in:
walkor 2022-12-07 14:22:47 +08:00
parent 29dd1692a1
commit 799f938e93
28 changed files with 94 additions and 135 deletions

View File

@ -1,8 +1,8 @@
<?php <?php
namespace plugin\admin\api; namespace plugin\admin\api;
use plugin\admin\app\model\AdminRole; use plugin\admin\app\model\Role;
use plugin\admin\app\model\AdminRule; use plugin\admin\app\model\Rule;
use support\exception\BusinessException; use support\exception\BusinessException;
use function admin; use function admin;
@ -73,7 +73,7 @@ class Auth
} }
// 角色没有规则 // 角色没有规则
$rules = AdminRole::whereIn('id', $roles)->pluck('rules'); $rules = Role::whereIn('id', $roles)->pluck('rules');
$rule_ids = []; $rule_ids = [];
foreach ($rules as $rule_string) { foreach ($rules as $rule_string) {
if (!$rule_string) { if (!$rule_string) {
@ -95,7 +95,7 @@ class Auth
// 如果action为index规则里有任意一个以$controller开头的权限即可 // 如果action为index规则里有任意一个以$controller开头的权限即可
if (strtolower($action) === 'index') { if (strtolower($action) === 'index') {
$controller = str_replace('\\', '\\\\', $controller); $controller = str_replace('\\', '\\\\', $controller);
$rule = AdminRule::where(function ($query) use ($controller, $action) { $rule = Rule::where(function ($query) use ($controller, $action) {
$query->where('key', 'like', "$controller@%")->orWhere('key', $controller); $query->where('key', 'like', "$controller@%")->orWhere('key', $controller);
})->whereIn('id', $rule_ids)->first(); })->whereIn('id', $rule_ids)->first();
if ($rule) { if ($rule) {
@ -107,7 +107,7 @@ class Auth
} }
// 查询是否有当前控制器的规则 // 查询是否有当前控制器的规则
$rule = AdminRule::where(function ($query) use ($controller, $action) { $rule = Rule::where(function ($query) use ($controller, $action) {
$query->where('key', "$controller@$action")->orWhere('key', $controller); $query->where('key', "$controller@$action")->orWhere('key', $controller);
})->whereIn('id', $rule_ids)->first(); })->whereIn('id', $rule_ids)->first();

View File

@ -1,8 +1,8 @@
<?php <?php
namespace plugin\admin\api; namespace plugin\admin\api;
use plugin\admin\app\model\AdminRole; use plugin\admin\app\model\Role;
use plugin\admin\app\model\AdminRule; use plugin\admin\app\model\Rule;
use support\exception\BusinessException; use support\exception\BusinessException;
use function admin; use function admin;
@ -20,7 +20,7 @@ class Menu
*/ */
public static function get($key) public static function get($key)
{ {
$menu = AdminRule::where('key', $key)->first(); $menu = Rule::where('key', $key)->first();
return $menu ? $menu->toArray() : null; return $menu ? $menu->toArray() : null;
} }
@ -32,7 +32,7 @@ class Menu
*/ */
public static function find($id): array public static function find($id): array
{ {
return AdminRule::find($id)->toArray(); return Rule::find($id)->toArray();
} }
/** /**
@ -43,7 +43,7 @@ class Menu
*/ */
public static function add(array $menu) public static function add(array $menu)
{ {
$item = new AdminRule; $item = new Rule;
foreach ($menu as $key => $value) { foreach ($menu as $key => $value) {
$item->$key = $value; $item->$key = $value;
} }
@ -69,7 +69,7 @@ class Menu
unset($menu_tree['children']); unset($menu_tree['children']);
if ($old_menu = Menu::get($menu_tree['key'])) { if ($old_menu = Menu::get($menu_tree['key'])) {
$pid = $old_menu['id']; $pid = $old_menu['id'];
AdminRule::where('key', $menu_tree['key'])->update($menu_tree); Rule::where('key', $menu_tree['key'])->update($menu_tree);
} else { } else {
$pid = static::add($menu_tree); $pid = static::add($menu_tree);
} }
@ -87,17 +87,17 @@ class Menu
*/ */
public static function delete($key) public static function delete($key)
{ {
$item = AdminRule::where('key', $key)->first(); $item = Rule::where('key', $key)->first();
if (!$item) { if (!$item) {
return; return;
} }
// 子规则一起删除 // 子规则一起删除
$delete_ids = $children_ids = [$item['id']]; $delete_ids = $children_ids = [$item['id']];
while($children_ids) { while($children_ids) {
$children_ids = AdminRule::whereIn('pid', $children_ids)->pluck('id')->toArray(); $children_ids = Rule::whereIn('pid', $children_ids)->pluck('id')->toArray();
$delete_ids = array_merge($delete_ids, $children_ids); $delete_ids = array_merge($delete_ids, $children_ids);
} }
AdminRule::whereIn('id', $delete_ids)->delete(); Rule::whereIn('id', $delete_ids)->delete();
} }

View File

@ -393,7 +393,7 @@ class PluginController extends Base
* 获取webman/admin版本 * 获取webman/admin版本
* @return string * @return string
*/ */
public function getAdminVersion(): string protected function getAdminVersion(): string
{ {
return config('plugin.admin.app.version', ''); return config('plugin.admin.app.version', '');
} }

View File

@ -2,7 +2,7 @@
namespace plugin\admin\app\controller; namespace plugin\admin\app\controller;
use plugin\admin\app\model\AdminRole; use plugin\admin\app\model\Role;
use support\exception\BusinessException; use support\exception\BusinessException;
use support\Request; use support\Request;
use support\Response; use support\Response;
@ -10,10 +10,10 @@ use support\Response;
/** /**
* 角色管理 * 角色管理
*/ */
class AdminRoleController extends Crud class RoleController extends Crud
{ {
/** /**
* @var AdminRole * @var Role
*/ */
protected $model = null; protected $model = null;
@ -22,7 +22,7 @@ class AdminRoleController extends Crud
*/ */
public function __construct() public function __construct()
{ {
$this->model = new AdminRole; $this->model = new Role;
} }
/** /**
@ -31,7 +31,7 @@ class AdminRoleController extends Crud
*/ */
public function index(): Response public function index(): Response
{ {
return view('admin-role/index'); return view('role/index');
} }
/** /**
@ -45,7 +45,7 @@ class AdminRoleController extends Crud
if ($request->method() === 'POST') { if ($request->method() === 'POST') {
return parent::insert($request); return parent::insert($request);
} }
return view('admin-role/insert'); return view('role/insert');
} }
/** /**
@ -57,7 +57,7 @@ class AdminRoleController extends Crud
public function update(Request $request): Response public function update(Request $request): Response
{ {
if ($request->method() === 'GET') { if ($request->method() === 'GET') {
return view('admin-role/update'); return view('role/update');
} }
[$id, $data] = $this->updateInput($request); [$id, $data] = $this->updateInput($request);
// id为1的管理员权限固定为* // id为1的管理员权限固定为*

View File

@ -3,8 +3,8 @@
namespace plugin\admin\app\controller; namespace plugin\admin\app\controller;
use plugin\admin\app\common\Util; use plugin\admin\app\common\Util;
use plugin\admin\app\model\AdminRole; use plugin\admin\app\model\Role;
use plugin\admin\app\model\AdminRule; use plugin\admin\app\model\Rule;
use support\exception\BusinessException; use support\exception\BusinessException;
use support\Request; use support\Request;
use support\Response; use support\Response;
@ -12,7 +12,7 @@ use support\Response;
/** /**
* 权限菜单 * 权限菜单
*/ */
class AdminRuleController extends Crud class RuleController extends Crud
{ {
/** /**
* 不需要权限的方法 * 不需要权限的方法
@ -22,7 +22,7 @@ class AdminRuleController extends Crud
public $noNeedAuth = ['get', 'permissionCodes']; public $noNeedAuth = ['get', 'permissionCodes'];
/** /**
* @var AdminRule * @var Rule
*/ */
protected $model = null; protected $model = null;
@ -31,7 +31,7 @@ class AdminRuleController extends Crud
*/ */
public function __construct() public function __construct()
{ {
$this->model = new AdminRule; $this->model = new Rule;
} }
/** /**
@ -40,7 +40,7 @@ class AdminRuleController extends Crud
*/ */
public function index(): Response public function index(): Response
{ {
return view('admin-rule/index'); return view('rule/index');
} }
/** /**
@ -63,7 +63,7 @@ class AdminRuleController extends Crud
function get(Request $request): Response function get(Request $request): Response
{ {
$rules = $this->getRules(admin('roles')); $rules = $this->getRules(admin('roles'));
$items = AdminRule::orderBy('weight', 'desc')->get()->toArray(); $items = Rule::orderBy('weight', 'desc')->get()->toArray();
$types = $request->get('type', '0,1'); $types = $request->get('type', '0,1');
$types = is_string($types) ? explode(',', $types) : [0, 1]; $types = is_string($types) ? explode(',', $types) : [0, 1];
$items_map = []; $items_map = [];
@ -111,7 +111,7 @@ class AdminRuleController extends Crud
if (in_array('*', $rules)) { if (in_array('*', $rules)) {
return $this->json(0, 'ok', ['*']); return $this->json(0, 'ok', ['*']);
} }
$keys = AdminRule::whereIn('id', $rules)->pluck('key'); $keys = Rule::whereIn('id', $rules)->pluck('key');
$permissions = []; $permissions = [];
foreach ($keys as $key) { foreach ($keys as $key) {
if (!$key = Util::controllerToUrlPath($key)) { if (!$key = Util::controllerToUrlPath($key)) {
@ -157,11 +157,11 @@ class AdminRuleController extends Crud
$menu = $items[$name] ?? []; $menu = $items[$name] ?? [];
if ($menu) { if ($menu) {
if ($menu->title != $title) { if ($menu->title != $title) {
AdminRule::where('key', $name)->update(['title' => $title]); Rule::where('key', $name)->update(['title' => $title]);
} }
continue; continue;
} }
$menu = new AdminRule; $menu = new Rule;
$menu->pid = $pid; $menu->pid = $pid;
$menu->key = $name; $menu->key = $name;
$menu->title = $title; $menu->title = $title;
@ -173,7 +173,7 @@ class AdminRuleController extends Crud
// 从数据库中删除已经不存在的方法 // 从数据库中删除已经不存在的方法
$menu_names_to_del = array_diff($methods_in_db, $methods_in_files); $menu_names_to_del = array_diff($methods_in_db, $methods_in_files);
if ($menu_names_to_del) { if ($menu_names_to_del) {
//AdminRule::whereIn('key', $menu_names_to_del)->delete(); //Rule::whereIn('key', $menu_names_to_del)->delete();
} }
} }
@ -208,7 +208,7 @@ class AdminRuleController extends Crud
public function insert(Request $request): Response public function insert(Request $request): Response
{ {
if ($request->method() === 'GET') { if ($request->method() === 'GET') {
return view('admin-rule/insert'); return view('rule/insert');
} }
$data = $this->insertInput($request); $data = $this->insertInput($request);
$data['key'] = str_replace('\\\\', '\\', $data['key']); $data['key'] = str_replace('\\\\', '\\', $data['key']);
@ -230,7 +230,7 @@ class AdminRuleController extends Crud
public function update(Request $request): Response public function update(Request $request): Response
{ {
if ($request->method() === 'GET') { if ($request->method() === 'GET') {
return view('admin-rule/update'); return view('rule/update');
} }
[$id, $data] = $this->updateInput($request); [$id, $data] = $this->updateInput($request);
if (!$row = $this->model->find($id)) { if (!$row = $this->model->find($id)) {
@ -341,7 +341,7 @@ class AdminRuleController extends Crud
*/ */
protected function getRules($roles): array protected function getRules($roles): array
{ {
$rules_strings = $roles ? AdminRole::whereIn('id', $roles)->pluck('rules') : []; $rules_strings = $roles ? Role::whereIn('id', $roles)->pluck('rules') : [];
$rules = []; $rules = [];
foreach ($rules_strings as $rule_string) { foreach ($rules_strings as $rule_string) {
if (!$rule_string) { if (!$rule_string) {

View File

@ -6,8 +6,8 @@ use Doctrine\Inflector\InflectorFactory;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use plugin\admin\app\common\LayuiForm; use plugin\admin\app\common\LayuiForm;
use plugin\admin\app\common\Util; use plugin\admin\app\common\Util;
use plugin\admin\app\model\AdminRole; use plugin\admin\app\model\Role;
use plugin\admin\app\model\AdminRule; use plugin\admin\app\model\Rule;
use plugin\admin\app\model\Option; use plugin\admin\app\model\Option;
use Support\Exception\BusinessException; use Support\Exception\BusinessException;
use Support\Request; use Support\Request;
@ -414,7 +414,7 @@ class TableController extends Base
$pid = (int)$pid; $pid = (int)$pid;
if ($pid) { if ($pid) {
$parent_menu = AdminRule::find($pid); $parent_menu = Rule::find($pid);
if (!$parent_menu) { if (!$parent_menu) {
return $this->json(1, '父菜单不存在'); return $this->json(1, '父菜单不存在');
} }
@ -490,9 +490,9 @@ class TableController extends Base
$reflection = new \ReflectionClass("$controller_namespace\\$controller_class"); $reflection = new \ReflectionClass("$controller_namespace\\$controller_class");
$controller_class_with_nsp = $reflection->getName(); $controller_class_with_nsp = $reflection->getName();
$menu = AdminRule::where('key', $controller_class_with_nsp)->first(); $menu = Rule::where('key', $controller_class_with_nsp)->first();
if (!$menu) { if (!$menu) {
$menu = new AdminRule; $menu = new Rule;
} }
$menu->pid = $pid; $menu->pid = $pid;
$menu->key = $controller_class_with_nsp; $menu->key = $controller_class_with_nsp;
@ -503,7 +503,7 @@ class TableController extends Base
$menu->save(); $menu->save();
$roles = admin('roles'); $roles = admin('roles');
$rules = AdminRole::whereIn('id', $roles)->pluck('rules'); $rules = Role::whereIn('id', $roles)->pluck('rules');
$rule_ids = []; $rule_ids = [];
foreach ($rules as $rule_string) { foreach ($rules as $rule_string) {
if (!$rule_string) { if (!$rule_string) {
@ -514,7 +514,7 @@ class TableController extends Base
// 不是超级管理员,则需要给当前管理员这个菜单的权限 // 不是超级管理员,则需要给当前管理员这个菜单的权限
if (!in_array('*', $rule_ids) && $roles){ if (!in_array('*', $rule_ids) && $roles){
$role = AdminRole::find(current($roles)); $role = Role::find(current($roles));
if ($role) { if ($role) {
$role->rules .= ",{$menu->id}"; $role->rules .= ",{$menu->id}";
} }

View File

@ -1,33 +0,0 @@
<?php
namespace plugin\admin\app\model;
use plugin\admin\app\model\Base;
/**
* @property integer $id 主键(主键)
* @property string $name 角色名
* @property string $rules 权限
* @property string $created_at 创建时间
* @property string $updated_at 更新时间
*/
class AdminRole extends Base
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'wa_admin_roles';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'id';
}

View File

@ -2,18 +2,14 @@
namespace plugin\admin\app\model; namespace plugin\admin\app\model;
use plugin\admin\app\model\Base;
/** /**
* @property integer $id 主键(主键) * @property integer $id 主键(主键)
* @property string $name 名字 * @property string $name 角色名
* @property integer $pid 上级id * @property string $rules 权限
* @property string $component 组件
* @property string $path 路径
* @property string $icon 图标
* @property string $title 标题
* @property string $created_at 创建时间 * @property string $created_at 创建时间
* @property string $updated_at 更新时间 * @property string $updated_at 更新时间
* @property string $frame_src url
* @property integer $hide_menu 隐藏菜单
*/ */
class Role extends Base class Role extends Base
{ {
@ -22,7 +18,7 @@ class Role extends Base
* *
* @var string * @var string
*/ */
protected $table = 'wa_admin_rules'; protected $table = 'wa_roles';
/** /**
* The primary key associated with the table. * The primary key associated with the table.
@ -30,6 +26,8 @@ class Role extends Base
* @var string * @var string
*/ */
protected $primaryKey = 'id'; protected $primaryKey = 'id';
} }

View File

@ -16,14 +16,14 @@ use plugin\admin\app\model\Base;
* @property integer $type 类型 * @property integer $type 类型
* @property integer $weight 排序 * @property integer $weight 排序
*/ */
class AdminRule extends Base class Rule extends Base
{ {
/** /**
* The table associated with the model. * The table associated with the model.
* *
* @var string * @var string
*/ */
protected $table = 'wa_admin_rules'; protected $table = 'wa_rules';
/** /**
* The primary key associated with the table. * The primary key associated with the table.

View File

@ -205,7 +205,7 @@
// 获取表格中下拉或树形组件数据 // 获取表格中下拉或树形组件数据
let apis = []; let apis = [];
apis.push(["roles", "/app/admin/admin-role/select?format=select"]); apis.push(["roles", "/app/admin/role/select?format=select"]);
let apiResults = {}; let apiResults = {};
apiResults["roles"] = []; apiResults["roles"] = [];
let count = apis.length; let count = apis.length;

View File

@ -127,7 +127,7 @@
// 字段 角色 roles // 字段 角色 roles
layui.use(["jquery", "xmSelect"], function() { layui.use(["jquery", "xmSelect"], function() {
layui.$.ajax({ layui.$.ajax({
url: "/app/admin/admin-role/select?format=select", url: "/app/admin/role/select?format=select",
dataType: "json", dataType: "json",
success: function (e) { success: function (e) {
let value = layui.$("#roles").attr("value"); let value = layui.$("#roles").attr("value");

View File

@ -150,7 +150,7 @@
// 字段 角色 roles // 字段 角色 roles
layui.use(["jquery", "xmSelect"], function() { layui.use(["jquery", "xmSelect"], function() {
layui.$.ajax({ layui.$.ajax({
url: "/app/admin/admin-role/select?format=select", url: "/app/admin/role/select?format=select",
dataType: "json", dataType: "json",
success: function (e) { success: function (e) {
let value = layui.$("#roles").attr("value"); let value = layui.$("#roles").attr("value");

View File

@ -68,7 +68,6 @@
<script> <script>
// 相关接口 // 相关接口
const CONTROLLER = "plugin\\admin\\app\\controller\\DictController";
const SELECT_API = "/app/admin/dict/select"; const SELECT_API = "/app/admin/dict/select";
const UPDATE_API = "/app/admin/dict/update"; const UPDATE_API = "/app/admin/dict/update";
const DELETE_API = "/app/admin/dict/delete"; const DELETE_API = "/app/admin/dict/delete";

View File

@ -58,18 +58,18 @@
<!-- 表格顶部工具栏 --> <!-- 表格顶部工具栏 -->
<script type="text/html" id="table-toolbar"> <script type="text/html" id="table-toolbar">
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="add" permission="app.admin.adminrole.insert"> <button class="pear-btn pear-btn-primary pear-btn-md" lay-event="add" permission="app.admin.role.insert">
<i class="layui-icon layui-icon-add-1"></i>新增 <i class="layui-icon layui-icon-add-1"></i>新增
</button> </button>
<button class="pear-btn pear-btn-danger pear-btn-md" lay-event="batchRemove" permission="app.admin.adminrole.delete"> <button class="pear-btn pear-btn-danger pear-btn-md" lay-event="batchRemove" permission="app.admin.role.delete">
<i class="layui-icon layui-icon-delete"></i>删除 <i class="layui-icon layui-icon-delete"></i>删除
</button> </button>
</script> </script>
<!-- 表格行工具栏 --> <!-- 表格行工具栏 -->
<script type="text/html" id="table-bar"> <script type="text/html" id="table-bar">
<button class="pear-btn pear-btn-xs tool-btn" lay-event="edit" permission="app.admin.adminrole.update">编辑</button> <button class="pear-btn pear-btn-xs tool-btn" lay-event="edit" permission="app.admin.role.update">编辑</button>
<button class="pear-btn pear-btn-xs tool-btn" lay-event="remove" permission="app.admin.adminrole.delete">删除</button> <button class="pear-btn pear-btn-xs tool-btn" lay-event="remove" permission="app.admin.role.delete">删除</button>
</script> </script>
<script src="/app/admin/component/layui/layui.js"></script> <script src="/app/admin/component/layui/layui.js"></script>
@ -80,11 +80,11 @@
// 相关常量 // 相关常量
const PRIMARY_KEY = "id"; const PRIMARY_KEY = "id";
const SELECT_API = "/app/admin/admin-role/select"; const SELECT_API = "/app/admin/role/select";
const UPDATE_API = "/app/admin/admin-role/update"; const UPDATE_API = "/app/admin/role/update";
const DELETE_API = "/app/admin/admin-role/delete"; const DELETE_API = "/app/admin/role/delete";
const INSERT_URL = "/app/admin/admin-role/insert"; const INSERT_URL = "/app/admin/role/insert";
const UPDATE_URL = "/app/admin/admin-role/update"; const UPDATE_URL = "/app/admin/role/update";
// 字段 创建时间 created_at // 字段 创建时间 created_at
layui.use(["laydate"], function() { layui.use(["laydate"], function() {
@ -164,7 +164,7 @@
// 获取表格中下拉或树形组件数据 // 获取表格中下拉或树形组件数据
let apis = []; let apis = [];
apis.push(["rules", "/app/admin/admin-rule/get?type=0,1,2"]); apis.push(["rules", "/app/admin/rule/get?type=0,1,2"]);
let apiResults = {}; let apiResults = {};
apiResults["rules"] = []; apiResults["rules"] = [];
let count = apis.length; let count = apis.length;

View File

@ -50,12 +50,12 @@
<script> <script>
// 相关接口 // 相关接口
const INSERT_API = "/app/admin/admin-role/insert"; const INSERT_API = "/app/admin/role/insert";
// 字段 权限 rules // 字段 权限 rules
layui.use(["jquery", "xmSelect"], function() { layui.use(["jquery", "xmSelect"], function() {
layui.$.ajax({ layui.$.ajax({
url: "/app/admin/admin-rule/get?type=0,1,2", url: "/app/admin/rule/get?type=0,1,2",
dataType: "json", dataType: "json",
success: function (e) { success: function (e) {
let value = layui.$("#rules").attr("value"); let value = layui.$("#rules").attr("value");

View File

@ -50,8 +50,8 @@
// 相关接口 // 相关接口
const PRIMARY_KEY = "id"; const PRIMARY_KEY = "id";
const SELECT_API = "/app/admin/admin-role/select" + location.search; const SELECT_API = "/app/admin/role/select" + location.search;
const UPDATE_API = "/app/admin/admin-role/update"; const UPDATE_API = "/app/admin/role/update";
// 获取数据库记录 // 获取数据库记录
layui.use(["form", "util"], function () { layui.use(["form", "util"], function () {
@ -79,7 +79,7 @@
// 字段 权限 rules // 字段 权限 rules
layui.use(["jquery", "xmSelect"], function() { layui.use(["jquery", "xmSelect"], function() {
layui.$.ajax({ layui.$.ajax({
url: "/app/admin/admin-rule/get?type=0,1,2", url: "/app/admin/rule/get?type=0,1,2",
dataType: "json", dataType: "json",
success: function (e) { success: function (e) {
let value = layui.$("#rules").attr("value"); let value = layui.$("#rules").attr("value");

View File

@ -45,18 +45,18 @@
<!-- 表格顶部工具栏 --> <!-- 表格顶部工具栏 -->
<script type="text/html" id="table-toolbar"> <script type="text/html" id="table-toolbar">
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="add" permission="app.admin.adminrule.insert"> <button class="pear-btn pear-btn-primary pear-btn-md" lay-event="add" permission="app.admin.rule.insert">
<i class="layui-icon layui-icon-add-1"></i>新增 <i class="layui-icon layui-icon-add-1"></i>新增
</button> </button>
<button class="pear-btn pear-btn-danger pear-btn-md" lay-event="batchRemove" permission="app.admin.adminrule.delete"> <button class="pear-btn pear-btn-danger pear-btn-md" lay-event="batchRemove" permission="app.admin.rule.delete">
<i class="layui-icon layui-icon-delete"></i>删除 <i class="layui-icon layui-icon-delete"></i>删除
</button> </button>
</script> </script>
<!-- 表格行工具栏 --> <!-- 表格行工具栏 -->
<script type="text/html" id="table-bar"> <script type="text/html" id="table-bar">
<button class="pear-btn pear-btn-xs tool-btn" lay-event="edit" permission="app.admin.adminrule.update">编辑</button> <button class="pear-btn pear-btn-xs tool-btn" lay-event="edit" permission="app.admin.rule.update">编辑</button>
<button class="pear-btn pear-btn-xs tool-btn" lay-event="remove" permission="app.admin.adminrule.delete">删除</button> <button class="pear-btn pear-btn-xs tool-btn" lay-event="remove" permission="app.admin.rule.delete">删除</button>
</script> </script>
<script src="/app/admin/component/layui/layui.js"></script> <script src="/app/admin/component/layui/layui.js"></script>
@ -68,12 +68,11 @@
// 相关常量 // 相关常量
const PRIMARY_KEY = "id"; const PRIMARY_KEY = "id";
const CONTROLLER = "plugin\\admin\\app\\controller\\AdminRuleController"; const SELECT_API = "/app/admin/rule/select?limit=5000";
const SELECT_API = "/app/admin/admin-rule/select?limit=5000"; const DELETE_API = "/app/admin/rule/delete";
const DELETE_API = "/app/admin/admin-rule/delete"; const UPDATE_API = "/app/admin/rule/update";
const UPDATE_API = "/app/admin/admin-rule/update"; const INSERT_URL = "/app/admin/rule/insert";
const INSERT_URL = "/app/admin/admin-rule/insert"; const UPDATE_URL = "/app/admin/rule/update";
const UPDATE_URL = "/app/admin/admin-rule/update";
// 表格渲染 // 表格渲染
layui.use(["table", "treetable", "form", "common", "popup", "util"], function() { layui.use(["table", "treetable", "form", "common", "popup", "util"], function() {
@ -178,7 +177,7 @@
let apis = []; let apis = [];
let apiResults = {}; let apiResults = {};
apiResults["pid"] = []; apiResults["pid"] = [];
apis.push(["pid", "/app/admin/admin-rule/select?format=tree&type=0,1"]); apis.push(["pid", "/app/admin/rule/select?format=tree&type=0,1"]);
apiResults["type"] = ["目录","菜单","权限"]; apiResults["type"] = ["目录","菜单","权限"];
let count = apis.length; let count = apis.length;
layui.each(apis, function (k, item) { layui.each(apis, function (k, item) {

View File

@ -85,7 +85,7 @@
<script> <script>
// 接口 // 接口
const INSERT_URL = "/app/admin/admin-rule/insert"; const INSERT_URL = "/app/admin/rule/insert";
// 图标选择 // 图标选择
layui.use(["iconPicker"], function() { layui.use(["iconPicker"], function() {
@ -99,7 +99,7 @@
// 上级菜单 // 上级菜单
layui.use(["jquery", "xmSelect"], function() { layui.use(["jquery", "xmSelect"], function() {
layui.$.ajax({ layui.$.ajax({
url: "/app/admin/admin-rule/select?format=tree&type=0,1", url: "/app/admin/rule/select?format=tree&type=0,1",
dataType: "json", dataType: "json",
success: function (e) { success: function (e) {
let value = layui.$("#pid").attr("value"); let value = layui.$("#pid").attr("value");

View File

@ -85,8 +85,8 @@
// 相关接口 // 相关接口
let PRIMARY_KEY = "id"; let PRIMARY_KEY = "id";
const SELECT_API = "/app/admin/admin-rule/select" + location.search; const SELECT_API = "/app/admin/rule/select" + location.search;
const UPDATE_API = "/app/admin/admin-rule/update"; const UPDATE_API = "/app/admin/rule/update";
// 获取行数据 // 获取行数据
layui.use(["form", "util"], function () { layui.use(["form", "util"], function () {
@ -123,7 +123,7 @@
// 获取上级菜单 // 获取上级菜单
layui.use(["jquery", "xmSelect"], function() { layui.use(["jquery", "xmSelect"], function() {
layui.$.ajax({ layui.$.ajax({
url: "/app/admin/admin-rule/select?format=tree&type=0,1", url: "/app/admin/rule/select?format=tree&type=0,1",
dataType: "json", dataType: "json",
success: function (e) { success: function (e) {
let value = layui.$("#pid").attr("value"); let value = layui.$("#pid").attr("value");

View File

@ -80,7 +80,7 @@
layui.use(["jquery", "xmSelect"], function() { layui.use(["jquery", "xmSelect"], function() {
layui.$.ajax({ layui.$.ajax({
url: "/app/admin/admin-rule/select?format=tree&type=0,1", url: "/app/admin/rule/select?format=tree&type=0,1",
dataType: "json", dataType: "json",
success: function (e) { success: function (e) {
let value = layui.$("#pid").attr("value"); let value = layui.$("#pid").attr("value");

View File

@ -37,7 +37,6 @@
<script> <script>
// 相关接口 // 相关接口
const CONTROLLER = "plugin\\admin\\app\\controller\\TableController";
const SELECT_API = "/app/admin/table/show"; const SELECT_API = "/app/admin/table/show";
const DROP_API = "/app/admin/table/drop"; const DROP_API = "/app/admin/table/drop";
const VIEW_URL = "/app/admin/table/view"; const VIEW_URL = "/app/admin/table/view";

View File

@ -59,7 +59,6 @@
const TABLE_NAME = "<?=htmlspecialchars($table)?>"; const TABLE_NAME = "<?=htmlspecialchars($table)?>";
const PRIMARY_KEY = "<?=htmlspecialchars($primary_key)?>"; const PRIMARY_KEY = "<?=htmlspecialchars($primary_key)?>";
const CONTROLLER = "plugin\\admin\\app\\controller\\TableController";
const SELECT_API = "/app/admin/table/select?table=" + TABLE_NAME; const SELECT_API = "/app/admin/table/select?table=" + TABLE_NAME;
const UPDATE_API = "/app/admin/table/update"; const UPDATE_API = "/app/admin/table/update";
const DELETE_API = "/app/admin/table/delete"; const DELETE_API = "/app/admin/table/delete";

View File

@ -100,7 +100,6 @@
// 相关接口 // 相关接口
const PRIMARY_KEY = "id"; const PRIMARY_KEY = "id";
const CONTROLLER = "plugin\\admin\\app\\controller\\UploadController";
const SELECT_API = "/app/admin/upload/select"; const SELECT_API = "/app/admin/upload/select";
const UPDATE_API = "/app/admin/upload/update"; const UPDATE_API = "/app/admin/upload/update";
const DELETE_API = "/app/admin/upload/delete"; const DELETE_API = "/app/admin/upload/delete";

View File

@ -101,7 +101,6 @@
// 相关接口 // 相关接口
const PRIMARY_KEY = "id"; const PRIMARY_KEY = "id";
const CONTROLLER = "plugin\\admin\\app\\controller\\UploadController";
const SELECT_API = "/app/admin/upload/select"; const SELECT_API = "/app/admin/upload/select";
const UPDATE_API = "/app/admin/upload/update"; const UPDATE_API = "/app/admin/upload/update";
const DELETE_API = "/app/admin/upload/delete"; const DELETE_API = "/app/admin/upload/delete";

View File

@ -33,15 +33,15 @@ return [
], ],
[ [
'title' => '角色管理', 'title' => '角色管理',
'key' => 'plugin\\admin\\app\\controller\\AdminRoleController', 'key' => 'plugin\\admin\\app\\controller\\RoleController',
'href' => '/app/admin/admin-role/index', 'href' => '/app/admin/role/index',
'type' => 1, 'type' => 1,
'weight' => 900, 'weight' => 900,
], ],
[ [
'title' => '菜单管理', 'title' => '菜单管理',
'key' => 'plugin\\admin\\app\\controller\\AdminRuleController', 'key' => 'plugin\\admin\\app\\controller\\RuleController',
'href' => '/app/admin/admin-rule/index', 'href' => '/app/admin/rule/index',
'type' => 1, 'type' => 1,
'weight' => 800, 'weight' => 800,
], ],

View File

@ -4,7 +4,7 @@
layui.$(function () { layui.$(function () {
let $ = layui.$; let $ = layui.$;
$.ajax({ $.ajax({
url: "/app/admin/admin-rule/permission-codes", url: "/app/admin/rule/permission-codes",
dataType: "json", dataType: "json",
success: function (res) { success: function (res) {
let style = ''; let style = '';

View File

@ -4,7 +4,7 @@
"image": "/app/admin/admin/images/logo.png" "image": "/app/admin/admin/images/logo.png"
}, },
"menu": { "menu": {
"data": "/app/admin/admin-rule/get", "data": "/app/admin/rule/get",
"method": "GET", "method": "GET",
"accordion": true, "accordion": true,
"collapse": false, "collapse": false,

File diff suppressed because one or more lines are too long