|
|
<#import "../master.ftl" as master><@master.layout>
<style> #fm label { width: 150px; }</style>
<div class="page-header"> <h3>Scrap defective/QC</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 , url:'/discard/all',method:'get',pageSize:20,toolbar:'#tb'"> <thead> <tr> <#--<th data-options="field:'orderNo',width:100,editor:'textbox'">SO No</th>--> <th data-options="field:'discardNo',width:100,editor:'textbox'">Scrap No</th> <th data-options="field:'discardedBy',width:80,align:'left'">Created By</th> <th data-options="field:'discardedDate',width:150,align:'center',formatter:formatDateTime">Create Date</th> <th data-options="field:'id',width:150,align:'center',formatter:formatAction">Actions</th> </tr> </thead></table>
<div id="tb" style="padding:10px 5px;display: none;"> <div> <#--生产订单单号: <input class="easyui-textbox" id="orderNo" style="width:110px">--> Create Date: <input class="easyui-datebox" id="discardedDateFrom" style="width:100px"> 到: <input class="easyui-datebox" id="discardedDateTo" style="width:100px"> <a href="#nowhere" id="queryLink" class="easyui-linkbutton" iconCls="icon-search">Search</a> <a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="newdiscard()">Create Scrap Form</a> </div></div>
<div id="dlg" class="easyui-dialog" style="width:500px;display: none;" closed="true" buttons="#dlg-buttons"> <form id="fm" method="post" novalidate style="margin:0;padding:20px 20px"> <div style="margin-bottom:10px"> <input name="orderNo" class="easyui-textbox" required="true" label="SO No:" style="width:100%"> </div> </form></div><div id="dlg-buttons" style="display: none;"> <a href="javascript:void(0)" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="savediscard()" 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>
<div id="dlgDtls" class="easyui-dialog" style="width:600px;display: none;" closed="true" data-options="modal:true" > <table id="dgDtls" class="easyui-datagrid" style="width:100%;height:300px;display: none;" data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true , method:'get', pageSize:50"> <thead> <tr> <th data-options="field:'finalRollNo',width:100">FG roll number</th> </tr> </thead> </table></div>
<script>
$(window).resize(function () { $("#dg").datagrid({"height": $(window).height() - $(".datagrid").offset().top - 20}); });
$(function () { $(window).resize(); });
$.extend($.fn.validatebox.defaults.rules, { validDate: { validator: function(value){ var date = $.fn.datebox.defaults.parser(value); var s = $.fn.datebox.defaults.formatter(date); return s==value; }, message: 'Please enter a valid date.' }, valueRange: { validator: function(value,param){ return value >= param[0] && value <= param[1]; }, message: 'Field do not match.' } });
$("#queryLink").click(function(){ var dg = $('#dg').datagrid({ queryParams: { orderNo: $("#orderNo").val(), discardedDateFrom: $("#discardedDateFrom").val(), discardedDateTo: $("#discardedDateTo").val() } }); });
function formatAction(value, row){ return "<a href='/discard/scan/" + value + "'>Scan</a>" + " | <a href='javascript:viewRolls(\"" + row.discardNo + "\")'>Scrapped Rolls</a>"; }
function viewRolls(discardNo){ $('#dlgDtls').dialog('open').dialog('center').dialog('setTitle',discardNo+'中已报废的卷'); $("#dgDtls").datagrid({url: "/discard/finalrolls/"+discardNo}); }
function newdiscard(){// $('#dlg').dialog('open').dialog('center').dialog('setTitle','Create Scrap Form');// $('#fm').form('clear');
$.post("/discard/add", {orderNo: "-"}, function(result){ if (result.errorMsg){ $.messager.alert('error',result.errorMsg, 'error'); } else { $('#dlg').dialog('close'); // close the dialog $('#dg').datagrid('reload'); // reload the user data } }); }
function savediscard(){ $('#fm').form('submit',{ url: "/discard/add", onSubmit: function(){ return $(this).form('validate'); }, success: function(result){ var result = eval("("+result+")"); if (result.errorMsg){ $.messager.alert('error',result.errorMsg, 'error'); } else { $('#dlg').dialog('close'); // close the dialog $('#dg').datagrid('reload'); // reload the user data } } }); }
</script>
</@master.layout>
|