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
127ef737
authored
Aug 08, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
优化采购员离职显示
parent
a6c0d55c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
4 deletions
app/Http/Controllers/Api/SupplierApiController.php
app/Http/Transformers/SupplierTransformer.php
app/Http/routes.php
app/Model/IntracodeModel.php
resources/views/script/SupplierListScript.blade.php
app/Http/Controllers/Api/SupplierApiController.php
View file @
127ef737
...
...
@@ -211,6 +211,8 @@ class SupplierApiController extends Controller
$list
=
$query
->
paginate
(
$limit
)
->
toArray
();
$transformer
=
new
SupplierTransformer
();
$list
[
'data'
]
=
$transformer
->
transformList
(
$list
[
'data'
]);
//这里还要单独去处理采购员是否离职的显示,考虑到性能,所以再单独搞个方法出来了
$list
[
'data'
]
=
$transformer
->
transformResignChannelUser
(
$list
[
'data'
]);
$this
->
response
(
0
,
'ok'
,
$list
[
'data'
],
$list
[
'total'
]);
}
...
...
app/Http/Transformers/SupplierTransformer.php
View file @
127ef737
...
...
@@ -72,6 +72,36 @@ class SupplierTransformer
return
$list
;
}
//这个是用来区分采购员里面哪些是离职的,那些是不离职的,显示在前端
public
function
transformResignChannelUser
(
$suppliers
)
{
foreach
(
$suppliers
as
&
$supplier
)
{
$onJobChannelUsers
=
(
new
IntracodeModel
())
->
getSampleEncode
();
$onJobUserNameList
=
array_values
(
$onJobChannelUsers
);
$channelUserNameList
=
!
empty
(
$supplier
[
'channel_username'
])
?
explode
(
','
,
$supplier
[
'channel_username'
])
:
[];
if
(
empty
(
$channelUserNameList
))
{
continue
;
}
$resignChannelUserNameList
=
$onJobChannelUserNameList
=
[];
//然后判断哪些是离职,哪些是在职的
foreach
(
$channelUserNameList
as
$username
)
{
// dump($username, $onJobUserNameList);
if
(
!
in_array
(
$username
,
$onJobUserNameList
))
{
$resignChannelUserNameList
[]
=
$username
;
}
else
{
$onJobChannelUserNameList
[]
=
$username
;
}
}
$supplier
[
'resign_channel_username'
]
=
$resignChannelUserNameList
?
implode
(
','
,
$resignChannelUserNameList
)
:
''
;
$supplier
[
'on_job_channel_username'
]
=
$onJobChannelUserNameList
?
implode
(
','
,
$onJobChannelUserNameList
)
:
''
;
}
unset
(
$supplier
);
return
$suppliers
;
}
public
function
checkHasQualityAssuranceAgreement
(
$attachment
)
{
if
(
!
$attachment
)
{
...
...
app/Http/routes.php
View file @
127ef737
...
...
@@ -63,4 +63,7 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
// (new \App\Http\Services\DataService())->initSystemTag();
\App\Model\SupplierChannelModel
::
where
(
'supplier_id'
,
6148
)
->
update
([
'status'
=>
2
]);
});
app/Model/IntracodeModel.php
View file @
127ef737
...
...
@@ -33,7 +33,7 @@ class IntracodeModel extends Model
}
}
$redis
->
set
(
'EncodedList_supplier_'
.
$includeResigned
,
json_encode
(
$codeList
));
$redis
->
expire
(
'EncodedList_supplier_'
.
$includeResigned
,
1
);
//缓存1s
$redis
->
expire
(
'EncodedList_supplier_'
.
$includeResigned
,
60
);
//缓存1分钟
}
}
return
$codeList
;
...
...
@@ -56,7 +56,7 @@ class IntracodeModel extends Model
}
}
$redis
->
set
(
'EncodedList_all_supplier'
,
json_encode
(
$codeList
));
$redis
->
expire
(
'EncodedList_all_supplier'
,
60
);
//缓存1
0
分钟
$redis
->
expire
(
'EncodedList_all_supplier'
,
60
);
//缓存1分钟
}
}
return
$codeList
;
...
...
resources/views/script/SupplierListScript.blade.php
View file @
127ef737
...
...
@@ -141,7 +141,18 @@
}
}
},
{
field
:
'channel_username'
,
title
:
'采购员'
,
align
:
'center'
,
width
:
130
},
{
field
:
'channel_username'
,
title
:
'采购员'
,
align
:
'center'
,
width
:
130
,
templet
:
function
(
data
)
{
if
(
!
data
.
channel_username
){
return
''
;
}
if
(
data
.
resign_channel_username
)
{
return
`<span>
${
data
.
on_job_channel_username
}
</span>`
+
`,<span style="color: #D7D7D7">
${
data
.
resign_channel_username
}
</span>`
;
}
else
{
return
`<span>
${
data
.
on_job_channel_username
}
</span>`
;
}
}
},
{
field
:
'purchase_username'
,
title
:
'渠道开发员'
,
align
:
'center'
,
width
:
110
},
{
field
:
'last_update_name'
,
title
:
'最新修改人'
,
align
:
'center'
,
width
:
110
},
{
field
:
'yunxin_channel_username'
,
title
:
'SKU采购员'
,
align
:
'center'
,
width
:
110
},
...
...
@@ -642,7 +653,8 @@
layer
.
load
(
1
);
location
.
reload
();
});
});
})
;
//检查是否能够审核,因为审核人只能审自己相关部门人员修改的供应商记录
function
checkCanAudit
(
supplierId
)
{
...
...
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