Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_supplier
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
2b9b1347
authored
Jun 16, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
联系人校验规则修改
parent
c45dd732
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
4 deletions
app/Http/Controllers/Filter/SupplierFilter.php
app/Http/Validators/SupplierContactValidator.php
resources/views/script/SupplierListScript.blade.php
resources/views/web/AddSupplierContact.blade.php
resources/views/web/UpdateSupplierContact.blade.php
app/Http/Controllers/Filter/SupplierFilter.php
View file @
2b9b1347
...
...
@@ -87,7 +87,6 @@ class SupplierFilter
}
});
}
//默认过滤带有-1字符串的供应商名称的数据
$query
->
whereRaw
(
'supplier_name NOT LIKE "%-1"'
);
return
$query
;
...
...
app/Http/Validators/SupplierContactValidator.php
View file @
2b9b1347
...
...
@@ -4,6 +4,7 @@
namespace
App\Http\Validators
;
use
App\Model\SupplierChannelModel
;
use
App\Model\SupplierContactModel
;
use
Validator
;
class
SupplierContactValidator
...
...
@@ -23,6 +24,28 @@ class SupplierContactValidator
$messages
=
$this
->
messages
();
$validator
=
Validator
::
make
(
$data
,
$rules
,
$messages
);
$contactModel
=
new
SupplierContactModel
();
//如果是原厂或者代理商性质的供应商,联系人不能重复
$supplierModel
=
new
SupplierChannelModel
();
$supplier
=
$supplierModel
->
where
(
'supplier_id'
,
$data
[
'supplier_id'
])
->
first
()
->
toArray
();
if
(
$supplier
[
'supplier_group'
]
==
1
||
$supplier
[
'supplier_group'
]
==
4
)
{
$query
=
$contactModel
->
where
(
'supplier_id'
,
$data
[
'supplier_id'
])
->
where
(
function
(
$q
)
use
(
$data
)
{
$q
->
where
(
'supplier_email'
,
$data
[
'supplier_email'
])
->
orWhere
(
'supplier_mobile'
,
$data
[
'supplier_mobile'
]);
});
//新增
if
(
empty
(
$data
[
'contact_id'
]))
{
$count
=
$query
->
count
();
}
else
{
//修改
$count
=
$query
->
where
(
'contact_id'
,
'!='
,
$data
[
'contact_id'
])
->
count
();
}
if
(
$count
)
{
return
'供应商已经存在手机号或者邮箱一样的联系人,请联系管理人员查看具体详情'
;
}
}
//判断联系方式的表单验证
if
(
$validator
->
fails
())
{
return
$validator
->
errors
()
->
first
();
...
...
resources/views/script/SupplierListScript.blade.php
View file @
2b9b1347
...
...
@@ -7,7 +7,9 @@
let
table
=
layui
.
table
;
let
form
=
layui
.
form
;
let
admin
=
layui
.
admin
;
let
whereCondition
=
{
source_type
:
'all'
};
let
initCondition
=
{
source_type
:
'all'
};
let
whereCondition
=
initCondition
;
let
type
=
'all'
;
let
currentPage
=
1
;
...
...
@@ -338,6 +340,8 @@
});
form
.
on
(
'submit(load)'
,
function
(
data
)
{
initCondition
.
source_type
=
whereCondition
.
source_type
;
whereCondition
=
$
.
extend
(
false
,
initCondition
,
data
.
field
);
//执行重载
table
.
reload
(
'list'
,
{
page
:
{
...
...
resources/views/web/AddSupplierContact.blade.php
View file @
2b9b1347
...
...
@@ -39,7 +39,7 @@
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
座机
</label>
<label
class=
"layui-form-label"
>
<span
class=
"require"
>
*
</span>
座机
</label>
<div
class=
"layui-input-block block-42"
>
<input
type=
"text"
name=
"supplier_telephone"
id=
"supplier_telephone"
placeholder=
"请输入座机"
class=
"layui-input"
...
...
resources/views/web/UpdateSupplierContact.blade.php
View file @
2b9b1347
...
...
@@ -41,7 +41,7 @@
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
座机
</label>
<label
class=
"layui-form-label"
>
<span
class=
"require"
>
*
</span>
座机
</label>
<div
class=
"layui-input-block block-42"
>
<input
type=
"text"
name=
"supplier_telephone"
id=
"supplier_telephone"
placeholder=
"请输入座机"
class=
"layui-input"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment