Commit 0719929c by mushishixian

列表

parent de7ae637
...@@ -21,15 +21,21 @@ class LogApiController extends Controller ...@@ -21,15 +21,21 @@ class LogApiController extends Controller
{ {
$limit = $request->get('limit', 10); $limit = $request->get('limit', 10);
$data = $request->only([ $data = $request->only([
'supplier_id',
'type', 'type',
'action',
'admin_id' 'admin_id'
]); ]);
$model = new LogModel(); $model = new LogModel();
$query = $model->orderBy('id', 'desc'); $query = $model->where('supplier_id',$data['supplier_id'])->orderBy('id', 'desc');
if (!empty($data['type'])) { if (!empty($data['type'])) {
$query->where('type', $data['type']); $query->where('type', $data['type']);
} }
if (!empty($data['action'])) {
$query->where('action', $data['action']);
}
if (!empty($data['admin_id'])) { if (!empty($data['admin_id'])) {
$adminUserService = new AdminUserService(); $adminUserService = new AdminUserService();
$user= $adminUserService->getAdminUserInfoByCodeId($data['admin_id']); $user= $adminUserService->getAdminUserInfoByCodeId($data['admin_id']);
......
...@@ -18,8 +18,9 @@ class SupplierFilter ...@@ -18,8 +18,9 @@ class SupplierFilter
//显示默认的数据(有权限逻辑) //显示默认的数据(有权限逻辑)
$query = $this->defaultFilter($query, $map['source_type']); $query = $this->defaultFilter($query, $map['source_type']);
//判断筛选参数 //判断筛选参数
if (!empty($map['supplier_id'])) {
$query->where('supplier_id', $map['supplier_id']);
}
if (!empty($map['supplier_name'])) { if (!empty($map['supplier_name'])) {
$query->where('supplier_name', 'like', "%{$map['supplier_name']}%"); $query->where('supplier_name', 'like', "%{$map['supplier_name']}%");
} }
...@@ -27,17 +28,17 @@ class SupplierFilter ...@@ -27,17 +28,17 @@ class SupplierFilter
$codes = explode(',', $map['supplier_code']); $codes = explode(',', $map['supplier_code']);
$query->whereIn('supplier_code', $codes); $query->whereIn('supplier_code', $codes);
} }
if (!empty($map['supplier_group'])) { if (!empty($map['supplier_group']) || (isset($map['supplier_group'])&&$map['supplier_group'] === '0')) {
$query->where('supplier_group', $map['supplier_group']); $query->where('supplier_group', $map['supplier_group']);
} }
if (!empty($map['stockup_type'])) { if (!empty($map['stockup_type'])) {
$query->where('stockup_type', 'like', "%{$map['stockup_type']}%"); $query->where('stockup_type', 'like', "%{$map['stockup_type']}%");
} }
if (!empty($map['channel_uid'])) {
$query->where('channel_uid', $map['channel_uid']);
}
if (!empty($map['purchase_uid'])) { if (!empty($map['purchase_uid'])) {
$query->where('purchase_uid', 'like', "%{$map['purchase_uid']}%"); $query->where('purchase_uid', $map['purchase_uid']);
}
if (!empty($map['channel_uid'])) {
$query->where('channel_uid', 'like', "%{$map['channel_uid']}%");
} }
if (!empty($map['create_uid'])) { if (!empty($map['create_uid'])) {
$query->where('create_uid', $map['create_uid']); $query->where('create_uid', $map['create_uid']);
...@@ -61,6 +62,13 @@ class SupplierFilter ...@@ -61,6 +62,13 @@ class SupplierFilter
$query->whereBetween('create_time', [$startTime, $endTime]); $query->whereBetween('create_time', [$startTime, $endTime]);
} }
if (!empty($map['update_time'])) {
$times = explode('~', $map['update_time']);
$startTime = strtotime($times[0]);
$endTime = strtotime($times[1]);
$query->whereBetween('update_time', [$startTime, $endTime]);
}
if (!empty($map['blacklist_uid'])) { if (!empty($map['blacklist_uid'])) {
$query = $query->whereHas('blacklist', function ($q) use ($map) { $query = $query->whereHas('blacklist', function ($q) use ($map) {
if (!empty($map['blacklist_uid'])) { if (!empty($map['blacklist_uid'])) {
......
...@@ -9,6 +9,7 @@ use App\Http\Services\SupplierStatisticsService; ...@@ -9,6 +9,7 @@ use App\Http\Services\SupplierStatisticsService;
use App\Http\Services\ViewCheckService; use App\Http\Services\ViewCheckService;
use App\Http\Transformers\SupplierTransformer; use App\Http\Transformers\SupplierTransformer;
use App\Model\IntracodeModel; use App\Model\IntracodeModel;
use App\Model\LogModel;
use App\Model\SupplierChannelModel; use App\Model\SupplierChannelModel;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
...@@ -166,7 +167,10 @@ class SupplierController extends Controller ...@@ -166,7 +167,10 @@ class SupplierController extends Controller
$this->data['supplier'] = $supplier; $this->data['supplier'] = $supplier;
$intracodeModel = new IntracodeModel(); $intracodeModel = new IntracodeModel();
$this->data['userCodes'] = $intracodeModel->getSampleEncode(); $this->data['userCodes'] = $intracodeModel->getSampleEncode();
$this->data['logs'] = []; $logModel = new LogModel();
$this->data['logs'] = $logModel->where('supplier_id',$supplierId)
->where('action','allocate_purchase_user')->orderBy('id','desc')
->limit(10)->get();
return $this->view('审核供应商'); return $this->view('审核供应商');
} }
......
...@@ -9,6 +9,7 @@ use Illuminate\Support\Facades\DB; ...@@ -9,6 +9,7 @@ use Illuminate\Support\Facades\DB;
class LogService class LogService
{ {
//供应商不同数据库字段对应的中文,用于日志记录 //供应商不同数据库字段对应的中文,用于日志记录
public $fieldMapToLogContent = [ public $fieldMapToLogContent = [
'supplier_name' => '供应商名称', 'supplier_name' => '供应商名称',
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
namespace App\Http\Services; namespace App\Http\Services;
use App\Http\Transformers\SupplierTransformer; use App\Http\Transformers\SupplierTransformer;
use App\Model\LogModel;
use App\Model\RedisModel; use App\Model\RedisModel;
use App\Model\SupplierAddressModel; use App\Model\SupplierAddressModel;
use App\Model\SupplierChannelModel; use App\Model\SupplierChannelModel;
...@@ -206,6 +207,7 @@ class SupplierService ...@@ -206,6 +207,7 @@ class SupplierService
$model = new SupplierChannelModel(); $model = new SupplierChannelModel();
$supplier = $model->where('supplier_id', $supplierId)->first(); $supplier = $model->where('supplier_id', $supplierId)->first();
$supplier = $supplier ? $supplier->toArray() : []; $supplier = $supplier ? $supplier->toArray() : [];
$prePurchaseUid = $supplier['purchase_uid'];
$result = $model->where('supplier_id', $supplierId)->update([ $result = $model->where('supplier_id', $supplierId)->update([
'update_time' => time(), 'update_time' => time(),
'purchase_uid' => $purchaseUid, 'purchase_uid' => $purchaseUid,
...@@ -213,7 +215,7 @@ class SupplierService ...@@ -213,7 +215,7 @@ class SupplierService
$toFollowUp = false; $toFollowUp = false;
if ($result) { if ($result) {
//重新分配渠道开发并且开发人员有变更的时候,就去检查是否需要跟进 //重新分配渠道开发并且开发人员有变更的时候,就去检查是否需要跟进
if ($supplier['purchase_uid']!=$purchaseUid) { if ($supplier['purchase_uid'] != $purchaseUid) {
$auditService = new SupplierAuditService(); $auditService = new SupplierAuditService();
//还要判断是否为待跟进供应商 //还要判断是否为待跟进供应商
if (!$auditService->checkIsNeedToFollowUpSupplier($supplierId)) { if (!$auditService->checkIsNeedToFollowUpSupplier($supplierId)) {
...@@ -223,8 +225,20 @@ class SupplierService ...@@ -223,8 +225,20 @@ class SupplierService
]); ]);
} }
} }
//还要去记录日志
$adminUserService = new AdminUserService();
$prePurchaseUser = $adminUserService->getAdminUserInfoByCodeId($prePurchaseUid);
$prePurchaseUserName = array_get($prePurchaseUser, 'name', '');
$purchaseUser = $adminUserService->getAdminUserInfoByCodeId($purchaseUid);
$purchaseUserName = array_get($purchaseUser, 'name', '');
$logService = new LogService();
$name = request()->user->name;
$content = "将渠道开发员由 [${prePurchaseUserName}] 改为 [${purchaseUserName}]";
$logService->AddLog($supplierId, LogModel::UPDATE_OPERATE, 'allocate_purchase_user',$content);
} }
return $toFollowUp; return $result;
} }
} }
\ No newline at end of file
...@@ -9,4 +9,8 @@ class LogModel extends Model ...@@ -9,4 +9,8 @@ class LogModel extends Model
protected $connection='web'; protected $connection='web';
protected $table='log'; protected $table='log';
public $timestamps = false; public $timestamps = false;
const UPDATE_OPERATE = 1;
const ADD_OPERATE = 2;
const VIEW_OPERATE = 3;
} }
...@@ -79,7 +79,6 @@ class TransformableTimeIntervalPresenter ...@@ -79,7 +79,6 @@ class TransformableTimeIntervalPresenter
$('.day_type_button').click(function() { $('.day_type_button').click(function() {
$('.day_type_button').attr('class','layui-btn layui-btn-primary layui-btn-sm day_type_button'); $('.day_type_button').attr('class','layui-btn layui-btn-primary layui-btn-sm day_type_button');
$(this).attr('class','layui-btn layui-btn-sm layui-btn-normal day_type_button'); $(this).attr('class','layui-btn layui-btn-sm layui-btn-normal day_type_button');
alert($(this).attr('dateInterval'));
laydate.render({ laydate.render({
elem: '#$unique' elem: '#$unique'
,type: 'date' ,type: 'date'
......
<script> <script>
layui.use(['table', 'form', 'element', 'layer','admin'], function () { layui.use(['table', 'form', 'element', 'table', 'layer', 'admin'], function () {
let admin = layui.admin; let admin = layui.admin;
let form = layui.form; let form = layui.form;
let table = layui.table
let element = layui.element; let element = layui.element;
table.render({
elem: '#logList'
, url: '/api/log/GetLogList'
, method: 'post'
, size: 'sm'
, limit: 10
, cellMinWidth: 80 //全局定义常规单元格的最小宽度
, where: {
supplier_id:{{$supplier['supplier_id']}},
action: 'allocate_purchase_user',
}
, loading: true
, first: true //不显示首页
, last: false //不显示尾页
, cols: [[
{field: 'add_time', title: '日志时间', width: 150, align: 'center'},
{
field: 'content', title: '日志内容', align: 'center', templet: function (data) {
return data.admin_name + data.content;
}
},
]]
, id: 'logList'
, page: {}
});
form.on('submit(auditSupplier)', function (data) { form.on('submit(auditSupplier)', function (data) {
let supplierId = getQueryVariable('supplier_id'); let supplierId = getQueryVariable('supplier_id');
let url = '/api/supplier/AllocatePurchaseUser?supplier_id=' + supplierId; let url = '/api/supplier/AllocatePurchaseUser?supplier_id=' + supplierId;
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
, url: '/api/supplier/GetSupplierList' , url: '/api/supplier/GetSupplierList'
, method: 'post' , method: 'post'
, size: 'sm' , size: 'sm'
, limit: 20
, cellMinWidth: 80 //全局定义常规单元格的最小宽度 , cellMinWidth: 80 //全局定义常规单元格的最小宽度
, where: whereCondition , where: whereCondition
, loading: true , loading: true
...@@ -42,7 +43,7 @@ ...@@ -42,7 +43,7 @@
field: 'supplier_code', title: '供应商编码', align: 'center', width: 90, templet: function (data) { field: 'supplier_code', title: '供应商编码', align: 'center', width: 90, templet: function (data) {
return "<a ew-href='/supplier/SupplierDetail?view=iframe&supplier_id=" + data.supplier_id + return "<a ew-href='/supplier/SupplierDetail?view=iframe&supplier_id=" + data.supplier_id +
"' style='color: dodgerblue' ew-title='供应商详情'>" + data.supplier_code + "</a>" "' style='color: dodgerblue' ew-title='供应商详情 - " + data.supplier_code + "'>" + data.supplier_code + "</a>"
} }
}, },
{field: 'supplier_name', title: '供应商名称', align: 'center'}, {field: 'supplier_name', title: '供应商名称', align: 'center'},
...@@ -55,7 +56,7 @@ ...@@ -55,7 +56,7 @@
{ {
field: 'contact_num', title: '联系人', align: 'center', width: 80, templet: function (data) { field: 'contact_num', title: '联系人', align: 'center', width: 80, templet: function (data) {
return "<a ew-href='/supplier/SupplierDetail?view=iframe&tab=contact&supplier_id=" + data.supplier_id + return "<a ew-href='/supplier/SupplierDetail?view=iframe&tab=contact&supplier_id=" + data.supplier_id +
"' style='color: dodgerblue' ew-title='供应商详情' title='点击跳转查看联系人列表'>" + data.contact_num + "</a>" "' style='color: dodgerblue' ew-title='供应商详情 - " + data.supplier_code + "' title='点击跳转查看联系人列表'>" + data.contact_num + "</a>"
} }
}, },
...@@ -133,7 +134,7 @@ ...@@ -133,7 +134,7 @@
layer.open({ layer.open({
type: 2, type: 2,
content: '/supplier/AllocatePurchaseUser?view=iframe&supplier_id=' + supplierId, content: '/supplier/AllocatePurchaseUser?view=iframe&supplier_id=' + supplierId,
area: ['500px', '70%'], area: ['600px', '70%'],
title: '配置渠道开发员', title: '配置渠道开发员',
end: function () { end: function () {
table.reload('list'); table.reload('list');
...@@ -157,7 +158,7 @@ ...@@ -157,7 +158,7 @@
const status = data[0].status; const status = data[0].status;
const hasSku = data[0].hasSku; const hasSku = data[0].hasSku;
if ((status === 3 || status === 2) && !hasSku) { if ((status === 3 || status === 2) && !hasSku) {
layer.confirm('对应供应商设为禁用后,猎芯将无法与其进行交易,如要再次启用,则须再次走入驻流程,是否执行当前操作?', function (index) { layer.confirm('对应供应商设为禁用并且审核通过后,猎芯将无法与其进行交易,如要再次启用,则须再次走入驻流程,是否执行当前操作?', function (index) {
let supplierId = data[0].supplier_id; let supplierId = data[0].supplier_id;
let res = ajax('/api/supplier/DisableSupplier', {supplier_id: supplierId}) let res = ajax('/api/supplier/DisableSupplier', {supplier_id: supplierId})
if (res.err_code === 0) { if (res.err_code === 0) {
......
...@@ -45,6 +45,4 @@ ...@@ -45,6 +45,4 @@
<blockquote class="layui-elem-quote layui-text"> <blockquote class="layui-elem-quote layui-text">
<b>操作日志</b> <b>操作日志</b>
</blockquote> </blockquote>
@foreach($logs as $log) <table class="layui-table" id="logList" lay-filter="logList"></table>
{{date('Y-m-d H:i:s',$log['add_time'])}} -- {{$log['content']}}
@endforeach
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