Pre Merge pull request !175 from Ricky/master

This commit is contained in:
Ricky 2020-08-10 16:12:37 +08:00 committed by Gitee
commit 186cfeba82
5 changed files with 80 additions and 4 deletions

View File

@ -30,6 +30,11 @@ public class GoodsModel
*/
private String type;
/**
* 时间
*/
private String time;
public String getName()
{
return name;
@ -70,6 +75,14 @@ public class GoodsModel
this.type = type;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -77,6 +90,7 @@ public class GoodsModel
.append("weight", getWeight())
.append("price", getPrice())
.append("type", getType())
.append("time", getTime())
.toString();
}
}

View File

@ -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);

View File

@ -191,8 +191,8 @@ $(function() {
'use strict';
$.fn.toTop = function(opt) {
var elem = this;
var win = $(window);
var doc = $('html, body');
var win = (opt && opt.hasOwnProperty('win')) ? opt.win : $(window);
var doc = (opt && opt.hasOwnProperty('doc')) ? opt.doc : $('html, body');
var options = $.extend({
autohide: true,
offset: 50,

View File

@ -82,6 +82,7 @@
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<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">
$(function() {
var options = {
@ -130,6 +131,15 @@
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',
align: 'center',
@ -166,6 +176,7 @@
name: "",
weight: "",
price: "",
time: "",
type: "",
}
});

View File

@ -100,7 +100,15 @@
if ($(this).width() < 769) {
panehHidden = true;
}
$('body').layout({ initClosed: panehHidden, west__size: 185 });
$('body').layout({ initClosed: panehHidden, west__size: 185});
// 回到顶部绑定
if ($.fn.toTop !== undefined) {
var opt = {
win:$('.ui-layout-center'),
doc:$('.ui-layout-center')
};
$('#scroll-up').toTop(opt);
}
queryUserList();
queryDeptTree();
});