新增一列后,在下令时间下面自动显示当前时间
获取时间已经写好,需要怎么调用到下令时间代码里面
function logEndTimeFun(element) {
WdatePicker({
el: element,
dateFmt: 'yyyy-MM-dd HH:mm',
onpicked: function () {
logform.preview();
}
})
}
这是js里面的代码
var tzxxDataTable = {
initTableData: function () {
var currentShift = window.parent.getCurrShfit();
console.log(currentShift);
$('#tzxxDataTable').datagrid({
url: 'dia/details/insertOrder.do',
fitColumns: true,
singleSelect: true,
toolbar: [{
iconCls: 'icon-add',
text: '新增',
handler: function () {
tzxxDataTable.addRow();
}
}],
queryParams: {
logId: $("#sourceLogId").val()
},
columns: [[
{field: 'id', title: 'id', width: 100, hidden: true},
{field: 'logId', title: 'logId', width: 100, hidden: true},
{field: 'operationId', title: 'operationId', width:100,hidden: true},
{
field: 'orderTime',
title: '下令时间',
width: '11%',
align: 'center',
event: 'orderTime'
},
{
field: 'operationMan', title: '操作人', width: '5%',align: 'left'
},
{
//xxqkXxjg
field: 'orderContent', title: '下令内容', width: '18%', editor: {
type: 'text'
}
},
let now = new Date() 这样能获取当前时间对象
传给后台的话一般是用"yyyy-MM-dd HH:mm:ss"格式
js默认没提供这种格式转换,所以要自己拼字符串
let nowStr = now.getYear+"-"+(now.getMonth()+1)+"-"+now.getDate()+" "+ now.getHours()+":"+now.getMinutes()+":"+now.getSeconds()
这是原生的写法,或者你去找找别人封装好的时间转换的js拿来用
其实自己写个时间处理的js也不错