Index: ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/goodsTemplateApplicationView.js =================================================================== diff -u -r12607 -r12641 --- ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/goodsTemplateApplicationView.js (.../goodsTemplateApplicationView.js) (revision 12607) +++ ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/goodsTemplateApplicationView.js (.../goodsTemplateApplicationView.js) (revision 12641) @@ -157,6 +157,22 @@ }); departJsonStore.reload(); +//Ext4 项目store +var projectStore = new Ext4.data.Store({ + proxy : { + type : 'ajax', + url : WWWROOT + '/disinfectSystem/recyclingApplicationAction!getAllProject.do', + reader : { + type : 'json', + root : 'data' + } + }, + fields : [ + {name : 'projCode',mapping : 'projCode'}, + {name : 'projName',mapping : 'projName'} + ] +}); + //申请科室Store var appDepartJsonStoreExt2 = new Ext.data.Store({ proxy : new Ext.data.HttpProxy({ @@ -848,6 +864,57 @@ printApplyGoods(printParams,printMode,SSTS_PrintApplicationGoods,applicationWindow); } +//点击表单上的打印按钮,都打印申请单的原始内容(无论供应室或者临床科室用户),根据新复制的函数,增加器械类型参数 +//打印纸张的大小可以不同,通过printConfig.js文件设置 +function applicationPrintBtnPressedNew(printMode, applicationId , tousseTypeItems){ + // 供应室打印参数 + var config = printConfig.invoicePlan; + formTypeOfPrinted = "invoicePlan"; + // 临床科室打印参数 + if (SSTS_PrintApplicationGoods){ + config = printConfig.application; + formTypeOfPrinted = "application"; + } + var printParams = getPrintJsonParams("print", applicationId , config); + + // 覆盖如下参数,打印申请单的所有的内容 + /*printParams.printScope.printTousse = true; + printParams.printScope.printDisinfectGoods = true; + printParams.printScope.printDiposable = true;*/ + + printParams.printScope.printTousse = false;//器械包 + printParams.printScope.printDressing = false;//敷料包 + printParams.printScope.printDisinfectGoods = false;//消毒物品 + printParams.printScope.printDiposable = false;//一次性物品 + + if(tousseTypeItems == ''){ + printParams.printScope.printTousse = true;//器械包 + printParams.printScope.printDressing = true;//敷料包 + printParams.printScope.printDisinfectGoods = true;//消毒物品 + printParams.printScope.printDiposable = true;//一次性物品 + }else{ + if(tousseTypeItems.indexOf('1') != -1){ + printParams.printScope.printTousse = true; + } + if(tousseTypeItems.indexOf('2') != -1){ + printParams.printScope.printDressing = true; + } + if(tousseTypeItems.indexOf('3') != -1){ + printParams.printScope.printDisinfectGoods = true; + } + if(tousseTypeItems.indexOf('4') != -1){ + printParams.printScope.printDiposable = true; + } + } + + + printParams.printScope.printForeignTousse = true; + printParams.printScope.printApplyInfo = true; // 仅打印申请信息 + printParams.printScope.printByOriginalApplications = true; + + printApplyGoods(printParams,printMode,SSTS_PrintApplicationGoods,applicationWindow); +} + function getApplyGoods(treeStore){ var nodes = treeStore.getRootNode().childNodes; @@ -952,24 +1019,94 @@ if(id == 0){ id = ""; } - var bbars = [{ + + //解析申请单打印按钮配置(数据格式:[{text:'',value:[]},{text:'',value:[]},......{text:'',value:[]}]) + var applicationPrintButtonConfigJsonArray; + if(sstsConfig.applicationPrintButtonConfig && sstsConfig.applicationPrintButtonConfig.items + && sstsConfig.applicationPrintButtonConfig.items.length > 0){ + applicationPrintButtonConfigJsonArray = sstsConfig.applicationPrintButtonConfig.items; + } + + //打印预览按钮的json + var printViewButtonJson = { text : '打印预览', - hidden:(id == "" || (SSTS_PrintApplicationGoods && SSTS_DepartPrintApplicationGoods)), + hidden:(id == "" || (SSTS_PrintApplicationGoods && SSTS_DepartPrintApplicationGoods))/*, handler:function(){ applicationPrintBtnPressed(1, id); - } - },{ + }*/ + }; + + //打印按钮的json + var printButtonJson = { + xtype:'button', text : '打印', - hidden:(id == "" || (SSTS_PrintApplicationGoods && SSTS_DepartPrintApplicationGoods)), + hidden:(id == "" || (SSTS_PrintApplicationGoods && SSTS_DepartPrintApplicationGoods))/*, handler:function(){ top.Ext4.MessageBox.confirm("请确认", "要打印本申请单吗?", function(btn) { if (btn == 'yes') { applicationPrintBtnPressed(0, id); } }); + }*/ + }; + + if(applicationPrintButtonConfigJsonArray && applicationPrintButtonConfigJsonArray.length > 0){ + if(applicationPrintButtonConfigJsonArray.length > 1){ + var prtViewBtnJsonArray = []; + var prtBtnJsonArray = []; + for(var i = 0;i < applicationPrintButtonConfigJsonArray.length;i++){ + var currentConfigItem = applicationPrintButtonConfigJsonArray[i]; + prtViewBtnJsonArray.push({text:'打印预览 '+currentConfigItem.text,hiddenValue:currentConfigItem.value.join(","), + handler:function(){ + //最后一个参数只能用this.hiddenValue,不能用currentConfigItem.value.join(",") + applicationPrintBtnPressedNew(1, id , this.hiddenValue); + } + }); + prtBtnJsonArray.push({text:'打印 '+currentConfigItem.text,hiddenValue:currentConfigItem.value.join(","), + handler:function(){ + //最后一个参数只能用this.hiddenValue,不能用currentConfigItem.value.join(",") + applicationPrintBtnPressedNew(0, id , this.hiddenValue); + } + }); } - },{ + + printViewButtonJson.menu = { + items : prtViewBtnJsonArray + }; + printButtonJson.menu = { + items : prtBtnJsonArray + }; + }else if(applicationPrintButtonConfigJsonArray.length == 1){ + var currentConfigItem = applicationPrintButtonConfigJsonArray[0]; + printViewButtonJson.handler = function(){ + applicationPrintBtnPressedNew(1, id , currentConfigItem.value.join(",")); + } + printButtonJson.handler = function(){ + top.Ext4.MessageBox.confirm("请确认", "要打印本申请单吗?", + function(btn) { + if (btn == 'yes') { + applicationPrintBtnPressedNew(0, id , currentConfigItem.value.join(",")); + } + }); + } + } + }else{ + printViewButtonJson.handler = function(){ + applicationPrintBtnPressed(1, id); + } + printButtonJson.handler = function(){ + top.Ext4.MessageBox.confirm("请确认", "要打印本申请单吗?", + function(btn) { + if (btn == 'yes') { + applicationPrintBtnPressed(0, id); + } + }); + } + } + + //printViewButtonJson,printButtonJson + var bbars = [printViewButtonJson,printButtonJson,{ id : 'commitBtn', text : '提交', hidden : hiddenCommitButton, @@ -996,23 +1133,27 @@ waitMsg : '正在保存数据,请稍候', waitTitle : '提交表单', success : function(form, action) { - applicationWindow.close(); - var msg = action.result.message; - if (msg.length <= 6){ - showResult(action.result.message); - } - else{ - top.Ext4.Msg.show({ - title:'提示', - msg: msg, - buttons: Ext4.Msg.OK, - icon: Ext4.Msg.INFO - }); - } - grid.dwrReload(); + if(action.result.success == true){ + applicationWindow.close(); + var msg = action.result.message; + if (msg.length <= 6){ + showResult(action.result.message); + } + else{ + top.Ext4.Msg.show({ + title:'提示', + msg: msg, + buttons: Ext4.Msg.OK, + icon: Ext4.Msg.INFO + }); + } + grid.dwrReload(); + }else{ + showResult(action.result.message); + } }, failure : function(form, action) { - showResult(action.response.statusText); + showResult(action.result.message); } }); }; @@ -1662,6 +1803,16 @@ var deptCoding = getDepartCoding(appDepartJsonStore,deptName); top.Ext4.ComponentQuery.query("#recyclingApplicationForm #departCoding")[0].setValue(deptCoding); setSettleAccountsDepartDefaultValue(deptName, deptCoding, departJsonStore); + //如果菜单中已启用申领一次性物品增加项目选项功能并且申请科室为课教项目经费,则该下拉框给予显示(仅中山眼科增加) + if(sstsConfig.showProjectNameSelectWhenApplyDiposableGoods == true){ + if(deptName == '科教项目经费'){ + top.Ext4.getCmp('projCode').setVisible(true); + projectStore.reload();//加载项目数据 + }else{ + top.Ext4.getCmp('projCode').setVisible(false); + top.Ext4.getCmp('projCode').setValue(''); + } + } }, focus : function(thiz){ thiz.selectText(); @@ -1707,6 +1858,39 @@ id : 'remark', name : 'remark', flex : 1 + } , { + xtype : 'combo', + fieldLabel : '项目', + hidden : true,//暂时屏蔽 + id : 'projCode', + name : 'projCode', + + queryParam : 'spell', + minChars : 0, + lazyInit : true, + triggerAction : 'all', + hideTrigger : true, + typeAhead : false, + flex : 1, + valueField : 'projCode', + displayField : 'projName', + //mode : 'local', + store : projectStore, + /*store : new Ext4.data.SimpleStore({ + fields : ['code','name'], + data : [['a','一'],['b','二']] + }),*/ + forceSelection : true, + allowBlank : true, + hidden : true, + listeners:{ + select:function(combo, record, index){ + + }, + focus : function(thiz){ + thiz.selectText(); + } + } } ] } ] } , @@ -2217,6 +2401,16 @@ top.Ext4.getCmp('applicationTimeStr').setValue(Ext.util.Format.date(new Date(recyclingApplication.applicationTime.time),'Y-m-d H:i')); } top.Ext4.getCmp("remark").setValue(recyclingApplication.remark); + + //如果启用了课题组接口功能且科室为科教项目经费 + if(sstsConfig.showProjectNameSelectWhenApplyDiposableGoods == true){ + if(recyclingApplication.depart == '科教项目经费'){ + top.Ext4.getCmp('projCode').setVisible(true); + projectStore.reload();//加载项目数据 + top.Ext4.getCmp('projCode').setValue(recyclingApplication.projCode); + } + } + if(recyclingApplication.editable == 'false'){//待发货 top.Ext4.getCmp('tempSaveBtn').disable(); top.Ext4.getCmp('package1').disable(); @@ -2654,7 +2848,6 @@ },{ text : '设为已打印', iconCls : 'btn_ext_application_edit', - id : 'endBtn', hidden : SSTS_PrintApplicationGoods, handler : function(){ updatePrintState(grid); @@ -2682,14 +2875,47 @@ null ); + /*var view = grid.getView(); // Capture the GridView. + grid.tip = new Ext.ToolTip({ + title:'申请物品列表', + target: view.mainBody, // The overall target element. + view:view, + delegate: '.x-grid3-row', // Each grid row causes its own seperate show and hide. + trackMouse: true, // Moving within the row should not hide the tip. + renderTo: document.body, // Render immediately so that tip.body can be referenced prior to the first show. + autoHide:true,//自动隐藏 + //mouseOffSet:[10,10],//从鼠标位置开始偏移(X/Y) + + anchor:'bottom',//top,right,bottom,left + + anchorToTarget:false,//false时,用anchor对齐,true时,用defaultAlign(默认值: "tl-bl?")对齐 + + defaultAlign:'l-r?', + + anchorOffset:10,//anchor的值是top或bottom时,anchor arrow水平偏移;anchor值是left或right时,nchor arrow竖直偏移 + + listeners: { // Change content dynamically depending on which element triggered the show. + beforeshow: function updateTipBody(tip) { + var rowIndex = tip.view.findRowIndex(tip.triggerElement); + if(!Ext.isEmpty(tableContent)){ + tip.body.dom.innerHTML = tableContent; + }else{ + return false; //停止执行,从而禁止显示Tip + tip.destroy(); + } + } + } + });*/ + + var tableContent; grid.on('mouseover', function(e) {// 添加mouseover事件 var index = grid.getView().findRowIndex(e.getTarget());// 根据mouse所在的target可以取到列的位置 if (index !== false) {// 当取到了正确的列时,(因为如果传入的target列没有取到的时候会返回false) var record = this.getStore().getAt(index); var BorrowName = ''; var BorrowAmount = ''; var isDiposableApplicationForm = (record.data['type']==diposableGoodsApplicationForm); - var tableContent = record.data['htmlContent'];// + tableContent = record.data['htmlContent'];// if(!tableContent){ var content = ""; DWREngine.setAsync(false); @@ -2732,9 +2958,14 @@ record.set("htmlContent",tableContent); } - var rowEl = Ext.fly(e.getTarget());// 把target转换成Ext.Element对象 + var rowEl = top.Ext.fly(e.getTarget());// 把target转换成Ext.Element对象 rowEl.set({ - 'ext:qtip' : tableContent,'ext:qwidth':450,'ext:qwidth':450,'ext:qtitle':" 申请物品列表:"}, false); + 'ext:qtip' : tableContent,'ext:qwidth':450,'ext:qtitle':' 申请物品列表:'},false); + + /*grid.tip.show(); + grid.tip.body.dom.innerHTML = tableContent;*/ + }else{ + } });