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
5a67a9c4
authored
Oct 28, 2025
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
校验权限
parent
c7311e26
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
4 deletions
app/Http/Controllers/Filter/SupplierFilter.php
app/Http/Services/ViewCheckService.php
resources/views/web/SupplierDetail.blade.php
storage/framework/views/d4d13e9bcdea7366e4952031431aae4b22f055c1.php
app/Http/Controllers/Filter/SupplierFilter.php
View file @
5a67a9c4
...
...
@@ -328,6 +328,14 @@ class SupplierFilter
if
(
$canViewDisableSupplier
&&
!
checkPerm
(
'ViewAllSupplier'
))
{
$mainQuery
->
orWhere
(
'status'
,
SupplierChannelModel
::
STATUS_DISABLE
);
}
//只有原厂、代理商需要走权限,其他性质的随便看
if
(
!
checkPerm
(
'ViewAllSupplier'
))
{
$mainQuery
->
orWhereNotIn
(
'supplier_group'
,
[
SupplierChannelModel
::
SUPPLIER_GROUP_ORIGINAL
,
SupplierChannelModel
::
SUPPLIER_GROUP_PROXY
]);
}
});
$query
->
with
([
'contact'
,
'attachment'
,
'yunxin_account'
]);
...
...
app/Http/Services/ViewCheckService.php
View file @
5a67a9c4
...
...
@@ -7,6 +7,7 @@ namespace App\Http\Services;
//后台用户相关信息服务
use
App\Model\RedisModel
;
use
Illuminate\Support\Facades\DB
;
use
App\Model\SupplierChannelModel
;
//用于判断是否已经查看的服务
class
ViewCheckService
...
...
@@ -32,11 +33,59 @@ class ViewCheckService
foreach
(
$supplierIds
as
$key
=>
$supplierId
)
{
if
(
!
empty
(
$result
[
$key
]))
{
$data
[
$supplierId
]
=
true
;
}
else
{
}
else
{
$data
[
$supplierId
]
=
false
;
}
}
return
$data
;
}
}
\ No newline at end of file
//判断是否能进行供应商编辑
public
function
checkCanEditSupplier
(
$supplierId
)
{
$userId
=
request
()
->
user
->
userId
;
$codeId
=
request
()
->
user
->
codeId
;
if
(
checkPerm
(
'ViewAllSupplier'
))
{
return
true
;
}
if
(
checkPerm
(
'ViewSubordinateSupplier'
))
{
$departmentService
=
new
DepartmentService
();
$subordinateUserIds
=
$departmentService
->
getSubordinateUserIds
(
$userId
);
$adminUserService
=
new
AdminUserService
();
$subordinateCodeIds
=
$adminUserService
->
getCodeIdsByUserIds
(
$subordinateUserIds
);
$subordinateCodeIds
=
$subordinateCodeIds
->
toArray
();
$likeSqlRaw
=
implode
(
'|'
,
$subordinateCodeIds
);
$inCodeIdSql
=
implode
(
','
,
$subordinateCodeIds
);
$inUserIdSql
=
implode
(
','
,
$subordinateUserIds
);
$inCodeIdSql
=
"("
.
$inCodeIdSql
.
")"
;
$inUserIdSql
=
"("
.
$inUserIdSql
.
")"
;
if
(
$subordinateCodeIds
)
{
//找出相关的供应商id
$supplierIds
=
SupplierChannelModel
::
whereRaw
(
"(create_uid in
$inUserIdSql
or purchase_uid in
$inCodeIdSql
or channel_uid REGEXP '
$likeSqlRaw
')"
)
->
pluck
(
'supplier_id'
)
->
toArray
();
if
(
in_array
(
$supplierId
,
$supplierIds
))
{
return
true
;
}
}
}
$supplier
=
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
first
()
->
toArray
();
$channelUid
=
$supplier
[
'channel_uid'
];
$purchaseUid
=
$supplier
[
'purchase_uid'
];
$createUid
=
$supplier
[
'create_uid'
];
$channelUid
=
!
empty
(
$channelUid
)
?
explode
(
','
,
$channelUid
)
:
[];
if
(
in_array
(
$userId
,
$channelUid
))
{
return
true
;
}
if
(
$codeId
==
$purchaseUid
)
{
return
true
;
}
if
(
$userId
==
$createUid
)
{
return
true
;
}
return
false
;
}
}
resources/views/web/SupplierDetail.blade.php
View file @
5a67a9c4
...
...
@@ -73,8 +73,10 @@
</button>
@elseif($supplier['status']==\App\Model\SupplierChannelModel::STATUS_PASSED||$supplier['status']==\App\Model\SupplierChannelModel::STATUS_REJECT
||$supplier['status']==\App\Model\SupplierChannelModel::STATUS_PENDING)
@if((new App\Http\Services\ViewCheckService())->checkCanEditSupplier($supplier['supplier_id']))
<a
id=
"updateSupplierUrl"
style=
"margin-bottom: 25px;margin-top: 5px"
class=
"layui-btn layui-btn"
>
修改
</a>
@endif
@endif
@if($supplier['status']==\App\Model\SupplierChannelModel::STATUS_DISABLE
&&
$supplier['is_entity']==\App\Model\SupplierChannelModel::IS_ENTITY_FALSE)
@if (checkPerm('CancelDisableSupplier'))
...
...
storage/framework/views/d4d13e9bcdea7366e4952031431aae4b22f055c1.php
View file @
5a67a9c4
...
...
@@ -188,7 +188,7 @@
align
:
'center'
,
width
:
120
,
templet
:
function
(
data
)
{
return
data
.
yunxin_account
?
'是'
:
'否'
;
return
data
.
yunxin_account
?
(
data
.
yunxin_account
.
a_status
==
1
?
'是'
:
'否'
)
:
'否'
;
}
},
//通过芯链上传合同
...
...
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