Commit d7914268 by mushishixian

fix

parent 8ad695f2
...@@ -83,6 +83,7 @@ class SupplierContactApiController extends Controller ...@@ -83,6 +83,7 @@ class SupplierContactApiController extends Controller
'supplier_position', 'supplier_position',
'can_check_uids' 'can_check_uids'
]); ]);
$data = BatchTrim($data);
//先去表单验证 //先去表单验证
$validator = new SupplierContactValidator(); $validator = new SupplierContactValidator();
$validateResult = $validator->checkSave($request); $validateResult = $validator->checkSave($request);
......
...@@ -375,8 +375,9 @@ class SupplierService ...@@ -375,8 +375,9 @@ class SupplierService
$logService = new LogService(); $logService = new LogService();
$content = "添加采购员 : " . $channelUserName; $content = "添加采购员 : " . $channelUserName;
$logService->AddLog($supplierId, LogModel::UPDATE_OPERATE, '添加采购员', $content); $logService->AddLog($supplierId, LogModel::UPDATE_OPERATE, '添加采购员', $content);
} }
$syncService = new SyncSupplierService();
$syncService->syncSupplierToErp($supplierId);
return $contactResult; return $contactResult;
} }
......
...@@ -13,6 +13,7 @@ class SupplierContactValidator ...@@ -13,6 +13,7 @@ class SupplierContactValidator
{ {
$data = $request->all(); $data = $request->all();
$data = BatchTrim($data);
$rules = [ $rules = [
"supplier_consignee" => "required", "supplier_consignee" => "required",
"supplier_email" => "required|email", "supplier_email" => "required|email",
......
...@@ -54,6 +54,7 @@ class SupplierValidator ...@@ -54,6 +54,7 @@ class SupplierValidator
if (empty($requestData['supplier_id'])) { if (empty($requestData['supplier_id'])) {
$rules['purchase_uid'] = 'required'; $rules['purchase_uid'] = 'required';
} }
//营业执照是不能为空的 //营业执照是不能为空的
$messages = $this->messages(); $messages = $this->messages();
$validator = Validator::make($requestData, $rules, $messages); $validator = Validator::make($requestData, $rules, $messages);
......
...@@ -176,3 +176,15 @@ function checkPerm($perm) ...@@ -176,3 +176,15 @@ function checkPerm($perm)
$perms = request()->perms; $perms = request()->perms;
return in_array($perm, $perms); return in_array($perm, $perms);
} }
//批量清楚前后空格
function BatchTrim($data)
{
if (!empty($data)) {
foreach ($data as &$item) {
$item = trim($item);
}
unset($item);
}
return $data;
}
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
$('#supplier_email').blur(function () { $('#supplier_email').blur(function () {
let value = $(this).val(); let value = $(this).val();
value = value.trim();
if (value !== '') { if (value !== '') {
let reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/; let reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
if (!reg.test(value)){ if (!reg.test(value)){
......
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