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
1724f4fb
authored
Jul 06, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
批量修改采购员的审核跳过问题
parent
060e9c63
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
18 deletions
app/Http/Controllers/Api/SupplierApiController.php
app/Http/Services/SupplierService.php
resources/views/script/SupplierListScript.blade.php
app/Http/Controllers/Api/SupplierApiController.php
View file @
1724f4fb
...
@@ -440,7 +440,6 @@ class SupplierApiController extends Controller
...
@@ -440,7 +440,6 @@ class SupplierApiController extends Controller
$this
->
response
(
-
1
,
'该采购员已经离职,请选择其他人员'
);
$this
->
response
(
-
1
,
'该采购员已经离职,请选择其他人员'
);
}
}
$supplierIds
=
explode
(
','
,
$supplierIds
);
$supplierIds
=
explode
(
','
,
$supplierIds
);
$model
=
new
SupplierChannelModel
();
foreach
(
$supplierIds
as
$supplierId
)
{
foreach
(
$supplierIds
as
$supplierId
)
{
$service
=
new
SupplierService
();
$service
=
new
SupplierService
();
$result
=
$service
->
allocateChannelUser
(
$supplierId
,
$channelUid
);
$result
=
$service
->
allocateChannelUser
(
$supplierId
,
$channelUid
);
...
...
app/Http/Services/SupplierService.php
View file @
1724f4fb
...
@@ -426,7 +426,7 @@ class SupplierService
...
@@ -426,7 +426,7 @@ class SupplierService
}
}
//分配采购员
//分配采购员
public
function
allocateChannelUser
(
$supplierId
,
$channelUid
,
$
logFla
g
=
true
)
public
function
allocateChannelUser
(
$supplierId
,
$channelUid
,
$
needLo
g
=
true
)
{
{
$supplier
=
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
first
();
$supplier
=
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
first
();
if
(
empty
(
$supplier
))
{
if
(
empty
(
$supplier
))
{
...
@@ -438,9 +438,8 @@ class SupplierService
...
@@ -438,9 +438,8 @@ class SupplierService
if
(
in_array
(
$channelUid
,
$preChannelUid
))
{
if
(
in_array
(
$channelUid
,
$preChannelUid
))
{
return
true
;
return
true
;
}
}
$result
=
DB
::
connection
(
'web'
)
->
transaction
(
function
()
use
(
$supplierId
,
$channelUid
,
$logFlag
)
{
$result
=
DB
::
connection
(
'web'
)
->
transaction
(
function
()
use
(
$supplierId
,
$channelUid
,
$needLog
)
{
$model
=
new
SupplierChannelModel
();
$supplier
=
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
first
();
$supplier
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
first
();
$supplier
=
$supplier
?
$supplier
->
toArray
()
:
[];
$supplier
=
$supplier
?
$supplier
->
toArray
()
:
[];
$preChannelUid
=
$supplier
[
'channel_uid'
];
$preChannelUid
=
$supplier
[
'channel_uid'
];
$preChannelUid
=
explode
(
','
,
$preChannelUid
);
$preChannelUid
=
explode
(
','
,
$preChannelUid
);
...
@@ -448,17 +447,23 @@ class SupplierService
...
@@ -448,17 +447,23 @@ class SupplierService
$preChannelUid
=
array_unique
(
$preChannelUid
);
$preChannelUid
=
array_unique
(
$preChannelUid
);
$preChannelUid
=
implode
(
','
,
$preChannelUid
);
$preChannelUid
=
implode
(
','
,
$preChannelUid
);
$preChannelUid
=
trim
(
$preChannelUid
,
','
);
$preChannelUid
=
trim
(
$preChannelUid
,
','
);
if
(
$
logFla
g
)
{
if
(
$
needLo
g
)
{
$
result
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
(
[
$
data
=
[
'update_time'
=>
time
(),
'update_time'
=>
time
(),
'channel_uid'
=>
$preChannelUid
,
'channel_uid'
=>
$preChannelUid
,
]);
];
//还要判断是否要进入审核状态,如果有忽略分配采购员进入审核的权限,那么就不用进入待审核状态
if
(
!
checkPerm
(
'IgnoreAllocateChannelUserAudit'
))
{
$data
[
'status'
]
=
SupplierChannelModel
::
STATUS_IN_REVIEW
;
}
$result
=
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
update
(
$data
);
}
else
{
}
else
{
$result
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
$result
=
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'channel_uid'
=>
$preChannelUid
,
'channel_uid'
=>
$preChannelUid
,
]);
]);
}
}
$contactResult
=
false
;
$contactResult
=
false
;
if
(
$result
)
{
if
(
$result
)
{
$contactModel
=
new
SupplierContactModel
();
$contactModel
=
new
SupplierContactModel
();
...
@@ -470,7 +475,7 @@ class SupplierService
...
@@ -470,7 +475,7 @@ class SupplierService
];
];
$contactResult
=
$contactModel
->
insert
(
$contact
);
$contactResult
=
$contactModel
->
insert
(
$contact
);
}
}
if
(
$contactResult
&&
$
logFla
g
)
{
if
(
$contactResult
&&
$
needLo
g
)
{
//判断是否是非正式(is_type=1)供应商,如果是,自动转正,并且修改为待审核状态
//判断是否是非正式(is_type=1)供应商,如果是,自动转正,并且修改为待审核状态
$this
->
autoChangeIsType
(
$supplier
);
$this
->
autoChangeIsType
(
$supplier
);
//记录日志
//记录日志
...
...
resources/views/script/SupplierListScript.blade.php
View file @
1724f4fb
...
@@ -148,15 +148,16 @@
...
@@ -148,15 +148,16 @@
},
},
{
{
field
:
'status_name'
,
title
:
'状态'
,
align
:
'center'
,
width
:
80
,
templet
:
function
(
data
)
{
field
:
'status_name'
,
title
:
'状态'
,
align
:
'center'
,
width
:
80
,
templet
:
function
(
data
)
{
if
(
data
.
status
===
3
)
{
switch
(
data
.
status
)
{
return
"
<
span
style
=
'color: red'
title
=
'" + data.reject_reason + "'
>
" + data.status_name + "
<
/span>
"
}
else
if
(
data
.
status
===
-
3
)
{
return
"
<
span
style
=
'color: red'
title
=
'" + data.block_reason + "'
>
" + data.status_name + "
<
/span>
"
}
else
{
return
data
.
status_name
;
}
switch
(
data
.
status
){
case
3
:
case
3
:
return
"
<
span
style
=
'color: red'
title
=
'" + data.reject_reason + "'
>
" + data.status_name + "
<
/span>
"
case
-
3
:
return
"
<
span
style
=
'color: red'
title
=
'" + data.block_reason + "'
>
" + data.status_name + "
<
/span>
"
case
-
2
:
return
"
<
span
style
=
'color: red'
title
=
'" + data.disable_reason + "'
>
" + data.status_name + "
<
/span>
"
default
:
return
data
.
status_name
;
}
}
}
}
},
},
...
...
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