Commit 4b30b87f by 杨树贤

提示逻辑

parent 972aebf0
...@@ -9,6 +9,7 @@ use App\Http\Services\CompanyService; ...@@ -9,6 +9,7 @@ use App\Http\Services\CompanyService;
use App\Http\Services\LogService; use App\Http\Services\LogService;
use App\Http\Services\SupplierAuditService; use App\Http\Services\SupplierAuditService;
use App\Http\Services\SupplierService; use App\Http\Services\SupplierService;
use App\Http\Services\SupplierStatisticsService;
use App\Http\Services\SyncSupplierService; use App\Http\Services\SyncSupplierService;
use App\Http\Transformers\SupplierTransformer; use App\Http\Transformers\SupplierTransformer;
use App\Http\Validators\SupplierValidator; use App\Http\Validators\SupplierValidator;
...@@ -16,6 +17,9 @@ use App\Model\LogModel; ...@@ -16,6 +17,9 @@ use App\Model\LogModel;
use App\Model\RedisModel; use App\Model\RedisModel;
use App\Model\SupplierChannelModel; use App\Model\SupplierChannelModel;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Auth;
use Cookie;
class SupplierApiController extends Controller class SupplierApiController extends Controller
{ {
...@@ -564,6 +568,7 @@ class SupplierApiController extends Controller ...@@ -564,6 +568,7 @@ class SupplierApiController extends Controller
} }
} }
//批量分配云芯采购员
public function BatchAllocateYunxinChannelUser($request) public function BatchAllocateYunxinChannelUser($request)
{ {
$channelUid = $request->get('channel_uid'); $channelUid = $request->get('channel_uid');
...@@ -716,4 +721,15 @@ class SupplierApiController extends Controller ...@@ -716,4 +721,15 @@ class SupplierApiController extends Controller
$this->response(-1, '不存在'); $this->response(-1, '不存在');
} }
//判断是否有全部采购员离职的供应商
public function checkHasAllResignedChannelUserSupplier($request)
{
setcookie('has_pop_up_all_channel_user_supplier_tips', 1);
$count = (new SupplierStatisticsService())->getStatisticsCount('all_channel_user_resigned');
if ($count) {
$this->response(0, 'ok', $count);
}
$this->response(-1, '没有全部采购员离职的供应商');
}
} }
...@@ -25,7 +25,11 @@ class SupplierStatisticsApiController extends Controller ...@@ -25,7 +25,11 @@ class SupplierStatisticsApiController extends Controller
$statistics = $service->getSupplierListStatistics(); $statistics = $service->getSupplierListStatistics();
$data = []; $data = [];
foreach ($statistics as $name => $count) { foreach ($statistics as $name => $count) {
$data[$name] = array_get(config('fixed.CompassMenuMap'), $name) . "(${count})"; if ($count === null) {
$data[$name] = array_get(config('fixed.CompassMenuMap'), $name);
}else{
$data[$name] = array_get(config('fixed.CompassMenuMap'), $name) . "(${count})";
}
} }
$this->response(0, 'ok', $data); $this->response(0, 'ok', $data);
} }
......
...@@ -343,6 +343,17 @@ class SupplierFilter ...@@ -343,6 +343,17 @@ class SupplierFilter
break; break;
case "pay_type_term": case "pay_type_term":
$query->where('pay_type', 1); $query->where('pay_type', 1);
//采购员全离职
case "all_channel_user_resigned":
$adminUserService = new AdminUserService();
$resignedUsers = $adminUserService->getOnJobUsers();
$resignedUserCodes = array_column($resignedUsers, 'code_id');
//因为可以查看相关的采购员的供应商,所以要构建复杂likeIn语句需要的数据
//注意下面三个条件最外层要用()包围起来,要不然mysql数据会有问题,具体自己查询mysql的and和or的语法注意事项
$likeSqlRaw = implode('|', $resignedUserCodes);
$query->where('channel_uid', '!=', '')->where('is_type', 0)
->whereRaw(DB::raw("(channel_uid NOT REGEXP '$likeSqlRaw')"));
break;
} }
return $query; return $query;
} }
......
...@@ -40,7 +40,7 @@ class CheckLogin ...@@ -40,7 +40,7 @@ class CheckLogin
if ($isApi) { if ($isApi) {
return ["errcode" => 101, "errmsg" => "没有登录"]; return ["errcode" => 101, "errmsg" => "没有登录"];
} }
return redirect($login['login'] . '?redirect=' . urlencode($request->fullUrl())); return redirect($login['login'] . '?redirect=' . urlencode($request->fullUrl().'?from=login'));
} }
$cookie = 'oa_user_id=' . $userId . '; oa_skey=' . $skey; $cookie = 'oa_user_id=' . $userId . '; oa_skey=' . $skey;
......
...@@ -12,6 +12,6 @@ class EncryptCookies extends BaseEncrypter ...@@ -12,6 +12,6 @@ class EncryptCookies extends BaseEncrypter
* @var array * @var array
*/ */
protected $except = [ protected $except = [
// 'has_pop_up_all_channel_user_supplier_tips'
]; ];
} }
...@@ -45,7 +45,7 @@ class AdminUserService ...@@ -45,7 +45,7 @@ class AdminUserService
public function getAdminIdByUserName($userName) public function getAdminIdByUserName($userName)
{ {
return UserInfoModel::where('name', $userName)->value('userId'); return UserInfoModel::where('name', $userName)->value('userId');
} }
public function getAdminIdByEmail($email) public function getAdminIdByEmail($email)
...@@ -81,6 +81,15 @@ class AdminUserService ...@@ -81,6 +81,15 @@ class AdminUserService
return $user ? $user->toArray() : []; return $user ? $user->toArray() : [];
} }
//获取未离职人员列表
public function getOnJobUsers()
{
$userInfoModel = new UserInfoModel();
$user = $userInfoModel->leftJoin('lie_intracode', 'user_info.userId', '=', 'lie_intracode.admin_id')
->where('user_info.status', '!=', 4)->where('lie_intracode.code_id', '!=', '')->get();
return $user ? $user->toArray() : [];
}
//判断是否是离职人员 //判断是否是离职人员
public function checkIsResignedByCodeId($codeId) public function checkIsResignedByCodeId($codeId)
{ {
......
...@@ -79,6 +79,7 @@ class SupplierStatisticsService ...@@ -79,6 +79,7 @@ class SupplierStatisticsService
'history_abnormal' => $historyAbnormal, 'history_abnormal' => $historyAbnormal,
'pay_type_term' => $payTypeTerm, 'pay_type_term' => $payTypeTerm,
'level_a' => $levelA, 'level_a' => $levelA,
'all_channel_user_resigned' => null,
]; ];
$result = array_map(function ($value) { $result = array_map(function ($value) {
if ($value > 999) { if ($value > 999) {
...@@ -91,7 +92,7 @@ class SupplierStatisticsService ...@@ -91,7 +92,7 @@ class SupplierStatisticsService
return $result; return $result;
} }
private function getStatisticsCount($type) public function getStatisticsCount($type)
{ {
$model = new SupplierChannelModel(); $model = new SupplierChannelModel();
//显示默认的数据(有权限逻辑) //显示默认的数据(有权限逻辑)
......
...@@ -31,8 +31,8 @@ class SupplierTransformer ...@@ -31,8 +31,8 @@ class SupplierTransformer
$adminUserService = new AdminUserService(); $adminUserService = new AdminUserService();
//获取基石上传记录情况,展示第一次上传时间和最后一次上传时间 //获取基石上传记录情况,展示第一次上传时间和最后一次上传时间
$firstUploadSkuTimes = SkuService::getUploadTimeBySupplierCodes(array_column($list, 'supplier_code'),'first'); $firstUploadSkuTimes = SkuService::getUploadTimeBySupplierCodes(array_column($list, 'supplier_code'), 'first');
$lastUploadSkuTimes = SkuService::getUploadTimeBySupplierCodes(array_column($list, 'supplier_code'),'last'); $lastUploadSkuTimes = SkuService::getUploadTimeBySupplierCodes(array_column($list, 'supplier_code'), 'last');
foreach ($list as &$supplier) { foreach ($list as &$supplier) {
$supplier['viewed'] = array_get($viewData, $supplier['supplier_id'], false); $supplier['viewed'] = array_get($viewData, $supplier['supplier_id'], false);
...@@ -62,9 +62,10 @@ class SupplierTransformer ...@@ -62,9 +62,10 @@ class SupplierTransformer
$userInfo = $adminUserService->getAdminUserInfo($supplier['create_uid']); $userInfo = $adminUserService->getAdminUserInfo($supplier['create_uid']);
$supplier['create_name'] = array_get($userInfo, 'name'); $supplier['create_name'] = array_get($userInfo, 'name');
} }
$supplier['first_upload_sku_time'] = array_get($firstUploadSkuTimes,$supplier['supplier_code']) ? date('Y-m-d H:i:s',
$supplier['first_upload_sku_time'] = date('Y-m-d H:i:s', $firstUploadSkuTimes[$supplier['supplier_code']]); $firstUploadSkuTimes[$supplier['supplier_code']]) : '';
$supplier['last_upload_sku_time'] = date('Y-m-d H:i:s', $lastUploadSkuTimes[$supplier['supplier_code']]); $supplier['last_upload_sku_time'] = array_get($lastUploadSkuTimes,$supplier['supplier_code']) ? date('Y-m-d H:i:s',
$lastUploadSkuTimes[$supplier['supplier_code']]) : '';
//获取最新修改人以及下级审核员 //获取最新修改人以及下级审核员
$logModel = new LogModel(); $logModel = new LogModel();
......
...@@ -12,6 +12,11 @@ class IntracodeModel extends Model ...@@ -12,6 +12,11 @@ class IntracodeModel extends Model
protected $table = 'lie_intracode'; protected $table = 'lie_intracode';
protected $primaryKey = 'code_id'; protected $primaryKey = 'code_id';
public function userInfo()
{
return $this->hasOne(UserInfoModel::class, 'admin_id', 'userId');
}
//默认不包含离职 //默认不包含离职
public function getEncode($includeResigned = false) public function getEncode($includeResigned = false)
{ {
......
...@@ -18,14 +18,14 @@ return [ ...@@ -18,14 +18,14 @@ return [
//1代理商,2现货商,3财务供应商,4原厂,5代工厂,6黑名单 //1代理商,2现货商,3财务供应商,4原厂,5代工厂,6黑名单
'SupplierGroup' => [ 'SupplierGroup' => [
0 => '其它',
1 => '代理商',
2 => '现货商', 2 => '现货商',
3 => '方案商',
4 => '原厂', 4 => '原厂',
1 => '代理商',
7 => '混合分销',
5 => '分销平台', 5 => '分销平台',
3 => '方案商',
6 => '代工厂', 6 => '代工厂',
7 => '混合分销', 0 => '其它',
], ],
//供应商编码规则映射表,用于根据供应商类型生成编码 //供应商编码规则映射表,用于根据供应商类型生成编码
//比如 : 原厂=>M+7位数 代理=>D+7位数 //比如 : 原厂=>M+7位数 代理=>D+7位数
...@@ -239,6 +239,7 @@ return [ ...@@ -239,6 +239,7 @@ return [
'history_abnormal' => '历史检测异常', 'history_abnormal' => '历史检测异常',
'level_a' => '战略供应商', 'level_a' => '战略供应商',
'pay_type_term' => '账期供应商', 'pay_type_term' => '账期供应商',
'all_channel_user_resigned' => '采购员全离职',
], ],
//Sku列表的罗盘对应菜单id //Sku列表的罗盘对应菜单id
'SkuListCompassMenuMap' => [ 'SkuListCompassMenuMap' => [
......
...@@ -39,8 +39,8 @@ ...@@ -39,8 +39,8 @@
</a> </a>
<dl class="layui-nav-child"> <dl class="layui-nav-child">
<dd lay-unselect> <dd lay-unselect>
<a href="{{ Config::get('website.login')['logout'].'?redirect='.URL::current() }}" style="margin-right:10px;"><i class="fa fa-sign-out"></i><span class="nav-label">切换账号</span></a> <a href="{{ Config::get('website.login')['logout'].'?redirect='.URL::current().'&from=login'}}" style="margin-right:10px;" onclick="clearTips()"><i class="fa fa-sign-out"></i><span class="nav-label">切换账号</span></a>
<a href="{{ Config::get('website.login')['logout'] }}"><i class="fa fa-sign-out"></i><span class="nav-label">退出</span></a> <a href="{{ Config::get('website.login')['logout'].'?redirect='.URL::current().'&from=login' }}" onclick="clearTips()" ><i class="fa fa-sign-out"></i><span class="nav-label">退出</span></a>
</dd> </dd>
</dl> </dl>
...@@ -49,4 +49,12 @@ ...@@ -49,4 +49,12 @@
<a ew-event="" title=""><i class="layui-icon layui-icon-more-vertical"></i></a> <a ew-event="" title=""><i class="layui-icon layui-icon-more-vertical"></i></a>
</li> </li>
</ul> </ul>
</div> </div>
\ No newline at end of file <script>
function clearTips(){
layui.use(['admin', 'index'], function () {
let admin = layui.admin;
admin.putTempData('has_pop_up_all_channel_user_supplier_tips', 0);
});
}
</script>
\ No newline at end of file
...@@ -35,6 +35,9 @@ ...@@ -35,6 +35,9 @@
menuObj.text(''); menuObj.text('');
menuObj.append(value); menuObj.append(value);
}); });
if (getQueryVariable('source_type')) {
$('#' + getQueryVariable('source_type')).click();
}
} }
if (hasLoading) { if (hasLoading) {
admin.removeLoading('#type_filter'); admin.removeLoading('#type_filter');
...@@ -81,6 +84,9 @@ ...@@ -81,6 +84,9 @@
}); });
}); });
if (getQueryVariable('source_type')) {
whereCondition.source_type = getQueryVariable('source_type');
}
let cols = [ let cols = [
{type: 'checkbox', fixed: true}, {type: 'checkbox', fixed: true},
...@@ -189,7 +195,6 @@ ...@@ -189,7 +195,6 @@
, done: function (res, curr, count) { , done: function (res, curr, count) {
//得到当前页码 //得到当前页码
currentPage = curr; currentPage = curr;
res.data.forEach(function (item, index) { res.data.forEach(function (item, index) {
if (item.status === -3) { if (item.status === -3) {
//禁用复选框,设置不可选中标识,将该行设置为阴影色 //禁用复选框,设置不可选中标识,将该行设置为阴影色
...@@ -631,6 +636,45 @@ ...@@ -631,6 +636,45 @@
} }
}) })
//判断是否要展示有全部离职采购员的供应商,有的话提示
if (!admin.getTempData('has_pop_up_all_channel_user_supplier_tips')) {
$.ajax({
url: '/api/supplier/checkHasAllResignedChannelUserSupplier',
type: 'POST',
async: true,
dataType: 'json',
timeout: 20000,
success: function (res) {
if (!res) {
layer.msg('网络错误,请重试', {icon: 6});
} else {
if (res.err_code === 0) {
layer.confirm('<div style="width: 400px;height: 50px;"><p>属于你部门的正式供应商有 <span style="color: red;">' + res.data + '</span> 没有有效采购员(采购员全离职)<p><p>请尽快分配采购员进行维护</p></div>', {
btn: ['立即前往', '关闭提示'], //按钮
offset: 'rb',
}, function () {
admin.putTempData('has_pop_up_all_channel_user_supplier_tips', 1);
layer.closeAll();
index.openTab({
title: '供应商列表',
url: '/supplier/SupplierList?view=iframe&source_type=all_channel_user_resigned',
end: function () {
}
});
}, function () {
admin.putTempData('has_pop_up_all_channel_user_supplier_tips', 1);
layer.closeAll();
});
} else {
}
}
},
error: function () {
layer.msg('网络错误', {icon: 5});
}
});
}
//点击查询按钮 //点击查询按钮
form.on('submit(load)', function (data) { form.on('submit(load)', function (data) {
//罗盘选项会跳回全部 //罗盘选项会跳回全部
......
...@@ -93,4 +93,9 @@ ...@@ -93,4 +93,9 @@
// 使用刚指定的配置项和数据显示图表。 // 使用刚指定的配置项和数据显示图表。
myChart.setOption(option); myChart.setOption(option);
layui.use(['admin', 'index'], function () {
let index = layui.index;
let admin = layui.admin;
});
</script> </script>
\ No newline at end of file
@include('web.supplier.SupplierListCommon') @include('web.supplier.SupplierListFilter')
<div class="layui-btn-group demoTable" style="margin-bottom: 15px;margin-top: 15px"> <div class="layui-btn-group demoTable" style="margin-bottom: 15px;margin-top: 15px">
@if(checkPerm('AddSupplier')) @if(checkPerm('AddSupplier'))
......
...@@ -93,7 +93,10 @@ ...@@ -93,7 +93,10 @@
<a title="公司性质为现货商性质的供应商没有上传品质协议" class="main_filter" id="no_quality_assurance_agreement"> <a title="公司性质为现货商性质的供应商没有上传品质协议" class="main_filter" id="no_quality_assurance_agreement">
</a> </a>
</div> </div>
<div class="layui-row">
<a title="采购员全离职" class="main_filter" id="all_channel_user_resigned">
</a>
</div>
</div> </div>
<div class="split-item" id="s5" style="text-align: center"> <div class="split-item" id="s5" style="text-align: center">
@if(checkPerm('SupplierBlockList')) @if(checkPerm('SupplierBlockList'))
......
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