Index: ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/goodsTemplateApplicationView.js =================================================================== diff -u -r14984 -r15116 --- ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/goodsTemplateApplicationView.js (.../goodsTemplateApplicationView.js) (revision 14984) +++ ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/goodsTemplateApplicationView.js (.../goodsTemplateApplicationView.js) (revision 15116) @@ -12,6 +12,9 @@ var windowHeight = top.document.body.clientHeight > 650 ? 650 : top.document.body.clientHeight; var invoicePlanPrintButtonName = '发货计划'; var recyclingApplicationVersion = sstsConfig.recyclingApplicationVersion; +//是否生产环境模式,用于决定是否显示最小单位数量,原来的最小单位,中包装单位装换单位系数,生产环境模式默认true隐藏这三项,平时开发可以将此值设置成false,便于调试 +var productMode = true; +var firstLoad = true; if (sstsConfig.invoicePlanPrintButtonName != undefined){ invoicePlanPrintButtonName = sstsConfig.invoicePlanPrintButtonName; } @@ -301,40 +304,47 @@ //进度条 var loadMask; +//物品选择下拉框的proxy +var goodProxy = { + type : 'ajax', + url : WWWROOT + '/disinfectSystem/baseData/tousseDefinitionAction!searchComboGoodsData.do?showExternalCodeOfDisposableGoods='+sstsConfig.showExternalCodeOfDisposableGoods, + reader : { + type : 'json', + totalProperty : 'totalCount', + idProperty: 'noneExsist', + root : 'data' + } +}; + +//物品选择下拉框的model +var goodModel = [ + {name : 'id',mapping : 'id'}, + {name : 'spelling',mapping : 'spelling'}, + {name : 'name',mapping : 'name'}, + {name : 'tousseDefinitionID'}, + {name : 'type',mapping : 'type'}, + {name : 'tousseType',mapping : 'tousseType'}, + {name : 'isApplyEntireTousse',mapping : 'isApplyEntireTousse'}, + {name : 'displayName',mapping : 'displayName'}, + {name : 'price',mapping : 'price'}, + {name : 'packageSpec',mapping : 'packageSpec'}, + {name : 'unit',mapping : 'unit'}, + {name : 'amount',mapping : 'amount'}, + {name : 'middlePackageUnit',mapping : 'middlePackageUnit'}, + {name : 'middlePackageAmount',mapping : 'middlePackageAmount'}, + {name : 'transferScale',mapping : 'transferScale'}, + {name : 'urgentAmount',mapping : 'urgentAmount'}, + {name : 'materials',mapping : 'materials'}, + {name : 'minApplyAmount',mapping : 'minApplyAmount'}, + {name : 'maxApplyAmount',mapping : 'maxApplyAmount'} +]; + //物品选择下拉框数据源 var comboGoodsStore = new Ext4.data.JsonStore({ pageSize:100, - proxy : { - type : 'ajax', - url : WWWROOT + '/disinfectSystem/baseData/tousseDefinitionAction!searchComboGoodsData.do?showExternalCodeOfDisposableGoods='+sstsConfig.showExternalCodeOfDisposableGoods, - reader : { - type : 'json', - totalProperty : 'totalCount', - idProperty: 'noneExsist', - root : 'data' - } - }, - fields : [ - {name : 'id',mapping : 'id'}, - {name : 'spelling',mapping : 'spelling'}, - {name : 'name',mapping : 'name'}, - {name : 'tousseDefinitionID'}, - {name : 'type',mapping : 'type'}, - {name : 'tousseType',mapping : 'tousseType'}, - {name : 'isApplyEntireTousse',mapping : 'isApplyEntireTousse'}, - {name : 'displayName',mapping : 'displayName'}, - {name : 'price',mapping : 'price'}, - {name : 'packageSpec',mapping : 'packageSpec'}, - {name : 'unit',mapping : 'unit'}, - {name : 'amount',mapping : 'amount'}, - {name : 'middlePackageUnit',mapping : 'middlePackageUnit'}, - {name : 'middlePackageAmount',mapping : 'middlePackageAmount'}, - {name : 'transferScale',mapping : 'transferScale'}, - {name : 'urgentAmount',mapping : 'urgentAmount'}, - {name : 'materials',mapping : 'materials'}, - {name : 'minApplyAmount',mapping : 'minApplyAmount'}, - {name : 'maxApplyAmount',mapping : 'maxApplyAmount'} - ],listeners:{ + proxy : goodProxy, + fields : goodModel, + listeners:{ beforeload : function(){ if(loadMask){ loadMask.show(); @@ -348,6 +358,28 @@ } }); +//全部物品选择下拉框数据源,只在申请窗口弹出的时候加载一次,用于缓存所有数据,物品绑定的数据从这里读取 +var allGoodsComboStore = new Ext4.data.JsonStore({ + proxy : goodProxy, + fields : goodModel, + listeners:{ + beforeload : function(){ + //在加载前设定参数,limit要设置成空,这样才会加载到所有的数据 + allGoodsComboStore.proxy.extraParams.cssdOrgUnitCode = ""; + allGoodsComboStore.proxy.extraParams.spell = ""; + allGoodsComboStore.proxy.extraParams.limit = ""; + //暂时只绑定一次性物品,所以type用一次性物品 + allGoodsComboStore.proxy.extraParams.tousseType = "一次性物品"; + }, + load : function () { + // console.log(allGoodsComboStore.getCount()); + } + } +}); + + + + var tousseAndDiposableGoodsStore = new Ext.data.Store({ proxy : new Ext.data.HttpProxy({ url : WWWROOT + '/disinfectSystem/baseData/tousseDefinitionAction!searchInsideTousseData.do', @@ -833,6 +865,28 @@ top.Ext4.getCmp('count1').focus(); } +/** + * 判断表格是否已经存在该物品 + * @param name 新添加物品的名字 + * @param type 新添加物品的类型 + * @returns {boolean} true就是存在,false就是不存在 + */ +function judgeIfExits(name,type) { + var node = "一次性物品" == type ? rightTemplateStore.getRootNode().childNodes:leftTemplateStore.getRootNode().childNodes; + var isExits = false; + if (!isUndefinedOrNullOrEmpty(node)) { + Ext.each(node,function (record) { + if (record.get('name') == name){ + showResult("已经存在" + name + ",不能重复添加!"); + isExits = true; + //此return false只是用于中断extJs的迭代,不是函数的返回 + return false; + } + }); + } + return isExits; +} + function addRecyclingApplicationItem(){ var id = curSelectedGoods.id; var name = top.Ext4.getCmp('package1').getValue(); @@ -887,36 +941,48 @@ return false; }else{ addItems(id,name,count,isDiposableGoods,isApplyEntireTousse,price,externalCode,storageAmount,tousseType,materials,unit,packageSpec,minApplyAmount,maxApplyAmount,urgentAmount,para); + afterAddItem(); } }); } else if(!isUndefinedOrNullOrEmpty(maxApplyAmount) && count > maxApplyAmount){ top.Ext4.Msg.alert("提示消息","申请数量大于最大可申请数量"); - //showResult("申请数量大于最大可申请数量"); clearCount(); addItems(id,name,count,isDiposableGoods,isApplyEntireTousse,price,externalCode,storageAmount,tousseType,materials,unit,packageSpec,minApplyAmount,maxApplyAmount,urgentAmount,para); + afterAddItem(); } else{ addItems(id,name,count,isDiposableGoods,isApplyEntireTousse,price,externalCode,storageAmount,tousseType,materials,unit,packageSpec,minApplyAmount,maxApplyAmount,urgentAmount,para); + afterAddItem(); } }else{ addItems(id,name,count,isDiposableGoods,isApplyEntireTousse,price,externalCode,storageAmount,tousseType,materials,unit,packageSpec,minApplyAmount,maxApplyAmount,urgentAmount,para); + afterAddItem(); } - - top.Ext4.getCmp('urgentAmount').setValue(''); - top.Ext4.getCmp('diposableGoodsAmount').setValue(''); - top.Ext4.getCmp('minApplyAmount').setValue(''); - top.Ext4.getCmp('maxApplyAmount').setValue(''); - top.Ext4.getCmp('isDiposableGoods').setValue(""); - top.Ext4.getCmp('package1').clearValue(); - top.Ext4.getCmp('count1').setValue(""); - top.Ext4.getCmp('price').setValue(""); - top.Ext4.getCmp('unitInfoDisplayField').setValue(""); - top.Ext4.getCmp('package1').focus(); - return true; } } + +/** + * 在点击了添加按钮后来进行判断是否有捆绑物品 + * @returns {boolean} + */ +function afterAddItem() { + var goodsBindHandler = new GoodsBindHandler(); + goodsBindHandler.handleBindGood(); + top.Ext4.getCmp('urgentAmount').setValue(''); + top.Ext4.getCmp('diposableGoodsAmount').setValue(''); + top.Ext4.getCmp('minApplyAmount').setValue(''); + top.Ext4.getCmp('maxApplyAmount').setValue(''); + top.Ext4.getCmp('isDiposableGoods').setValue(""); + top.Ext4.getCmp('package1').clearValue(); + top.Ext4.getCmp('count1').setValue(""); + top.Ext4.getCmp('price').setValue(""); + top.Ext4.getCmp('unitInfoDisplayField').setValue(""); + top.Ext4.getCmp('package1').focus(); + return true; +} + // 点击表单上的打印按钮,都打印申请单的原始内容(无论供应室或者临床科室用户) // 打印纸张的大小可以不同,通过printConfig.js文件设置 function applicationPrintBtnPressed(printMode, applicationId){ @@ -1551,17 +1617,17 @@ },{ header : "最小单位数量", dataIndex : 'unitCount', - hidden: true, + hidden: productMode, sortable: false },{ header : "原来的最小单位", dataIndex : 'minUnit', - hidden: true, + hidden: productMode, sortable: false },{ header : "中包装单位装换单位系数", dataIndex : 'transferScale', - hidden: true, + hidden: productMode, sortable: false },{ header : "包装规格", @@ -2548,6 +2614,8 @@ }); applicationWindow.show(); + + allGoodsComboStore.reload(); loadMask = new Ext4.LoadMask({msg:'数据处理中,请稍候......',target:applicationWindow}); @@ -3413,7 +3481,7 @@ },{ text : '申请外来器械', iconCls : 'btn_ext_add_customTousse', - hidden : SSTS_ForeignTousseApplication_Create, + hidden : SSTS_ForeignTousseApplication_Create || (sstsConfig.recyclingApplicationVersion == 2 && !isSupplyRoomUser), handler : function() { openForeignTousseForm("","apply"); }