|
|
<#import "../master.ftl" as master><@master.layout><style>#fm label { width: 100px;}.page-header { margin: 20px 0 -10px;}</style>
<div class="page-header"> <h3>Blocked & unblocked</h3></div>
<table id="dg" class="easyui-datagrid" style="width:100%;height:460px;display: none;" data-options="pagination: true, showFooter: true, singleSelect:true, fitColumns:true, onSelect:onTableRowSelect, onLoadSuccess:onTableRowSelect, url:'/roll/getFreezeRolls',method:'POST', pageSize:20,toolbar:'#tb'"> <thead> <tr> <th data-options="field:'finalRollNo',width:90,editor:'textbox'">Roll No</th> <th data-options="field:'rollQty',width:60,editor:'textbox'">Roll Qty</th> <th data-options="field:'orderNo',width:60,editor:'textbox'">SO No</th> <th data-options="field:'partNo',width:80,editor:'textbox'">Part No</th> <th data-options="field:'partDesc',width:120,editor:'textbox'">Part Description</th> <th data-options="field:'apn',width:80">APN</th> <th data-options="field:'customerPartNo',width:80">Customer Part No</th> <th data-options="field:'createdBy',width:60">Frozen By</th> <th data-options="field:'createdDate',width:100, formatter: formatStringTime">Frozen Time</th> <th data-options="field:'updatedBy',width:60">Unfrozen By</th> <th data-options="field:'updatedDate', width:100, formatter: formatStringTime">Unfrozen Time</th> <th data-options="field:'unFrozenFlag',width:60,editor:'textbox', formatter: formatFreezeStatus">Status</th> <th data-options="field:'id', width:60, formatter: formatFreezeAction">Actions</th> </tr> </thead></table>
<div id="tb" style="padding:10px 5px;display: none;"> <div> Roll No: <input class="easyui-textbox" id="search_roll_no" style="width:100px;"> Part No: <input class="easyui-textbox" id="search_part_no" style="width:100px"> Order No: <input class="easyui-textbox" id="search_order_no" style="width:100px"> 是否解冻: <select id="status" class="easyui-combobox" style="width:100px;" data-options="required:true"> <option value="">All</option> <option value="N">Blocked</option> <option value="Y">Unblocked</option> </select> <a id="queryLink" class="easyui-linkbutton" iconCls="icon-search">Search</a> <#if currentUser.isAdmin || currentUser.authorities?contains("freezeAndThaw")> <a href="javascript:void(0)" id="closedAllOrder" class="easyui-linkbutton" iconCls="icon-add" onclick="freezeRollModal()"> 冻结卷</a> </#if> </div> </div>
<div id="dlg" class="easyui-dialog for-scan" style="width:500px;display: none;" closed="true" buttons="#dlg-buttons"> <form id="fm" method="post" novalidate style="margin:0;padding:20px 20px"> <div id="serial_input_2nd" style="margin-bottom:10px"> <input id="roll_no" name="rollNo" class="easyui-textbox" required="true" data-options="labelWidth:100" label="Roll No:" style="width:100%"> </div> </form></div><div id="dlg-buttons" style="display: none; text-align: center;"> <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveFreezeRoll()" style="width:90px">Save</a> <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')" style="width:90px">Cancel</a></div>
<script>//公共参数let currentRow;let username = $('#current_username').val();
//延时操作var delay = (function(){ var timer = 0; return function(callback, ms){ clearTimeout (timer); timer = setTimeout(callback, ms); };})();
//设置自动的高度$(window).resize(function () { $("#dg").datagrid({"height": $(window).height() - $(".datagrid").offset().top - 30});});
//重置页面的高度$(function () { $(window).resize();});
//不同状态的功能function formatFreezeAction(value, row){ let status = row.unfrozenFlag; let tags = ''; if('N' == status){ tags += '<a style="text-decoration:none;" onclick="preUnfrozenRoll(\''+row.finalRollNo+'\')">Unblocked roll</a>'; } return tags;}
function formatFreezeStatus(value, row){ let status = row.unfrozenFlag; if('N' == status){ return 'Frozen'; }else{ return 'Unblocked'; }} //表格选中事件function onTableRowSelect(index, row) { }
//查询功能$("#queryLink").click(function(){ var dg = $('#dg').datagrid({ queryParams: { orderNo: $.trim($("#search_order_no").val()), partNo: $.trim($("#search_part_no").val()), rollNo: $.trim($("#search_roll_no").val()), status: $("#status").val() } });});
//新增冻结卷function freezeRollModal(){ delay(function(){ //初始化参数 $('#roll_no').val(''); $('#dlg').dialog('open').dialog('center').dialog('setTitle', 'New blocked roll'); }, 500);}
//modal打开关闭选中的箱$("#dlg").dialog({ onClose: function () { //刷新订单的列表 $('#dg').datagrid('reload'); }, onOpen: function(){ //获取焦点 //showEl("#dlg #input_roll", true); $('#roll_no').textbox('textbox').focus(); }});
//新增入库箱function saveFreezeRoll(){ //参数 let rollNo = $.trim($('#roll_no').val()); //设置参数 let postData = {'finalRollNo': rollNo, 'createdBy': username, 'updatedBy': username, 'unfrozenFlag': 'N'}; //序列化 postData = JSON.stringify(postData); //post请求类型修改 $.ajaxSetup({ contentType: "application/json;charset=utf-8"}); //提交请求 $.post('/roll/insertFreezeRoll', postData, function(ret){ if(ret.success){ //刷新箱号的列表 $('#dlg').dialog('close');
}else{ $.messager.alert('Error',ret.msg, 'error'); } }, 'json'); $.ajaxSetup({ contentType: "application/x-www-form-urlencoded"});}
//解冻确认function preUnfrozenRoll(rollNo){ $.messager.confirm('Confirm','Confirm unblocked roll: <b>'+rollNo+'</b> ?', function(r){ if (r){ unfrozenRoll(rollNo); } });}
//删除销售交货单function unfrozenRoll(rollNo){ //获取解冻的卷 currentRow = $('#dg').datagrid('getSelected'); let postData = {'id': currentRow.id, 'finalRollNo': rollNo, 'updatedBy': username, 'unfrozenFlag': 'Y'}; //保存或修改数据 //序列化 postData = JSON.stringify(postData); //post请求类型修改 $.ajaxSetup({ contentType: "application/json;charset=utf-8"}); $.post('/roll/updateFreezeRoll', postData, function(result){ if (result.success){ //刷新主表数据 $('#dg').datagrid('reload'); } else { $.messager.alert('error',result.msg, 'error'); } },'json'); $.ajaxSetup({ contentType: " application/x-www-form-urlencoded"});}
</script>
</@master.layout>
|