Commit 44ef292e by 杨树贤

菜单和用户接入

parent bd802a79
......@@ -53,3 +53,12 @@ MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
START_IFRAME_TAB=true
LOGIN_DOMAIN=user.semourdev.net
PERM_URL=http://perm.semourdev.net/api/check
PERM_ID=12
PERM_GOURL=http://perm.semourdev.net
ADMIN_GROUP=1000,20000
MENU_ID=2
MENU_URL=http://data.semourdev.net/api/config/
......@@ -26,10 +26,10 @@ class InquiryController extends AdminController
{
return Grid::make(new Inquiry(['user','sales_user']), function (Grid $grid) {
$grid->showFilter();
$grid->disableActions();
// $grid->disableActions();
$grid->disableFilterButton();
$grid->disableRefreshButton();
$grid->disableCreateButton();
// $grid->disableCreateButton();
$grid->filter(function ($filter) {
$filter->expand(true);
$filter->whereBetween('create_time', function ($q) {
......@@ -122,16 +122,29 @@ class InquiryController extends AdminController
protected function form()
{
return Form::make(new Inquiry(), function (Form $form) {
$form->display('inquiry_id');
$form->text('sales_id');
$form->text('inquiry_sn');
$form->text('status');
$form->text('remark');
$form->text('priority');
$form->text('user_types');
$form->text('processing_time');
$form->text('create_time');
$form->text('update_time');
$form->row(function (Form\Row $form) {
$form->text('sales_id');
$form->text('inquiry_sn');
});
$form->row(function (Form\Row $form) {
$form->text('status');
$form->text('remark');
$form->text('priority');
});
$form->row(function (Form\Row $form) {
$form->array('column_name', function ($table) {
$table->text('key')->width(3);
$table->text('value')->width(3);
$table->text('desc')->width(3);
$table->text('desc')->width(3);
$table->text('desc')->width(3);
$table->text('desc')->width(3);
$table->text('desc')->width(3);
$table->text('desc')->width(3);
$table->text('desc')->width(3);
});
});
});
}
......
......@@ -5,6 +5,7 @@ use Dcat\Admin\Admin;
use Dcat\Admin\Grid;
use Dcat\Admin\Form;
use Dcat\Admin\Grid\Filter;
use Dcat\Admin\Layout\Menu;
use Dcat\Admin\Layout\Navbar;
use Dcat\Admin\Show;
use Dcat\Admin\Show\Field;
......@@ -188,6 +189,35 @@ HTML
);
});
Admin::menu(function (Menu $menu) {
//权限系统的菜单
$permMenus = request()->menus;
$permMenus = (array) $permMenus;
$addMenus = [];
foreach ($permMenus as $key => &$permMenu) {
$permMenu = (array) $permMenu;
//为了区分本系统手动添加的菜单
$key = $key + 1000;
$permMenu['id'] = $key + 1;
$permMenu['icon'] = $permMenu['class'];
$permMenu['uri'] = $permMenu['href'];
$permMenu['parent_id'] = 0;
$addMenus[] = $permMenu;
if (!empty($permMenu['childs'])) {
foreach ($permMenu['childs'] as $k => &$child) {
$child = (array) $child;
//为了让字菜单的id不和父菜单的id冲突
$child['id'] = $k + ($key + 1) * 100;
$child['parent_id'] = $key + 1;
$child['icon'] = $child['class'];
$child['uri'] = $child['href'];
$addMenus[] = $child;
}
}
}
unset($permMenu, $child);
$menu->add($addMenus);
});
Grid::resolving(function (Grid $grid) {
$grid->tableCollapse(true);
......
......@@ -23,8 +23,8 @@ class Kernel extends HttpKernel
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
// CheckLogin::class,
// Permission::class,
CheckLogin::class,
Permission::class,
];
/**
......
......@@ -51,8 +51,7 @@ class CheckLogin
}
$user = $ret->data;
// $user->code = DB::connection()->table('lie_intracode')->where('admin_id',
// $user->userId)->select('code_id')->first();
$user->header = $request->cookie('oa_header');
$request->user = $user;
......
......@@ -13,5 +13,7 @@ class EncryptCookies extends Middleware
*/
protected $except = [
//
'oa_user_id',
'oa_skey'
];
}
......@@ -21,7 +21,7 @@ class Permission
//处理权限和菜单
$permData = config('perm.perm');
$action = $request->route('key');
empty($action) && $action = 'Dashboard';
empty($action) && $action = 'Index';
//获取菜单
if (!$isApi && empty($request->input('window'))) {
......
......@@ -128,7 +128,7 @@ return [
|
*/
'auth' => [
'enable' => true,
'enable' => false,
'controller' => App\Admin\Controllers\AuthController::class,
......@@ -200,7 +200,7 @@ return [
|--------------------------------------------------------------------------
*/
'helpers' => [
'enable' => true,
'enable' => false,
],
/*
......
<?php
return [
'perm' => [
'id' => env('PERM_ID'),
'url' => env('PERM_URL'),
'go_url' => env('PERM_GOURL'),
'admin_group' => explode(',', env('ADMIN_GROUP')),//管理员权限组,有所有权限
'menu_id' => env('MENU_ID'),
'menu_url' => env('MENU_URL'),
'not_auth' => []
]
];
<?php
return [
'login' => [
'login' => 'http://' . env('LOGIN_DOMAIN', '') . '/login',
'logout'=> 'http://' . env('LOGIN_DOMAIN', '') . '/logout',
'check' => 'http://' . env('LOGIN_DOMAIN', '') . '/api/checklogin',
'search'=> 'http://' . env('LOGIN_DOMAIN', '') . '/api/search',
'dashboard'=>'http://'.env('LOGIN_DOMAIN', '') . '/dashboard',
],
];
......@@ -5,5 +5,7 @@ return [
'userAddress' => 'UserAddress',
'inquiry' => 'Inquiry',
'country' => 'Country',
'task' => 'Task',
'use' => 'Task',
],
];
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment