Commit fc6c76a7 by 杨树贤

联系人加密

parent f4f8d82f
......@@ -101,7 +101,7 @@ class SupplierContactApiController extends Controller
//有需要自动替换补全数据操作后的提示
if ($hasNeedReplaceContact) {
$this->response(0, '系统检测到当前采购有默认的空联系人,直接更新对应数据');
}else{
} else {
$this->response(0, '保存成功');
}
}
......@@ -150,4 +150,16 @@ class SupplierContactApiController extends Controller
}
$this->response(-1, '找不到删除对象');
}
public function GetSupplierContact($request)
{
$contactId = $request->input('contact_id');
$type = $request->input('type');
$contact = SupplierContactModel::select([$type,'supplier_consignee','contact_id','supplier_id'])->where('contact_id', $contactId)->first()->toArray();
$logService = new LogService();
$content = $request->user->name . ' 查看了联系人 ' . $contact['supplier_consignee'] . ' 的' . array_get(config('field.SupplierContactFieldMap'),
$type);
$logService->AddLog($contact['supplier_id'], LogModel::VIEW_OPERATE, '查看供应商基本资料', $content);
$this->response(0, 'ok', $contact);
}
}
......@@ -15,6 +15,32 @@ class SupplierContactTransformer
$user = $service->getAdminUserInfoByCodeId($item['can_check_uids']);
$item['channel_name'] = array_get($user, 'name');
$item['working_status'] = $service->checkIsResignedByCodeId($item['can_check_uids']) ? '离职' : '在职';
if (!empty($item['supplier_email'])) {
$emailTemp = explode('@', $item['supplier_email'])[0];
$replace = str_pad('*', strlen($emailTemp), '*');
$emailTemp = str_replace($emailTemp, $replace, $emailTemp);
$item['supplier_email'] = $emailTemp . '@' . explode('@', $item['supplier_email'])[1];
}
if (!empty($item['supplier_mobile'])) {
$temp = substr($item['supplier_mobile'], 3, 4);
$item['supplier_mobile'] = str_replace($temp, '****' , $item['supplier_mobile']);
}
if (!empty($item['supplier_qq'])) {
$temp = substr($item['supplier_qq'], 2, strlen($item['supplier_qq']));
$replace = str_pad('*', strlen($temp), '*');
$item['supplier_qq'] = str_replace($temp, $replace , $item['supplier_qq']);
}
if (!empty($item['supplier_telephone'])) {
if (count(explode('-', $item['supplier_telephone']))>1) {
$temp = explode('-', $item['supplier_telephone'])[1];
$replace = str_pad('*', strlen($temp), '*');
$item['supplier_telephone'] = str_replace($temp, $replace , $item['supplier_telephone']);
}else{
$replace = str_pad('*', strlen($item['supplier_telephone']), '*');
$item['supplier_telephone'] = str_replace($item['supplier_telephone'], $replace , $item['supplier_telephone']);
}
}
}
unset($item);
......
......@@ -209,5 +209,12 @@ return [
],
//新增供应商的时候默认的采购开发员
'DefaultPurchaseName' => '欧中云'
'DefaultPurchaseName' => '欧中云',
'SupplierContactFieldMap' => [
'supplier_email' => '邮箱',
'supplier_mobile' => '手机号',
'supplier_telephone' => '座机',
'supplier_qq' => 'QQ',
]
];
\ No newline at end of file
......@@ -23,16 +23,47 @@
},
@endif
{
field: 'supplier_consignee', title: '<span class="require">* </span>联系人', align: 'center',width:150
field: 'supplier_consignee',
title: '<span class="require">* </span>联系人',
align: 'center',
width: 150
},
{field: 'supplier_position', title: '<span class="require">* </span>职位', align: 'center',width: 100},
{field: 'supplier_email', title: '<span class="require">* </span>邮箱', align: 'center',width: 200},
{field: 'supplier_mobile', title: '<span class="require">* </span>手机号', align: 'center',width: 150},
{field: 'supplier_telephone', title: '<span class="require">* </span>座机', align: 'center',width: 150},
{field: 'supplier_qq', title: 'QQ', align: 'center',width: 120},
{field: 'supplier_fax', title: '传真', align: 'center',width: 140},
{field: 'channel_name', title: '<span class="require">* </span>采购员', align: 'center',width: 110},
{field: 'working_status', title: '采购员状态', align: 'center',width: 120},
{field: 'supplier_position', title: '<span class="require">* </span>职位', align: 'center', width: 100},
{
field: 'supplier_email',
title: '<span class="require">* </span>邮箱',
align: 'center',
width: 200,
templet: function (data) {
return '<span>' + data.supplier_email + '</span><span style="color: dodgerblue" class="viewContact" type="supplier_email" contact_id="' + data.contact_id + '">查看</span>'
}
},
{
field: 'supplier_mobile',
title: '<span class="require">* </span>手机号',
align: 'center',
width: 180,
templet: function (data) {
return '<span>' + data.supplier_mobile + '</span><span style="color: dodgerblue" class="viewContact" type="supplier_mobile" contact_id="' + data.contact_id + '">查看</span>'
}
},
{
field: 'supplier_telephone',
title: '<span class="require">* </span>座机',
align: 'center',
width: 180,
templet: function (data) {
return '<span>' + data.supplier_telephone + '</span><span style="color: dodgerblue" class="viewContact" type="supplier_telephone" contact_id="' + data.contact_id + '">查看</span></span>'
}
},
{
field: 'supplier_qq', title: 'QQ', align: 'center', width: 180, templet: function (data) {
return '<span>' + data.supplier_qq + '</span><span style="color: dodgerblue" class="viewContact" type="supplier_qq" contact_id="' + data.contact_id + '">查看</span>'
}
},
{field: 'supplier_fax', title: '传真', align: 'center', width: 140},
{field: 'channel_name', title: '<span class="require">* </span>采购员', align: 'center', width: 110},
{field: 'working_status', title: '采购员状态', align: 'center', width: 120},
]],
id: 'contactList',
page: {},
......@@ -117,5 +148,36 @@
}
});
}
//删除
$(document).on('click', '.viewContact', function () {
let contactId = $(this).attr('contact_id');
let type = $(this).attr('type');
let resp = ajax('/api/supplier_contact/GetSupplierContact', {contact_id: contactId, type: type});
if (!resp) {
layer.msg('网络连接失败', {'icon': 5});
return false;
}
if (resp.err_code === 0) {
switch (type) {
case 'supplier_email':
$(this).prev().text(resp.data.supplier_email);
break;
case 'supplier_qq':
$(this).prev().text(resp.data.supplier_qq);
break;
case 'supplier_mobile':
$(this).prev().text(resp.data.supplier_mobile);
break;
case 'supplier_telephone':
$(this).prev().text(resp.data.supplier_telephone);
break;
}
console.log(resp);
} else {
layer.msg(resp.err_msg, {'icon': 5});
return false;
}
});
});
</script>
\ No newline at end of file
<style>
.viewContact {
margin-left: 10px;
}
</style>
<div class="layui-row">
<blockquote class="layui-elem-quote layui-text">
<b>联系人管理</b>
......
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