Commit 04172cec by 杨树贤

转移供应商联系人

parent 954df2aa
......@@ -172,4 +172,14 @@ class SupplierContactApiController extends Controller
$logService->AddLog($contact['supplier_id'], LogModel::VIEW_OPERATE, '查看供应商基本资料', $content);
$this->response(0, 'ok', $contact);
}
//转移供应商联系人
public function TransferSupplierContact($supplierId, $originCanCheckUid, $newCanCheckUid)
{
return DB::connection('web')->transaction(function () use ($supplierId, $originCanCheckUid, $newCanCheckUid) {
//直接去批量修改即可
return SupplierContactModel::where('supplier_id', $supplierId)->where('can_check_uids', $originCanCheckUid)
->update(['can_check_uids' => $newCanCheckUid]);
});
}
}
......@@ -17,6 +17,7 @@ use App\Http\Transformers\SupplierTransformer;
use App\Model\IntracodeModel;
use App\Model\LogModel;
use App\Model\SupplierChannelModel;
use App\Model\SupplierContactModel;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use function foo\func;
......@@ -413,4 +414,24 @@ class SupplierController extends Controller
return $this->view('查询供应商');
}
//交接供应商
public function TransferSupplier($request)
{
$supplierId = $request->input('supplier_id');
$supplier = SupplierChannelModel::where('supplier_id', $supplierId)->first();
if (empty($supplier)) {
return '当前选择的供应商不存在';
}
$this->data['supplier'] = $supplier;
$channelUids = SupplierContactModel::where('supplier_id', $supplierId)->pluck('can_check_uids')
->toArray();
$channelUids = array_unique($channelUids);
$supplierUserCodes = (new IntracodeModel())->getSampleEncodeByCodeIds($channelUids);
$this->data['supplierUserCodes'] = $supplierUserCodes;
$this->data['userCodes'] = (new IntracodeModel())->getSampleEncode();
return $this->view('供应商交接');
}
}
......@@ -79,6 +79,21 @@ class IntracodeModel extends Model
return $result;
}
//根据用户内部编码获取
public function getSampleEncodeByCodeIds($codeIds = [])
{
$codeList = $this->getEncode(true);
$result = [];
foreach ($codeList as $code) {
if (in_array($code['code_id'], $codeIds)) {
$result[$code['code_id']] = $code['name'] . '(' . $code['code_id'] . ')';
}
continue;
}
return $result;
}
//获取简单的内部用户数据
//默认不包含离职的
public function getSampleName($includeResigned = false)
......@@ -91,6 +106,7 @@ class IntracodeModel extends Model
return $result;
}
//获取简单的内部用户数据(包含离职)
public function getAllSampleEncode()
{
......
<script>
layui.use(['table', 'form', 'element', 'layer', 'Split', 'admin', 'index','xmSelect'], function () {
layui.use(['table', 'form', 'element', 'layer', 'Split', 'admin', 'index', 'xmSelect'], function () {
let $ = layui.jquery;
let Split = layui.Split;
// 水平分割,需要分割的元素(id)、默认大小(百分比)、最小值(单位px)
......@@ -126,7 +126,7 @@
height: 'auto',
data: function () {
//这个数据在对应的blade页面下面...
return {!! json_encode($createUserDepartmentList) !!};
return {!! json_encode($createUserDepartmentList) !!};
}
})
......@@ -714,7 +714,7 @@
}
})
//设置SKU采购
//查询供应商
$("#query_supplier").click(function () {
layer.open({
type: 2,
......@@ -726,6 +726,29 @@
});
})
//交接供应商
$("#transfer_supplier").click(function () {
let checkStatus = table.checkStatus('list');
let data = checkStatus.data;
if (!data.length) {
layer.msg('请先选择要操作的供应商', {icon: 5})
} else {
if (data.length > 1) {
layer.msg('该操作不支持多选', {icon: 5})
return;
}
let supplierId = data[0].supplier_id;
layer.open({
type: 2,
content: '/supplier/TransferSupplier?view=iframe&supplier_id=' + supplierId,
area: ['50%', '70%'],
title: '交接供应商',
end: function () {
}
});
}
})
//判断是否要展示有全部离职采购员的供应商,有的话提示
if (!admin.getTempData('has_pop_up_all_channel_user_supplier_tips')) {
$.ajax({
......
<script>
layui.use(['table', 'form', 'element', 'table', 'layer', 'admin'], function () {
let admin = layui.admin;
let form = layui.form;
let table = layui.table
let element = layui.element;
form.on('submit(blockSupplier)', function (data) {
admin.showLoading({
type: 3,
});
let url = '/api/supplier/transferSupplier?supplier_id=' + getQueryVariable('supplier_id');
let res = ajax(url, data);
if (!res) {
admin.removeLoading();
layer.msg('网络错误,请重试', {icon: 6});
} else {
if (res.err_code === 0) {
layer.msg(res.err_msg, {icon: 6});
} else {
admin.removeLoading();
layer.msg(res.err_msg, {icon: 5});
}
}
return false;
});
});
</script>
......@@ -21,7 +21,8 @@
<button type="button" class="layui-btn layui-btn-sm" id="allocate_channel_user">分配采购员</button>
@endif
@if(checkPerm('ChangeSupplierIsType'))
<button type="button" class="layui-btn layui-btn-sm" title="该操作可以将竞调供应商转为正式供应商" id="change_supplier_is_type">
<button type="button" class="layui-btn layui-btn-sm" title="该操作可以将竞调供应商转为正式供应商"
id="change_supplier_is_type">
转正供应商
</button>
@endif
......@@ -35,10 +36,12 @@
{{-- </button>--}}
@endif
@if(request()->user->userId==1000 || request()->user->userId==2082)
<button type="button" class="layui-btn layui-btn-sm" title="该操作可以将供应商同步到供应商" id="sync_supplier_to_erp">
<button type="button" class="layui-btn layui-btn-sm" title="该操作可以将供应商同步到供应商"
id="sync_supplier_to_erp">
金蝶同步
</button>
<button type="button" class="layui-btn layui-btn-sm" title="该操作可以将供应商同步到一体化" id="sync_supplier_to_united">
<button type="button" class="layui-btn layui-btn-sm" title="该操作可以将供应商同步到一体化"
id="sync_supplier_to_united">
一体化同步
</button>
@endif
......@@ -63,14 +66,18 @@
</button>
@endif
@if(checkPerm('BatchAllocateYunxinChannelUser'))
<button type="button" class="layui-btn layui-btn-sm" id="batch_allocate_yunxin_channel_user">设置SKU采购</button>
<button type="button" class="layui-btn layui-btn-sm" id="batch_allocate_yunxin_channel_user">设置SKU采购
</button>
@endif
@if(checkPerm('ExportSupplier'))
<button type="button" class="layui-btn layui-btn-sm" id="export_supplier">导出采购员全离职供应商</button>
@endif
@if(checkPerm('QuerySupplier'))
<button type="button" class="layui-btn layui-btn-sm" id="query_supplier">查询供应商</button>
@endif
@if(checkPerm('QuerySupplier'))
<button type="button" class="layui-btn layui-btn-sm" id="query_supplier">查询供应商</button>
@endif
@if(checkPerm('TransferSupplier'))
<button type="button" class="layui-btn layui-btn-sm" id="transfer_supplier">供应商交接</button>
@endif
</div>
<button type="button" id="refreshWindow" style="display: none">刷新页面</button>
<table class="layui-table" id="list" lay-filter="list"></table>
......
<style>
.layui-form-item {
margin-bottom: 5px;
}
</style>
<div class="layui-card">
<div class="layui-card-header" style="height: 280px">
<form class="layui-form" action="">
<div class="layui-form-item">
<blockquote class="layui-elem-quote layui-text">
<b>当前选中需要转移联系人的供应商</b>
<br>
<p style="color: cornflowerblue;font-size: 16px">{{$supplier['supplier_name']}}</p>
</blockquote>
</div>
<div class="layui-form-item">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('can_check_uids','原采购员 : ',0,$supplierUserCodes,['required'=>true,'width'=>'150px']) !!}
</div>
<div class="layui-form-item">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('new_can_check_uids','新采购员 : ',0,$userCodes,['required'=>true,'width'=>'150px']) !!}
</div>
<div class="layui-form-item">
<div align="center" style="margin-top: 20px;text-align: right">
<button type="button" class="layui-btn layui-btn-sm layui-btn-info submit-loading" lay-submit
lay-filter="transferSupplier">确认
</button>
<button type="button" class="layui-btn layui-btn-sm layui-btn-primary" lay-submit
lay-filter="cancel">取消
</button>
</div>
</div>
</form>
</div>
</div>
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