Index: ssts-web/src/main/webapp/disinfectsystem/print/print.js =================================================================== diff -u -r35470 -r35487 --- ssts-web/src/main/webapp/disinfectsystem/print/print.js (.../print.js) (revision 35470) +++ ssts-web/src/main/webapp/disinfectsystem/print/print.js (.../print.js) (revision 35487) @@ -1761,17 +1761,25 @@ } function printObjWithdefaultPrintFun(obj) { - var t = getTemplateByDatasourceAndStyle(obj.dataSourceName, obj.styleName); - if (t) { - var pageType = t.fullName; - if (invokeTemplatePrintFunction(pageType, obj, t)) { - return; + var arr = []; + for (var i = 0; i < allTemplateArray.length; ++i) { + var t = allTemplateArray[i]; + if (t.dataSourceName == obj.dataSourceName && t.styleName == obj.styleName) { + arr.push(t); } - } else { + } + if(arr.length == 0){ obj.defaultPrintFun(); + }else if(arr.length == 1){ + var pageType = arr[0].fullName; + if (invokeTemplatePrintFunction(pageType, obj, arr[0])) { + return; + } + }else { + showAllLabel(arr, obj,true) } } -function createStorageLocation(barcode, name, unitName, storageLocationCode, simpleName) { +function createStorageLocation(orgUnit,wareHouseBelong,name,wareHouseCode,storageLocationSimpleName,parentStorageLocation,barcode,putInGoods,unitName) { doGetLodop(); var tableHtml = ""; tableHtml += ""; @@ -1784,7 +1792,7 @@ tableHtml += ""; tableHtml += ""; - tableHtml += ""; + tableHtml += ""; tableHtml += ""; tableHtml += ""; @@ -1799,23 +1807,23 @@ }; -function storageLocationDefaultPrint(barcode, name, unitName, storageLocationCode, simpleName) { +function storageLocationDefaultPrint(orgUnit,wareHouseBelong,name,wareHouseCode,storageLocationSimpleName,parentStorageLocation,barcode,putInGoods,unitName) { if (barcode != null && barcode != '') { doGetLodop(); LODOP.PRINT_INIT(""); LODOP.SET_PRINTER_INDEX(-1);// TODO 可增加切换打印机的处理 - createStorageLocation(barcode, name, unitName, storageLocationCode, simpleName); + createStorageLocation(orgUnit,wareHouseBelong,name,wareHouseCode,storageLocationSimpleName,parentStorageLocation,barcode,putInGoods,unitName); LODOP.PRINT(); } else { alert("打印内容为空"); } } //库位打印预览 -function storageLocationPreview(barcode, name, unitName, storageLocationCode, simpleName) { +function storageLocationPreview(orgUnit,wareHouseBelong,name,wareHouseCode,storageLocationSimpleName,parentStorageLocation,barcode,putInGoods,unitName) { if (barcode != null && barcode != '') { doGetLodop(); LODOP.PRINT_INIT(""); - createStorageLocation(barcode, name, unitName, storageLocationCode, simpleName); + createStorageLocation(orgUnit,wareHouseBelong,name,wareHouseCode,storageLocationSimpleName,parentStorageLocation,barcode,putInGoods,unitName); LODOP.SET_SHOW_MODE("HIDE_PAPER_BOARD", 1); LODOP.PREVIEW(); } else { @@ -1824,14 +1832,22 @@ }; //库位打印 function printObjStorageLocation(obj) { - var t = getTemplateByDatasourceAndStyle(obj.dataSourceName, obj.styleName); - if (t) { - var pageType = t.fullName; + var arr = []; + for (var i = 0; i < allTemplateArray.length; ++i) { + var t = allTemplateArray[i]; + if (t.dataSourceName == obj.dataSourceName && t.styleName == obj.styleName) { + arr.push(t); + } + } + if(arr.length == 0){ + obj.defaultPrintFun(); + }else if(arr.length == 1){ + var pageType = arr[0].fullName; if (invokeTemplatePrintFunction(pageType, obj)) { return; } - } else { - obj.defaultPrintFun(); + }else { + showAllLabel(arr, obj) } } @@ -4846,7 +4862,6 @@ return false; } - function getTemplateByDatasourceAndStyle(datasource, style) { for (var i = 0; i < allTemplateArray.length; ++i) { var t = allTemplateArray[i]; @@ -5495,4 +5510,113 @@ LODOP.PREVIEW(); } } +} + +//GDSRMYY-555:弹出多个模版标签 +var labelWindow; +function showAllLabel(data, obj, showLabelTemplate, showTime){ + var labelStore = new Ext.data.JsonStore({ + data:data, + fields : [ + {name : 'dataSourceName'}, + {name : 'description'}, + {name : 'fullName'}, + {name : 'height'}, + {name : 'id'}, + {name : 'name'}, + {name : 'programCodes'}, + {name : 'styleName'}, + {name : 'templateInfo'}, + {name : 'width'} + ] + }); + + var cm = new top.Ext.grid.ColumnModel([{ + id : 'name', + header : "标签名称", + width:150, + dataIndex : 'name' + }]); + + var formObj = new top.Ext.FormPanel({ + frame : true, + labelAlign:'right', + labelSeparator : ':', + bodyStyle : 'padding:5px 5px 0px 5px', + autoWidth : true, + autoHeight : true, + autoScroll : true, + items:[{ + layout : 'column', + items : [{ + columnWidth : 1, + layout: 'form', + items : [ + new top.Ext.grid.EditorGridPanel({ + id : 'configGrid', + store : labelStore, + cm : cm, + width : 240, + height: 150, + clicksToEdit : 1, + frame : false, + bodyStyle : 'border:1px solid #afd7af', + anchor : '100%', + viewConfig: { + forceFit:true + }, + hideHeaders:true, + tbar : [{ + text: '数据源为【'+data[0].dataSourceName+'】的标签模版:' + }], + selModel : new top.Ext.grid.RowSelectionModel({ + singleSelect : false + }) + }) + ] + }] + }], + buttons : [{ + id : 'saveBtn', + text : '打印', + handler : function(){ + var records = top.Ext.getCmp('configGrid').getSelectionModel().getSelections(); + if(records.length == 0){ + showResult('请选择一个模版!'); + returnFloat + } + var pageType = records[0].data.fullName; + var labelTemplate; + var time = ''; + if(showLabelTemplate){ + labelTemplate = records[0].data; + } + if(showTime){ + time = showTime; + } + if (invokeTemplatePrintFunction(pageType, obj, labelTemplate, time)) { + labelWindow.close(); + return; + } + } + },{ + id : 'cancleBtn', + text : '取消', + handler : function() { + labelWindow.close(); + } + }] + }); + + labelWindow = new top.Ext.Window( { + layout : 'fit', + title : '选择标签模版', + width : 400, + modal : true, + autoHeight : true, + border : false, + plain : true, + items : [formObj] + }); + labelWindow.show(); } \ No newline at end of file
" + storageLocationCode + "" + wareHouseCode + "