您好,登錄后才能下訂單哦!
增加js
/*---------------------格式化時(shí)間開始--------------------------*/
//對(duì)Date的擴(kuò)展,將 Date 轉(zhuǎn)化為指定格式的String //月(M)、日(d)、小時(shí)(h)、分(m)、秒(s)、季度(q) 可以用 1-2 個(gè)占位符, //年(y)可以用 1-4 個(gè)占位符,毫秒(S)只能用 1 個(gè)占位符(是 1-3 位的數(shù)字) //例子: //(new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423 //(new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18 Date.prototype.Format = function (fmt) { //author: meizz var o = { "M+": this.getMonth() + 1, //月份 "d+": this.getDate(), //日 "h+": this.getHours(), //小時(shí) "m+": this.getMinutes(), //分 "s+": this.getSeconds(), //秒 "q+": Math.floor((this.getMonth() + 3) / 3), //季度 "S": this.getMilliseconds() //毫秒 }; if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); for (var k in o) if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); return fmt; } var date = new Date();
/*---------------------格式化時(shí)間結(jié)束--------------------------*/
cols: [[ { type: 'numbers', title: '序號(hào)', width: 50 }, { type: 'checkbox' }, { field: 'BILL_NO', title: '單據(jù)編碼', width: 230, }, { field: 'BIZ_STATUS', title: '單據(jù)狀態(tài)', templet: function (d) { return getDictName('COM_BIZ_STATUS', d.BIZ_STATUS); }, width: 100, }, { field: 'RETURN_MSG_CODE', title: '狀態(tài)', width: 100, }, { field: 'UNIT_NAME', title: '創(chuàng)建組織', width: 100, }, { field: 'BUSIN_TYPE_ITEM_NAME', title: '業(yè)務(wù)類別', width: 230, }, { field: 'TITLE', title: '申請(qǐng)單標(biāo)題', width: 280, }, { field: 'CREATE_BY_NAME', title: '創(chuàng)建人姓名', width: 130, }, { field: 'GMT_CREATE', title: '創(chuàng)建時(shí)間', sort: false, templet: function (d) { date.setTime(d.GMT_CREATE); return date.Format("yyyy-MM-dd hh:mm:ss"); }, width: 130, }, { field: 'RETURN_MSG', title: '傳輸云超市返回信息', width: 400, }, ]],
格式化創(chuàng)建時(shí)間
格式化單據(jù)狀態(tài)直接調(diào)用function的方法返回對(duì)應(yīng)的顯示值
以上這篇layui使用templet格式化表格數(shù)據(jù)的方法就是小編分享給大家的全部內(nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持億速云。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。