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
92788d77
authored
Jul 21, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
筛选组件
parent
5a370456
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
124 additions
and
12 deletions
app/Http/Controllers/Filter/SupplierFilter.php
app/Presenters/Filter/MultiTransformableSelectPresenter.php
app/Presenters/Filter/TransformableSelectPresenter.php
config/field.php
resources/views/web/supplier/SupplierListCommon.blade.php
app/Http/Controllers/Filter/SupplierFilter.php
View file @
92788d77
...
...
@@ -66,6 +66,14 @@ class SupplierFilter
}
}
if
(
!
empty
(
$map
[
'sku_tag'
]))
{
$query
->
where
(
'sku_tag'
,
$map
[
'sku_tag'
]);
}
if
(
!
empty
(
$map
[
'sku_mode'
]))
{
$query
->
where
(
'sku_mode'
,
$map
[
'sku_mode'
]);
}
if
(
!
empty
(
$map
[
'create_time'
]))
{
$times
=
explode
(
'~'
,
$map
[
'create_time'
]);
$startTime
=
strtotime
(
$times
[
0
]);
...
...
app/Presenters/Filter/MultiTransformableSelectPresenter.php
0 → 100644
View file @
92788d77
<?php
namespace
App\Presenters\Filter
;
//左边数据可以多种,右边数据也可以多种,而且右边数据跟着左边来变
class
MultiTransformableSelectPresenter
{
public
function
render
(
$map
=
[],
$data
=
[])
{
$defaultKey
=
array_keys
(
$map
)[
0
];
$unique
=
"unique_"
.
mt_rand
(
1
,
100000
);
$selectUnique
=
"unique_"
.
mt_rand
(
1
,
100000
);
//默认的第一项数据
$firstDataItemKey
=
array_first
(
array_keys
(
$data
));
$html
=
<<<EOF
<div class="layui-row" style="width:268px;margin-bottom: 3px;">
<div class="layui-col-md5">
<div class="layui-input-inline" style="width: 100px;margin-left: 10px">
<select lay-filter="$unique">
{$this->optionsRender($map)}
</select>
</div>
</div>
<div class="layui-col-md7" style="margin-left: -3px">
<div class="layui-input-inline">
<select class="value_select" name="$defaultKey" id="$selectUnique" lay-filter="$selectUnique" lay-search="">
</select>
</div>
</div>
{$this->selectOptionsRender($data)}
</div>
<script>
$(function() {
layui.use(['form', 'element'], function () {
let form = layui.form;
//初始化渲染
let optionsHtml = $('#$firstDataItemKey').html();
$('#$selectUnique').html(optionsHtml);
form.render();
//变更渲染
form.on('select($unique)', function(data){
console.log(data.value)
optionsHtml = $('#'+data.value).html();
$('#$selectUnique').html(optionsHtml);
data.othis.parent().parent().parent().find('.value_select').attr('name',data.value);
form.render();
});
});
});
</script>
EOF;
return
$html
;
}
public
function
optionsRender
(
$data
)
{
$optionsHtml
=
''
;
foreach
(
$data
as
$key
=>
$value
)
{
$optionsHtml
=
$optionsHtml
.
"<option value='
$key
'>
$value
</option>"
;
}
return
$optionsHtml
;
}
public
function
selectOptionsRender
(
$data
)
{
$html
=
''
;
foreach
(
$data
as
$key
=>
$value
)
{
//第二层
$optionsHtml
=
' <option value="">请选择</option>'
;
foreach
(
$value
as
$k
=>
$v
)
{
$optionsHtml
=
$optionsHtml
.
"<option value='
$k
'>
$v
</option>"
;
}
$html
.=
<<<EOF
<div id="$key" style="display: none" >
$optionsHtml;
</div>
EOF;
}
return
$html
;
}
}
\ No newline at end of file
app/Presenters/Filter/TransformableSelectPresenter.php
View file @
92788d77
...
...
@@ -3,7 +3,7 @@
namespace
App\Presenters\Filter
;
//左边可以下拉,右边也可以下拉
class
TransformableSelectPresenter
{
public
function
render
(
$map
=
[],
$data
=
[])
...
...
config/field.php
View file @
92788d77
...
...
@@ -42,6 +42,18 @@ return [
'cp_time'
=>
1
,
],
//SKU 标签
'SkuTag'
=>
[
1
=>
'优选'
,
2
=>
'认证'
,
],
//SKU 模式
'SkuMode'
=>
[
1
=>
'原厂直供'
,
2
=>
'国内现货'
,
],
'SupplierAccountType'
=>
[
0
=>
'其它'
,
1
=>
'云芯商家'
...
...
resources/views/web/supplier/SupplierListCommon.blade.php
View file @
92788d77
...
...
@@ -142,28 +142,34 @@
</div>
<div
class=
"layui-inline"
>
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('status','供应商状态','',config('fixed.SupplierStatus')) !!}
</div>
<div
class=
"layui-inline"
>
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('stockup_type','合作类型','',config('fixed.StockupType')) !!}
</div>
<div
class=
"layui-inline"
>
@inject('transformableSelectPresenter','App\Presenters\Filter\TransformableSelectPresenter')
{!! $transformableSelectPresenter->render(['channel_uid'=>'采购员','purchase_uid'=>'开发员','create_uid'=>'创建人'],$userCodes) !!}
</div>
</div>
<div
class=
"layui-row"
>
<div
class=
"layui-inline"
>
@inject('multiTransformableSelectPresenter','App\Presenters\Filter\MultiTransformableSelectPresenter')
{!! $multiTransformableSelectPresenter->render(['has_sku'=>'SKU上传','sku_tag'=>'SKU标准','sku_mode'=>'SKU模式'],
['has_sku'=>[-1=>'否',1=>'是'],'sku_tag'=>config('field.SkuTag'),'sku_mode'=>config('field.SkuMode')]) !!}
</div>
@if(checkPerm('ViewFakeSupplier'))
<div
class=
"layui-inline"
>
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('is_type','正式供应商','',[0=>'是',1=>'否']
,['width'=>'100px']
) !!}
{!! $statusPresenter->render('is_type','正式供应商','',[0=>'是',1=>'否']) !!}
</div>
@endif
</div>
<div
class=
"layui-row"
>
<div
class=
"layui-inline"
>
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('has_sku','SKU上传','',[-1=>'否',1=>'是']) !!}
</div>
<div
class=
"layui-inline"
>
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('status','供应商状态','',config('fixed.SupplierStatus')) !!}
</div>
{{--
<div
class=
"layui-inline"
>
--}}
{{-- @inject('statusPresenter','App\Presenters\StatusPresenter')--}}
{{-- {!! $statusPresenter->render('has_sku','SKU上传','',[-1=>'否',1=>'是']) !!}--}}
{{--
</div>
--}}
<div
class=
"layui-inline"
style=
"width: 600px"
>
@inject('transformableTimeIntervalPresenter','App\Presenters\Filter\TransformableTimeIntervalPresenter')
{!! $transformableTimeIntervalPresenter->render(['update_time'=>'更新时间','create_time'=>'创建时间']) !!}
...
...
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