<%@ page contentType="text/html;charset=UTF-8"%> <%@ include file="/WEB-INF/include/taglibs.jsp"%> <table align="center" style="width:100%;height:30px"> <tr> <td class="title">未完成:</td><td><span id="replenishmentNewCountsMax"/></td> <td class="title">补货中:</td><td><span id="replenishmentInhandCountsMax"/></td> <td class="title">已完成补货:</td><td><span id="replenishementFinishedCountsMax"/></td> <td> </td> </tr> </table> <table id="replenishmentPortalgridMax" class="easyui-datagrid" data-options="border:false,fitColumns:true"> <thead> <tr> <th data-options="field:'id',hidden:true">主键</th> <th data-options="field:'itemName',align:'center'">商品</th> <th data-options="field:'itemCode',align:'center',width:100">商品编码</th> <th data-options="field:'status',align:'center',width:100,formatter:replenishmentStatusFormat">补货状态</th> <th data-options="field:'needQuantity',align:'center',width:100">补货数量</th> <th data-options="field:'toLocationName',align:'center',width:100">储位</th> <th data-options="field:'creationTime',align:'center',width:100">制单时间</th> </tr> </thead> </table> <script type="text/javascript"> function replenishmentStatusFormat(value, row, index) { if(value == '5300') { return "新纪录"; } else if(value == '5301') { return "任务中"; } else if(value == '5302') { return "已完成"; } else if(value == '5303') { return "已取消"; } } $(function(){ var $portalgrid = $("#replenishmentPortalgridMax"); var portalgridData = []; var pageSize = 15; var beginIndex = 0; var endIndex = 0; var totalCounts = 0; var totalPages = 0; loadPortalData(); // intervalIdForReplenishmentDetailLoadData= setInterval(loadPortalData, 1000 * 60 * 5); function loadPortalData() { // if(intervalIdForReplenishmentDetailScrollUp) { // clearInterval(intervalIdForReplenishmentDetailScrollUp); // } $.ajax({ url : "${pageContext.request.contextPath}/ReplenishmentDetail/loadPortalData.action", type : 'post', dataType : 'json', success : function(resp) { if(resp.replenishmentDetails) { portalgridData = resp.replenishmentDetails; if(portalgridData.length) { totalCounts = portalgridData.length; totalPages = totalCounts % pageSize == 0 ? totalCounts / pageSize : totalCounts / pageSize + 1; if(totalPages.toFixed(0) > 1) { beginIndex = 0; endIndex = pageSize; scrollup(); // intervalIdForReplenishmentDetailScrollUp = setInterval(scrollup, 1000 * 5); } else { $portalgrid.datagrid("loadData", portalgridData); } } } $("#replenishmentNewCountsMax").text(resp.newCounts ? resp.newCounts : 0); $("#replenishmentInhandCountsMax").text(resp.inhandCounts ? resp.inhandCounts : 0); $("#replenishementFinishedCountsMax").text(resp.finishedCounts ? resp.finishedCounts : 0); } }); } function scrollup() { var _portalgridData = []; for(var i = beginIndex; i < endIndex; i++) { _portalgridData.push(portalgridData[i]); $portalgrid.datagrid("loadData", _portalgridData); } beginIndex = beginIndex + pageSize; beginIndex = beginIndex > totalCounts ? 0 : beginIndex; endIndex = beginIndex + pageSize > totalCounts ? totalCounts : beginIndex + pageSize; } }); </script>