Commit e8ab2327 by 朱继来

1. 列表响应式调整;

2. 权限调整;
parent 70b73aed
...@@ -355,16 +355,16 @@ Class OrderController extends Controller ...@@ -355,16 +355,16 @@ Class OrderController extends Controller
$perm = new PermController; $perm = new PermController;
// 获取权限菜单
if ($request->user->email != 'admin@ichunt.com' && $request->user->userId != 1000)
$menus = $perm->getPermMenu($request, $menus);
// 用户权限
$userPerms = $perm->handlePerms($request, $request->user->userId);
// 用户角色 // 用户角色
$role = $perm->getUserRole($request); $role = $perm->getUserRole($request);
// 获取权限菜单
if ($role != 1) {
$menus = $perm->getPermMenu($menus, $request->user->userId);
}
$userPerms = $perm->getUserAllPerms($request->user->userId, $role); // 用户权限
$data = [ $data = [
'header' => $request->user->header, 'header' => $request->user->header,
'uri' => $uri, 'uri' => $uri,
...@@ -382,6 +382,7 @@ Class OrderController extends Controller ...@@ -382,6 +382,7 @@ Class OrderController extends Controller
public function orderList(Request $request) public function orderList(Request $request)
{ {
$info = $this->getOrderInfo($request, 1); $info = $this->getOrderInfo($request, 1);
$info['title'] = '平台订单';
// 若为京东自营、自营客服角色,则跳转到自营列表 // 若为京东自营、自营客服角色,则跳转到自营列表
if (in_array($info['role'], [6, 7])) { if (in_array($info['role'], [6, 7])) {
......
...@@ -113,207 +113,92 @@ ...@@ -113,207 +113,92 @@
return $roleUsers; return $roleUsers;
} }
// 获取权限系统用户的所有权限 // 获取权限菜单
public function getUserPerms(Request $request, $uid) public function getPermMenu($menus, $user_id)
{
$userPerms = $this->getUserAllPerms($user_id);
if ($userPerms) {
return $this->handleMenus($menus, $userPerms);
}
return false;
}
// 获取用户所有权限
public function getUserAllPerms($user_id, $role=0)
{ {
// 根据域名查询系统业务ID // 根据域名查询系统业务ID
$domain = Config('website.order_url'); $domain = Config('website.order_url');
$business = DB::table('t_business_config')->where('url', $domain)->first(); $business = DB::table('t_business_config')->where('url', $domain)->first();
if ($business) { if ($role != 1) {
$bid = $business->bid; $bid = $business->bid;
// 权限系统配置的管理帐号 $url = Config('website.perm_api').$user_id.'/'.$bid;
$adminAccount = json_decode($business->admin, true);
$configs = Config('perm');
// 若是管理员,则返回Config所有权限
if (in_array($request->user->email, $adminAccount)) {
return $configs;
}
// 获取用户权限
$perms = json_decode($this->curlPermApi($uid, $bid), true);
if ($perms['retcode'] == 0) {
$userPerms = $perms['data']['perms'];
$matchPerms = $this->matchUserPerms($configs, $userPerms); $userPerms = json_decode(curlApi($url), true);
return $matchPerms; if ($userPerms && $userPerms['retcode'] == 0) {
return $userPerms['data']['perms'];
} }
} else { // 获取管理员所有权限
return $this->getAllPerms(json_decode($business->configs, true));
} }
return false; return false;
} }
// 处理用户权限值 // 获取系统配置权限
public function handlePerms(Request $request, $uid) public function getAllPerms($configs)
{ {
$perms = $this->getUserPerms($request, $uid); $perms = [];
$userPerms = array(); foreach ($configs as $k => $v) {
$perm_a = [];
$perm_b = [];
foreach ($perms as $perm) { if (isset($v['childs']) && count($v['childs']) > 0) {
if(is_array($perm)) { $perm_b = $this->getAllPerms($v['childs']);
foreach ($perm as $val) {
if (is_array($val)) {
foreach ($val as $v) {
$userPerms[] = $v;
}
}
}
}
}
return $userPerms;
}
/**
* 请求权限系统接口
* @param [Integer] $uid [用户ID]
* @param [Integer] $bid [业务ID]
* @return [Json] 返回权限数据
*/
public function curlPermApi($uid, $bid)
{
$url = Config('website.perm_api').$uid.'/'.$bid;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
/**
* 匹配用户在菜单的权限
* @param [Array] $config [配置菜单权限]
* @param [Array] $perms [用户所有权限]
* @return [Json]
*/
public function matchUserPerms($configs, $perms)
{
foreach ($configs as $key=>$config) {
if (is_array($config)) {
foreach($config as $k=>$v) {
if (is_array($v)) {
$menu[$key][$k] = array_intersect($v, $perms);
continue;
} else { } else {
if (in_array($v, $perms)) { $perm_a[] = $v['permId'];
$menu[$key][$k] = $v;
}
continue;
}
}
} }
continue; $perms = array_merge($perms, array_merge($perm_a, $perm_b));
} }
return $menu; return $perms;
} }
// 处理菜单
/** public function handleMenus($menus, $perms)
* 获取权限菜单
* @param [Array] $menus [数据表菜单]
* @return [Array] 返回处理后的菜单
*/
public function getPermMenu(Request $request, $menus)
{ {
$menuPerm = $this->getUserPerms($request, $request->user->userId); foreach ($menus as $k => $v) {
if (strlen($v->href) > 2) {
$menuData = array(); if (preg_match('/\/web\//', $v->href)) {
$newMenu = array(); $permId = str_replace('/web/','',$v->href);
$matchMenu = array();
if ($menuPerm) {
// 处理返回的菜单---简化
foreach ($menuPerm as $key => $val) {
if (is_array($val)) {
// 处理二级菜单内容
foreach ($val as $k => $v) {
if (is_array($v)) {
foreach ($v as $k1 => $v1) {
if (preg_match('/_check$/', $v1)) {
$menuData[$key][] = $k;
continue;
}
}
} else { } else {
if (strpos($v, '_check') !== false) { $permId = str_replace('/', '', $v->href);
$menuData[$key][] = $k;
continue;
}
}
}
}
} }
// 匹配菜单 // 查看菜单权限
if ($menus) { $permId = $permId . '_check';
foreach ($menus as $k => $v) {
// 遍历简化过的菜单
foreach ($menuData as $pk => $pv) {
// 匹配标题
if ($pk == $v->title) {
// 遍历对应标题下的子项
foreach ($pv as $pk1 => $pv1) {
if (is_array($v->childs) && !empty($v->childs)) {
foreach ($v->childs as $k1 => $v1) {
if ($pv1 == $v1->title) {
$childs[] = $v1;
$object = (object)[
'title' => $v->title,
'href' => $v->href,
'class' => $v->class,
'childs' => $childs,
];
$matchMenu[$k] = $object;
continue; if (!in_array($permId, $perms)) {
} unset($menus[$k]);
}
} else {
$object = (object)[
'title' => $v->title,
'href' => $v->href,
'class' => $v->class,
'childs' => $v->childs,
];
$matchMenu[$k] = $object;
continue;
} }
} }
unset($childs); // 清除内容 if (count($v->childs) > 0) {
} $menus[$k]->childs = array_values($this->handleMenus($v->childs, $perms));
}
}
}
// 重新组合数组 if (empty($menus[$k]->childs)) {
if ($matchMenu) { unset($menus[$k]);
foreach ($matchMenu as $v) {
$newMenu[] = $v;
} }
} }
} }
return $newMenu; return array_values($menus);
} }
} }
\ No newline at end of file
<?php
return [
// 菜单权限
'联营订单' => [
'平台订单' => ['orderlist_check', 'export', 'cancel_order', 'check_account', 'order_send', 'update_address', 'update_invoice', 'check_test_order', 'check_order', 'download_contract', 'send_salesman'],
'ERP订单' => ['erp_order_check'],
'线上用户下单' => ['add_order_check'],
],
'自营订单' => [
'订单列表' => ['self_order_check', 'self_order_export', 'self_order_cancel', 'self_order_express', 'self_order_invoice_express', 'self_order_update_address', 'self_order_update_invoice', 'self_check_test_order', 'self_order_download_contract', 'self_check_pay', 'self_check_order'],
'快递配置' => ['self_order_express_set_check'],
'线上用户下单' => ['add_online_check'],
'内部采购下单' => ['add_offline_check', 'add_offline_audit'],
],
'订单统计' => [
'联营订单统计' => ['order_count_check'],
'自营订单统计' => ['self_order_count_check'],
],
'账期管理' => [
'申请列表' => ['order_account_apply_check'],
],
];
\ No newline at end of file
...@@ -197,3 +197,19 @@ li { ...@@ -197,3 +197,19 @@ li {
cursor: pointer; cursor: pointer;
} }
.show-list-info {
float: left;
width: 55%;
}
/* 响应式 */
@media screen and (max-width: 500px) {
.Wdate{ width: 110px !important; }
.btn-group { width: 220px; }
.search-btn { margin-bottom: 20px !important; }
.show-list-info { display: none; }
}
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
$action_name = explode('@', $route)[1]; $action_name = explode('@', $route)[1];
?> ?>
<input type="hidden" class="action_type" value="{{$action_name}}"> <input type="hidden" class="action_type" value="{{$action_name}}">
<div class="tabs-box"> <div class="tabs-box table-responsive">
<table class="table table-bordered order-express"> <table class="table table-bordered order-express">
<?php <?php
$currency = $order_info['currency'] == 2 ? '$' : '¥'; $currency = $order_info['currency'] == 2 ? '$' : '¥';
...@@ -397,7 +397,7 @@ ...@@ -397,7 +397,7 @@
@endif @endif
</div> </div>
<div class="tabs-box goods-price"> <div class="tabs-box goods-price table-responsive">
<table class="table"> <table class="table">
<thead> <thead>
<tr class="caption"> <tr class="caption">
...@@ -465,7 +465,7 @@ ...@@ -465,7 +465,7 @@
</table> </table>
</div> </div>
<div class="tabs-box order-total"> <div class="tabs-box order-total table-responsive">
<div> <div>
<table> <table>
<tr> <tr>
...@@ -515,7 +515,7 @@ ...@@ -515,7 +515,7 @@
<?php $client_source = App\Http\Controllers\clientSource($order_info['user_id']); ?> <?php $client_source = App\Http\Controllers\clientSource($order_info['user_id']); ?>
@if (!empty($client_source) || $order_info['status'] == -1) @if (!empty($client_source) || $order_info['status'] == -1)
<div class="tabs-box"> <div class="tabs-box table-responsive">
<table class="table table-bordered table-hover"> <table class="table table-bordered table-hover">
@if (!empty($client_source)) @if (!empty($client_source))
<tr> <tr>
...@@ -650,7 +650,7 @@ ...@@ -650,7 +650,7 @@
@if (!empty($order_shipping_info['info']) || !empty($order_shipping_inside)) @if (!empty($order_shipping_info['info']) || !empty($order_shipping_inside))
<p>物流信息</p> <p>物流信息</p>
<div class="tabs-box"> <div class="tabs-box table-responsive">
<table class="table table-bordered table-hover"> <table class="table table-bordered table-hover">
<thead> <thead>
<tr> <tr>
...@@ -711,7 +711,7 @@ ...@@ -711,7 +711,7 @@
@if (!empty($actionLog)) @if (!empty($actionLog))
<p>操作记录</p> <p>操作记录</p>
<div class="tabs-box"> <div class="tabs-box table-responsive">
<table class="table table-bordered table-hover"> <table class="table table-bordered table-hover">
<thead> <thead>
<tr> <tr>
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
</dl> </dl>
<dl> <dl>
<dt>创建日期: </dt> <dt>创建日期: </dt>
<dd> <dd style="width:auto !important;">
<input type="text" name="time_start" value="{{ !empty($condition['time_start']) ? date('Y/m/d', $condition['time_start']) : '' }}" class="Wdate " onfocus="WdatePicker({dateFmt:'yyyy/MM/dd'})" placeholder="开始时间" autocomplete="off" /> <input type="text" name="time_start" value="{{ !empty($condition['time_start']) ? date('Y/m/d', $condition['time_start']) : '' }}" class="Wdate " onfocus="WdatePicker({dateFmt:'yyyy/MM/dd'})" placeholder="开始时间" autocomplete="off" />
</dd> </dd>
<dd> <dd>
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
</div> </div>
</div> </div>
<div class="row-fluid"> <div class="row-fluid table-responsive">
<table class="table table-hover"> <table class="table table-hover">
<thead> <thead>
<tr> <tr>
...@@ -295,7 +295,7 @@ ...@@ -295,7 +295,7 @@
</div> </div>
<div class="row-fluid pagination"> <div class="row-fluid pagination">
@if ($username != 'vpadmin@ichunt.com') @if ($username != 'vpadmin@ichunt.com')
<span> <span class="show-list-info">
共{{$count ? $count : 0}}单, 共{{$count ? $count : 0}}单,
应付金额 ¥{{$pay_count['rmb_count'] ? $pay_count['rmb_count'] : 0}}, ${{$pay_count['usd_count'] ? $pay_count['usd_count'] : 0}}, 应付金额 ¥{{$pay_count['rmb_count'] ? $pay_count['rmb_count'] : 0}}, ${{$pay_count['usd_count'] ? $pay_count['usd_count'] : 0}},
实收金额 ¥{{$pay_count['rmb_pay'] ? $pay_count['rmb_pay'] : 0}}, 实收金额 ¥{{$pay_count['rmb_pay'] ? $pay_count['rmb_pay'] : 0}},
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
</dl> </dl>
<dl> <dl>
<dt>创建日期: </dt> <dt>创建日期: </dt>
<dd> <dd style="width:auto !important;">
<input type="text" name="time_start" value="{{ !empty($condition['time_start']) ? date('Y/m/d', $condition['time_start']) : '' }}" class="Wdate " onfocus="WdatePicker({dateFmt:'yyyy/MM/dd'})" placeholder="开始时间" autocomplete="off" /> <input type="text" name="time_start" value="{{ !empty($condition['time_start']) ? date('Y/m/d', $condition['time_start']) : '' }}" class="Wdate " onfocus="WdatePicker({dateFmt:'yyyy/MM/dd'})" placeholder="开始时间" autocomplete="off" />
</dd> </dd>
<dd> <dd>
...@@ -177,7 +177,7 @@ ...@@ -177,7 +177,7 @@
<td width="15%"> <td width="15%">
<dl> <dl>
<dt> <dt class="search-btn">
<button class="nbtn searchOrder">搜索</button> <button class="nbtn searchOrder">搜索</button>
</dt> </dt>
...@@ -195,7 +195,7 @@ ...@@ -195,7 +195,7 @@
</div> </div>
</div> </div>
<div class="row-fluid"> <div class="row-fluid table-responsive">
<table class="table table-hover"> <table class="table table-hover">
<thead> <thead>
<tr> <tr>
...@@ -418,7 +418,7 @@ ...@@ -418,7 +418,7 @@
</div> </div>
<div class="row-fluid pagination"> <div class="row-fluid pagination">
@if ($username != 'vpadmin@ichunt.com') @if ($username != 'vpadmin@ichunt.com')
<span style="float: left; width: 55%;"> <span class="show-list-info">
共{{$count ? $count : 0}}单, 共{{$count ? $count : 0}}单,
{{$paid_order_count}}单已付款(包含预付款), {{$paid_order_count}}单已付款(包含预付款),
下单用户数为{{$user_count}}人, 下单用户数为{{$user_count}}人,
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</dl> </dl>
<dl> <dl>
<dt>创建日期: </dt> <dt>创建日期: </dt>
<dd> <dd style="width:auto !important;">
<input type="text" name="time_start" value="{{ !empty($condition['time_start']) ? date('Y/m/d', $condition['time_start']) : '' }}" class="Wdate " onfocus="WdatePicker({dateFmt:'yyyy/MM/dd'})" placeholder="开始时间" autocomplete="off" /> <input type="text" name="time_start" value="{{ !empty($condition['time_start']) ? date('Y/m/d', $condition['time_start']) : '' }}" class="Wdate " onfocus="WdatePicker({dateFmt:'yyyy/MM/dd'})" placeholder="开始时间" autocomplete="off" />
</dd> </dd>
<dd> <dd>
...@@ -158,7 +158,7 @@ ...@@ -158,7 +158,7 @@
<td width="15%"> <td width="15%">
<dl> <dl>
<dt> <dt class="search-btn">
<button class="nbtn search_self_order">搜索</button> <button class="nbtn search_self_order">搜索</button>
</dt> </dt>
...@@ -175,7 +175,7 @@ ...@@ -175,7 +175,7 @@
</div> </div>
</div> </div>
<div class="row-fluid"> <div class="row-fluid table-responsive">
<table class="table table-hover"> <table class="table table-hover">
<thead> <thead>
<tr> <tr>
...@@ -348,7 +348,7 @@ ...@@ -348,7 +348,7 @@
</table> </table>
</div> </div>
<div class="row-fluid pagination"> <div class="row-fluid pagination">
<span style="float: left; width: 55%;"> <span class="show-list-info">
共{{$count ? $count : 0}}单, 共{{$count ? $count : 0}}单,
{{$paid_order_count}}单已付款(包含预付款), {{$paid_order_count}}单已付款(包含预付款),
下单用户数为{{$user_count}}人, 下单用户数为{{$user_count}}人,
......
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