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
60d549b9
authored
Feb 20, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
跳转需求
parent
d5563313
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
12 deletions
app/Http/Controllers/Api/SupplierApiController.php
app/Http/Controllers/SupplierController.php
app/Http/Services/SupplierService.php
resources/views/web.blade.php
app/Http/Controllers/Api/SupplierApiController.php
View file @
60d549b9
...
@@ -208,16 +208,7 @@ class SupplierApiController extends Controller
...
@@ -208,16 +208,7 @@ class SupplierApiController extends Controller
//获取供应商列表
//获取供应商列表
public
function
GetSupplierList
(
Request
$request
)
public
function
GetSupplierList
(
Request
$request
)
{
{
$model
=
new
SupplierChannelModel
();
$list
=
(
new
SupplierService
())
->
getSupplierList
(
$request
->
all
());
$query
=
$model
->
orderBy
(
'update_time'
,
'desc'
);
$filter
=
new
SupplierFilter
();
$query
=
$filter
->
listFilter
(
$request
->
all
(),
$query
);
$limit
=
$request
->
get
(
'limit'
,
10
);
$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'
]);
$this
->
response
(
0
,
'ok'
,
$list
[
'data'
],
$list
[
'total'
]);
}
}
...
...
app/Http/Controllers/SupplierController.php
View file @
60d549b9
...
@@ -107,6 +107,13 @@ class SupplierController extends Controller
...
@@ -107,6 +107,13 @@ class SupplierController extends Controller
public
function
SupplierDetail
(
$request
)
public
function
SupplierDetail
(
$request
)
{
{
$supplierId
=
$request
->
get
(
'supplier_id'
);
$supplierId
=
$request
->
get
(
'supplier_id'
);
//判断是否能查看
$canCheck
=
(
new
SupplierService
())
->
checkCanViewSupplier
(
$supplierId
);
if
(
!
$canCheck
)
{
return
'没查看该供应商的权限'
;
}
$supplierService
=
new
SupplierService
();
$supplierService
=
new
SupplierService
();
$supplier
=
$supplierService
->
getSupplier
(
$supplierId
);
$supplier
=
$supplierService
->
getSupplier
(
$supplierId
);
if
(
empty
(
$supplier
))
{
if
(
empty
(
$supplier
))
{
...
...
app/Http/Services/SupplierService.php
View file @
60d549b9
...
@@ -20,6 +20,22 @@ class SupplierService
...
@@ -20,6 +20,22 @@ class SupplierService
public
$newSupplierId
=
0
;
public
$newSupplierId
=
0
;
public
function
getSupplierList
(
$map
)
{
$model
=
new
SupplierChannelModel
();
$query
=
$model
->
orderBy
(
'update_time'
,
'desc'
);
$filter
=
new
SupplierFilter
();
$query
=
$filter
->
listFilter
(
$map
,
$query
);
$limit
=
array_get
(
$map
,
'limit'
,
10
);
$list
=
$query
->
paginate
(
$limit
)
->
toArray
();
$transformer
=
new
SupplierTransformer
();
$list
[
'data'
]
=
$transformer
->
transformList
(
$list
[
'data'
]);
//这里还要单独去处理采购员是否离职的显示,考虑到性能,所以再单独搞个方法出来了
$list
[
'data'
]
=
$transformer
->
transformResignChannelUser
(
$list
[
'data'
]);
return
$list
;
}
public
function
getSupplier
(
$supplierId
,
$getExtraInfo
=
false
)
public
function
getSupplier
(
$supplierId
,
$getExtraInfo
=
false
)
{
{
$model
=
new
SupplierChannelModel
();
$model
=
new
SupplierChannelModel
();
...
@@ -653,10 +669,21 @@ class SupplierService
...
@@ -653,10 +669,21 @@ class SupplierService
//检验供应商是否有设置对应的阶梯价格系数
//检验供应商是否有设置对应的阶梯价格系数
public
static
function
checkHasLadderPriceSetting
(
$supplierId
)
public
static
function
checkHasLadderPriceSetting
(
$supplierId
)
{
{
$supplierCode
=
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
value
(
'supplier_code'
);
$supplierCode
=
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
value
(
'supplier_code'
);
$redis
=
new
RedisModel
();
$redis
=
new
RedisModel
();
$rule
=
$redis
->
hget
(
'magic_cube_price_rule'
,
$supplierCode
);
$rule
=
$redis
->
hget
(
'magic_cube_price_rule'
,
$supplierCode
);
return
(
bool
)
$rule
;
return
(
bool
)
$rule
;
}
}
//检查是否有查看权限
public
function
checkCanViewSupplier
(
$supplierId
)
{
$map
=
[
'supplier_id'
=>
$supplierId
,
'source_type'
=>
'all'
];
$list
=
$this
->
getSupplierList
(
$map
);
return
(
bool
)
$list
[
'total'
];
}
}
}
\ No newline at end of file
resources/views/web.blade.php
View file @
60d549b9
...
@@ -55,12 +55,20 @@
...
@@ -55,12 +55,20 @@
if
(
layui
.
admin
.
setter
.
pageTabs
&&
layui
.
admin
.
setter
.
tabAutoRefresh
==
true
)
{
if
(
layui
.
admin
.
setter
.
pageTabs
&&
layui
.
admin
.
setter
.
tabAutoRefresh
==
true
)
{
$
(
'.layui-layout-admin>.layui-body>.layui-tab'
).
attr
(
'lay-autoRefresh'
,
'true'
);
$
(
'.layui-layout-admin>.layui-body>.layui-tab'
).
attr
(
'lay-autoRefresh'
,
'true'
);
}
}
let
jumpUrl
=
getQueryVariable
(
'jump_url'
);
if
(
jumpUrl
)
{
index
.
loadHome
({
menuPath
:
jumpUrl
+
location
.
search
+
'&view=iframe'
,
menuName
:
'
<
i
class
=
"layui-icon layui-icon-home"
><
/i>
'
});
}
else
{
// 默认加载主页
// 默认加载主页
index
.
loadHome
({
index
.
loadHome
({
menuPath
:
'/index/Index?view=iframe'
,
menuPath
:
'/index/Index?view=iframe'
,
menuName
:
'
<
i
class
=
"layui-icon layui-icon-home"
><
/i>
'
menuName
:
'
<
i
class
=
"layui-icon layui-icon-home"
><
/i>
'
});
});
}
admin
.
on
(
'tab'
,
function
(
d
)
{
admin
.
on
(
'tab'
,
function
(
d
)
{
//判断列表是否需要刷新
//判断列表是否需要刷新
...
...
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