Index: ssts-web/src/main/webapp/disinfectsystem/foreigntousseapplication/foreignTousseInfoForm.js =================================================================== diff -u -r34906 -r35001 --- ssts-web/src/main/webapp/disinfectsystem/foreigntousseapplication/foreignTousseInfoForm.js (.../foreignTousseInfoForm.js) (revision 34906) +++ ssts-web/src/main/webapp/disinfectsystem/foreigntousseapplication/foreignTousseInfoForm.js (.../foreignTousseInfoForm.js) (revision 35001) @@ -36,7 +36,6 @@ var isShowMenuButton = true; //防止用户配置了配置文件,却忘记配置default的颜色 washClassifyTypeColor['default'] = washClassifyTypeColor['default'] ? washClassifyTypeColor['default'] : 'darkcyan-row'; - //大小属性的下拉选项 var packageSizeArray = [[PACKAGE_SIZE_HUGE],[PACKAGE_SIZE_BIG],[PACKAGE_SIZE_CENTER],[PACKAGE_SIZE_SMALL]]; if(sstsConfig.pageSizeArrayConfig && sstsConfig.pageSizeArrayConfig.length > 0){ @@ -188,6 +187,28 @@ {name : 'washClassifyType'} ]}); +function setParentPrice(materialsJson){ + var sumPrice = 0; + if(materialsJson.length > 0){ + for(var k=0;k 0){ + return parseFloat(sumPrice).toFixed(2) + }else { + return sumPrice + } +} + function showPatientInfo(patientInfo){ top.Ext4.getCmp('patient').setValue(patientInfo.patientName); top.Ext4.getCmp('patientAge').setValue(patientInfo.patientAge); @@ -1721,14 +1742,6 @@ if(result.success){ var materialsJson = result.data; for(var i = 0;i < materialsJson.length;i++){ - var price = ''; - if(sstsConfig.enableTotalPriceCalculatedBasedOnTheUnitPriceOfTheMaterialOfForeignTousseFunction){ - sumPrice = 0; - if(materialsJson[i].price !== null && !isNaN(materialsJson[i].price)){ - price = materialsJson[i].price; - sumPrice += price; - } - } materials.push({ id : materialsJson[i].id, //材料实例的id tousseName : materialsJson[i].materialName, @@ -1793,10 +1806,7 @@ var materialsJson = result.data[i].materials; var price = ''; if(sstsConfig.enableTotalPriceCalculatedBasedOnTheUnitPriceOfTheMaterialOfForeignTousseFunction){ - if(materialsJson[j].price !== null && !isNaN(materialsJson[j].price)){ - price = materialsJson[j].price; - sumPrice += price; - } + sumPrice = setParentPrice(materialsJson); }else { sumPrice = result.data[i].price } @@ -2234,12 +2244,10 @@ currentRecord.set("oldName",r[0].data.name); currentRecord.set("tousseName",r[0].data.name); if(sstsConfig.enableTotalPriceCalculatedBasedOnTheUnitPriceOfTheMaterialOfForeignTousseFunction){ - var price = 0; - if(r[0].data.price !== null && !isNaN(r[0].data.price)){ - price = parseFloat(r[0].data.price); - var sumPrice = currentRecord.parentNode.get('price'); - currentRecord.parentNode.set('price',sumPrice + price) - } + setTimeout(function(){ + var sumPrice = setParentPrice(currentRecord.parentNode.childNodes); + currentRecord.parentNode.set('price',sumPrice) + }, 200); } } } @@ -2316,7 +2324,15 @@ listeners : { 'focus':function(){ this.selectText(); - } + }, + blur:function(field, event, eOpts){ + if(sstsConfig.enableTotalPriceCalculatedBasedOnTheUnitPriceOfTheMaterialOfForeignTousseFunction){ + setTimeout(function(){ + var sumPrice = setParentPrice(currentRecord.parentNode.childNodes); + currentRecord.parentNode.set('price',sumPrice) + }, 200); + } + } } } },{ @@ -3632,17 +3648,18 @@ var parentNode = record.parentNode; var ids = record.get("id"); var price = record.get("price"); + var amount = record.get("amount"); var sumPrice = parentNode.get("price"); if(sstsConfig.disableModifyExistMaterilaOfForeignTousse){ if(ids == 0){ parentNode.removeChild(record); - parentNode.set('price',sumPrice - price) + parentNode.set('price',sumPrice - (price*amount)) }else{ showResult('已经存在的材料不能删除' , null , sstsConfig.messagePauseTimeOnPackingPage); } }else{ parentNode.removeChild(record); - parentNode.set('price',sumPrice - price) + parentNode.set('price',sumPrice - (price*amount)) } } }); @@ -3659,8 +3676,11 @@ iconCls :'btn_ext_pause', handler : function() { var parentNode = record.parentNode; + var price = record.get("price"); + var amount = record.get("amount"); + var sumPrice = parentNode.get("price"); parentNode.removeChild(record); - parentNode.set('price',sumPrice - price) + parentNode.set('price',sumPrice - (price*amount)) } }); }