Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Springboot Plus
Commits
79c6aa5a
Commit
79c6aa5a
authored
May 07, 2018
by
闲.大赋
Browse files
!20 增加datetime区间的支持
Merge pull request !20 from jmu/feature/datetime
parents
5790b5b2
a3fccba5
Changes
3
Hide whitespace changes
Inline
Side-by-side
admin-core/src/main/java/com/ibeetl/admin/core/util/Tool.java
View file @
79c6aa5a
package
com.ibeetl.admin.core.util
;
import
org.apache.commons.lang3.time.DateUtils
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Date
;
/**
...
...
@@ -13,7 +13,7 @@ import java.util.Date;
*/
public
class
Tool
{
static
final
String
DATE_FORAMT
=
"yyyy-MM-dd"
;
static
final
String
DATETIME_FORAMT
=
"yyyy-MM-dd
hh
:mm:ss"
;
static
final
String
DATETIME_FORAMT
=
"yyyy-MM-dd
HH
:mm:ss"
;
public
static
Date
[]
parseDataRange
(
String
str
)
{
//查询范围
...
...
@@ -24,9 +24,22 @@ public class Tool {
return
new
Date
[]
{
min
,
max
};
}
public
static
Date
[]
parseDataTimeRange
(
String
str
)
{
//查询范围
String
[]
arrays
=
str
.
split
(
"至"
);
Date
min
=
parseDateWithPattern
(
arrays
[
0
],
DATETIME_FORAMT
);
Date
max
=
parseDateWithPattern
(
arrays
[
1
],
DATETIME_FORAMT
);
return
new
Date
[]
{
min
,
max
};
}
public
static
Date
parseDate
(
String
str
)
{
return
parseDateWithPattern
(
str
,
DATE_FORAMT
);
}
public
static
Date
parseDateWithPattern
(
String
str
,
String
pattern
)
{
try
{
return
new
SimpleDateFormat
(
DATE_FORAMT
)
.
parse
(
str
.
trim
());
return
DateUtils
.
parse
Date
(
str
.
trim
()
,
pattern
);
}
catch
(
ParseException
e
)
{
throw
new
RuntimeException
(
e
);
}
...
...
admin-core/src/main/resources/static/js/lib.js
View file @
79c6aa5a
...
...
@@ -184,7 +184,17 @@ var Lib = {
elem
:
$
(
this
)[
0
],
range
:
'
至
'
});
})
});
$
(
form
).
find
(
"
.datetime-range-pick
"
).
find
(
"
input
"
).
each
(
function
()
{
laydate
=
layui
.
laydate
;
laydate
.
render
({
elem
:
$
(
this
)[
0
],
range
:
'
至
'
,
type
:
'
datetime
'
});
});
$
(
form
).
find
(
"
.input-date
"
).
each
(
function
()
{
laydate
=
layui
.
laydate
;
...
...
admin-core/src/main/resources/templates/common/tag/searchForm.tag.html
View file @
79c6aa5a
...
...
@@ -47,6 +47,19 @@ case 2:{ //日期范围
</div>
</div>
<!--#}
case 3:{ //时间范围
-->
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
${item.name}
</label>
<div
class=
"layui-input-inline"
>
<div
class=
"datetime-range-pick"
>
<input
type=
"text"
name=
"${item.fieldName}"
autocomplete=
"off"
class=
"layui-input"
>
</div>
</div>
</div>
<!--#} -->
<!--#}/*switch 结束*/
}/*结束循环*/ -->
...
...
Write
Preview
Supports
Markdown
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