Index: ssts-web/src/main/webapp/disinfectsystem/qualitymonitoring/qualitymonitoringInstanceForReviewViewForm.js =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/qualitymonitoring/qualitymonitoringInstanceForReviewViewForm.js (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/qualitymonitoring/qualitymonitoringInstanceForReviewViewForm.js (revision 26118) @@ -0,0 +1,2810 @@ +var qualityMonitoringWin = null; +//是否禁用“预览”按钮 +var disableShowImageButton = false; +//抽检器械的store +var materialDefinitionStore; +// 添加抽检器械的材料store +var materialDefinitionAddStore; +var tousseDefinitionStore; +var materialItemCount = 0; +var tousseItemCount = 0; +var formPanel; +var qualityMonitoringSterilizationID; +var qualityMonitoringWRRecordID = 0; +var responPartName = ''; +//监测项的combo +var formDefinitionStore; +var frequencyStore; +var materialCountRecords; +var materialMsg = null; +var tousseInstanceInfo = ""; +var recycleQM = false; +var otherPartAddQM = false; + +function cancelQualityMonitoring() { + closeQMWindow(); +} + +function closeQMWindow(){ + if(recycleQM == true){ + // 回收页面进来 + closeQMLayer(); + }else{ + qualityMonitoringWin.close(); + } +} + +function triggerItemAction(valueTriggerItemIds,action){ + if(valueTriggerItemIds != null && valueTriggerItemIds != ""){ + var itemIdArray = valueTriggerItemIds.split(","); + if(itemIdArray.length > 0){ + for(var n = 0 ; n < itemIdArray.length ; n++){ + var triggerItemId = itemIdArray[n]; + if(triggerItemId != null && triggerItemId != ""){ + if("show" == action){ + Ext.getCmp("hideElement" + triggerItemId).show(); + }else{ + var xtype = Ext.getCmp("hideElement" + triggerItemId).getXType(); + if(xtype == 'fieldset'){ + var length = Ext.getCmp("hideElement" + triggerItemId).items.each(function(fsItem){ + var itemType = fsItem.getXType(); + if(itemType == "panel"){ + fsItem.items.each(function(item,index,length){ + item.setValue(false); + }); + }else if(itemType == "hidden"){ + fsItem.setValue(""); + } + }); + }else if(xtype == 'panel'){ + var panel = Ext.getCmp("hideElement" + triggerItemId); + panel.items.each(function(item,index,length){ + item.setValue(""); + }); + } + Ext.getCmp("hideElement" + triggerItemId).hide(); + } + } + } + } + } +} + +/** + * 创建监测项的表单元素. + * @param type 表单元素的类型 + * @param id 监测项元素id + * @param name 监测项元素名称 + * @param allowBlank 是否允许为空 + * @param options 单选或者多选的配置项 + * @param value 默认值 + * @param isTriggerItem 触发项 + * @returns + */ +function createQualityMonitoringItemElement(type,id,name,allowBlank,options,value,isTriggerItem){ + var hideElement = false; + if('是' == isTriggerItem && (value == null || value == "")){ + hideElement = true; + } + if(type == '文本'){ + return { + columnWidth : .5, + layout : 'form', + labelWidth : 90, + hidden:hideElement, + id:'hideElement'+id, + items : [{ + xtype : 'textfield', + fieldLabel : name, + maxLength : '30', + id : 'configItemOption'+id, + name : 'configItemOption'+id, + allowBlank : allowBlank, + value : value, + anchor : '95%' + }] + }; + }else if(type == '文本框'){ + return { + columnWidth : .9, + layout : 'form', + labelWidth : 90, + hidden:hideElement, + id:'hideElement'+id, + items : [{ + xtype : 'textarea', + fieldLabel : name, + maxLength : '300', + id : 'configItemOption'+id, + name : 'configItemOption'+id, + allowBlank : allowBlank, + value : value, + anchor : '95%' + }] + }; + + }else if(type == '数字'){ + return { + columnWidth : .5, + layout : 'form', + labelWidth : 90, + hidden:hideElement, + id:'hideElement'+id, + items : [{ + xtype : 'numberfield', + fieldLabel : name, + id : 'configItemOption'+id, + name : 'configItemOption'+id, + allowBlank : allowBlank, + allowDecimals : true, + value : value, + anchor : '95%' + }] + }; + }else if(type == '时间'){ + return { + columnWidth : .5, + layout : 'form', + labelWidth : 90, + hidden:hideElement, + id:'hideElement'+id, + items : [{ + xtype : 'datefieldWithMin', + fieldLabel : name, + id : 'configItemOption'+id, + name : 'configItemOption'+id, + format : 'Y-m-d H:i', + value : value, + readOnly : true, + editable : false, + allowBlank : allowBlank, + anchor : '95%' + }] + }; + }else if(type == '时间段'){ + if(value == null || value == ''){ + value = '00:00'; + } + return { + columnWidth : .5, + layout : 'form', + labelWidth : 90, + hidden:hideElement, + id:'hideElement'+id, + items : [{ + xtype : 'textfield', + fieldLabel : name, + maxLength : '16', + id : 'configItemOption'+id, + name : 'configItemOption'+id, + regex : /^\d*:\d\d$/, + regexText : '请按照"小时:分钟"的格式填写', + allowBlank : allowBlank, + value : value, + anchor : '95%' + }] + }; + }else if(type == '日期'){ + return { + columnWidth : .5, + layout : 'form', + labelWidth : 90, + hidden:hideElement, + id:'hideElement'+id, + items : [{ + xtype : 'datefieldWithMin', + fieldLabel : name, + id : 'configItemOption'+id, + name : 'configItemOption'+id, + format : 'Y-m-d', + value : value, + readOnly : true, + editable : false, + allowBlank : allowBlank, + anchor : '95%' + }] + }; + }else if(type == '单选'){ + var optionsArrays = new Array(); + if(options != ""){ + var optionsJson = JSON.parse(options); + var hideTriggerItemIdsValue = ""; + for(var j = 0 ; j < optionsJson.length ; j++){ + var optionsArray = new Array(); + optionsArray.push(optionsJson[j].name); + optionsArray.push(optionsJson[j].valueTriggerItemIds); + optionsArrays.push(optionsArray); + if(value == optionsJson[j].name){ + hideTriggerItemIdsValue = optionsJson[j].valueTriggerItemIds; + } + } + } + return { + columnWidth : .5, + layout : 'form', + labelWidth : 90, + style:'margin-top:10px', + hidden:hideElement, + id:'hideElement'+id, + items : [{ + xtype:'hidden', + id:'triggerItemIds' + id, + name:'triggerItemIds' + id, + value : hideTriggerItemIdsValue + },{ + xtype : 'combo', + fieldLabel : name, + id : 'configItemOption'+id, + name : 'configItemOption'+id, + valueField : 'value', + displayField : 'value', + allowBlank : allowBlank, + editable : false, + listWidth: 400, + store : new Ext.data.SimpleStore({ + fields : [ 'value', 'valueTriggerItemIds'], + data : optionsArrays + }), + forceSelection : true, + value : value, + mode : 'local', + triggerAction : 'all', + anchor : '100%', + listeners:{ + select : function(combo, record, index) { + var valueTriggerItemIds = record.get("valueTriggerItemIds"); + var oldTriggerItemIds = Ext.getCmp("triggerItemIds" + id).getValue(); + triggerItemAction(oldTriggerItemIds,"hide"); + triggerItemAction(valueTriggerItemIds,"show"); + Ext.getCmp("triggerItemIds" + id).setValue(valueTriggerItemIds); + } + } + }] + }; + }else if(type == '多选'){ + if(value == null || value == ''){ + value = ''; + } + var optionsArray = new Array(); + optionsArray.push({ + id : 'configItemOption'+id, + name : 'configItemOption'+id, + xtype : 'hidden', + hidden : allowBlank, + value : value + }); + if(options != ""){ + var optionsJson = JSON.parse(options); + for(var j = 0 ; j < optionsJson.length ; j++){ + var checked = false; + if(value != null && value.indexOf(JSON.stringify(optionsJson[j])) != -1){ + checked = true; + } + optionsArray.push({ + layout : 'form', + columnWidth : 0.5, + labelWidth : 200, + style:'margin-top:10px', + items:[{ + name : 'cconfigItemOption'+id, + fieldLabel : optionsJson[j].name, + xtype : 'checkbox', + checked : checked, + columnWidth : .5, + inputValue : JSON.stringify(optionsJson[j]), + listeners : { + check : function(thiz, checked){ + var elementId = thiz.getName().substring(1); + var elementObj = Ext.getCmp(elementId); + if(elementObj != undefined && elementObj != null){ + var oldElementValue = elementObj.getValue(); + var checkedValue = JSON.parse(thiz.getRawValue()); + if(checked){ + if(oldElementValue.indexOf(thiz.getRawValue()) == -1){ + oldElementValue += ","; + oldElementValue += thiz.getRawValue() + elementObj.setValue(oldElementValue); + } + if(checkedValue != null){ + var valueTriggerItemIds = checkedValue.valueTriggerItemIds; + triggerItemAction(valueTriggerItemIds,"show"); + } + }else{ + var newValue = oldElementValue.replace("," + thiz.getRawValue(),''); + elementObj.setValue(newValue); + + if(checkedValue != null){ + var valueTriggerItemIds = checkedValue.valueTriggerItemIds; + triggerItemAction(valueTriggerItemIds,"hide"); + } + } + } + } + } + }] + }); + } + } + return { + columnWidth : 1, + xtype : "fieldset", + title: name, + allowBlank: allowBlank, + id:'hideElement'+id, + layout : 'column', + hidden:hideElement, + autoHeight : true, + items : optionsArray + }; + } +} +/** + * 返回炉次显示框 + */ +function createQualityMonitoringElementSterName(value){ + return { + columnWidth : .5, + layout : 'form', + labelWidth : 90, + items : [{ + xtype : 'textfield', + fieldLabel : '炉次', + maxLength : '30', + id : 'configItemOptionSterName', + name : 'configItemOptionSterName', + allowBlank : true, + readOnly : true, + value : value, + anchor : '95%' + }] + }; +} +/** + * 返回炉号显示框 + * @param value + * @returns + */ +function createQualityMonitoringElementSterFre(value){ + return { + columnWidth : .5, + layout : 'form', + labelWidth : 90, + items : [{ + xtype : 'textfield', + fieldLabel : '炉号', + maxLength : '30', + id : 'configItemOptionSterFre', + name : 'configItemOptionSterFre', + allowBlank : true, + readOnly: true, + value : value, + anchor : '95%' + }] + }; +} + +/** + * 获取所有选择重新装配的器械包条码(用逗号分隔). + * @returns {String} + */ +function getScanRepacingTiBarcodes(){ + tiBarcodes = ""; + var tousseName = Ext.getCmp('tousseName').getRawValue(); + var isRepacking = Ext.getCmp('isRepacking').getValue(); + if(tousseName != null && tousseName != "" && isRepacking == "是"){ + var barcode = Ext.getCmp('barcodeForQuality').getValue(); + tiBarcodes += barcode ; + } + var addTousseInstanceAmount = tousseItemCount; + for(var i =1; i <= addTousseInstanceAmount; i++){ + var tousseBarcode = Ext.getCmp('tempBarcode'+i+"_"+1).getValue(); + var tousseName = Ext.getCmp('tempBarcode'+i+"_"+3).getValue(); + var tousseAmount = Ext.getCmp('tempBarcode'+i+"_"+6).getValue(); + var tousseRePacking = Ext.getCmp('tempBarcode'+i+"_"+8).getValue(); + if((tousseName != null && tousseName != "") && (tousseAmount != null && tousseAmount != "") && tousseRePacking == "是"){ + if(tiBarcodes != null && tiBarcodes != ""){ + tiBarcodes += "," + tousseBarcode ; + }else{ + tiBarcodes += tousseBarcode ; + } + + } + } + return tiBarcodes; +} + +/** + * + * @param materialInfo 材料信息 + * @param saveAndCreate 是否为“保存并新建”操作 + */ +function submitForm2(materialInfo,saveAndCreate){ + //1、启用责任人文本框,如果有灭菌状态 + Ext.getCmp('responsiblePerson').setDisabled(false); + var sterilizationStatus = ''; + if(typeof(sterilizerStatus) != 'undefined' && sterilizerStatus != null && sterilizerStatus != ""){ + sterilizationStatus = sterilizerStatus; + } + + //2、把第一个器械包的信息增加到tousseInstanceInfo的前面 + var tousseName = Ext.getCmp('tousseName').getRawValue(); + if(tousseName != null && tousseName != ""){ + var barcode = Ext.getCmp('barcodeForQuality').getValue(); + var tousseInstanceId = Ext.getCmp('tousseInstanceId').getValue(); + var amount = Ext.getCmp('tousseAmount').getValue(); + var isRecycle = Ext.getCmp('isRecycle').getValue(); + var isRepacking = Ext.getCmp('isRepacking').getValue(); + var info = barcode + "@" + tousseInstanceId + "@" + tousseName + "@" + amount + "@" + isRecycle+ "@" + isRepacking+ "@" + 1 +";"; + tousseInstanceInfo = info + tousseInstanceInfo; + } + //3、提交 + setQmSubmitResult(0); + Ext.getCmp('addQualityMonitoringForm').form.submit({ + url : WWWROOT + '/disinfectSystem/qualityMonitoringInstanceAction!saveQualityMonitoringInstance.do', + params : { + tousseInstanceInfo : tousseInstanceInfo, //器械包信息 + materialInfo : materialInfo, //材料信息 + sterilizationStatus:sterilizationStatus, //灭菌状态 + qualityMonitoringSterilizationID : qualityMonitoringSterilizationID, //灭菌记录id + qualityMonitoringWRRecordID : qualityMonitoringWRRecordID //清洗记录id + }, + method : 'POST', + waitMsg : '正在保存数据,请稍候', + waitTitle : '提交表单', + success : function(form, action) { + var result = Ext.decode(action.response.responseText); + showResultQM(result.message); + setQmSubmitResult(1); + if(saveAndCreate){ + tempFormDefintionId = Ext.getCmp("formDefinitionId").getValue(); + tempFormDefinitionName = Ext.getCmp("name").getValue(); + closeQMWindow(); + qualityMonitoringSterilizationID = 0; + qualityMonitoringWRRecordID = 0; + materialCountRecords = null; + materialMsg = null; + if(recycleQM == true){ + addQMAgain(); + }else{ + addQualityMonitoring("",tempFormDefintionId,tempFormDefinitionName);/* */ + if(typeof(grid) != 'undefined' && grid != null){ + grid.getStore().reload(); + } + } + }else{ + closeQMWindow(); + if(recycleQM == false){ + if(typeof(grid) != 'undefined' && grid != null){ + grid.getStore().reload(); + } + } + } + }, + failure : function(form, action) { + if(action.response != null && action.response.responseText != null){ + var result = Ext.decode(action.response.responseText); + showResultQM(result.message); + }else{ + alert('failure = ' + action.failureType); + } + setQmSubmitResult(-1); + closeQMWindow(); + } + }); +} + +/** + * 设置“qmSubmitResult”的值(1、0或者空=提交前 2、1=提交成功 3、-1=提交失败). + * @param value + */ +function setQmSubmitResult(value){ + if(!isUndefinedOrNullOrEmpty(Ext.getCmp('qmSubmitResult'))){ + Ext.getCmp('qmSubmitResult').setValue(value); + } +} +function showAllTousseOfSterileCheckBox(show){ + if(!isUndefinedOrNullOrEmpty(qualityMonitoringSterilizationID) && show){ + Ext.getCmp('allTousseOfSterile').setVisible(true); + Ext.getCmp('allTousseOfSterile').getEl().up('.x-form-item').setDisplayed(true); + }else{ + Ext.getCmp('allTousseOfSterile').setVisible(false); + Ext.getCmp('allTousseOfSterile').getEl().up('.x-form-item').setDisplayed(false); + } +} + +function selectEmptyDo(){ + Ext.getCmp('scope').setValue("无"); + Ext.getCmp('optionAmount').setValue(''); + Ext.getCmp('sterilizationRecordInfo').setVisible(false); + Ext.getCmp('tousseInfoFieldSet').setVisible(true); + hideFirstTousse(); + showFirstMaterial(); + Ext.getCmp('recycleC').setVisible(false); + Ext.getCmp('repackingC').setVisible(false); + showAllTousseOfSterileCheckBox(true); + Ext.getCmp('addExtractCheckTousse').setVisible(false); + Ext.getCmp('addExtractCheckMaterial').setVisible(true); + Ext.getCmp('sterilizationRecordInfo').setVisible(false); + if(sstsConfig.hasOwnProperty('isInspectScopeHideTousseMsg') && sstsConfig.isInspectScopeHideTousseMsg){ + // 隐藏器械包信息 + Ext.getCmp('tousseInfoFieldSet').setVisible(false); + } + Ext.getCmp("insertBasket").hide(); + Ext.getCmp("containerNameItem").hide(); + Ext.getCmp('containerName').setVisible(false); + Ext.getCmp('containerName').getEl().up('.x-form-item').setDisplayed(false); + Ext.getCmp('addQualityMonitoringForm').remove('itemsFieldSet'); + hideExtractCheckMaterial(); + Ext.getCmp('addQualityMonitoringForm').doLayout(); +} + +/** + * 构建监测细则的fieldset. + * @param formId 监测项id + * @param configName 监测项名称 + */ +function addQualityMonitoringItem(formId,configName){ + // 质量监测添加‘无’这个项. + if(configName == '无'){ + selectEmptyDo(); + return; + } + Ext.Ajax.request({ + url : WWWROOT + '/disinfectSystem/formDefinitionAction!loadFormDefinition.do', + params : {id : formId}, + success : function(response,options){ + var result = Ext.decode(response.responseText); + if(result.success){ + Ext.getCmp('scope').setValue(result.data.scope); + if(sstsConfig.hasOwnProperty('isInspectScopeHideTousseMsg') && sstsConfig.isInspectScopeHideTousseMsg){ + if("无" == result.data.scope){ + // 如果监测范围为无,隐藏器械包信息 + Ext.getCmp('tousseInfoFieldSet').setVisible(false); + } + } + Ext.getCmp('optionAmount').setValue(''); + var baseInfoPanel = Ext.getCmp('baseInfoPanel'); + if("是" == result.data.isInsertBasket){ + Ext.getCmp("insertBasket").show(); + Ext.getCmp("containerNameItem").show(); + + Ext.getCmp('containerName').setVisible(true); + Ext.getCmp('containerName').getEl().up('.x-form-item').setDisplayed(true); + }else{ + Ext.getCmp("insertBasket").hide(); + Ext.getCmp("containerNameItem").hide(); + + Ext.getCmp('containerName').setVisible(false); + Ext.getCmp('containerName').getEl().up('.x-form-item').setDisplayed(false); + } + Ext.getCmp('responsibilityPart').setValue(result.data.responsibilityPart); + var items = new Array(); + // 如果显示炉次炉号,添加表单 + if(result.data.showSterilizerNumFrequency == '是'){ + items.push(createQualityMonitoringElementSterName('')); + items.push(createQualityMonitoringElementSterFre('')); + } + for(var i = 0 ; i< result.data.items.length ; i++){ + var item = result.data.items[i]; + if(Ext.getCmp('optionAmount').getValue() == null || Ext.getCmp('optionAmount').getValue() == ''){ + Ext.getCmp('optionAmount').setValue(item.id); + }else{ + Ext.getCmp('optionAmount').setValue(Ext.getCmp('optionAmount').getValue()+';'+item.id); + } + var allowBlank = result.data.items[i].requirement == '必填'?false:true; + items.push(createQualityMonitoringItemElement(item.type,item.id,item.name,allowBlank,item.optionsJson,null,item.isTriggerItem)); + if(result.data.items[i].type == '多选'){ + items.push({ + columnWidth : 1, + xtype : "label", + html : ' ', + anchor : '95%' + }); + } + } + + Ext.getCmp('addQualityMonitoringForm').remove('itemsFieldSet'); + if(items.length > 0){ + Ext.getCmp('addQualityMonitoringForm').add({ + id : 'itemsFieldSet', + xtype:"fieldset", + labelAlign :'left', + title:"监测项", + layout:'column', + autoHeight:true, + items:items + }); + } + Ext.getCmp('addQualityMonitoringForm').doLayout(); + if(Ext.getCmp('itemsFieldSet')){ + Ext.getCmp('itemsFieldSet').doLayout(); + } +// cccbbb + if(result.data.scope == "器械包"){ + Ext.getCmp('sterilizationRecordInfo').setVisible(false); + Ext.getCmp('tousseInfoFieldSet').setVisible(true); + // 隐藏第一个材料和添加的材料信息 + hideFirstMaterial(); + hideExtractCheckMaterial(); + // 显示器械包输入框 + showFirstTousse(); + + Ext.getCmp('recycleC').setVisible(true); + Ext.getCmp('repackingC').setVisible(true); + showAllTousseOfSterileCheckBox(true); + Ext.getCmp('addExtractCheckTousse').setVisible(true); + Ext.getCmp('addExtractCheckMaterial').setVisible(false); + // 清除材料数据 + Ext.getCmp('material').setValue(""); + Ext.getCmp('materialAmount').setValue(""); + }else if(result.data.scope == "材料"){ + Ext.getCmp('sterilizationRecordInfo').setVisible(false); + Ext.getCmp('tousseInfoFieldSet').setVisible(true); + hideFirstTousse(); + showFirstMaterial(); + Ext.getCmp('recycleC').setVisible(false); + Ext.getCmp('repackingC').setVisible(false); + showAllTousseOfSterileCheckBox(false); +// Ext.getCmp('material').getEl().up('.x-form-item').setDisplayed(true); + //showExtractCheckMaterial(); + Ext.getCmp('addExtractCheckTousse').setVisible(false); + Ext.getCmp('addExtractCheckMaterial').setVisible(true); + addMaterialAndAmount(); + addMaterialMsg(); + }else if(result.data.scope == "灭菌炉记录"){ + Ext.getCmp('sterilizationRecordInfo').setVisible(true); + // 如果监测范围为灭菌炉记录,隐藏器械包信息 + Ext.getCmp('tousseInfoFieldSet').setVisible(false); + Ext.getCmp('addExtractCheckTousse').setVisible(false); + Ext.getCmp('addExtractCheckMaterial').setVisible(false); + hideExtractCheckMaterial(); + }else if(result.data.scope == "材料和器械包"){ + Ext.getCmp('sterilizationRecordInfo').setVisible(false); + Ext.getCmp('tousseInfoFieldSet').setVisible(true); + showFirstTousse(); + showFirstMaterial(); +// Ext.getCmp('material').getEl().up('.x-form-item').setDisplayed(true); + Ext.getCmp('recycleC').setVisible(true); + Ext.getCmp('repackingC').setVisible(true); + showAllTousseOfSterileCheckBox(true); + Ext.getCmp('addExtractCheckTousse').setVisible(true); + Ext.getCmp('addExtractCheckMaterial').setVisible(true); + // 添加抽检器械和数量 + addMaterialAndAmount(); + addMaterialMsg(); + }else if(result.data.scope == "无"){ + Ext.getCmp('sterilizationRecordInfo').setVisible(false); + Ext.getCmp('tousseInfoFieldSet').setVisible(true); + hideFirstTousse(); + showFirstMaterial(); +// Ext.getCmp('material').getEl().up('.x-form-item').setDisplayed(true); + Ext.getCmp('recycleC').setVisible(true); + Ext.getCmp('repackingC').setVisible(true); + showAllTousseOfSterileCheckBox(true); + Ext.getCmp('addExtractCheckTousse').setVisible(false); + Ext.getCmp('addExtractCheckMaterial').setVisible(true); + Ext.getCmp('sterilizationRecordInfo').setVisible(false); + if(sstsConfig.hasOwnProperty('isInspectScopeHideTousseMsg') && sstsConfig.isInspectScopeHideTousseMsg){ + // 隐藏器械包信息 + Ext.getCmp('tousseInfoFieldSet').setVisible(false); + } + hideExtractCheckMaterial(); + } + // 新建质量监测单,数量默认为1 + var tAmount = Ext.getCmp('tousseAmount').getValue(); + var mAmount = Ext.getCmp('materialAmount').getValue(); + if(isUndefinedOrNullOrEmpty(tAmount) || tAmount <= 0){ + // 没有值,设置默认值为1 + Ext.getCmp('tousseAmount').setValue(1); + } + if(isUndefinedOrNullOrEmpty(mAmount) || mAmount <= 0){ + // 没有值,设置默认值为1 + Ext.getCmp('materialAmount').setValue(1); + } + resetRecycleAndRepackingValue(); + } + }, + failure : function(response, options) { + showResultQM('系统加载出错,请稍候再试'); + } + }); +} +// 装配页面进来,添加材料和数量 +function addMaterialAndAmount(){ + if(materialCountRecords != null && materialCountRecords != 'undefined' && materialCountRecords.length > 0){ + var maerialName = Ext.getCmp('material').getValue(); + if( !isUndefinedOrNullOrEmpty(maerialName) ){ + // 如果已经打开了,再选择其他的监测项,不再添加材料数据 + return ; + } + + for(var i = 0 ; i < materialCountRecords.length ; i++){ + var materialName = materialCountRecords[i].data["name"]; + var count = materialCountRecords[i].data['count']; + if( i == 0 ){ + // 第一条记录 + Ext.getCmp('material').setValue(materialName); + Ext.getCmp('materialAmount').setValue(count); + }else{ + addExtractCheckMaterial(false,materialName,count); + } + } + } +} + +//回收页面进来,添加材料和数量 +function addMaterialMsg(){ + if(materialMsg != null && materialMsg != 'undefined' && materialMsg.length > 0){ + var maerialName = Ext.getCmp('material').getValue(); + if( !isUndefinedOrNullOrEmpty(maerialName) ){ + // 如果已经打开了,再选择其他的监测项,不再添加材料数据 + return ; + } + for(var i = 0 ; i < materialMsg.length ; i++){ + var materialName = materialMsg[i].materialName; + var count = materialMsg[i].amount; + if( i == 0 ){ + // 第一条记录 + Ext.getCmp('material').setValue(materialName); + Ext.getCmp('materialAmount').setValue(count); + }else{ + addExtractCheckMaterial(false,materialName,count); + } + } + } +} + +/** + * 判断是否整炉. + * @returns {Boolean} + */ +function allTousseOfSterileChecked(){ + var isAll = Ext.getCmp('isAllTousseOfSterile').getValue(); //是否整炉 + if(isAll == '是'){ + return true; + } + return false; +} + +/** + * 控制“重新回收”和“重新装配”的复选框的是否可用. + */ +function updateControlStatus(){ + if(allTousseOfSterileChecked()){ + enableRecycleAndRepacking(); + }else{ + var tousseType = Ext.getCmp('tousseType').getValue(); + var tousseInstanceId = Ext.getCmp('tousseInstanceId').getValue(); + var toussedefRecycling = Ext.getCmp('tousseDefRecycling').getValue(); + + if (isUndefinedOrNullOrEmpty(tousseInstanceId)) { + disableRecycleAndRepacking(); + } else if (tousseType==PACKAGE_TYPE_FOREIGN + || tousseType==PACKAGE_TYPE_SPLIT + || tousseType == '敷料包' || toussedefRecycling == '否') { + disableRecycleCanRepacking(); + } else { + enableRecycleAndRepacking(); + } + } +} + +/** + * 将“重新回收”和“重新装配”及“是否整炉”设置为未选中状态. + */ +function resetRecycleAndRepackingValue(){ + Ext.getCmp('isRecycle').setValue(''); + Ext.getCmp('isRepacking').setValue(''); + Ext.getCmp('isAllTousseOfSterile').setValue(''); + + Ext.getCmp('recycle').setValue(false); + Ext.getCmp('repacking').setValue(false); + Ext.getCmp('allTousseOfSterile').setValue(false); +} + +/** + * 禁用“重新回收”和“重新装配”的复选框. + */ +function disableRecycleAndRepacking(){ + Ext.getCmp('isRecycle').setValue(''); + Ext.getCmp('isRepacking').setValue(''); + Ext.getCmp('recycle').disable(); + Ext.getCmp('repacking').disable(); + + Ext.getCmp('recycle').setValue(false); + Ext.getCmp('repacking').setValue(false); +} + +/** + * 不能重新回收,可以重新装配. + */ +function disableRecycleCanRepacking(){ + Ext.getCmp('isRecycle').setValue(''); + Ext.getCmp('isRepacking').setValue(''); + Ext.getCmp('recycle').disable(); + Ext.getCmp('repacking').enable(); + + Ext.getCmp('recycle').setValue(false); + Ext.getCmp('repacking').setValue(false); +} + +/** + * 启用“重新回收”和“重新装配”的复选框. + */ +function enableRecycleAndRepacking(){ + Ext.getCmp('recycle').enable(); + Ext.getCmp('repacking').enable(); +} + +/** + * 根据“器械包条码”以及“监测项定义id”,获取器械包名字以及监测环节的责任人. + * @param tempBarcode 器械包条码 + * @param qmDefinitionId 监测项定义id + * @param materialDefinitionStore 抽检器械的store + */ +function getTousseInstanceNameAndResponsiblePerson(tempBarcode, qmDefinitionId, materialDefinitionStore){ + if(tempBarcode){ + Ext.Ajax.request({ + url : WWWROOT + '/disinfectSystem/qualityMonitoringDefinitionAction!getTousseInstanceNameAndResponsiblePerson.do', + params : {barcode : tempBarcode,qmDefinitionId : qmDefinitionId}, + success : function(response,options){ + var result = Ext.decode(response.responseText); + if(result.success){ + //1、设置“器械包名称”、“器械包实例条码”、“器械包实例id”、“器械包类型”、“是否需要回收”、“责任人” + if(tempBarcode != null && tempBarcode != ''){ + Ext.getCmp('tousseName').setValue(result.tousseName + "(" + tempBarcode + ")"); + }else{ + Ext.getCmp('tousseName').setValue(result.tousseName); + } + Ext.getCmp('barcodeForQuality').setValue(tempBarcode); + Ext.getCmp('tousseInstanceId').setValue(result.tousseInstanceId); + Ext.getCmp('tousseType').setValue(result.tousseType); + Ext.getCmp('tousseDefRecycling').setValue(result.isRecycle); + Ext.getCmp('responsiblePerson').setValue(result.responsiblePerson); + + //2、如果有炉号炉次,则需要设值 + if(!isUndefinedOrNullOrEmpty(Ext.getCmp('configItemOptionSterName'))){ + Ext.getCmp('configItemOptionSterName').setValue(result.sterilizerName); + Ext.getCmp('configItemOptionSterFre').setValue(result.sterileFrequency); + } + + //3、设值包定义id,并且材料要与此包定义关联 + if(result.tousseDefinitionId){ + Ext.getCmp('tousseDefinitionId').setValue(result.tousseDefinitionId); + if(materialDefinitionStore){ + materialDefinitionStore.reload(); + } + }else if(materialDefinitionStore){ + Ext.getCmp('tousseDefinitionId').setValue(''); + } + + //4、控制“重新回收”和“重新装配”的复选框的是否可用. + updateControlStatus(); + }else{ + if(result.message){ + showResultQM(result.message); + }else{ + showResultQM("找不到该条码所对应的器械包实例"); + } + } + }, + failure : function(response, options) { + var result = Ext.decode(response.responseText); + if(result.message){ + showResultQM(result.message); + }else{ + showResultQM('系统加载出错,请稍候再试'); + } + } + }); + } +} +function getPostionByBasketBarcode(tempBarcode,positionId){ + if(tempBarcode){ + Ext.Ajax.request({ + url : WWWROOT + '/disinfectSystem/qualityMonitoringDefinitionAction!getPostionMsg.do', + params : {barcode : tempBarcode,qualityMonitoringWRRecordID : qualityMonitoringWRRecordID}, + success : function(response,options){ + var result = Ext.decode(response.responseText); + if(result.success){ + if(result.positionMsg){ + Ext.getCmp(positionId).setValue(result.positionMsg); + } + }else{ + if(result.message){ + showResultQM(result.message); + }else{ + showResultQM("找不到该条码所对应的篮筐实例"); + } + } + }, + failure : function(response, options) { + var result = Ext.decode(response.responseText); + if(result == null || result.message == null){ + showResultQM('系统加载出错,请稍候再试'); + }else{ + showResultQM(result.message); + } + } + }); + } +} +// 添加抽检器械和数量 +function addExtractCheckMaterial(isOpenRecord,mateialName,count,basketPosition,orderNumber){ + materialItemCount++; + var tousseAndMaterial = Ext.getCmp('tosseAndMaterial'); + var mCount = 1; + if(count != null && count != 'undefined'){ + mCount = count; + } + var items = new Array(); + var items1 = new Array(); + var items2 = new Array(); + var items3 = new Array(); + items = { + layout : 'form', + id : 'materialC'+materialItemCount, + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'combo', + id : 'material'+materialItemCount, + name : 'material'+materialItemCount, + fieldLabel : '抽检器械', + queryParam : 'spell', + minChars : 0, + valueField : 'id', + displayField : 'name', + store : materialDefinitionAddStore, + value : mateialName, + forceSelection : true, + lazyInit : true, + triggerAction : 'all', + hideTrigger : true, + typeAhead : false, + anchor : '95%', + listeners : { + select : function(combo, record, index) { + combo.setValue(record.data.name); + } + } + }] + }; + items1 = { + layout : 'form', + id : 'materialAmountC'+materialItemCount, + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'numberfield', + allowDecimals : false, + name : 'materialAmount'+materialItemCount, + id : 'materialAmount'+materialItemCount, + fieldLabel : "器械数量", + value : mCount, + allowBlank : true, + blankText : '数量不能为空', + anchor : '95%' + }] + }; + items2 = { + layout : 'form', + hidden : !(qualityMonitoringWRRecordID > 0 && (sstsConfig.hasOwnProperty('haveRinserPosition')) && sstsConfig.haveRinserPosition), + id : 'basketBarcodeC'+materialItemCount, + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'textfield', + name : 'basketBarcodeForQuality'+materialItemCount, + id : 'basketBarcodeForQuality'+materialItemCount, + fieldLabel : "篮筐条码", + anchor : '95%', + listeners : { + specialkey : function(field,e){ + if(e.getKey() == 13){ + var idName = field.getId().replace("basketBarcodeForQuality","position"); + getPostionByBasketBarcode(field.getValue(),idName); + field.setValue(''); + } + } + } + }] + }; + + items3 = { + layout : 'form', + hidden : !(qualityMonitoringWRRecordID > 0 && (sstsConfig.hasOwnProperty('haveRinserPosition')) && sstsConfig.haveRinserPosition), + id : 'positionC'+materialItemCount, + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'textfield', + name : 'position'+materialItemCount, + id : 'position'+materialItemCount, + editable : false, + fieldLabel : "位置", + anchor : '95%' + }] + }; + var items4 = new Array(); + items4 = { + xtype : 'hidden', + name : 'materialOrder'+materialItemCount, + id : 'materialOrder'+materialItemCount + }; + tousseAndMaterial.add(items); + tousseAndMaterial.add(items1); + tousseAndMaterial.add(items2); + tousseAndMaterial.add(items3); + tousseAndMaterial.add(items4); + tousseAndMaterial.doLayout(); + // 顺序包括器械包和材料都排进去 + var curOrder = materialItemCount + tousseItemCount + 2; + Ext.getCmp('materialOrder'+materialItemCount).setValue(curOrder); + if(basketPosition != null && basketPosition != ''){ + Ext.getCmp('position'+materialItemCount).setValue(basketPosition); + } + if(orderNumber != null && orderNumber > 0){ + Ext.getCmp('materialOrder'+materialItemCount).setValue(orderNumber); + } + if(isOpenRecord == true && mateialName != null && mateialName != ''){ + //打开记录,不允许修改 + Ext.getCmp('material'+materialItemCount).disable(); + Ext.getCmp('materialAmount'+materialItemCount).disable(); + Ext.getCmp('basketBarcodeForQuality'+materialItemCount).disable(); + Ext.getCmp('position'+materialItemCount).disable(); + } +} +// 隐藏第一个器械包信息,包括器械包条码,数量 +function hideFirstTousse(){ + Ext.getCmp('tousseBarcodeC').setVisible(false); + Ext.getCmp('tousseNameC').setVisible(false); + Ext.getCmp('tousseAmountC').setVisible(false); +} +//显示第一个器械包信息,包括器械包条码,数量 +function showFirstTousse(){ + Ext.getCmp('tousseBarcodeC').setVisible(true); + Ext.getCmp('tousseNameC').setVisible(true); + Ext.getCmp('tousseAmountC').setVisible(true); +} + +//隐藏第一个材料信息,包括器械包条码,数量 +function hideFirstMaterial(){ + Ext.getCmp('materialC').setVisible(false); + Ext.getCmp('materialAmountC').setVisible(false); +} +//显示第一个材料信息,包括器械包条码,数量 +function showFirstMaterial(){ + Ext.getCmp('materialC').setVisible(true); + Ext.getCmp('materialAmountC').setVisible(true); +} + +function hideExtractCheckMaterial(){ + if(materialItemCount > 0){ + for(var i=1;i 0){ + Ext.getCmp('addQualityMonitoringForm').add({ + id : 'itemsFieldSet', + xtype:"fieldset", + labelWidth :400, + labelAlign :'left', + title:"监测项", + layout:'column', + autoHeight:true, + items:items + }); + } + Ext.getCmp('addQualityMonitoringForm').doLayout(); + if(Ext.getCmp('itemsFieldSet')){ + Ext.getCmp('itemsFieldSet').doLayout(); + } + //打开已有质量监测记录,器械包条码,器械包名称,重新回收和重新装配都禁用掉,不能再修改 + Ext.getCmp('recycle').disable(); + Ext.getCmp('repacking').disable(); + Ext.getCmp('tempBarcode').disable(); + Ext.getCmp('tousseName').disable(); + Ext.getCmp('tousseAmount').disable(); + Ext.getCmp('material').disable(); + Ext.getCmp('materialAmount').disable(); + Ext.getCmp('basketBarcodeForQuality').disable(); + Ext.getCmp('position').disable(); + Ext.getCmp('allTousseOfSterile').disable(); + }else{ + showResultQM("找不到该条码所对应的器械包实例"); + } + }, + failure : function(response, options) { + showResultQM('系统加载出错,请稍候再试'); + } + }); + }else{ + setStartDate(Ext, 'yyyy/MM/dd HH:mm', 'dateTime'); //(设置抽检时间,取服务器时间 cjr) + disableRecycleAndRepacking(); + var resonPart = Ext.getCmp('responsibilityPart').getValue(); + if(resonPart != null && resonPart != '') { + if(resonPart == '全部环节'){ + formDefinitionStore.baseParams.responsiblePerson = ""; + }else{ + formDefinitionStore.baseParams.responsiblePerson = resonPart; + } + }else{ + Ext.getCmp('responsibilityPart').setValue('全部环节'); + formDefinitionStore.baseParams.responsiblePerson = ""; + } + if( !isUndefinedOrNullOrEmpty(formDefinitionId) && !isUndefinedOrNullOrEmpty(formDefinitionName) ){ + Ext.getCmp('formName').setValue(formDefinitionName); + addQualityMonitoringItem(formDefinitionId,formDefinitionName); + Ext.getCmp("formDefinitionId").setValue(formDefinitionId); + Ext.getCmp("name").setValue(formDefinitionName); + }else{ + formDefinitionStore.load(); + } + } + +} + +function uploadWindowA(imageType,id){ + var onUploadComplete = function(dialog){ + disableShowImageButton = false; + dialog.hide(); + }; + //文件上传成功后的回调函数 + var onUploadSuccess = function(dialog, filename, resp_data, record){ + disableShowImageButton = false; + dialog.hide(); + }; +// //文件上传失败后的回调函数 + var onUploadFailed = function(dialog, filename, resp_data, record){ + showResultQM(resp_data.message);//resp_data是json格式的数据 + disableShowImageButton = true; + }; + var dialog = new top.Ext.ux.UploadDialog.Dialog({ + title: "上传" + imageType, + url:WWWROOT + '/disinfectSystem/baseData/uploadImageFileAction!uploadImage.do?imageType='+imageType+'&objectId='+id , //这里我用struts2做后台处理 + post_var_name:'uploadFiles',//这里是自己定义的,默认的名字叫file + width : 450, + height : 300, + minWidth : 450, + minHeight : 300, + draggable : true , + resizable : true , + constraintoviewport: true , + permitted_extensions:['JPG','jpg','jpeg','JPEG','GIF','gif','png','PNG'], + modal: true , + reset_on_hide: false , + allow_close_on_upload: false , //关闭上传窗口是否仍然上传文件 + upload_autostart: false + }); + dialog.show(); + dialog.on('uploadsuccess',onUploadSuccess); //定义上传成功回调函数 + dialog.on('uploadfailed',onUploadFailed); //定义上传失败回调函数 +// dialog.on('uploadcomplete',onUploadComplete); //定义上传完成回调函数 +} + +/** + * 保存质量监测实例. + * @param thiz 按钮对象 + * @param materialDefinitionStore 抽检器械的store + * @param saveAndCreate 是否为“保存并新建”操作 + * @returns {Boolean} + */ +function saveQualityMonitoring(thiz,materialDefinitionStore,saveAndCreate) { + //1、验证所有的监测细则的填写是否合法 + var optionAmount = Ext.getCmp('optionAmount').getValue(); //监测细则的表单元素id集合(用分号分隔) + if (optionAmount) { + var optionAmountArr = optionAmount.split(';'); + for(var i = 0 ; i < optionAmountArr.length ; i++){ + var itemId = optionAmountArr[i]; + if(Ext.getCmp('configItemOption'+itemId).getXType() != 'hidden'){ + if(!Ext.getCmp('configItemOption'+itemId).isValid()){ + showResultQM("请正确填写表单各值。"); + return false; + } + }else{ + if(!Ext.getCmp('configItemOption'+itemId).hidden && Ext.getCmp('configItemOption'+itemId).getValue() == '#@'){ + showResultQM("请正确填写表单各值。"); + return false; + } + } + + //如果是多选,并且必填,需要单独校验 + var extElement = Ext.getCmp('hideElement' + itemId); + if (extElement.getXType() == 'fieldset' && !extElement.allowBlank) { + var checkboxArr = extElement.findByType('checkbox'); + var checked = false; + for (var int = 0; int < checkboxArr.length; int ++) { + if (checkboxArr[int].checked) { + checked = checkboxArr[int].checked; + continue; + } + } + if (!checked) { + showResultQM(extElement.title + "是必填项"); + return false; + } + } + } + } + + //2、验证是否选择监测项 + var inspecItemName = Ext.getCmp("formName") ; + if(inspecItemName == null || inspecItemName.getValue() == ''){ + showResultQM("请选择监测项!"); + return false; + } + + //3、组织材料信息(点击“添加抽检器械”按钮添加的器械) + var materialInfo = ""; + var materialLength = materialItemCount; //(Ext.getCmp('setLeft').items.length-3)/2; + for(var i = 1 ; i <= materialLength ; i++){ + var isVisiable = Ext.getCmp("materialC"+i).isVisible(); + if(isVisiable == false){ + continue; + } + var material = Ext.getCmp("material"+i).getValue(); + var amount = Ext.getCmp("materialAmount"+i).getValue(); + var position = Ext.getCmp("position"+i).getValue(); + var order = Ext.getCmp("materialOrder"+i).getValue(); + if((material != null && material != "") && (amount != null && amount != "")){ + materialInfo += material + "@" + amount + "@" + position + "@" + order + ";"; + } + } + + //4、组织器械包信息(点击“添加抽检器械包”按钮添加的器械包) + tousseInstanceInfo = ""; + var addTousseInstanceAmount = tousseItemCount; + for(var i =1; i <= addTousseInstanceAmount; i++){ + var tousseBarcode = Ext.getCmp('tempBarcode'+i+"_"+1).getValue(); + var tousseName = Ext.getCmp('tempBarcode'+i+"_"+3).getValue(); + var tousseAmount = Ext.getCmp('tempBarcode'+i+"_"+6).getValue(); + var tousseInstanceId = Ext.getCmp('tempBarcode'+i+"_"+5).getValue(); + var tousseRecycle = Ext.getCmp('tempBarcode'+i+"_"+7).getValue(); + var tousseRePacking = Ext.getCmp('tempBarcode'+i+"_"+8).getValue(); + var order = Ext.getCmp('tousseOrder'+i).getValue(); + if((tousseName != null && tousseName != "") && (tousseAmount != null && tousseAmount != "")){ + tousseInstanceInfo += tousseBarcode + "@" + tousseInstanceId + "@" + tousseName + "@" + tousseAmount + "@" + tousseRecycle+ "@" + tousseRePacking+ "@" + order +";"; + } + } + + //5、如果是(整炉 or 监测项=无 or 监测范围=无 or 监测范围=灭菌炉记录)则可以不用填写器械包信息,否则强制要登记器械包信息 + var ForQuality = Ext.getCmp('barcodeForQuality').getValue(); //第一组的器械包条码 + var tousseName = Ext.getCmp('tousseName').getRawValue(); //第一组的器械包名称 + var material = Ext.getCmp('material').getValue(); //第一组的材料名称 + var inspectName = Ext.getCmp('formName').getRawValue(); //监测项 + var scope = Ext.getCmp('scope').getValue(); //监测范围 + if(!allTousseOfSterileChecked()){ + if(inspectName != '无' && scope != '无' && scope != '灭菌炉记录'){ + // 质量检测项为'无',强制登记器械包信息 + if(!material && !tousseName){ + showResultQM("请录入抽验器械或器械包名称"); + return false; + } + } + } + + //6、如果是重新打开的记录,不再校验材料和包的关系 + var qid = Ext.getCmp('id').getValue(); + if(isUndefinedOrNullOrEmpty(qid)){ + if(material){ + var amount = Ext.getCmp('materialAmount').getValue(); + if(!amount || amount < 0){ + showResultQM('输入的“'+material+'”的数量且不能小于1'); + return false; + } + var position = Ext.getCmp("position").getValue(); + materialInfo += material +"@"+ amount + "@" + position + "@" + 2 + ";"; + if(tousseName){ + var tousseDefinitionId = Ext.getCmp('tousseDefinitionId').getValue(); + var isContain = false; + // 判断材料是否在包里面 + DWREngine.setAsync(false); + TousseInstanceTableManager.isTiContainsMaterial(tousseDefinitionId,material,function(responseText){ + result = Ext.decode(responseText); + isContain = result.isContain; + }); + DWREngine.setAsync(true); + if(isContain == false){ + showResultQM('器械包' + tousseName +'中找不到材料“'+material+'”'); + Ext.getCmp('material').setValue(''); + Ext.getCmp('materialAmount').setValue(); + return false; + } + } + } + }else{ + if(material){ + var amount = Ext.getCmp('materialAmount').getValue(); + var position = Ext.getCmp("position").getValue(); + materialInfo += material +"@"+ amount + "@" + position + "@" + 2 + ";"; + } + } + + //7、如果有显示“清洗篮筐名称”则需要填写 + var container = Ext.getCmp("containerName") ; + if(container != null && container.isVisible() && container.getValue() == ""){ + showResultQM("请扫描篮筐条码!"); + return false; + } + checkIsTousseInstanceRepackingAndSubmitForm(thiz,materialInfo,saveAndCreate); +} + +function loadResponPersonByBarcode(barcode){ + if(isUndefinedOrNullOrEmpty(barcode)){ + showResultQM('条码不能为空!'); + return ; + } + UserTableManager.getUserByBarcode(barcode,function(responseText){ + if(!isUndefinedOrNullOrEmpty(responseText)){ + var result = Ext.decode(responseText); + if(!result.success){ + showResultQM("请输入正确的人员条码!"); + return; + } + Ext.getCmp('responsiblePerson').setValue(result.fullName); + }else{ + showResultQM('找不到该条码所对应的人员信息'); + } + }); +} + +function checkIsUniqueWithBarcodeAndInspectItemAndSubmitForm(thiz,id,barcode,formDefinitionId,materialInfo,saveAndCreate){ + if(barcode && formDefinitionId){ + Ext.Ajax.request({ + url : WWWROOT + '/disinfectSystem/qualityMonitoringInstanceAction!checkIsUniqueWithBarcodeAndInspectItem.do', + params : { + id : id, + barcode : barcode, + formDefinitionId : formDefinitionId + }, + success : function(response,options){ + var result = Ext.decode(response.responseText); + if(!result.isUnique){ + showResultQM("当前器械包所对应的检测项已存在"); + thiz.enable(); + return false; + } + submitForm2(materialInfo,saveAndCreate); + }, + failure : function(response, options) { + showResultQM('系统加载出错,请稍候再试'); + } + }); + }else{ + submitForm2(materialInfo,saveAndCreate); + } +} + +/** + * 校验是否有包实例已经重新装配过,如果已经装配过则不允许再次装配了,如果校验通过则提交. + * @param thiz 按钮对象 + * @param materialInfo 材料信息 + * @param saveAndCreate 是否为“保存并新建”操作 + */ +function checkIsTousseInstanceRepackingAndSubmitForm(thiz,materialInfo,saveAndCreate){ + var barcodes = getScanRepacingTiBarcodes(); + Ext.Ajax.request({ + url : WWWROOT + '/disinfectSystem/qualityMonitoringInstanceAction!checkIsTousseInstanceRepacking.do', + params : { + barcodes : barcodes + }, + success : function(response,options){ + var result = Ext.decode(response.responseText); + if(result.haveRepacking){ + showResultQM("扫描的器械包已经重新装配!"); + thiz.enable(); + return false; + } + submitForm2(materialInfo,saveAndCreate); + }, + failure : function(response, options) { + showResultQM('系统加载出错,请稍候再试'); + } + }); +} +// 监测范围是器械包,加载器械包 +function loadTousseMsg(qualityMonitoringInstance, qualityMonitoringGoodsList){ + setIsRecycleAndIsRepackingForWholeFurnace(qualityMonitoringInstance); + if(qualityMonitoringGoodsList == null || qualityMonitoringGoodsList == '' || qualityMonitoringGoodsList.length == 0){ + return ; + } + for(var i = 0 ;i < qualityMonitoringGoodsList.length ;i++){ + if(i == 0){ + var barcode = qualityMonitoringGoodsList[i].barcode; + var tousseInstanceId = qualityMonitoringGoodsList[i].tousseInstanceId; + var tousseName = qualityMonitoringGoodsList[i].tousseName; + var amount = qualityMonitoringGoodsList[i].amount; + Ext.getCmp('tousseInstanceId').setValue(tousseInstanceId); + Ext.getCmp('tempBarcode').setValue(barcode); + Ext.getCmp('tousseName').setValue(tousseName); + Ext.getCmp('tousseAmount').setValue(amount); + if('是'==qualityMonitoringGoodsList[i].isRecycle){ + Ext.getCmp('isRecycle').setValue(qualityMonitoringGoodsList[i].isRecycle); + Ext.getCmp('isRepacking').setValue('否'); + + Ext.getCmp('recycle').setValue(true); + Ext.getCmp('repacking').setValue(false); + }else if('是'==qualityMonitoringGoodsList[i].isRepacking){ + Ext.getCmp('isRecycle').setValue('否'); + Ext.getCmp('isRepacking').setValue(qualityMonitoringGoodsList[i].isRepacking); + + Ext.getCmp('recycle').setValue(false); + Ext.getCmp('repacking').setValue(true); + }else{ + Ext.getCmp('isRecycle').setValue('否'); + Ext.getCmp('isRepacking').setValue('否'); + + Ext.getCmp('recycle').setValue(false); + Ext.getCmp('repacking').setValue(false); + } + }else{ + var barcode = qualityMonitoringGoodsList[i].barcode; + var tousseInstanceId = qualityMonitoringGoodsList[i].tousseInstanceId; + var tousseName = qualityMonitoringGoodsList[i].tousseName; + var amount = qualityMonitoringGoodsList[i].amount; + var orderNumber = qualityMonitoringGoodsList[i].orderNumber; + var isRecycle = qualityMonitoringGoodsList[i].isRecycle; + var isRePacking = qualityMonitoringGoodsList[i].isRepacking; + addExtractCheckTousse(tousseName,barcode,tousseInstanceId,amount,orderNumber,isRecycle,isRePacking); + } + } +} +//监测范围是材料,加载材料信息 +function loadMaterialMsg(qualityMonitoringGoodsList){ + if(qualityMonitoringGoodsList == null || qualityMonitoringGoodsList == '' || qualityMonitoringGoodsList.length == 0){ + return ; + } + for(var i = 0 ;i < qualityMonitoringGoodsList.length ;i++){ + if(i == 0){ + var mateialName = qualityMonitoringGoodsList[i].material; + var amount = qualityMonitoringGoodsList[i].amount; + var position = qualityMonitoringGoodsList[i].position; + Ext.getCmp('material').setValue(mateialName); + Ext.getCmp('materialAmount').setValue(amount); + Ext.getCmp('position').setValue(position); + }else{ + var mateialName = qualityMonitoringGoodsList[i].material; + var amount = qualityMonitoringGoodsList[i].amount; + var orderNumber = qualityMonitoringGoodsList[i].orderNumber; + var position = qualityMonitoringGoodsList[i].position; + // 添加抽检器械和数量 + addExtractCheckMaterial(true,mateialName,amount,position,orderNumber); + } + } +} + +/** + * 整炉的时候设置“重新回收”和“重新装配”两个选项. + * @param qualityMonitoringInstance 质量监测记录对象 + */ +function setIsRecycleAndIsRepackingForWholeFurnace(qualityMonitoringInstance) { + if (qualityMonitoringInstance.isAllTousseOfSterile == '是') { //是整炉 + if('是'==qualityMonitoringInstance.isRecycle){ + Ext.getCmp('isRecycle').setValue(qualityMonitoringInstance.isRecycle); + Ext.getCmp('isRepacking').setValue('否'); + + Ext.getCmp('recycle').setValue(true); + Ext.getCmp('repacking').setValue(false); + }else if('是'==qualityMonitoringInstance.isRepacking){ + Ext.getCmp('isRecycle').setValue('否'); + Ext.getCmp('isRepacking').setValue(qualityMonitoringInstance.isRepacking); + + Ext.getCmp('recycle').setValue(false); + Ext.getCmp('repacking').setValue(true); + }else{ + Ext.getCmp('isRecycle').setValue('否'); + Ext.getCmp('isRepacking').setValue('否'); + Ext.getCmp('recycle').setValue(false); + Ext.getCmp('repacking').setValue(false); + } + } +} + + +//监测范围是器械包和材料,加载器械包和材料信息 +function loadMateriaAndTousselMsg(qualityMonitoringInstance, qualityMonitoringGoodsList){ + setIsRecycleAndIsRepackingForWholeFurnace(qualityMonitoringInstance); + + if(qualityMonitoringGoodsList == null || qualityMonitoringGoodsList == '' || qualityMonitoringGoodsList.length == 0){ + return ; + } + for(var i = 0 ;i < qualityMonitoringGoodsList.length ;i++){ + var orderNumber = qualityMonitoringGoodsList[i].orderNumber; + if(orderNumber == 1){ + // 第一个是器械包 + var barcode = qualityMonitoringGoodsList[i].barcode; + var tousseInstanceId = qualityMonitoringGoodsList[i].tousseInstanceId; + var tousseName = qualityMonitoringGoodsList[i].tousseName; + var amount = qualityMonitoringGoodsList[i].amount; + Ext.getCmp('tousseInstanceId').setValue(tousseInstanceId); + Ext.getCmp('tempBarcode').setValue(barcode); + Ext.getCmp('tousseName').setValue(tousseName); + Ext.getCmp('tousseAmount').setValue(amount); + if('是'==qualityMonitoringGoodsList[i].isRecycle){ + Ext.getCmp('isRecycle').setValue(qualityMonitoringGoodsList[i].isRecycle); + Ext.getCmp('isRepacking').setValue('否'); + + Ext.getCmp('recycle').setValue(true); + Ext.getCmp('repacking').setValue(false); + }else if('是'==qualityMonitoringGoodsList[i].isRepacking){ + Ext.getCmp('isRecycle').setValue('否'); + Ext.getCmp('isRepacking').setValue(qualityMonitoringGoodsList[i].isRepacking); + + Ext.getCmp('recycle').setValue(false); + Ext.getCmp('repacking').setValue(true); + }else{ + Ext.getCmp('isRecycle').setValue('否'); + Ext.getCmp('isRepacking').setValue('否'); + Ext.getCmp('recycle').setValue(false); + Ext.getCmp('repacking').setValue(false); + } + }else if(orderNumber == 2){ + var mateialName = qualityMonitoringGoodsList[i].material; + var amount = qualityMonitoringGoodsList[i].amount; + var position = qualityMonitoringGoodsList[i].position; + Ext.getCmp('material').setValue(mateialName); + Ext.getCmp('materialAmount').setValue(amount); + Ext.getCmp('position').setValue(position); + }else { + var tousseName = qualityMonitoringGoodsList[i].tousseName; + var mateialName = qualityMonitoringGoodsList[i].material; + if(tousseName != null && tousseName != ''){ + // 添加器械包 + var barcode = qualityMonitoringGoodsList[i].barcode; + var tousseInstanceId = qualityMonitoringGoodsList[i].tousseInstanceId; + var amount = qualityMonitoringGoodsList[i].amount; + var orderNumber = qualityMonitoringGoodsList[i].orderNumber; + var isRecycle = qualityMonitoringGoodsList[i].isRecycle; + var isRePacking = qualityMonitoringGoodsList[i].isRepacking; + addExtractCheckTousse(tousseName,barcode,tousseInstanceId,amount,orderNumber,isRecycle,isRePacking); + }else if(mateialName != null && mateialName != ''){ + var amount = qualityMonitoringGoodsList[i].amount; + var orderNumber = qualityMonitoringGoodsList[i].orderNumber; + var position = qualityMonitoringGoodsList[i].position; + // 添加抽检器械和数量 + addExtractCheckMaterial(true,mateialName,amount,position,orderNumber); + } + } + } +} + +/** + * 初始化Store. + */ +function initStore(){ + materialDefinitionStore = new Ext.data.Store({ + proxy : new Ext.data.HttpProxy({ + url : WWWROOT + '/disinfectSystem/baseData/materialDefinitionAction!getMaterialDefinitionDataIncludeForeignMD.do?selectType=material', + method : 'POST' + }), + reader : new Ext.data.JsonReader({ + totalProperty : 'totalCount', + root : 'data' + }, [ + {name : 'id',mapping : 'id'}, + {name : 'spelling',mapping : 'spelling'}, + {name : 'name',mapping : 'name'}, + {name : 'count',mapping : 'count'} + ]), + listeners : { + beforeload : function(thiz, options){ + thiz.baseParams['tousseDefinitionId'] = Ext.getCmp('tousseDefinitionId').getValue(); + } + } + }); + materialDefinitionAddStore = new Ext.data.Store({ + proxy : new Ext.data.HttpProxy({ + url : WWWROOT + '/disinfectSystem/baseData/materialDefinitionAction!getMaterialDefinitionDataIncludeForeignMD.do?selectType=material', + method : 'POST' + }), + reader : new Ext.data.JsonReader({ + totalProperty : 'totalCount', + root : 'data' + }, [ + {name : 'id',mapping : 'id'}, + {name : 'spelling',mapping : 'spelling'}, + {name : 'name',mapping : 'name'}, + {name : 'count',mapping : 'count'} + ]) + }); + tousseDefinitionStore = new Ext.data.Store({ + proxy : new Ext.data.HttpProxy({ + url : WWWROOT + '/disinfectSystem/baseData/tousseDefinitionAction!getTousseAndDiposableGoodsData.do?type='+encodeURI('器械包和外来器械包'), + method : 'POST' + }), + reader : new Ext.data.JsonReader({ + totalProperty : 'totalCount', + root : 'data' + }, [ + {name : 'id',mapping : 'id'}, + {name : 'spelling',mapping : 'spelling'}, + {name : 'name',mapping : 'name'}, + {name : 'displayName',mapping : 'displayName'}, + {name : 'amount',mapping : 'amount'}] + ) + }); + + formDefinitionStore = new Ext.data.Store({ + proxy : new Ext.data.HttpProxy({ + url : WWWROOT + '/disinfectSystem/qualityMonitoringDefinitionAction!loadLastDeployFormDefinitionGroupByFormName.do', + method : 'POST' + }), + baseParams:{formType : qmFormType}, + reader : new Ext.data.JsonReader({ + root : 'data' + },[ + {name : 'id'}, + {name : 'name'} + ] + ), + listeners:{ + load:function(store,records) { + if( otherPartAddQM == true ){ + if(records.length>0) { + Ext.getCmp('formName').setValue(records[0].data.name); + addQualityMonitoringItem(records[0].data.id,records[0].data.name); + Ext.getCmp("formDefinitionId").setValue(records[0].data.id); + Ext.getCmp("name").setValue(records[0].data.name); + }else{ + // 没有找到监测项 + Ext.getCmp('formName').setValue(''); + } + } + // 加载监测项对所选的项赋初值,只是从其他环节进来执行一次. + otherPartAddQM = false; + } + } + }); + + frequencyStore = new Ext.data.Store({ + proxy : new Ext.data.HttpProxy({ + url : WWWROOT + '/disinfectSystem/sterilization/sterilizationRecordAction!getFrequency.do?', + method : 'POST' + }), + baseParams:{sterilizerDate : ""}, + reader : new Ext.data.JsonReader({ + root : 'data' + },[ + {name : 'value'}, + ] + ) + }); +} + +/** + * 创建质量监测实例的表单. + * @param id 质量监测实例id + * @returns {Ext.FormPanel} + */ +function getFormPanelContent(id){ + initStore(); + if(recycleQM == true){ + disableShowImageButton = true; + } + var varibaleContent1; + var varibaleContent2; + // 责任环节带出监测项 + if(sstsConfig.hasOwnProperty('responsibilityPartBringInspectItem') && sstsConfig.responsibilityPartBringInspectItem){ + varibaleContent1 = getResponsibilityPartContent(id); + varibaleContent2 = getInspectItemContent(id); + }else{ + varibaleContent1 = getInspectItemContent(id); + varibaleContent2 = getResponsibilityPartContent(id); + } + formPanel = new Ext.FormPanel({ + id : 'addQualityMonitoringForm', + frame : true, + labelSeparator : ':', + bodyStyle : 'padding:5px 5px 0px 5px', + width : 630, + height : 500, + labelAlign : 'right', + buttonAlign : 'center', + //autoScroll : true, + bodyStyle : 'overflow-x:hidden; overflow-y:scroll', + items : [{ + id:'baseInfoPanel', + layout : 'column', + xtype:"fieldset", //定义类别为fieldset + title:"基本信息", + autoHeight:true, + items : [ + {xtype: 'hidden',name: 'id',id: 'id'}, //质量监测实例id + {xtype: 'hidden',name: 'tousseInstanceId',id: 'tousseInstanceId'}, //第一个包实例id + {xtype: 'hidden',name: 'tousseDefinitionId',id: 'tousseDefinitionId'}, //第一个包定义id + {xtype: 'hidden',name: 'tousseType',id: 'tousseType'}, //第一个器械包类型 + {xtype: 'hidden',name: 'barcodeForQuality',id: 'barcodeForQuality'}, //第一个器械包条码 + {xtype: 'hidden',name: 'isRecycle',id: 'isRecycle'}, //第一个是否重新回收 + {xtype: 'hidden',name: 'isRepacking',id: 'isRepacking'}, //第一个是否重新装配 + {xtype: 'hidden',name: 'scope',id: 'scope'}, //监测范围 + {xtype: 'hidden',name: 'type',id: 'type',value : parm_s_type}, //监测类型:“质量监测” + {xtype: 'hidden',name: 'name',id: 'name'}, //质量监测实例名称 + {xtype: 'hidden',name: 'optionAmount',id: 'optionAmount'}, //监测项元素id集合(用分号分隔) + {xtype: 'hidden',name: 'uploadImgIds',id: 'uploadImgIds'}, + {xtype: 'hidden',name: 'containerBarcode',id: 'containerBarcode'}, + {xtype: 'hidden',name: 'tousseDefRecycling',id: 'tousseDefRecycling'}, //第一个器械包是否需要回收 + {xtype: 'hidden',name: 'formDefinitionId',id: 'formDefinitionId'}, //质量监测定义id + {xtype: 'hidden',name: 'isAllTousseOfSterile',id: 'isAllTousseOfSterile'}, //是否整炉 + {xtype: 'hidden',name: 'errorDamageQmKey',id: 'errorDamageQmKey'}, + + varibaleContent1, + varibaleContent2, + { + layout : 'form', + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'datefieldWithMin', + fieldLabel : '抽检时间', + id : 'dateTime', + name : 'dateTime', +// value : new Date(), + editable : false, + format : 'Y-m-d H:i', + altFormats:'Y-m-d|Y-n-j|y-n-j|y-m-j|y-m-d|y-n-d|Y-n-d|Y-m-j|Ymd|Ynj|ynj|ymj|ymd|ynd|Ynd|Ymj|Y/m/d|Y/n/j|y/n/j|y/m/j|y/m/d|y/n/d|Y/n/d|Y/m/j', + allowBlank : false, + anchor : '95%' + }] + }, { + layout : 'form', + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'textfield', + name : 'createUserName', + id : 'createUserName', + fieldLabel : "登记人", + anchor : '95%', + readOnly : true, + value : userName + }] + },{ + layout : 'form', + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'textfield', + name : 'responsiblePersonBarcode', + id : 'responsiblePersonBarcode', + fieldLabel : "扫描责任人条码", + listeners : { + specialkey : function(field,e){ + if(e.getKey() == 13){ + var barcodeValue = field.getValue(); + Ext.getCmp("responsiblePersonBarcode").setValue(''); + loadResponPersonByBarcode(barcodeValue); + } + } + }, + anchor : '95%' + }] + },{ + layout : 'form', + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'textfield', + name : 'responsiblePerson', + id : 'responsiblePerson', + fieldLabel : "责任人", + anchor : '95%' + }] + },{ + id:'insertBasket', + name:'insertBasket', + layout : 'form', + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'textfield', + name : 'scanBarcode', + id : 'scanBarcode', + fieldLabel : "清洗篮筐条码", + listeners : { + specialkey : function(field,e){ + if(e.getKey() == 13){ + var barcodeValue = field.getValue(); + Ext.getCmp("scanBarcode").setValue(''); + ContainerTableManager.getBasketByBarcodeAndProcedures(barcodeValue,basketAllowProcedure,function(jsonStr){ + var obj = Ext.util.JSON.decode(jsonStr); + if(obj.success){ + Ext.getCmp('containerName').setValue(obj.containerName); + }else{ + showResultQM(obj.message); + } + Ext.getCmp("containerBarcode").setValue(barcodeValue); + }); + } + } + }, + anchor : '95%' + }] + },{ + id:'containerNameItem', + name:'containerNameItem', + layout : 'form', + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'textfield', + name : 'containerName', + id : 'containerName', + fieldLabel : "清洗篮筐名称", + readOnly:true, + allowBlank:true, + anchor : '95%' + }] + },{ + layout : 'form', + columnWidth : 1, + labelWidth : 90, + items : [ { + xtype : 'textarea', + name : 'remark', + id : 'remark', + width : 150, + height : 50, + fieldLabel : "备注", + anchor : '97%' + }] + },{ + layout : 'column', + columnWidth : 1, + labelWidth : 90, + items : [ + { + layout : 'form', + columnWidth : 0.8, + labelWidth : 90, + items : [ + { + xtype : 'textfield', + name : 'uploadImage', + id : 'uploadImage', + fieldLabel : "上传图片", + anchor : '100%' + } + ] + }, + { + layout : 'form', + columnWidth : 0.08, + labelWidth : 90, + items : [ + { xtype:'button', + text : '上传', + handler : function(){ + if(id == null || id == ''){ + showResultQM("请先保存后再上传图片!"); + }else{ + uploadWindowA(imageType_qualitymonitoring,id); + } + } + } + ] + }, + { + layout : 'form', + columnWidth : 0.12, + labelWidth : 90, + items : [ + { xtype:'button', + text : '预览', + disabled:disableShowImageButton, + iconCls : 'btn_ext_application_search', + handler : function(){ + showUploadImageWin(id); + } + } + ] + } + ] + }] + }], + buttons : [{ + id : 'addExtractCheckTousse', + text : '添加抽检器械包', + handler : function(){ + addExtractCheckTousse(); + } + },{ + id : 'addExtractCheckMaterial', + text : '添加抽检器械', + handler : function(){ + addExtractCheckMaterial(); + } + },{ + id : 'saveBtn', + text : '   保存    ', + handler : function(){ + saveQualityMonitoring(this,materialDefinitionStore,false); + } + },{ + id : 'saveAndCreateBtn', + text : '保存并新建', + handler : function(){ + saveQualityMonitoring(this,materialDefinitionStore,true); + } + }, { + text : '   取消    ', + id : 'saveAndNewBtn', + handler : cancelQualityMonitoring + }] + }); + formPanel.add({ + id : 'tousseInfoFieldSet', + xtype:"fieldset", + labelAlign :'left', + title:"器械包信息", +// layout:'column', + autoHeight:true, + items:[{ + layout : 'column', + columnWidth : .5, + labelWidth : 90, + id:'setLayout', + items : [{ + layout : 'form', + columnWidth : 1, + labelWidth : 90, + items : [{ + id : 'allTousseOfSterile', + name : 'allTousseOfSterile', + fieldLabel : '是否整炉', + xtype : 'checkbox', + inputValue : '是否整炉', + listeners:{ + check:function( thiz, checked ){ + if(checked){ + Ext.getCmp('isAllTousseOfSterile').setValue('是'); + }else{ + Ext.getCmp('isAllTousseOfSterile').setValue('否'); + } + updateControlStatus(); + } + } + }] + },{ + layout : 'form', + columnWidth : .5, + id : 'recycleC', + labelWidth : 90, + items : [{ + id : 'recycle', + name : 'recycle', + fieldLabel : '重新回收', + xtype : 'checkbox', + inputValue : '重新回收', + listeners:{ + check:function( thiz, checked ){ + if(checked){ + Ext.getCmp('isRecycle').setValue('是'); + Ext.getCmp('repacking').setValue(false); + }else{ + Ext.getCmp('isRecycle').setValue('否'); + } + } + } + }] + },{ + layout : 'form', + columnWidth : .5, + id : 'repackingC', + labelWidth : 90, + items : [{ + id : 'repacking', + name : 'repacking', + fieldLabel : '重新装配', + xtype : 'checkbox', + inputValue : '重新装配', + listeners:{ + check:function( thiz, checked ){ + if(checked){ + Ext.getCmp('isRepacking').setValue('是'); + Ext.getCmp('recycle').setValue(false); + }else{ + Ext.getCmp('isRepacking').setValue('否'); + } + } + } + }] + + },{ + layout : 'column', + columnWidth : 1, + labelWidth : 90, + id: 'tosseAndMaterial', + items : [{ + layout : 'form', + id : 'tousseBarcodeC', + labelWidth : 90, + columnWidth : .5, + items : [{ + xtype : 'textfield', + name : 'tempBarcode', + id : 'tempBarcode', + fieldLabel : "器械包条码", + listeners : { + specialkey : function(field,e){ + if(e.getKey() == 13){ + getTousseInstanceNameAndResponsiblePerson(field.getValue(), Ext.getCmp('formDefinitionId').getValue(), materialDefinitionStore); + field.setValue(''); + } + } + }, + anchor : '95%' + }] + },{ + layout : 'form', + id : 'tousseNameC', + labelWidth : 90, + columnWidth : .5, + items : [{ + xtype : 'combo', + id : 'tousseName', + name : 'tousseName', + fieldLabel : '器械包名称', + queryParam : 'spell', + minChars : 0, + valueField : 'name', + displayField : 'name', + store : tousseDefinitionStore, + forceSelection : true, + lazyInit : true, + triggerAction : 'all', + hideTrigger : true, + typeAhead : false, + anchor : '95%', + listeners : { + select : function(combo, record, index) { + combo.setValue(record.data.name); + Ext.getCmp('tousseDefinitionId').setValue(record.data.id); + //加载责任人 + + }, + blur : function(field){ + if(!Ext.getCmp('tousseName').getRawValue()){ + Ext.getCmp('tousseDefinitionId').setValue(''); + } + //重新加载包内的材料 + materialDefinitionStore.reload(); + } + } + }] + },{ + layout : 'form', + id : 'tousseAmountC', + labelWidth : 90, + columnWidth : .51, + items : [{ + xtype : 'numberfield', + allowDecimals : false, + name : 'tousseAmount', + id : 'tousseAmount', + fieldLabel : "器械包数量", + allowBlank : true, + blankText : '数量不能为空', + anchor : '95%' + }] + },{ + layout : 'form', + id : 'materialC', + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'combo', + id : 'material', + name : 'material', + fieldLabel : '抽检器械', + queryParam : 'spell', + minChars : 0, + valueField : 'id', + displayField : 'name', + store : materialDefinitionStore, + forceSelection : true, + lazyInit : true, + triggerAction : 'all', + hideTrigger : true, + typeAhead : false, + anchor : '95%', + listeners : { + select : function(combo, record, index) { + combo.setValue(record.data.name); + } + } + }] + },{ + layout : 'form', + id : 'materialAmountC', + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'numberfield', + allowDecimals : false, + name : 'materialAmount', + id : 'materialAmount', + fieldLabel : "器械数量", + allowBlank : true, + blankText : '数量不能为空', + anchor : '95%' + }] + },{ + layout : 'form', + hidden : !(qualityMonitoringWRRecordID > 0 && (sstsConfig.hasOwnProperty('haveRinserPosition')) && sstsConfig.haveRinserPosition), + id : 'basketBarcodeC', + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'textfield', + name : 'basketBarcodeForQuality', + id : 'basketBarcodeForQuality', + fieldLabel : "篮筐条码", + anchor : '95%', + listeners : { + specialkey : function(field,e){ + if(e.getKey() == 13){ + var idName = field.getId().replace("basketBarcodeForQuality","position"); + getPostionByBasketBarcode(field.getValue(),idName); + field.setValue(''); + } + } + } + }] + },{ + layout : 'form', + hidden : !(qualityMonitoringWRRecordID > 0 && (sstsConfig.hasOwnProperty('haveRinserPosition')) && sstsConfig.haveRinserPosition), + id : 'positionC', + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'textfield', + name : 'position', + id : 'position', + editable : false, + fieldLabel : "位置", + anchor : '95%' + }] + }] + }] + }] + }); + formPanel.add({ + id : 'sterilizationRecordInfo', + xtype:"fieldset", + labelAlign :'left', + title:"灭菌记录信息", + autoHeight:true, + items:[{ + layout : 'column', + columnWidth : .5, + labelWidth : 90, + id:'setLayout', + items : [{ + layout : 'form', + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'datefieldWithMin', + fieldLabel : '灭菌日期', + id : 'srDateTime', + name : 'srDateTime', + editable : false, + format : 'Y-m-d', + altFormats:'Y-m-d|Y-n-j|y-n-j|y-m-j|y-m-d|y-n-d|Y-n-d|Y-m-j|Ymd|Ynj|ynj|ymj|ymd|ynd|Ynd|Ymj|Y/m/d|Y/n/j|y/n/j|y/m/j|y/m/d|y/n/d|Y/n/d|Y/m/j', + allowBlank : true, + anchor : '95%', + listeners : { + select : function() { + // this.value 2017-2-2 + Ext.getCmp('sterilizerFre').setValue(""); + frequencyStore.baseParams.sterilizerDate = this.value; + var name = Ext.getCmp('sterilizerName').getValue(); + frequencyStore.baseParams.sterilizerName = name; + frequencyStore.load(); + } + } + }] + },{ + layout : 'form', + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'combo', + id : 'sterilizerName', + name : 'sterilizerName', + fieldLabel : '灭菌炉号', + queryParam : 'spell', + minChars : 0, + valueField : 'name', + displayField : 'name', + store : new Ext.data.SimpleStore({ + fields : [ 'name' ], + url : WWWROOT + '/disinfectSystem/baseData/sterilizerAction!getAllSterilizer.do?' + }), + forceSelection : true, + lazyInit : true, + triggerAction : 'all', + hideTrigger : false, + typeAhead : false, + anchor : '95%', + listeners : { + select : function(combo, record, index) { + // record.data.name 选择的值 + Ext.getCmp('sterilizerFre').setValue(""); + frequencyStore.baseParams.sterilizerName = record.data.name; + var date = Ext.getCmp('srDateTime').getRawValue(); + frequencyStore.baseParams.sterilizerDate = date; + frequencyStore.load(); + } + } + }] + },{ + layout : 'form', + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'combo', + id : 'sterilizerFre', + name : 'sterilizerFre', + fieldLabel : '炉次', + queryParam : 'spell', + minChars : 0, + valueField : 'value', + displayField : 'value', + store : frequencyStore, + forceSelection : true, + lazyInit : true, + triggerAction : 'all', + hideTrigger : false, + typeAhead : false, + anchor : '95%' + }] + }] + }] + }); + return formPanel; +} +function recycleAddQualityMonitoringDo(errorDamageQmKey){ + setStartDate(Ext, 'yyyy/MM/dd HH:mm', 'dateTime'); //(设置抽检时间,取服务器时间 cjr) + disableRecycleAndRepacking(); + var responPartName = "回收清点"; + Ext.getCmp('responsibilityPart').setValue(responPartName); + if(sstsConfig.hasOwnProperty('responsibilityPartNotLimitInspect') && sstsConfig.responsibilityPartNotLimitInspect){ + formDefinitionStore.baseParams.responsiblePerson = responPartName; + //formDefinitionStore.baseParams.isNotLimitInspect = "是"; + formDefinitionStore.load(); + }else{ + formDefinitionStore.baseParams.responsiblePerson = responPartName; + formDefinitionStore.load(); + } + if(!isUndefinedOrNullOrEmpty(errorDamageQmKey)){ + Ext.getCmp("errorDamageQmKey").setValue(errorDamageQmKey); + }else{ + Ext.getCmp("errorDamageQmKey").setValue(""); + } +// formDefinitionStore.baseParams.responsiblePerson = "回收清点"; +// formDefinitionStore.load(); +} + +function showResultQM(msg){ + if(recycleQM == true){ + showResultCurPage(msg); + }else{ + showResult(msg); + } +}