Index: ssts-web/src/main/webapp/disinfectsystem/invoice/invoiceView.js =================================================================== diff -u -r19439 -r19463 --- ssts-web/src/main/webapp/disinfectsystem/invoice/invoiceView.js (.../invoiceView.js) (revision 19439) +++ ssts-web/src/main/webapp/disinfectsystem/invoice/invoiceView.js (.../invoiceView.js) (revision 19463) @@ -1358,27 +1358,6 @@ }); } -function batchPrintInvoices_result(result, printType){ - var typeofFunction = typeof(batchPrintInvoices_CurrentProject) - if(typeofFunction != undefined && typeofFunction != 'undefined'){ - batchPrintInvoices_CurrentProject(result, printType); - return; - } - batchPrintInvoices_result_default(result, printType); -} -function batchPrintInvoices_result_default(result, printType) { - result.serialNumber = ''; -// result.applicant = ''; - //result.applicationTime = ''; - result.printUser = curUserName; - result.printTime = Ext.util.Format.date(new Date(), 'Y-m-d H:i'); - result.remark = ''; - // 发料人默认改为当前用户 - if (isUndefinedOrNullOrEmpty(result.sender)) { - result.sender = curUserName; - } - printInvoices2(result, printType); -} var loadFormData = function(grid) { var records = grid.getSelectionModel().getSelections(); if (records.length == 0) { @@ -1705,12 +1684,11 @@ // path : WWWROOT + '/disinfectsystem/invoice/', // expires : new Date(new Date().getTime() + 2592000000) // })); - var departGroupStore = new Ext.data.SimpleStore({ fields : ['id', 'shift','departCode' ], url : WWWROOT + '/disinfectSystem/invoiceDepartmentAction!loadDepartGroup.do' }); - + var invoicePrintModule; departGroupStore.on('load', function(){ ShiftDef = Ext.data.Record.create([ @@ -1798,114 +1776,8 @@ ] }); - /** - * 显示和选择打印发货单的配置 - */ - function showSelectUser(){ - return openModalWindow(WWWROOT+"/disinfectsystem/invoice/selectInvoiceConfig.jsp?","选择打印分组", "760", "400"); - } - var mask = null; - function getMask(){ - if(!mask){ - mask = new Ext.LoadMask(Ext.getBody(), { - msg : '正在处理打印请求,请稍候...' - }); - } - return mask; - } - function batchPrintInvoiceWithType(ids,type){ - getMask(); - mask.msg = '正在处理打印请求,请稍候...'; - mask.show(); - -// var mask = new Ext4.LoadMask({ -// msg : '正在处理打印请求,请稍候...', -// renderTo : document.body -// }); -// mask.show(); - - Ext.Ajax.timeout=300*000; - Ext.Ajax.request({ - timeout: 300*000, - url : WWWROOT + '/disinfectSystem/invoiceAction!mergeLoadPrintData.do', - params : {ids : ids,type:type}, - success : function(response){ - var result = Ext.decode(response.responseText); - if(!result.success){ - if(result.message){ - showResult(result.message); - } - }else{ - if(result.batches.length <= 0){ - showResult("没有打印数据"); - }else{ - for(var i = 0; i < result.batches.length;++i){ - batchPrintInvoices_result(result.batches[i], 0); - } - grid.dwrReload(); - } - - //updatePrintStatus(ids); - } - mask.hide(); -// mask.destroy(); - }, - failure: function(response){ - showResult("打印失败!"); - mask.hide(); -// mask.destroy(); - } - }); - } - function batchPrint(){ - var selectResult = showSelectUser(); - if(selectResult == null && selectResult == undefined){ - return; - } - var id = selectResult.split("&#;")[0]; - if(id == '' || id == null){ - showResult('请选择对应的班次!'); - return; - } -// var mask = new Ext.LoadMask(Ext.getBody(), { -// msg : '正在处理批量打印请求,请稍候...' -// }); - getMask(); - mask.msg='正在处理批量打印请求,请稍候...'; - mask.show(); - - Ext.Ajax.timeout=300*000; - Ext.Ajax.request({ - timeout: 300*000, - url : WWWROOT + '/disinfectSystem/invoiceAction!mergeLoadPrintDataByConfig.do', - params : {id : id}, - success : function(response){ - var result = Ext.decode(response.responseText); - if(!result.success){ - if(result.message){ - showResult(result.message); - } - }else{ - if(result.batches.length <= 0){ - showResult("没有打印数据"); - }else{ - for(var i = 0; i < result.batches.length;++i){ - batchPrintInvoices_result(result.batches[i], 0); - } - grid.dwrReload(); - } - - //updatePrintStatus(ids); - } - mask.hide(); - }, - failure: function(response){ - showResult("打印失败!"); - mask.hide(); - } - }); - } + var tbar = [{ text : '查看', hidden : SSTS_Invoice_Update, @@ -2006,15 +1878,18 @@ iconCls : 'icon_print', menu: new Ext.menu.Menu({ items: [ - {text: '批量打印' + entityName, hidden: !validateIsSupplyRoomUser,handler: batchPrint}, + {text: '批量打印' + entityName, hidden: !validateIsSupplyRoomUser,handler: function (){ + invoicePrintModule.batchPrint(); + } + }, {text: '打印一次性物品', handler:function(){ checkPrintStatus(function(){ var ids = getSelectedIds(); if (ids != null && ids != false){ top.Ext.MessageBox.confirm("请确认", "要打印所选的发货单的一次性物品吗?", function(btn) { if (btn == 'yes') { - batchPrintInvoiceWithType(ids,'一次性物品'); + invoicePrintModule.batchPrintInvoiceWithType(ids,'一次性物品'); } }); } @@ -2030,7 +1905,7 @@ top.Ext.MessageBox.confirm("请确认", "要打印所选的发货单的器械包吗?", function(btn) { if (btn == 'yes') { - batchPrintInvoiceWithType(ids,'器械包'); + invoicePrintModule.batchPrintInvoiceWithType(ids,'器械包'); } }); } @@ -2047,7 +1922,7 @@ top.Ext.MessageBox.confirm("请确认", "要打印所选的发货单的消毒物品吗?", function(btn) { if (btn == 'yes') { - batchPrintInvoiceWithType(ids,'消毒物品'); + invoicePrintModule.batchPrintInvoiceWithType(ids,'消毒物品'); } }); } @@ -2064,7 +1939,7 @@ top.Ext.MessageBox.confirm("请确认", "要打印所选发货单的器械包及消毒物品吗?", function(btn) { if (btn == 'yes') { - batchPrintInvoiceWithType(ids,'器械包及消毒物品'); + invoicePrintModule.batchPrintInvoiceWithType(ids,'器械包及消毒物品'); } }); } @@ -2077,7 +1952,7 @@ top.Ext.MessageBox.confirm("请确认", "要打印所选发货单的全部物品吗?", function(btn) { if (btn == 'yes') { - batchPrintInvoiceWithType(ids,'全部'); + invoicePrintModule.batchPrintInvoiceWithType(ids,'全部'); } }); } @@ -2339,4 +2214,5 @@ } } }); + invoicePrintModule = new InvoicePrintModule(grid,curUserName); }); \ No newline at end of file