主子表示例添加日期格式案例

pull/196/head
RuoYi 2020-08-11 17:34:10 +08:00
parent cdbf0e2264
commit a0ada99856
3 changed files with 39 additions and 1 deletions

View File

@ -1,5 +1,6 @@
package com.ruoyi.web.controller.demo.domain; package com.ruoyi.web.controller.demo.domain;
import java.util.Date;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
@ -24,6 +25,11 @@ public class GoodsModel
* *
*/ */
private Double price; private Double price;
/**
*
*/
private Date date;
/** /**
* *
@ -60,6 +66,16 @@ public class GoodsModel
this.price = price; this.price = price;
} }
public Date getDate()
{
return date;
}
public void setDate(Date date)
{
this.date = date;
}
public String getType() public String getType()
{ {
return type; return type;
@ -76,6 +92,7 @@ public class GoodsModel
.append("name", getName()) .append("name", getName())
.append("weight", getWeight()) .append("weight", getWeight())
.append("price", getPrice()) .append("price", getPrice())
.append("date", getDate())
.append("type", getType()) .append("type", getType())
.toString(); .toString();
} }

View File

@ -119,6 +119,15 @@
formatter: function(value, row, index) { formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='goods[%s].weight' value='%s'>", index, value); var html = $.common.sprintf("<input class='form-control' type='text' name='goods[%s].weight' value='%s'>", index, value);
return html; return html;
}
},
{
field: 'date',
align: 'center',
title: '商品日期',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='goods[%s].date' value='%s' placeholder='yyyy-MM-dd'>", index, value);
return html;
} }
}, },
{ {
@ -155,6 +164,15 @@
autoclose: true autoclose: true
}); });
function bindDatetimepicker() {
$("input[name$='date']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true,
pickerPosition:'top-right'
});
}
function addColumn() { function addColumn() {
var count = $("#" + table.options.id).bootstrapTable('getData').length; var count = $("#" + table.options.id).bootstrapTable('getData').length;
sub.editColumn(); sub.editColumn();
@ -166,9 +184,12 @@
name: "", name: "",
weight: "", weight: "",
price: "", price: "",
date: "",
type: "", type: "",
} }
}); });
bindDatetimepicker();
} }
</script> </script>
</body> </body>

View File

@ -119,7 +119,7 @@ public class SysUserOnlineServiceImpl implements ISysUserOnlineService
{ {
Cache<String, Deque<Serializable>> cache = ehCacheManager.getCache(ShiroConstants.SYS_USERCACHE); Cache<String, Deque<Serializable>> cache = ehCacheManager.getCache(ShiroConstants.SYS_USERCACHE);
Deque<Serializable> deque = cache.get(loginName); Deque<Serializable> deque = cache.get(loginName);
if (StringUtils.isNull(cache) || StringUtils.isEmpty(deque)) if (StringUtils.isEmpty(deque) || deque.size() == 0)
{ {
return; return;
} }