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
25191251
authored
Jul 07, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
temp
parent
95e84e9d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
129 additions
and
0 deletions
app/Http/Controllers/Api/SupplierApiController.php
app/Http/Services/SupplierTagService.php
resources/views/script/BatchAddTags.blade.php
resources/views/web/BatchAddTags.blade.php
app/Http/Controllers/Api/SupplierApiController.php
View file @
25191251
...
@@ -656,4 +656,21 @@ class SupplierApiController extends Controller
...
@@ -656,4 +656,21 @@ class SupplierApiController extends Controller
$this
->
response
(
0
,
'申请审核成功'
);
$this
->
response
(
0
,
'申请审核成功'
);
}
}
//批量新增标签
public
function
BatchAddTags
(
$request
)
{
$supplierIds
=
$request
->
get
(
'supplier_ids'
);
$systemTags
=
$request
->
get
(
'system_tags'
);
$customTags
=
$request
->
get
(
'custom_tags'
);
$supplierIds
=
$supplierIds
?
explode
(
','
,
$supplierIds
)
:
[];
$systemTags
=
$systemTags
?
explode
(
','
,
$systemTags
)
:
[];
$customTags
=
$customTags
?
explode
(
','
,
$customTags
)
:
[];
$supplierService
=
new
SupplierService
();
if
(
empty
(
$systemTags
)
&&
empty
(
$customTags
))
{
$this
->
response
(
-
1
,
'请设置标签'
);
}
$supplierService
->
batchAddTags
(
$supplierIds
,
$systemTags
,
$customTags
);
$this
->
response
(
0
,
'批量新增标签成功'
);
}
}
}
app/Http/Services/SupplierTagService.php
View file @
25191251
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
namespace
App\Http\Services
;
namespace
App\Http\Services
;
//后台用户相关信息服务
//后台用户相关信息服务
use
App\Model\SupplierChannelModel
;
use
GuzzleHttp\Client
;
use
GuzzleHttp\Client
;
use
GuzzleHttp\RequestOptions
;
use
GuzzleHttp\RequestOptions
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\DB
;
...
@@ -119,4 +120,15 @@ class SupplierTagService
...
@@ -119,4 +120,15 @@ class SupplierTagService
Log
::
error
(
'保存标签失败,'
.
json_encode
(
$data
));
Log
::
error
(
'保存标签失败,'
.
json_encode
(
$data
));
}
}
}
}
//批量新增标签
public
function
batchAddTags
(
$supplierIds
,
$addSysTags
,
$addCusTags
)
{
$suppliers
=
SupplierChannelModel
::
whereIn
(
'supplier_id'
,
$supplierIds
)
->
get
()
->
toArray
();
foreach
(
$suppliers
as
$supplier
)
{
$systemTags
=
$supplier
[
'system_tags'
]
?
explode
(
','
,
$supplier
[
'system_tags'
])
:
[];
$customTags
=
$supplier
[
'custom_tags'
]
?
explode
(
','
,
$supplier
[
'custom_tags'
])
:
[];
}
}
}
}
\ No newline at end of file
resources/views/script/BatchAddTags.blade.php
0 → 100644
View file @
25191251
<script>
layui
.
use
([
'table'
,
'form'
,
'element'
,
'table'
,
'layer'
,
'admin'
],
function
()
{
let
admin
=
layui
.
admin
;
let
form
=
layui
.
form
;
let
table
=
layui
.
table
let
element
=
layui
.
element
;
form
.
on
(
'submit(auditSupplier)'
,
function
(
data
)
{
admin
.
showLoading
({
type
:
3
});
let
supplierIds
=
getQueryVariable
(
'supplier_ids'
);
let
url
=
'/api/supplier/BatchAllocatePurchaseUser?supplier_ids='
+
supplierIds
;
$
.
ajax
({
url
:
url
,
type
:
'GET'
,
async
:
true
,
data
:
data
.
field
,
dataType
:
'json'
,
timeout
:
20000
,
success
:
function
(
res
)
{
admin
.
removeLoading
();
if
(
res
.
err_code
===
0
)
{
admin
.
closeThisDialog
();
parent
.
layer
.
msg
(
res
.
err_msg
,
{
icon
:
6
});
}
else
{
parent
.
layer
.
msg
(
res
.
err_msg
,
{
icon
:
5
});
}
},
error
:
function
()
{
admin
.
removeLoading
();
parent
.
layer
.
msg
(
'网络错误'
,
{
icon
:
5
});
}
});
return
false
;
});
form
.
on
(
'submit(cancel)'
,
function
(
data
)
{
admin
.
closeThisDialog
();
});
});
</script>
\ No newline at end of file
resources/views/web/BatchAddTags.blade.php
0 → 100644
View file @
25191251
<style>
.layui-form-item
{
margin-bottom
:
5px
;
}
</style>
<div
class=
"layui-card"
>
<div
class=
"layui-card-header"
style=
"height: 170px"
>
<blockquote
class=
"layui-elem-quote layui-text"
>
<b>
渠道开发员设置
</b>
</blockquote>
<form
class=
"layui-form"
action=
""
>
<input
type=
"hidden"
name=
"supplier_ids"
value=
"{{$supplierIds}}"
>
<div
class=
"layui-form-item"
>
<div
class=
"layui-inline"
style=
"margin-left: -30px"
>
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('purchase_uid','渠道开发员',null,
$userCodes,['required'=>true,'width'=>'150px']) !!}
</div>
</div>
<div
class=
"layui-form-item"
>
<div
align=
"center"
style=
"margin-top: 10px;text-align: right"
>
<button
type=
"button"
class=
"layui-btn layui-btn-sm layui-btn-info submit-loading"
lay-submit
lay-filter=
"auditSupplier"
>
确认
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-sm layui-btn-primary"
lay-submit
lay-filter=
"cancel"
>
取消
</button>
</div>
</div>
</form>
</div>
<div
class=
"layui-card-body"
>
<blockquote
class=
"layui-elem-quote layui-text"
>
<b>
当前选中需要批量修改渠道员的供应商列表
</b>
</blockquote>
<table
class=
"layui-table"
>
<colgroup>
<col
width=
"300"
>
<col
width=
"100"
>
<col>
</colgroup>
<thead>
<tr>
<th>
供应商名称
</th>
<th>
当前渠道开发员
</th>
</tr>
</thead>
<tbody>
@foreach($suppliers as $supplier)
<tr>
<td>
{{$supplier['supplier_name']}}
</td>
<td>
{{$supplier['purchase_username']}}
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
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