Commit 23ea6cf2 by 杨树贤

Merge branch 'master' into ysx-sku标签-20221213

parents 40b064d7 0b5290cd
......@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Http\Controllers\Filter\SupplierAccountFilter;
use App\Http\Services\LogService;
use App\Http\Services\SupplierAccountService;
use App\Http\Transformers\SupplierLogTransformer;
use App\Http\Validators\SupplierAccountValidator;
......@@ -131,4 +132,16 @@ class SupplierAccountApiController extends Controller
}
$this->response(-1, '禁用失败', $result);
}
public function GetSupplierAccount($request)
{
$id = $request->input('id');
$type = $request->input('type');
$account = SupplierAccountModel::where('id', $id)->first()->toArray();
$logService = new LogService();
$temp = ($type == 'mobile') ? '账号' : '密码';
$content = $request->user->name . ' 查看了供应商账号的' . $temp;
$logService->AddLog($account['supplier_id'], LogModel::VIEW_OPERATE, '查看供应商基本资料', $content);
$this->response(0, 'ok', $account);
}
}
......@@ -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);
}
}
......@@ -19,6 +19,11 @@ class SupplierAccountTransformer
$item['type_name'] = array_get(config('field.SupplierAccountType'), $item['a_type']);
$item['create_time'] = $item['create_time'] ? date('Y-m-d H:i:s', $item['create_time']) : '';
$item['update_time'] = $item['update_time'] ? date('Y-m-d H:i:s', $item['update_time']) : '';
if (!empty($item['mobile'])) {
$item['mobile'] = substr($item['mobile'], 0, 3) . '****' . substr($item['mobile'], 7);
}
$replace = str_pad('*', strlen($item['password_raw']), '*');
$item['password_raw'] = str_replace($item['password_raw'], $replace , $item['password_raw']);
}
unset($item);
......
......@@ -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);
......
......@@ -172,7 +172,7 @@ return [
"RS COMPONENTS LIMITED",
"FUTURE ELECTRONICS (HONG KONG) LIMITED",
"Avnet Technology Hong Kong Limited",
"Mogultech International Ltd."
// "Mogultech International Ltd."
],
'CompanyNature' => [
'其它' => '其它',
......@@ -209,5 +209,12 @@ return [
],
//新增供应商的时候默认的采购开发员
'DefaultPurchaseName' => '欧中云'
'DefaultPurchaseName' => '欧中云',
'SupplierContactFieldMap' => [
'supplier_email' => '邮箱',
'supplier_mobile' => '手机号',
'supplier_telephone' => '座机',
'supplier_qq' => 'QQ',
]
];
\ No newline at end of file
......@@ -85,3 +85,17 @@ function inArray(needle, haystack) {
}
return false;
}
function getCookie(name) {
var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
if (arr != null) return unescape(arr[2]);
return null;
}
function getLogDomain() {
var default_domain = "http://monitor.liexindev.net";
if (document.domain.indexOf("ichunt") !== -1) {
default_domain = "https://monitor.ichunt.net";
}
return default_domain;
}
......@@ -9,7 +9,7 @@
<link rel="stylesheet" href="/plugins/assets/module/admin.css"/>
<script src="/js/jquery-2.2.1.js"></script>
<script type="text/javascript" src="/plugins/assets/libs/layui/layui.js"></script>
<script type="text/javascript" src="/plugins/assets/js/common.js"></script>
<script type="text/javascript" src="/plugins/assets/js/common.js?version={{time()}}"></script>
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
......
......@@ -15,9 +15,17 @@
{type: 'radio'},
{field: 'id', title: 'ID', align: 'center', width: 80},
{
field: 'mobile', title: '账号', align: 'center', width: 170
field: 'mobile', title: '账号', align: 'center', width: 170,
templet: function (data) {
return '<span>' + data.mobile + '</span><span style="color: dodgerblue;margin-left: 10px" class="viewAccount" type="mobile" id="' + data.id + '">查看</span>'
}
},
{
field: 'password_raw', title: '密码', align: 'center', width: 170,
templet: function (data) {
return '<span>' + data.password_raw + '</span><span style="color: dodgerblue;margin-left: 10px" class="viewAccount" type="password_raw" id="' + data.id + '">查看</span>'
}
},
{field: 'password_raw', title: '密码', align: 'center', width: 170},
{
field: 'supplier_code', title: '供应商编码', align: 'center', width: 120
},
......@@ -145,5 +153,45 @@
location.reload();
});
$(document).on('click', '.viewAccount', function () {
if ($(this).text() === '隐藏') {
$(this).prev().text($(this).attr('prev_text'));
$(this).text('查看');
} else {
let id = $(this).attr('id');
let type = $(this).attr('type');
let resp = ajax('/api/supplier_account/GetSupplierAccount', {id: id, type: type});
if (!resp) {
layer.msg('网络连接失败', {'icon': 5});
return false;
}
let prevText = $(this).prev().text();
$(this).attr('prev_text', prevText);
if (resp.err_code === 0) {
switch (type) {
case 'mobile':
$(this).prev().text(resp.data.mobile);
break;
case 'password_raw':
$(this).prev().text(resp.data.password_raw);
break;
}
console.log(resp);
$.get(getLogDomain() + "/api/addSensitiveClick", {
uid: getCookie("oa_user_id") || 0,
sys_id: 4,
mask_type: type || 0,
origin_id: id || 0,
source_from: window.location.href
});
$(this).text('隐藏');
} else {
layer.msg(resp.err_msg, {'icon': 5});
return false;
}
}
});
});
</script>
\ 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 data.supplier_email ? '<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 data.supplier_mobile ? '<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 data.supplier_telephone ? '<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 data.supplier_qq ? '<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,51 @@
}
});
}
$(document).on('click', '.viewContact', function () {
if ($(this).text() === '隐藏') {
$(this).prev().text($(this).attr('prev_text'));
$(this).text('查看');
} else {
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;
}
let prevText = $(this).prev().text();
$(this).attr('prev_text', prevText);
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;
}
$(this).text('隐藏');
$.get(getLogDomain() + "/api/addSensitiveClick", {
uid: getCookie("oa_user_id") || 0,
sys_id: 4,
mask_type: type || 0,
origin_id: contactId || 0,
source_from: window.location.href
});
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