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
f69a1d67
authored
Aug 04, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix
parent
4ebc38d1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
5 deletions
app/Http/Controllers/Api/SupplierShareApplyApiController.php
app/Http/Services/DepartmentService.php
resources/views/script/ApplySupplierShareScript.blade.php
app/Http/Controllers/Api/SupplierShareApplyApiController.php
View file @
f69a1d67
...
...
@@ -27,7 +27,7 @@ class SupplierShareApplyApiController extends Controller
//校验申请的供应商,并且还要返回所属部门列表
public
function
CheckApplySupplierShare
(
$request
)
{
$supplierName
=
$request
->
get
(
'supplier_name'
);
$supplierName
=
trim
(
$request
->
get
(
'supplier_name'
)
);
if
(
empty
(
$supplierName
))
{
$this
->
response
(
-
1
,
'供应商名称不能为空'
);
}
...
...
@@ -36,14 +36,25 @@ class SupplierShareApplyApiController extends Controller
if
(
empty
(
$supplier
))
{
$this
->
response
(
-
1
,
'该供应商名称不存在,请输入正确供应商名称'
);
}
$userId
=
$request
->
user
->
userId
;
$codeId
=
$request
->
user
->
codeId
;
//要判断自己是不是有这个供应商了,有的话没必要申请
$isOwn
=
$supplierModel
->
where
(
'supplier_name'
,
$supplierName
)
->
where
(
function
(
$q
)
use
(
$userId
,
$codeId
)
{
$q
->
where
(
'create_uid'
,
$userId
)
->
orWhere
(
'purchase_uid'
,
$codeId
)
->
orwhere
(
'channel_uid'
,
'like'
,
"%
$codeId
%"
);
})
->
where
(
'is_type'
,
0
)
->
count
();
if
(
$isOwn
)
{
$this
->
response
(
-
1
,
'你已经可以管理该供应商,无需申请共用'
);
}
if
(
empty
(
$supplier
[
'create_uid'
])
&&
empty
(
$supplier
[
'channel_uid'
])
&&
empty
(
$supplier
[
'purchase_uid'
]))
{
$this
->
response
(
-
1
,
'该供应商没有相关的所属人信息,请联系管理员'
);
}
$departmentService
=
new
DepartmentService
();
$department
=
$departmentService
->
getTopDepartmentByUserId
(
$request
->
user
->
userId
);
$applyService
=
new
SupplierShareApplyService
();
$departments
=
$applyService
->
getApplyCanUseDepartments
(
$supplier
);
//获取当前人的部门id,如果部门列表里面包含自己的部门,则提示该供应商属于自己部门,请找主管分配
$departmentService
=
new
DepartmentService
();
$department
=
$departmentService
->
getTopDepartmentByUserId
(
$request
->
user
->
userId
);
if
(
in_array
(
$department
,
$departments
))
{
$this
->
response
(
-
1
,
'该供应商属于自己部门,请找主管分配'
);
}
...
...
app/Http/Services/DepartmentService.php
View file @
f69a1d67
...
...
@@ -75,6 +75,10 @@ class DepartmentService
return
$department
;
}
$department
=
$departmentModel
->
where
(
'department_id'
,
$department
[
'parent_id'
])
->
first
()
->
toArray
();
// //还不是顶级的话,继续找
// if ($department['parent_id'] != 0) {
// $department = $departmentModel->where('department_id', $department['parent_id'])->first()->toArray();
// }
return
$department
;
}
return
[];
...
...
resources/views/script/ApplySupplierShareScript.blade.php
View file @
f69a1d67
...
...
@@ -21,12 +21,21 @@
}
},
{
field
:
'department_name'
,
title
:
'被申请部门'
,
width
:
150
,
align
:
'center'
,
templet
:
function
(
d
)
{
field
:
'department_name'
,
title
:
'被申请部门'
,
width
:
150
,
align
:
'center'
,
templet
:
function
(
d
)
{
return
d
.
apply_department
?
d
.
apply_department
.
department_name
:
''
;
}
},
{
field
:
'create_time'
,
title
:
'申请时间'
,
width
:
150
,
align
:
'center'
},
{
field
:
'status_name'
,
title
:
'状态'
,
width
:
150
,
align
:
'center'
},
{
field
:
'status_name'
,
title
:
'状态'
,
width
:
150
,
align
:
'center'
,
templet
:
function
(
d
)
{
console
.
log
(
d
);
if
(
d
.
status
===
-
1
||
d
.
status
===
-
2
)
{
return
"
<
span
style
=
'color: red'
>
" + d.status_name + "
<
/span>
"
}
else
{
return
d
.
status_name
;
}
}
},
]]
,
id
:
'applyList'
,
page
:
{}
...
...
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