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
adac2d4c
authored
Nov 26, 2025
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
筛选精确度提升
parent
dee14bb8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
app/Presenters/Filter/TransformableTimeIntervalPresenter.php
resources/views/web/sku/SkuListFilter.blade.php
app/Presenters/Filter/TransformableTimeIntervalPresenter.php
View file @
adac2d4c
...
...
@@ -8,7 +8,7 @@ use Carbon\Carbon;
class
TransformableTimeIntervalPresenter
{
public
function
render
(
$map
=
[])
public
function
render
(
$map
=
[]
,
$isDateTime
=
false
)
{
$unique
=
"unique_"
.
mt_rand
(
1
,
100000
);
$defaultKey
=
array_keys
(
$map
)[
0
];
...
...
@@ -16,6 +16,9 @@ class TransformableTimeIntervalPresenter
$threeDayTimeInterval
=
Carbon
::
now
()
->
subDay
(
2
)
->
toDateString
()
.
' ~ '
.
Carbon
::
now
()
->
addDay
(
1
)
->
toDateString
();
$thisWeekTimeInterval
=
Carbon
::
now
()
->
startOfWeek
()
->
toDateString
()
.
' ~ '
.
Carbon
::
now
()
->
addDay
(
1
)
->
toDateString
();
$thisMonthTimeInterval
=
Carbon
::
now
()
->
startOfMonth
()
->
toDateString
()
.
' ~ '
.
Carbon
::
now
()
->
addDay
(
1
)
->
toDateString
();
$timeType
=
$isDateTime
?
'datetime'
:
'date'
;
$intervelWidth
=
$isDateTime
?
'258px'
:
'158px'
;
$optionMarginLeft
=
$isDateTime
?
'82px'
:
'-18px'
;
$html
=
<<<EOF
<div class="layui-row" style="margin-bottom: 3px;">
<div class="layui-col-md6">
...
...
@@ -27,14 +30,14 @@ class TransformableTimeIntervalPresenter
</div>
</div>
<div class="layui-col-md7" style="margin-left: -15px">
<div class="layui-input-inline" style="min-width: 150px;width:
158px
">
<div class="layui-input-inline" style="min-width: 150px;width:
$intervelWidth
">
<input type="text" name="$defaultKey" id="$unique" placeholder="请选择时间区间" autocomplete="off" class="layui-input">
</div>
</div>
</div>
<div class="layui-col-md6">
<div style="margin-top: 5px;">
<div class="layui-col-md2" style="margin-left:
-18px
">
<div class="layui-col-md2" style="margin-left:
$optionMarginLeft
">
<button type="button" class="layui-btn layui-btn-primary layui-btn-sm day_type_button"
dateInterval="$todayTimeInterval"
id="${unique}_today">今日</button>
...
...
@@ -69,11 +72,11 @@ class TransformableTimeIntervalPresenter
});
laydate.render({
elem: '#$unique'
,type: '
dat
e'
,type: '
$timeTyp
e'
,trigger:'click'
,range: '~' //或 range: '~' 来自定义分割字符
,change: function (value, date, endDate) {
alert(123)
}
});
$('.day_type_button').click(function() {
...
...
@@ -81,7 +84,7 @@ class TransformableTimeIntervalPresenter
$(this).attr('class','layui-btn layui-btn-sm layui-btn-normal day_type_button');
laydate.render({
elem: '#$unique'
,type: '
dat
e'
,type: '
$timeTyp
e'
,value: $(this).attr('dateInterval')
,trigger:'click'
,range: '~' //或 range: '~' 来自定义分割字符
...
...
resources/views/web/sku/SkuListFilter.blade.php
View file @
adac2d4c
...
...
@@ -156,7 +156,7 @@
</div>
<div
class=
"layui-inline"
style=
"width: 600px"
>
@inject('transformableTimeIntervalPresenter','App\Presenters\Filter\TransformableTimeIntervalPresenter')
{!! $transformableTimeIntervalPresenter->render(['update_time'=>'更新时间','create_time'=>'创建时间','audit_time'=>'上传时间']) !!}
{!! $transformableTimeIntervalPresenter->render(['update_time'=>'更新时间','create_time'=>'创建时间','audit_time'=>'上传时间']
,true
) !!}
</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