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
f8bca94c
authored
Jun 26, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
联系人离职查看
parent
e2cf5fa3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
7 deletions
app/Http/Controllers/Api/SupplierContactApiController.php
app/Http/Services/AdminUserService.php
resources/views/script/SkuListScript.blade.php
app/Http/Controllers/Api/SupplierContactApiController.php
View file @
f8bca94c
...
...
@@ -34,6 +34,12 @@ class SupplierContactApiController extends Controller
$query
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
orderBy
(
'contact_id'
,
'desc'
);
$adminId
=
$request
->
user
->
userId
;
$codeId
=
$request
->
user
->
codeId
;
//大家都可以查看离职的采购员的联系人
$allCanCheckUids
=
SupplierContactModel
::
where
(
'supplier_id'
,
$supplierId
)
->
pluck
(
'can_check_uids'
)
->
toArray
();
$resignedUsers
=
(
new
AdminUserService
())
->
getResignedUsers
();
$resignedUserCodes
=
array_column
(
$resignedUsers
,
'code_id'
);
$resignedCanCheckUids
=
array_intersect
(
$allCanCheckUids
,
$resignedUserCodes
);
//不能查看所有的,就是说只能看绑定的采购的
if
(
$canViewAllSupplierContact
)
{
...
...
@@ -47,7 +53,7 @@ class SupplierContactApiController extends Controller
$subordinateCodeIds
=
$subordinateCodeIds
->
toArray
();
//因为可以查看自己部下相关的采购员,开发员的供应商,所以要构建复杂likeIn语句需要的数据
//注意下面三个条件最外层要用()包围起来,要不然mysql数据会有问题,具体自己查询mysql的and和or的语法注意事项
$inCodeIdSql
=
implode
(
','
,
$subordinateCodeIds
);
$inCodeIdSql
=
implode
(
','
,
array_merge
(
$subordinateCodeIds
,
$resignedCanCheckUids
)
);
$inUserIdSql
=
implode
(
','
,
$subordinateUserIds
);
$inCodeIdSql
=
"("
.
$inCodeIdSql
.
")"
;
$inUserIdSql
=
"("
.
$inUserIdSql
.
")"
;
...
...
@@ -58,11 +64,14 @@ class SupplierContactApiController extends Controller
}
}
else
{
if
(
$codeId
)
{
$query
->
whereRaw
(
"(can_check_uids =
$codeId
or admin_id =
$adminId
)"
);
$inCodeIdSql
=
implode
(
','
,
array_merge
([
$codeId
],
$resignedCanCheckUids
));
$inCodeIdSql
=
"("
.
$inCodeIdSql
.
")"
;
$query
->
whereRaw
(
"(can_check_uids in
$inCodeIdSql
or admin_id =
$adminId
)"
);
}
else
{
$query
->
whereRaw
(
"(admin_id =
$adminId
)"
);
}
}
$list
=
$query
->
paginate
(
$limit
)
->
toArray
();
$transformer
=
new
SupplierContactTransformer
();
$list
[
'data'
]
=
$transformer
->
transformList
(
$list
[
'data'
]);
...
...
@@ -155,7 +164,7 @@ class SupplierContactApiController extends Controller
{
$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
();
$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
);
...
...
app/Http/Services/AdminUserService.php
View file @
f8bca94c
...
...
@@ -76,9 +76,9 @@ class AdminUserService
public
function
getResignedUsers
()
{
$userInfoModel
=
new
UserInfoModel
();
$user
=
$userInfoModel
->
leftJoin
(
'lie_intracode'
,
'user_info.userId'
,
'='
,
'lie_intracode.admin_id'
)
$user
s
=
$userInfoModel
->
leftJoin
(
'lie_intracode'
,
'user_info.userId'
,
'='
,
'lie_intracode.admin_id'
)
->
where
(
'user_info.status'
,
4
)
->
where
(
'lie_intracode.code_id'
,
'!='
,
''
)
->
get
();
return
$user
?
$user
->
toArray
()
:
[];
return
$user
s
?
$users
->
toArray
()
:
[];
}
//获取未离职人员列表
...
...
resources/views/script/SkuListScript.blade.php
View file @
f8bca94c
...
...
@@ -73,7 +73,7 @@
},
{
field
:
'stock'
,
title
:
'库存数量'
,
align
:
'center'
,
width
:
80
},
{
field
:
'cn_price'
,
title
:
'
国内含币价(¥)
'
,
align
:
'left'
,
width
:
150
,
templet
:
function
(
data
)
{
field
:
'cn_price'
,
title
:
'
人民币成本价(¥)
'
,
align
:
'left'
,
width
:
150
,
templet
:
function
(
data
)
{
if
(
data
.
ladder_price
)
{
let
ladder
=
data
.
ladder_price
[
data
.
ladder_price
.
length
-
1
];
return
'
<
div
class
=
"view_ladder_price_cn layui-row"
><
div
class
=
"layui-col-xs5"
><
span
>
'+ (ladder.purchases) + '
+<
/span></
div
><
div
class
=
"layui-col-xs7"
><
span
>
¥
' + (ladder.price_cn) + '
<
/span></
div
><
/div>'
;
...
...
@@ -82,7 +82,7 @@
}
},
{
field
:
'us_price'
,
title
:
'
USD成本价(未税
)'
,
align
:
'left'
,
width
:
150
,
templet
:
function
(
data
)
{
field
:
'us_price'
,
title
:
'
美金成本价($
)'
,
align
:
'left'
,
width
:
150
,
templet
:
function
(
data
)
{
if
(
data
.
ladder_price
)
{
let
ladder
=
data
.
ladder_price
[
data
.
ladder_price
.
length
-
1
];
if
(
ladder
.
price_us
)
{
...
...
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