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
06d84b5b
authored
Jul 26, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
批量新增标签操作方式修改
parent
80ecdf5e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
93 additions
and
62 deletions
app/Http/Controllers/SupplierTagController.php
app/Model/SupplierChannelModel.php
resources/views/script/BatchAddTagScript.blade.php
resources/views/script/SupplierListScript.blade.php
resources/views/web/BatchAddTag.blade.php
app/Http/Controllers/SupplierTagController.php
View file @
06d84b5b
...
...
@@ -44,14 +44,22 @@ class SupplierTagController extends Controller
//供应商详情
public
function
BatchAddTag
(
$request
)
{
$supplierIds
=
$request
->
get
(
'supplier_ids'
);
$this
->
data
[
'supplierIds'
]
=
$supplierIds
;
$supplierIds
=
explode
(
','
,
$supplierIds
);
$model
=
new
SupplierChannelModel
();
$suppliers
=
$model
->
whereIn
(
'supplier_id'
,
$supplierIds
)
->
get
()
->
toArray
();
$transformer
=
new
SupplierTransformer
();
$suppliers
=
$transformer
->
transformList
(
$suppliers
);
$suppliers
=
(
new
SupplierChannelModel
())
->
where
(
'is_type'
,
0
)
->
select
([
'supplier_id'
,
'supplier_code'
,
'system_tags'
,
'customer_tags'
,
'supplier_name'
,
])
->
get
();
$this
->
data
[
'suppliers'
]
=
$suppliers
;
$supplierCodes
=
[];
foreach
(
$suppliers
as
$supplier
)
{
$supplier
=
$supplier
->
toArray
();
$supplierCodes
[
$supplier
[
'supplier_code'
]]
=
$supplier
[
'supplier_name'
]
.
'('
.
$supplier
[
'supplier_code'
]
.
')'
;
}
$this
->
data
[
'supplierCodes'
]
=
$supplierCodes
;
$this
->
data
[
'suppliers'
]
=
collect
(
$suppliers
)
->
keyBy
(
'supplier_code'
)
->
toArray
();
$this
->
data
[
'title'
]
=
'批量修改供应商编码'
;
return
$this
->
view
(
'批量修改供应商编码'
);
}
...
...
app/Model/SupplierChannelModel.php
View file @
06d84b5b
...
...
@@ -64,4 +64,10 @@ class SupplierChannelModel extends Model
{
return
$this
->
hasMany
(
SupplierPayTypeModel
::
class
,
'supplier_id'
,
'supplier_id'
);
}
//获取正式供应商
public
function
getOfficialSuppliers
()
{
return
SupplierChannelModel
::
whereIn
(
'is_type'
,
0
)
->
get
()
->
toArray
();
}
}
resources/views/script/BatchAddTagScript.blade.php
View file @
06d84b5b
...
...
@@ -74,10 +74,33 @@
let
systemTagOption
=
getTagOption
(
'system_tags_selector'
,
2
);
let
tagSelector
=
xmSelect
.
render
(
systemTagOption
);
let
tagIds
=
$
(
'#system_tags'
).
attr
(
'value'
);
tagSelector
.
setValue
(
tagIds
.
split
(
','
));
//自定义标签
$
(
'#customer_tags'
).
tagsInput
({});
//点击添加选择的供应商到待修改列表
$
(
document
).
on
(
'click'
,
'#addSupplierToList'
,
function
()
{
let
supplierCode
=
$
(
'#supplier_selector'
).
val
();
if
(
!
supplierCode
)
{
layer
.
msg
(
'请先选择需要操作的供应商'
,
{
icon
:
5
});
return
;
}
let
suppliers
=
{
!!
json_encode
(
$suppliers
)
!!
};
let
supplier
=
suppliers
[
supplierCode
];
let
appendHtml
=
`
<tr>
<td>
${
supplier
[
'supplier_name'
]}
</td>
<td>
${
supplier
[
'system_tags'
]}
</td>
<td>
${
supplier
[
'customer_tags'
]}
</td>
</tr>
`
;
console
.
log
(
appendHtml
);
let
selectedSupplierIds
=
$
(
'#supplier_ids'
).
val
();
selectedSupplierIds
=
selectedSupplierIds
?
selectedSupplierIds
.
split
(
','
)
:
[];
selectedSupplierIds
.
push
(
supplier
[
'supplier_id'
]);
$
(
'#supplier_ids'
).
val
(
selectedSupplierIds
.
join
(
','
));
$
(
'#operateSupplierList'
).
append
(
appendHtml
);
});
});
</script>
\ No newline at end of file
resources/views/script/SupplierListScript.blade.php
View file @
06d84b5b
...
...
@@ -587,22 +587,14 @@
//批量修改供应商标签
$
(
"#batch_add_tags"
).
click
(
function
()
{
let
checkStatus
=
table
.
checkStatus
(
'list'
);
let
data
=
checkStatus
.
data
;
let
supplierIds
=
Array
.
from
(
data
,
({
supplier_id
})
=>
supplier_id
);
supplierIds
=
supplierIds
.
join
(
','
);
if
(
!
data
.
length
)
{
layer
.
msg
(
'请先选择要操作的供应商'
,
{
icon
:
5
})
}
else
{
layer
.
open
({
type
:
2
,
content
:
'/supplier_tag/BatchAddTag?view=iframe&supplier_ids='
+
supplierIds
,
area
:
[
'70%'
,
'90%'
],
title
:
'供应商标签添加'
,
end
:
function
()
{
}
});
}
layer
.
open
({
type
:
2
,
content
:
'/supplier_tag/BatchAddTag?view=iframe'
,
area
:
[
'70%'
,
'90%'
],
title
:
'供应商标签添加'
,
end
:
function
()
{
}
});
});
//设置SKU采购
...
...
resources/views/web/BatchAddTag.blade.php
View file @
06d84b5b
...
...
@@ -3,13 +3,13 @@
margin-bottom
:
5px
;
}
</style>
<
div
class=
"layui-card
"
>
<div
class=
"layui-card
-header"
style=
"height: 230px
"
>
<
blockquote
class=
"layui-elem-quote layui-text
"
>
<b
>
标签新增
</b
>
</blockquote
>
<form
class=
"layui-form"
action=
""
>
<input
type=
"hidden"
name=
"supplier_ids"
value=
"{{$supplierIds}}
"
>
<
form
class=
"layui-form"
action=
"
"
>
<div
class=
"layui-card"
>
<
div
class=
"layui-card-header"
style=
"height: 230px
"
>
<b
lockquote
class=
"layui-elem-quote layui-text"
>
<b>
标签新增
</b
>
</blockquote
>
<input
type=
"hidden"
name=
"supplier_ids"
id=
"supplier_ids
"
>
<div
class=
"layui-form-item"
>
<div
class=
"layui-input-block"
style=
"margin-left: -30px"
>
<div
class=
"layui-form-item"
>
...
...
@@ -18,7 +18,7 @@
<div
class=
"layui-input-block"
style=
"margin-top: 15px"
>
<div
id=
"system_tags_selector"
class=
"layui-input-inline"
style=
"width: 100%;"
>
</div>
<input
type=
"hidden"
name=
"system_tags"
value=
"{{$supplier['system_tags'] or ''}}"
<input
type=
"hidden"
name=
"system_tags"
id=
"system_tags"
>
</div>
</div>
...
...
@@ -26,7 +26,7 @@
<label
class=
"layui-form-label"
>
自定义标签 :
</label>
<div
class=
"layui-input-block"
style=
"margin-top: 15px"
>
<input
name=
"customer_tags"
id=
"customer_tags"
value=
"{{$supplier['customer_tags'] or ''}}"
>
<input
name=
"customer_tags"
id=
"customer_tags"
>
</div>
</div>
</div>
...
...
@@ -41,34 +41,35 @@
</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=
"400"
>
<col
width=
"400"
>
</colgroup>
<thead>
<tr>
<th>
供应商名称
</th>
<th>
系统标签
</th>
<th>
自定义标签
</th>
</tr>
</thead>
<tbody>
@foreach($suppliers as $supplier)
</div>
<div
class=
"layui-card-body"
>
<blockquote
class=
"layui-elem-quote layui-text"
>
<b>
选择需要新增标签的供应商
</b>
</blockquote>
<div
class=
"layui-row"
style=
"margin-bottom: 12px"
>
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('supplier_selector','供应商选择 : ',null,
$supplierCodes,['width'=> '500px']) !!}
<button
type=
"button"
class=
"layui-btn-sm layui-btn"
style=
"margin-top: 5px;margin-left: 5px;"
id=
"addSupplierToList"
>
确认添加到操作列表
</button>
</div>
<table
class=
"layui-table"
>
<colgroup>
<col
width=
"300"
>
<col
width=
"400"
>
<col
width=
"400"
>
</colgroup>
<thead>
<tr>
<t
d>
{{$supplier['supplier_name']}}
</td
>
<t
d>
{{$supplier['system_tags']}}
</td
>
<t
d>
{{$supplier['customer_tags']}}
</td
>
<t
h>
供应商名称
</th
>
<t
h>
系统标签
</th
>
<t
h>
自定义标签
</th
>
</tr>
@endforeach
</tbody>
</table>
</thead>
<tbody
id=
"operateSupplierList"
>
</tbody>
</table>
</div>
</div>
</
div
>
</
form
>
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