主子表subdata.html页面添加商品时间选择
This commit is contained in:
parent
9627ba9e1d
commit
df29372303
|
|
@ -30,6 +30,11 @@ public class GoodsModel
|
||||||
*/
|
*/
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间
|
||||||
|
*/
|
||||||
|
private String time;
|
||||||
|
|
||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return name;
|
return name;
|
||||||
|
|
@ -70,13 +75,22 @@ public class GoodsModel
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public String getTime() {
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTime(String time) {
|
||||||
|
this.time = time;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
.append("name", getName())
|
.append("name", getName())
|
||||||
.append("weight", getWeight())
|
.append("weight", getWeight())
|
||||||
.append("price", getPrice())
|
.append("price", getPrice())
|
||||||
.append("type", getType())
|
.append("type", getType())
|
||||||
|
.append("time", getTime())
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
/**
|
||||||
|
* bootstrapTable行内编辑扩展
|
||||||
|
* 可以自行扩展其他属性,如data-type="date"
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function($) {
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
||||||
|
_initBody = BootstrapTable.prototype.initBody;
|
||||||
|
|
||||||
|
BootstrapTable.prototype.initBody = function() {
|
||||||
|
var that = this;
|
||||||
|
_initBody.apply(this, Array.prototype.slice.apply(arguments));
|
||||||
|
var data = that.getData();
|
||||||
|
var $tr = that.$body.find('tr');
|
||||||
|
$.each($tr, function(rowindex, row) {//循环行
|
||||||
|
var $td = $(row).find('td');//当前行的所有列
|
||||||
|
$.each(that.columns, function(columnindex, column) {//循环列
|
||||||
|
const $time = $($td[columnindex]).find('.time');// 查找时间控件
|
||||||
|
if($time.length > 0){
|
||||||
|
$time.each((i, element) => {//循环time控件,获取element
|
||||||
|
//可以获取其他属性
|
||||||
|
layui.use('laydate', function () {
|
||||||
|
layui.laydate.render({
|
||||||
|
elem: element,
|
||||||
|
theme: 'molv',
|
||||||
|
trigger: 'click',
|
||||||
|
type: 'date',
|
||||||
|
done: function (value, d) {
|
||||||
|
//此处可以扩展callback
|
||||||
|
data[rowindex][column.field] = value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
})(jQuery);
|
||||||
|
|
@ -82,6 +82,7 @@
|
||||||
<th:block th:include="include :: footer" />
|
<th:block th:include="include :: footer" />
|
||||||
<th:block th:include="include :: datetimepicker-js" />
|
<th:block th:include="include :: datetimepicker-js" />
|
||||||
<script th:src="@{/js/jquery.tmpl.js}"></script>
|
<script th:src="@{/js/jquery.tmpl.js}"></script>
|
||||||
|
<script th:src="@{/ajax/libs/bootstrap-table/extensions/editable/bootstrap-table-editable-inline.js}"></script>
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
$(function() {
|
$(function() {
|
||||||
var options = {
|
var options = {
|
||||||
|
|
@ -129,6 +130,15 @@
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: 'time',
|
||||||
|
align: 'center',
|
||||||
|
title: '时间',
|
||||||
|
formatter: function(value, row, index) {
|
||||||
|
var html = $.common.sprintf("<input class='form-control time' type='text' name='goods[%s].time' value='%s'>", index, value);
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: 'type',
|
field: 'type',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue