var pageCurr; function getCol() { var cols = [ {type: 'checkbox'} ]; cols.push.apply(cols, typeof getDetlCols === 'function' ? getDetlCols() : detlCols); cols.push({field: 'locNo', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('location_no') : '库位号',hide:true} ,{field: 'status', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('data_status') : '数据状态', templet:function(row){ var html = " -1) ? 'en' : 'cn'; layDate.render({ elem: '.layui-laydate-range' ,type: 'datetime' ,range: true ,lang: lang }); $(document).on('i18n:languageChanged', function() { I18n.updatePage($('#search-box')); var lang = (typeof I18n !== 'undefined' && I18n.getLanguage().indexOf('en') > -1) ? 'en' : 'cn'; // Re-render date picker with new language $('.layui-laydate-range').each(function() { var $this = $(this); var val = $this.val(); var $newElem = $this.clone(); $newElem.removeAttr('lay-key'); $newElem.val(val); $this.replaceWith($newElem); layDate.render({ elem: $newElem[0] ,type: 'datetime' ,range: true ,lang: lang }); }); table.reload('waitPakin', { cols: [getCol()] }); }); }); // 关闭动作 $(document).on('click','#data-detail-close', function () { parent.layer.closeAll(); }); function tableReload(child) { var searchData = {}; $.each($('#search-box [name]').serializeArray(), function() { searchData[this.name] = this.value; }); (child ? parent.tableIns : tableIns).reload({ where: searchData, page: { curr: pageCurr }, done: function (res, curr, count) { if (res.code === 403) { top.location.href = baseUrl+"/"; } if (typeof I18n !== 'undefined') { updatePagination(); } pageCurr=curr; if (res.data.length === 0 && count !== 0) { tableIns.reload({ where: searchData, page: { curr: pageCurr-1 } }); pageCurr -= 1; } limit(child); } }); } function setFormVal(el, data, showImg) { for (var val in data) { var find = el.find(":input[id='" + val + "']"); if (find[0]!=null){ if (find[0].type === 'checkbox'){ if (data[val]==='Y'){ find.attr("checked","checked"); find.val('Y'); } else { find.remove("checked"); find.val('N'); } continue; } } find.val(data[val]); if (showImg){ var next = find.next(); if (next.get(0)){ if (next.get(0).localName === "img") { find.hide(); next.attr("src", data[val]); next.show(); } } } } } function clearFormVal(el) { $(':input', el) .val('') .removeAttr('checked') .removeAttr('selected'); } function detailScreen(index) { var detail = layer.getChildFrame('#data-detail', index); var height = detail.height()+60; if (height > ($(window).height()*0.9)) { height = ($(window).height()*0.8); } layer.style(index, { // top: (($(window).height()-height)/3)+"px", height: height+'px' }); } $('body').keydown(function () { if (event.keyCode === 13) { $("#search").click(); } });