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
c05824db
authored
Mar 02, 2026
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
优化搜索
parent
5c587825
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
184 additions
and
66 deletions
app/Http/Controllers/Api/SupplierContactApiController.php
app/Http/Services/AdminUserService.php
resources/views/script/supplier/SupplierContactScript.blade.php
resources/views/web/supplier/SupplierContact.blade.php
app/Http/Controllers/Api/SupplierContactApiController.php
View file @
c05824db
...
@@ -36,6 +36,32 @@ class SupplierContactApiController extends Controller
...
@@ -36,6 +36,32 @@ class SupplierContactApiController extends Controller
$adminId
=
$request
->
user
->
userId
;
$adminId
=
$request
->
user
->
userId
;
$codeId
=
$request
->
user
->
codeId
;
$codeId
=
$request
->
user
->
codeId
;
// 搜索条件:联系人名称
$supplierConsignee
=
$request
->
get
(
'supplier_consignee'
);
if
(
!
empty
(
$supplierConsignee
))
{
$query
->
where
(
'supplier_consignee'
,
'like'
,
'%'
.
$supplierConsignee
.
'%'
);
}
// 搜索条件:采购员类型
$channelUserType
=
$request
->
get
(
'channel_user_type'
);
if
(
!
empty
(
$channelUserType
))
{
$query
->
where
(
'channel_user_type'
,
$channelUserType
);
}
// 搜索条件:采购员名称
$channelName
=
$request
->
get
(
'channel_name'
);
if
(
!
empty
(
$channelName
))
{
// 通过用户名查找codeId,然后用codeId过滤
$adminUserService
=
new
AdminUserService
();
$codeIds
=
$adminUserService
->
getCodeIdsByName
(
$channelName
);
if
(
!
empty
(
$codeIds
))
{
$query
->
whereIn
(
'can_check_uids'
,
$codeIds
);
}
else
{
// 没找到匹配的用户,返回空结果
$query
->
whereRaw
(
'1=0'
);
}
}
//大家都可以查看离职的采购员的联系人
//大家都可以查看离职的采购员的联系人
$allCanCheckUids
=
SupplierContactModel
::
where
(
'supplier_id'
,
$supplierId
)
->
pluck
(
'can_check_uids'
)
->
toArray
();
$allCanCheckUids
=
SupplierContactModel
::
where
(
'supplier_id'
,
$supplierId
)
->
pluck
(
'can_check_uids'
)
->
toArray
();
$resignedUsers
=
(
new
AdminUserService
())
->
getResignedUsers
();
$resignedUsers
=
(
new
AdminUserService
())
->
getResignedUsers
();
...
...
app/Http/Services/AdminUserService.php
View file @
c05824db
...
@@ -43,6 +43,16 @@ class AdminUserService
...
@@ -43,6 +43,16 @@ class AdminUserService
return
$codeId
;
return
$codeId
;
}
}
// 根据用户名模糊搜索获取codeId列表
public
function
getCodeIdsByName
(
$userName
)
{
$userIds
=
UserInfoModel
::
where
(
'name'
,
'like'
,
'%'
.
$userName
.
'%'
)
->
pluck
(
'userId'
)
->
toArray
();
if
(
empty
(
$userIds
))
{
return
[];
}
return
IntracodeModel
::
whereIn
(
'admin_id'
,
$userIds
)
->
pluck
(
'code_id'
)
->
toArray
();
}
public
function
getAdminIdByUserName
(
$userName
)
public
function
getAdminIdByUserName
(
$userName
)
{
{
return
UserInfoModel
::
where
(
'name'
,
$userName
)
->
value
(
'userId'
);
return
UserInfoModel
::
where
(
'name'
,
$userName
)
->
value
(
'userId'
);
...
...
resources/views/script/supplier/SupplierContactScript.blade.php
View file @
c05824db
...
@@ -5,70 +5,111 @@
...
@@ -5,70 +5,111 @@
let
admin
=
layui
.
admin
;
let
admin
=
layui
.
admin
;
let
element
=
layui
.
element
;
let
element
=
layui
.
element
;
let
supplierId
=
getQueryVariable
(
'supplier_id'
);
let
supplierId
=
getQueryVariable
(
'supplier_id'
);
table
.
render
({
elem
:
'#contactList'
,
// 渲染表格
url
:
'/api/supplier_contact/GetSupplierContactList'
,
function
renderTable
(
whereParams
)
{
method
:
'get'
,
table
.
render
({
cellMinWidth
:
80
,
//全局定义常规单元格的最小宽度
elem
:
'#contactList'
,
where
:
{
url
:
'/api/supplier_contact/GetSupplierContactList'
,
supplier_id
:
getQueryVariable
(
"supplier_id"
)
method
:
'get'
,
},
cellMinWidth
:
80
,
//全局定义常规单元格的最小宽度
size
:
"sm"
,
where
:
whereParams
,
loading
:
true
,
size
:
"sm"
,
first
:
true
,
//不显示首页
loading
:
true
,
last
:
false
,
//不显示尾页
first
:
true
,
//不显示首页
cols
:
[[
last
:
false
,
//不显示尾页
{
cols
:
[[
type
:
'checkbox'
,
{
},
type
:
'checkbox'
,
{
},
field
:
'supplier_consignee'
,
{
title
:
'
<
span
class
=
"require"
>*
<
/span>联系人'
,
field
:
'supplier_consignee'
,
align
:
'center'
,
title
:
'
<
span
class
=
"require"
>*
<
/span>联系人'
,
width
:
150
align
:
'center'
,
},
width
:
150
{
field
:
'supplier_position'
,
title
:
'
<
span
class
=
"require"
>*
<
/span>职位', align: 'center', width: 100}
,
},
{
{
field
:
'supplier_position'
,
title
:
'
<
span
class
=
"require"
>*
<
/span>职位', align: 'center', width: 100}
,
field
:
'supplier_email'
,
{
title
:
'
<
span
class
=
"require"
>*
<
/span>邮箱'
,
field
:
'supplier_email'
,
align
:
'center'
,
title
:
'
<
span
class
=
"require"
>*
<
/span>邮箱'
,
width
:
200
,
align
:
'center'
,
templet
:
function
(
data
)
{
width
:
200
,
return
data
.
supplier_email
?
'
<
span
>
' + data.supplier_email + '
<
/span><span style="color: dodgerblue" class="viewContact" type="supplier_email" contact_id="' + data.contact_id + '">查看</
span
>
' : '';
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>手机号'
,
field: '
supplier_mobile
',
align
:
'center'
,
title: '
<
span
class
=
"require"
>*
<
/span>手机号'
,
width
:
180
,
align
:
'center'
,
templet
:
function
(
data
)
{
width
:
180
,
return
data
.
supplier_mobile
?
'
<
span
>
' + data.supplier_mobile + '
<
/span><span style="color: dodgerblue" class="viewContact" type="supplier_mobile" contact_id="' + data.contact_id + '">查看</
span
>
' : '';
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>座机'
,
field: '
supplier_telephone
',
align
:
'center'
,
title: '
<
span
class
=
"require"
>*
<
/span>座机'
,
width
:
180
,
align
:
'center'
,
templet
:
function
(
data
)
{
width
:
180
,
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>' : ''
;
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
:
'channel_user_type_name'
,
title
:
'
<
span
class
=
"require"
>*
<
/span>采购员类型', align: 'center', width: 210}
,
{
field
:
'working_status'
,
title
:
'采购员状态'
,
align
:
'center'
,
width
:
120
},
{
field
:
'add_time'
,
title
:
'新增时间'
,
align
:
'center'
,
width
:
150
},
{
field
:
'update_time'
,
title
:
'更新时间'
,
align
:
'center'
,
width
:
150
},
]],
id
:
'contactList'
,
page
:
{},
});
}
// 初始渲染
renderTable
({
supplier_id
:
supplierId
});
// 搜索按钮
$
(
'#searchBtn'
).
on
(
'click'
,
function
()
{
let
consignee
=
$
(
'input[name="supplier_consignee"]'
).
val
();
let
channelUserType
=
$
(
'select[name="channel_user_type"]'
).
val
();
let
channelName
=
$
(
'input[name="channel_name"]'
).
val
();
table
.
reload
(
'contactList'
,
{
where
:
{
supplier_id
:
supplierId
,
supplier_consignee
:
consignee
,
channel_user_type
:
channelUserType
,
channel_name
:
channelName
},
},
{
page
:
{
field
:
'supplier_qq'
,
title
:
'QQ'
,
align
:
'center'
,
width
:
180
,
templet
:
function
(
data
)
{
curr
:
1
return
data
.
supplier_qq
?
'
<
span
>
' + data.supplier_qq + '
<
/span><span style="color: dodgerblue" class="viewContact" type="supplier_qq" contact_id="' + data.contact_id + '">查看</
span
>
' : '';
}
}
});
});
// 重置按钮
$
(
'#resetBtn'
).
on
(
'click'
,
function
()
{
$
(
'input[name="supplier_consignee"]'
).
val
(
''
);
$
(
'select[name="channel_user_type"]'
).
val
(
''
);
$
(
'input[name="channel_name"]'
).
val
(
''
);
form
.
render
(
'select'
);
table
.
reload
(
'contactList'
,
{
where
:
{
supplier_id
:
supplierId
},
},
{field: '
supplier_fax
', title: '
传真
', align: '
center
', width: 140},
page
:
{
{field: '
channel_name
', title: '
<
span
class
=
"require"
>*
<
/span>采购员', align: 'center', width: 110}
,
curr
:
1
{
field
:
'channel_user_type_name'
,
title
:
'
<
span
class
=
"require"
>*
<
/span>采购员类型', align: 'center', width: 210}
,
}
{
field
:
'working_status'
,
title
:
'采购员状态'
,
align
:
'center'
,
width
:
120
},
});
{
field
:
'add_time'
,
title
:
'新增时间'
,
align
:
'center'
,
width
:
150
},
{
field
:
'update_time'
,
title
:
'更新时间'
,
align
:
'center'
,
width
:
150
},
]],
id
:
'contactList'
,
page
:
{},
});
});
//新增联系方式
//新增联系方式
...
...
resources/views/web/supplier/SupplierContact.blade.php
View file @
c05824db
...
@@ -2,12 +2,54 @@
...
@@ -2,12 +2,54 @@
.viewContact
{
.viewContact
{
margin-left
:
10px
;
margin-left
:
10px
;
}
}
.search-form
{
margin-top
:
10px
;
margin-bottom
:
10px
;
}
.search-form
.layui-form-item
{
margin-bottom
:
0
;
}
</style>
</style>
<div
class=
"layui-row"
>
<div
class=
"layui-row"
>
<blockquote
class=
"layui-elem-quote layui-text"
>
<blockquote
class=
"layui-elem-quote layui-text"
>
<b>
联系人管理
</b>
<b>
联系人管理
</b>
</blockquote>
</blockquote>
{{-- @if($operate == 'update')--}}
{{-- 搜索表单 --}}
<div
class=
"search-form"
>
<form
class=
"layui-form"
lay-filter=
"searchForm"
>
<div
class=
"layui-form-item"
>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
style=
"width: 80px;"
>
联系人
</label>
<div
class=
"layui-input-inline"
style=
"width: 150px;"
>
<input
type=
"text"
name=
"supplier_consignee"
placeholder=
"请输入联系人名称"
class=
"layui-input"
>
</div>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
style=
"width: 100px;"
>
采购员类型
</label>
<div
class=
"layui-input-inline"
style=
"width: 150px;"
>
<select
name=
"channel_user_type"
>
<option
value=
""
>
全部
</option>
<option
value=
"1"
>
猎芯采购
</option>
<option
value=
"2"
>
京东采购
</option>
<option
value=
"3"
>
艾奇采购
</option>
<option
value=
"4"
>
数据跟单员
</option>
</select>
</div>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
style=
"width: 80px;"
>
采购员
</label>
<div
class=
"layui-input-inline"
style=
"width: 150px;"
>
<input
type=
"text"
name=
"channel_name"
placeholder=
"请输入采购员名称"
class=
"layui-input"
>
</div>
</div>
<div
class=
"layui-inline"
>
<button
type=
"button"
class=
"layui-btn layui-btn-sm"
id=
"searchBtn"
>
搜索
</button>
<button
type=
"reset"
class=
"layui-btn layui-btn-primary layui-btn-sm"
id=
"resetBtn"
>
重置
</button>
</div>
</div>
</form>
</div>
{{-- @if($operate == 'update')--}}
<div
class=
"layui-btn-group demoTable"
style=
"margin-top: 5px"
>
<div
class=
"layui-btn-group demoTable"
style=
"margin-top: 5px"
>
@if(checkPerm('AddSupplierContact'))
@if(checkPerm('AddSupplierContact'))
<button
type=
"button"
class=
"layui-btn layui-btn-sm"
id=
"add_contact"
>
新增
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-sm"
id=
"add_contact"
>
新增
</button>
...
@@ -22,8 +64,8 @@
...
@@ -22,8 +64,8 @@
<button
type=
"button"
class=
"layui-btn layui-btn-sm"
id=
"set_yunxin_channel_user"
>
设置SKU采购
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-sm"
id=
"set_yunxin_channel_user"
>
设置SKU采购
</button>
@endif
@endif
</div>
</div>
{{-- @endif--}}
{{-- @endif--}}
<table
class=
"layui-table"
lay-filter=
"contactList"
id=
"contactList"
></table>
<table
class=
"layui-table"
lay-filter=
"contactList"
id=
"contactList"
></table>
</div>
</div>
@include('script.supplier.SupplierContactScript')
@include('script.supplier.SupplierContactScript')
\ No newline at end of file
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