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
bc488f20
Commit
bc488f20
authored
May 06, 2018
by
jmu
Browse files
add datetime feature
(cherry picked from commit dc40a5d)
parent
5790b5b2
Changes
3
Hide whitespace changes
Inline
Side-by-side
admin-core/src/main/java/com/ibeetl/admin/core/util/Tool.java
View file @
bc488f20
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,20 +13,33 @@ 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
)
{
//查询范围
String
[]
arrays
=
str
.
split
(
"
至
"
);
String
[]
arrays
=
str
.
split
(
""
);
Date
min
=
parseDate
(
arrays
[
0
]);
Date
max
=
parseDate
(
arrays
[
1
]);
return
new
Date
[]
{
min
,
max
};
}
public
static
Date
[]
parseDataTimeRange
(
String
str
)
{
//查询范围
String
[]
arrays
=
str
.
split
(
"To"
);
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 @
bc488f20
...
...
@@ -182,9 +182,19 @@ var Lib = {
laydate
=
layui
.
laydate
;
laydate
.
render
({
elem
:
$
(
this
)[
0
],
range
:
'
至
'
range
:
'
To
'
});
})
});
$
(
form
).
find
(
"
.datetime-range-pick
"
).
find
(
"
input
"
).
each
(
function
()
{
laydate
=
layui
.
laydate
;
laydate
.
render
({
elem
:
$
(
this
)[
0
],
range
:
'
To
'
,
type
:
'
datetime
'
});
});
$
(
form
).
find
(
"
.input-date
"
).
each
(
function
()
{
laydate
=
layui
.
laydate
;
...
...
admin-core/src/main/resources/templates/common/tag/searchForm.tag.html
View file @
bc488f20
...
...
@@ -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