Commit 5759f1fe by mushishixian

修复联系人

parent 6ea2d53e
...@@ -46,7 +46,7 @@ class SupplierContactService ...@@ -46,7 +46,7 @@ class SupplierContactService
//还要将采购的数据整理重新写入 //还要将采购的数据整理重新写入
$supplierId = $contact['supplier_id']; $supplierId = $contact['supplier_id'];
$supplierModel = new SupplierChannelModel(); $supplierModel = new SupplierChannelModel();
$channelUid = $supplierModel->where('supplier_Id',$supplierId)->value('channel_uid'); $channelUid = $supplierModel->where('supplier_Id', $supplierId)->value('channel_uid');
$channelUid = explode(',', $channelUid); $channelUid = explode(',', $channelUid);
$channelUid = array_filter($channelUid, function ($value) { $channelUid = array_filter($channelUid, function ($value) {
return !empty($value); return !empty($value);
...@@ -63,14 +63,19 @@ class SupplierContactService ...@@ -63,14 +63,19 @@ class SupplierContactService
$result = $model->insertGetId($contact); $result = $model->insertGetId($contact);
$contactId = $result; $contactId = $result;
} }
//找出所有的联系人对应的采购id,更新主表
$canCheckUids = $model->where('supplier_id', $supplierId)->pluck('can_check_uids');
$canCheckUids = !empty($canCheckUids) ? implode(',', $canCheckUids->toArray()) : '';
//不存在则写入 //不存在则写入
if (!in_array($contact['can_check_uids'], $channelUid)) { // if (!in_array($contact['can_check_uids'], $channelUid)) {
$channelUid[] = $contact['can_check_uids']; // $channelUid[] = $contact['can_check_uids'];
} // }
$supplierModel->where('supplier_id',$supplierId)->update([ $supplierModel->where('supplier_id', $supplierId)->update([
'channel_uid'=>implode(',',$channelUid), 'channel_uid' => $canCheckUids,
'update_time' => time(), 'update_time' => time(),
]); ]);
$newContact = $model->where('contact_id', $contactId)->first()->toArray(); $newContact = $model->where('contact_id', $contactId)->first()->toArray();
if ($result) { if ($result) {
//修改供应商为审核状态 //修改供应商为审核状态
...@@ -86,9 +91,9 @@ class SupplierContactService ...@@ -86,9 +91,9 @@ class SupplierContactService
//待审核(没有完善过联系人的,不需要记录日志,让其继续保持一条日志,就叫新增供应商) //待审核(没有完善过联系人的,不需要记录日志,让其继续保持一条日志,就叫新增供应商)
if ($supplierStatus != SupplierChannelModel::STATUS_PENDING) { if ($supplierStatus != SupplierChannelModel::STATUS_PENDING) {
$logService = new LogService(); $logService = new LogService();
$content = !empty($contact['contact_id'])?'修改联系人':'添加联系人'; $content = !empty($contact['contact_id']) ? '修改联系人' : '添加联系人';
$remark = json_encode([ $remark = json_encode([
'old_contact'=>$oldContact, 'old_contact' => $oldContact,
'new_contact' => $newContact, 'new_contact' => $newContact,
]); ]);
$logService->AddLog($contact['supplier_id'], LogModel::UPDATE_OPERATE, '修改供应商基本资料', $content, $remark); $logService->AddLog($contact['supplier_id'], LogModel::UPDATE_OPERATE, '修改供应商基本资料', $content, $remark);
......
...@@ -48,11 +48,7 @@ ...@@ -48,11 +48,7 @@
</div> </div>
</div> </div>
<!-- 加载动画 --> <!-- 加载动画 -->
{{--<div class="page-loading">--}}
{{-- <div class="ball-loader">--}}
{{-- <span></span><span></span><span></span><span></span>--}}
{{-- </div>--}}
{{--</div>--}}
<!-- js部分 --> <!-- js部分 -->
<!-- 引入同名的js,默认引入 --> <!-- 引入同名的js,默认引入 -->
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
let form = layui.form; let form = layui.form;
let admin = layui.admin; let admin = layui.admin;
let element = layui.element; let element = layui.element;
let supplierId = getQueryVariable('supplier_id');
table.render({ table.render({
elem: '#contactList', elem: '#contactList',
url: '/api/supplier_contact/GetSupplierContactList', url: '/api/supplier_contact/GetSupplierContactList',
...@@ -45,6 +46,7 @@ ...@@ -45,6 +46,7 @@
area: ['600px', '525px'], area: ['600px', '525px'],
title: '新增联系人', title: '新增联系人',
end: function () { // 监听弹窗关闭 end: function () { // 监听弹窗关闭
location.href = '/supplier/UpdateSupplier?view=iframe&tab=contact&supplier_id='+supplierId;
table.reload('contactList'); table.reload('contactList');
} }
}); });
...@@ -64,6 +66,7 @@ ...@@ -64,6 +66,7 @@
area: ['600px', '525px'], area: ['600px', '525px'],
title: '编辑联系人', title: '编辑联系人',
end: function () { // 监听弹窗关闭 end: function () { // 监听弹窗关闭
location.href = '/supplier/UpdateSupplier?view=iframe&tab=contact&supplier_id='+supplierId;
table.reload('contactList'); table.reload('contactList');
} }
}); });
...@@ -89,6 +92,7 @@ ...@@ -89,6 +92,7 @@
return false; return false;
} }
if (resp.err_code === 0) { if (resp.err_code === 0) {
location.href = '/supplier/UpdateSupplier?view=iframe&tab=contact&supplier_id='+supplierId;
table.reload('contactList'); table.reload('contactList');
layer.closeAll(); layer.closeAll();
layer.msg(resp.err_msg, {'icon': 6}); layer.msg(resp.err_msg, {'icon': 6});
......
...@@ -35,11 +35,6 @@ ...@@ -35,11 +35,6 @@
</div> </div>
<!-- 加载动画 --> <!-- 加载动画 -->
<div class="page-loading">
<div class="ball-loader">
<span></span><span></span><span></span><span></span>
</div>
</div>
<!-- js部分 --> <!-- js部分 -->
<script type="text/javascript" src="/plugins/assets/libs/layui/layui.js"></script> <script type="text/javascript" src="/plugins/assets/libs/layui/layui.js"></script>
......
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