Fisheye: Tag 27541 refers to a dead (removed) revision in file `ssts-web/src/main/webapp/disinfectsystem/routineMonitoring/routineMonitoringForm.js'. Fisheye: No comparison available. Pass `N' to diff? Index: ssts-web/src/main/webapp/disinfectsystem/packing/packingView.jsp =================================================================== diff -u -r27527 -r27541 --- ssts-web/src/main/webapp/disinfectsystem/packing/packingView.jsp (.../packingView.jsp) (revision 27527) +++ ssts-web/src/main/webapp/disinfectsystem/packing/packingView.jsp (.../packingView.jsp) (revision 27541) @@ -277,11 +277,6 @@ var foreignDefaultLabelpaper = '<%=request.getAttribute("foreignDefaultLabelpaper")%>'; var projectName = '<%=request.getAttribute("projectName")%>'; var parm_s_type ="质量监测"; -var routineMonitoring_type ="定期监测"; -var formType_routineMonitoring = '<%=FormDefinition.FOMRTYPE_PERIODICMONITORING%>'; -var formType_qualityMonitoring = '<%=FormDefinition.FOMRTYPE_QUALITYMONITORING%>'; -var moduleNameArr2 = new Array("<%=QualityMonitoringDefinition.QUALITYMONITORING_MODULE_NAME_RECYCLING%>","<%=QualityMonitoringDefinition.QUALITYMONITORING_MODULE_NAME_WASH%>","<%=QualityMonitoringDefinition.QUALITYMONITORING_MODULE_NAME_PACKING%>","<%=QualityMonitoringDefinition.QUALITYMONITORING_MODULE_NAME_REVIEW%>","<%=QualityMonitoringDefinition.QUALITYMONITORING_MODULE_NAME_STERILIZATION%>","<%=QualityMonitoringDefinition.QUALITYMONITORING_MODULE_NAME_INVOICE%>","<%=QualityMonitoringDefinition.QUALITYMONITORING_MODULE_NAME_USERECORD%>","<%=QualityMonitoringDefinition.QUALITYMONITORING_MODULE_NAME_ROXYDISINFECTION%>","<%=QualityMonitoringDefinition.QUALITYMONITORING_MODULE_NAME_INFECTIONPART%>","<%=QualityMonitoringDefinition.QUALITYMONITORING_MODULE_NAME_OTHERPART%>"); - //回收记录 var taskType_recyclingRecord = '<%=PackingTask.TASK_RECYCLINGRECORD%>'; //申请单 @@ -341,11 +336,6 @@ SSTS_SystemWarning_TousseGoods_delete = false; -var SSTS_RoutineMonitoring_Create = true; - -SSTS_RoutineMonitoring_Create = false; - - //回收报损 var LINKTYPE_RECYCLINGRECORD = '<%=RecyclingDamageItem.LINKTYPE_RECYCLINGRECORD%>'; //清洗报损 @@ -439,7 +429,6 @@ var jobType_wrapper_name = wrapper; var qmFormType = '<%=FormDefinition.FOMRTYPE_QUALITYMONITORING%>'; -var formType_routineMonitoring = '<%=FormDefinition.FOMRTYPE_PERIODICMONITORING%>'; //教学图片 var teachingPicture = false; if (notInWhiteList(sstsConfig, 'teachingPicture')) { @@ -504,10 +493,6 @@ .script("${ctx }/dwr/interface/QualityMonitoringInstanceTableManager.js") .script("${ctx}/disinfectsystem/qualitymonitoring/qualitymonitoringInstanceForm.js") .script("${ctx}/dwr/interface/IDCardDefinitionTableManager.js") - - - .script("${ctx}/disinfectsystem/routineMonitoring/routineMonitoringForm.js") - .script("rePrintBarcodeWin.js") Index: ssts-web/src/main/webapp/disinfectsystem/washanddisinfectmanager/washanddisinfectrecord/washAndDisinfectView.jsp =================================================================== diff -u -r27527 -r27541 --- ssts-web/src/main/webapp/disinfectsystem/washanddisinfectmanager/washanddisinfectrecord/washAndDisinfectView.jsp (.../washAndDisinfectView.jsp) (revision 27527) +++ ssts-web/src/main/webapp/disinfectsystem/washanddisinfectmanager/washanddisinfectrecord/washAndDisinfectView.jsp (.../washAndDisinfectView.jsp) (revision 27541) @@ -75,35 +75,13 @@ SSTS_DamageRecord_Create = false; -var SSTS_RoutineMonitoring_Create = true; - -SSTS_RoutineMonitoring_Create = false; - - -var SSTS_RoutineMonitoring_Delete = true; - -SSTS_RoutineMonitoring_Delete = false; - - -var SSTS_RoutineMonitoring_Review = true; - -SSTS_RoutineMonitoring_Review = false; - - -var SSTS_RoutineMonitoring_Return = true; - -SSTS_RoutineMonitoring_Return = false; - - var enableEditBtn = false; var enableSaveBtn = false; var enableSaveAndNewBtn = false; //清洗方式 start var washMachine = '<%=WashAndDisinfectRecord.WASHINGMODE_MACHINE%>'; var washManual = '<%=WashAndDisinfectRecord.WASHINGMODE_MANUAL%>'; var moduleNameArr = new Array("<%=QualityMonitoringDefinition.QUALITYMONITORING_MODULE_NAME_RECYCLING%>","<%=QualityMonitoringDefinition.QUALITYMONITORING_MODULE_NAME_WASH%>","<%=QualityMonitoringDefinition.QUALITYMONITORING_MODULE_NAME_PACKING%>","<%=QualityMonitoringDefinition.QUALITYMONITORING_MODULE_NAME_REVIEW%>","<%=QualityMonitoringDefinition.QUALITYMONITORING_MODULE_NAME_STERILIZATION%>","<%=QualityMonitoringDefinition.QUALITYMONITORING_MODULE_NAME_INVOICE%>","<%=QualityMonitoringDefinition.QUALITYMONITORING_MODULE_NAME_USERECORD%>","<%=QualityMonitoringDefinition.QUALITYMONITORING_MODULE_NAME_ROXYDISINFECTION%>","<%=QualityMonitoringDefinition.QUALITYMONITORING_MODULE_NAME_INFECTIONPART%>","<%=QualityMonitoringDefinition.QUALITYMONITORING_MODULE_NAME_OTHERPART%>"); -var moduleNameArr2 = new Array("<%=QualityMonitoringDefinition.QUALITYMONITORING_MODULE_NAME_RECYCLING%>","<%=QualityMonitoringDefinition.QUALITYMONITORING_MODULE_NAME_WASH%>","<%=QualityMonitoringDefinition.QUALITYMONITORING_MODULE_NAME_PACKING%>","<%=QualityMonitoringDefinition.QUALITYMONITORING_MODULE_NAME_REVIEW%>","<%=QualityMonitoringDefinition.QUALITYMONITORING_MODULE_NAME_STERILIZATION%>","<%=QualityMonitoringDefinition.QUALITYMONITORING_MODULE_NAME_INVOICE%>","<%=QualityMonitoringDefinition.QUALITYMONITORING_MODULE_NAME_USERECORD%>","<%=QualityMonitoringDefinition.QUALITYMONITORING_MODULE_NAME_ROXYDISINFECTION%>","<%=QualityMonitoringDefinition.QUALITYMONITORING_MODULE_NAME_INFECTIONPART%>","<%=QualityMonitoringDefinition.QUALITYMONITORING_MODULE_NAME_OTHERPART%>"); - var PACKAGE_TYPE_FOREIGN = '<%=TousseDefinition.PACKAGE_TYPE_FOREIGN%>'; var PACKAGE_TYPE_SPLIT = '<%=TousseDefinition.PACKAGE_TYPE_SPLIT%>'; //清洗方式 end @@ -116,7 +94,6 @@ var parm_s_type ="质量监测"; -var routineMonitoring_type ="定期监测"; var userName = '<%=request.getAttribute("userName")%>'; //回收报损 var LINKTYPE_RECYCLINGRECORD = '<%=RecyclingDamageItem.LINKTYPE_RECYCLINGRECORD%>'; @@ -135,8 +112,6 @@ //扫描篮筐允许的篮筐状态集合 var basketAllowProcedure = '<%=Container.CONTAINER_STATUS_FREE%>;<%=Container.CONTAINER_STATUS_WASHLOADING%>;<%=Container.CONTAINER_STATUS_WASHED%>;<%=Container.CONTAINER_STATUS_PACKED%>'; var qmFormType = '<%=FormDefinition.FOMRTYPE_QUALITYMONITORING%>'; -var formType_routineMonitoring = '<%=FormDefinition.FOMRTYPE_PERIODICMONITORING%>'; -var formType_qualityMonitoring = '<%=FormDefinition.FOMRTYPE_QUALITYMONITORING%>'; //设备品牌,型号 var changLong = '<%= DeviceInterface.CHANGLONG %>'; var marge = '<%= DeviceInterface.MARGE %>'; @@ -155,8 +130,6 @@ - - 清洗消毒信息 Index: ssts-web/src/main/webapp/disinfectsystem/packing/packingView.js =================================================================== diff -u -r27527 -r27541 --- ssts-web/src/main/webapp/disinfectsystem/packing/packingView.js (.../packingView.js) (revision 27527) +++ ssts-web/src/main/webapp/disinfectsystem/packing/packingView.js (.../packingView.js) (revision 27541) @@ -904,17 +904,17 @@ header: '操作', width : 120, align:'center', - sortable: true, + sortable: true, renderer: function(v,p,record,rowIndex, columnIndex, store){ - var str = ''; + var str = '
'; if(record.get('leaf')){ var taskid = record.get('taskId'); var tousseName = record.get('tousseName'); var tousseID = record.get('tousseID'); var status = record.get('status'); if(!SSTS_PackingTask_Delete){ if(taskid != undefined && taskid != null){ - str += ""; + str += ""; } } if(status == '待装配'){ @@ -948,6 +948,7 @@ } } } + str += '
'; return str; } },{ @@ -2360,37 +2361,28 @@ deletePackingTask(ids); } },"-",{ - text : '报损器械', + text : '添加报损器械', hidden : SSTS_QualityRecord_Create, iconCls : 'btn_ext_application_add', handler : function() { addAndEditRecyclingDamageRecord('', LINKTYPE_PACKINGRECORD); } },"-",{ - text : '丢失器械', + text : '添加丢失器械', //hidden : SSTS_QualityRecord_Create, iconCls : 'btn_ext_application_add', handler : function() { addAndEditRecyclingLostRecord('', LINKTYPE_PACKINGRECORD_ERROR); } },"-",{ - text : '质量监测', + text : '添加质量监测', hidden:SSTS_QualityRecord_Create, iconCls : 'btn_ext_application_add', handler : function() { materialCountRecords = Ext4.getCmp("materialGrid").getSelectionModel().getSelection(); otherPartAddQM = true; addQualityMonitoringByResponPart("清洗消毒"); } -},"-",{ - text : '定期监测', - hidden:SSTS_RoutineMonitoring_Create, - iconCls : 'btn_ext_application_add', - handler : function() { - otherPartAddRM = true; - addRoutineMonitoringByResponPart("清洗消毒",routineMonitoring_type); - //addQualityMonitoringWash(); - } }/* ,"-",{ text : '打印回收清单', hidden:SSTS_RecyclingDetail_Print, Index: ssts-web/src/main/webapp/disinfectsystem/routineMonitoring/routineMonitoringView.js =================================================================== diff -u -r27527 -r27541 --- ssts-web/src/main/webapp/disinfectsystem/routineMonitoring/routineMonitoringView.js (.../routineMonitoringView.js) (revision 27527) +++ ssts-web/src/main/webapp/disinfectsystem/routineMonitoring/routineMonitoringView.js (.../routineMonitoringView.js) (revision 27541) @@ -1,17 +1,2462 @@ var entityName = "定期监测"; var grid; -var typeValue = ""; -var aa = SSTS_RoutineMonitoring_Create; +var routineMonitoringWin = null; +var qualityMonitoringArray = new Array(); +var frequencyStore; + +var qmInstanceStore = new Ext.data.Store({ + proxy : new Ext.data.MemoryProxy([]), + reader : new Ext.data.JsonReader({ + fields : [{ + name : 'id' + },{ + name : 'name' + },{ + name : 'dateTime' + }] + }) +}); + +var goodsRecord = Ext.data.Record.create([ + {name : 'id'}, + {name : 'name'}, + {name : 'dateTime'} +]); + +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'}, + ] + ) +}); + +function removeItem(gridId){ + var gridObj = top.Ext.getCmp(gridId); + var rows = gridObj.getSelectionModel().getSelections(); + if (rows) { + var store = gridObj.getStore(); + for ( var i = 0; i < rows.length; i++) { + store.remove(rows[i]); + } + } +} + +function addQMInstance(id,name,dateTime){ + var isExist = false; + for (var i = 0; i < qmInstanceStore.getCount(); i++) { + var record = qmInstanceStore.getAt(i); + if(record.get('id') == id){ + isExist = true; + break; + } + } + if(!isExist){ + var record = new goodsRecord({ + id : id, + name : name, + dateTime : dateTime + }); + qmInstanceStore.add(record); + }else{ + showResult(name+",已添加!"); + } +} + +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){ + top.Ext.getCmp("hideElement" + triggerItemId).show(); + }else{ + var xtype = top.Ext.getCmp("hideElement" + triggerItemId).getXType(); + if(xtype == 'fieldset'){ + var length = top.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 = top.Ext.getCmp("hideElement" + triggerItemId); + panel.items.each(function(item,index,length){ + item.setValue(""); + }); + } + top.Ext.getCmp("hideElement" + triggerItemId).hide(); + } + } + } + } + } +} + +//返回炉次显示框 +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%' + }] + }; +} +// 返回炉号显示框 +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%' + }] + }; +} + +//返回炉次显示框 质量监测 +function createQualityMonitoringElementSterNameQW(value){ + return { + columnWidth : .5, + layout : 'form', + labelWidth : 90, + items : [{ + xtype : 'textfield', + fieldLabel : '炉次', + maxLength : '30', + id : 'configItemOptionSterNameQW', + name : 'configItemOptionSterNameQW', + allowBlank : true, + readOnly : true, + value : value, + anchor : '95%' + }] + }; +} +// 返回炉号显示框 质量监测 +function createQualityMonitoringElementSterFreQW(value){ + return { + columnWidth : .5, + layout : 'form', + labelWidth : 90, + items : [{ + xtype : 'textfield', + fieldLabel : '炉号', + maxLength : '30', + id : 'configItemOptionSterFreQW', + name : 'configItemOptionSterFreQW', + allowBlank : true, + readOnly: true, + value : value, + anchor : '95%' + }] + }; +} + /** + * 创建监测项的表单元素. + * @param type 表单元素的类型 + * @param id 监测项元素id + * @param name 监测项元素名称 + * @param allowBlank 是否允许为空 + * @param options 单选或者多选的配置项 + * @param value 默认值 + * @param isTriggerItem 触发项 + * @param doNotSetDefaultValue 不设置默认值 //在加载的时候,为true。在新建的时候,不设置(undefined) + * @returns + */ +function createQualityMonitoringItemElement(type,id,name,allowBlank,options,value,isTriggerItem,doNotSetDefaultValue){ + var hideElement = false; + if('是' == isTriggerItem && (value == null || value == "")){ + hideElement = true; + } + if(type == '文本'){ + if((value == null || value == "") && !doNotSetDefaultValue){ + value = options; + } + 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 == '文本框'){ + if((value == null || value == "") && !doNotSetDefaultValue){ + value = options; + } + 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, + 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 = top.Ext.getCmp("triggerItemIds" + id).getValue(); + triggerItemAction(oldTriggerItemIds,"hide"); + triggerItemAction(valueTriggerItemIds,"show"); + top.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 = top.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 addRoutingResultFieldSet(result){ + var qualifiedChecked = true; + var unqualifiedChecked = false; + if(result == '不合格'){ + qualifiedChecked = false; + unqualifiedChecked = true; + } + top.Ext.getCmp('addRoutineMonitoringForm').add({ + id : 'resultFieldSet', + xtype:"fieldset", + labelAlign :'left', + title:"监测结果", + layout:'column', + autoHeight:true, + items:[{ + id : 'resultColumn', + columnWidth : 1, + layout : 'column', + autoHeight : true, + items : [{ + layout : 'form', + columnWidth : 0.5, + labelWidth : 200, + items:[{ + name : 'result', + fieldLabel : '合格', + xtype : 'radio', + checked : qualifiedChecked, + columnWidth : .5, + inputValue : '合格', + listeners : { + check : function(thiz, checked){ + if(checked){ + qmInstanceStore.removeAll(); + top.Ext.getCmp("addQualityMonitoringGrid").hide(); + } + } + } + }] + },{ + layout : 'form', + columnWidth : 0.5, + labelWidth : 200, + items:[{ + name : 'result', + fieldLabel : '不合格', + xtype : 'radio', + checked : unqualifiedChecked, + columnWidth : .5, + inputValue : '不合格', + listeners : { + check : function(thiz, checked){ + if(checked){ + top.Ext.getCmp("addQualityMonitoringGrid").show(); + } + } + } + }] + }] + }] + }); + + + var cm = new top.Ext.grid.ColumnModel([{ + id:'id', + name:'id', + hidden :true, + dataIndex : 'id' + },{ + id : 'name', + header : "监测项名称", + width:180, + menuDisabled: true, + dataIndex : 'name' + },{ + id : 'dateTime', + header : "录入时间", + width:120, + menuDisabled: true, + dataIndex : 'dateTime' + },{ + id : 'deleteItem', + header:'删除', + menuDisabled: true, + dataIndex:'button', + renderer: function(v,p,record,index){ + var itemid = record.get("id"); + return ""; + } + }]); + + var tbar = [{ + text : '添加质量监测', + handler:function(){ + addQualityMonitoring(""); + } + }]; + + top.Ext.getCmp('addRoutineMonitoringForm').add({ + id : 'addQualityMonitoringGrid', + xtype:"fieldset", + labelAlign :'left', + title:"添加质量监测", + hidden:true, + layout:'column', + autoHeight:true, + items:[{ + columnWidth : 1, + items : [ + new top.Ext.grid.GridPanel({ + id:'qmGridPanel', + store : qmInstanceStore, + cm : cm, + width : 620, + height: 120, + tbar:tbar, + viewConfig: { + forceFit:true + }, + bodyStyle : 'border:1px solid #afd7af', + anchor : '100%', + autoExpandColumn : 'deleteItem' + }) + ] + }] + }); +} + +/** + * 选择监测项下拉框的某个选项时调用(定期监测不合格是添加的质量监测). + * @param formId + */ +function addQualityMonitoringItem(formId){ + 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){ + top.Ext.getCmp('scope2').setValue(result.data.scope); + top.Ext.getCmp('optionAmount2').setValue(''); + var items = new Array(); + if(sstsConfig.hasOwnProperty('isInspectScopeHideTousseMsg') && sstsConfig.isInspectScopeHideTousseMsg){ + if('无' == result.data.scope){ + hideQualityMonitoringTousseMsg(); + }else{ + showQualityMonitoringTousseMsg(); + } + } + + // 如果显示炉次炉号,添加表单 + if(result.data.showSterilizerNumFrequency == '是'){ + items.push(createQualityMonitoringElementSterNameQW('')); + items.push(createQualityMonitoringElementSterFreQW('')); + } + for(var i = 0 ; i< result.data.items.length ; i++){ + var item = result.data.items[i]; + if(top.Ext.getCmp('optionAmount2').getValue() == null || top.Ext.getCmp('optionAmount2').getValue() == ''){ + top.Ext.getCmp('optionAmount2').setValue(item.id); + }else{ + top.Ext.getCmp('optionAmount2').setValue(top.Ext.getCmp('optionAmount2').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%' + }); + } + } + + top.Ext.getCmp('addQualityMonitoringForm').remove('itemsFieldSet2'); + if(items.length > 0){ + top.Ext.getCmp('addQualityMonitoringForm').add({ + id : 'itemsFieldSet2', + xtype:"fieldset", + labelAlign :'left', + title:"监测项", + layout:'column', + autoHeight:true, + items:items + }); + } + + top.Ext.getCmp('addQualityMonitoringForm').doLayout(); + if(top.Ext.getCmp('itemsFieldSet2')){ + top.Ext.getCmp('itemsFieldSet2').doLayout(); + } + } + }, + failure : function(response, options) { + showResult('系统加载出错,请稍候再试'); + } + }); + +} + +/** + * 定期监测失败后添加的质量监测. + * qmInstanceId + */ +function addQualityMonitoring(qmInstanceId) { + var materialDefinitionStore = new Ext.data.Store({ + proxy : new Ext.data.HttpProxy({ + url : WWWROOT + '/disinfectSystem/baseData/materialDefinitionAction!getMaterialDefinitionData.do', + 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'] = top.Ext.getCmp('tousseDefinitionId2').getValue(); + } + } + }); + + var 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'}] + ) + }); + + var formDefinitionStore = new Ext.data.Store({ + proxy : new Ext.data.HttpProxy({ + url : WWWROOT + '/disinfectSystem/qualityMonitoringDefinitionAction!loadLastDeployFormDefinitionGroupByFormName.do', + method : 'POST' + }), + baseParams:{formType : formType_qualityMonitoring}, + reader : new Ext.data.JsonReader({ + root : 'data' + },[ + {name : 'id'}, + {name : 'name'} + ] + ), + listeners:{ + load:function(store,records) { + if(records.length>0) { + top.Ext.getCmp('formName2').setValue(records[0].data.name); + addQualityMonitoringItem(records[0].data.id,records[0].data.name); + top.Ext.getCmp("formDefinitionId2").setValue(records[0].data.id); + top.Ext.getCmp("name2").setValue(records[0].data.name); + }else{ + // 没有找到监测项 + top.Ext.getCmp('formName2').setValue(''); + } + } + } + }); + + var formPanel = new top.Ext.FormPanel({ + id : 'addQualityMonitoringForm', + frame : true, + labelSeparator : ':', + bodyStyle : 'padding:5px 5px 0px 5px', + width : 600, + height : 500, + labelAlign : 'right', + buttonAlign : 'center', + autoScroll : true, + items : [{ + layout : 'column', + xtype:"fieldset", //定义类别为fieldset + title:"基本信息", + autoHeight:true, + items : [{ + xtype : 'hidden', + name : 'id', + id : 'id2' + },{ + xtype : 'hidden', + name : 'tousseInstanceId', + id : 'tousseInstanceId2' + },{ + xtype : 'hidden', + name : 'tousseDefinitionId', + id : 'tousseDefinitionId2' + },{ + xtype : 'hidden', + name : 'formDefinitionId', + id : 'formDefinitionId2' + },{ + xtype : 'hidden', + name : 'barcode', + id : 'barcode2' + },{ + xtype : 'hidden', + name : 'scope', + id : 'scope2' + },{ + xtype : 'hidden', + name : 'type', + id : 'type2', + value : '质量监测' + },{ + xtype : 'hidden', + name : 'name', + id : 'name2', + value : '质量监测' + },{ + xtype : 'hidden', + name : 'optionAmount', + id : 'optionAmount2' + },{ + layout : 'form', + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'combo', + id : 'formName2', + name : 'formName', + queryParam : 'spell', + fieldLabel : '监测项', + minChars : 0, + valueField : 'id', + displayField : 'name', + anchor : '95%', + store : formDefinitionStore, + lazyInit : true, + forceSelection : true, + triggerAction : 'all', + hideTrigger : false, + typeAhead : false, + allowBlank : false, + listeners : { + beforequery:function(queryEvent){ + if(qmInstanceId != "" && qmInstanceId != 0){ + return false; + } + }, + beforeselect : function(combo, record, index) { + if(record.data.name != combo.getValue()){ + if(top.Ext.getCmp('barcode2').getValue()){ + getTousseInstanceNameAndResponsiblePerson(top.Ext.getCmp('tempBarcode2').getValue(), combo.getValue(), null,true); + } + } + }, + select : function(combo,record,index){ + top.Ext.getCmp("formDefinitionId2").setValue(combo.getValue()); + top.Ext.getCmp("name2").setValue(combo.getRawValue()); + addQualityMonitoringItem(combo.getValue(),combo.getRawValue()); + } + } + }] + }, { + layout : 'form', + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'datefieldWithMin', + fieldLabel : '抽检时间', + id : 'dateTime2', + name : 'dateTime', +// value : new Date(), + editable : false, + format : 'Y-m-d H:i', + allowBlank : false, + anchor : '95%' + }] + }, { + layout : 'form', + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'textfield', + name : 'tempBarcode', + id : 'tempBarcode2', + fieldLabel : "器械包条码", + listeners : { + specialkey : function(field,e){ + if(e.getKey() == 13){ + getTousseInstanceNameAndResponsiblePerson(field.getValue(), top.Ext.getCmp('formDefinitionId2').getValue(), materialDefinitionStore,true); + field.setValue(''); + } + } + }, + anchor : '95%' + }] + }, { + layout : 'form', + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'combo', + id : 'tousseName2', + 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); + top.Ext.getCmp('tousseDefinitionId2').setValue(record.data.id); + //加载责任人 + + }, + blur : function(field){ + if(!top.Ext.getCmp('tousseName2').getRawValue()){ + top.Ext.getCmp('tousseDefinitionId2').setValue(''); + } + //重新加载包内的材料 + materialDefinitionStore.reload(); + } + } + }] + }, { + layout : 'form', + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'combo', + id : 'material2', + 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', + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'numberfield', + allowDecimals : false, + name : 'amount', + id : 'amount2', + fieldLabel : "数量", + anchor : '95%' + }] + },{ + layout : 'form', + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'textfield', + name : 'registerPerson', + id : 'registerPerson2', + fieldLabel : "登记人", + anchor : '95%', + readOnly : true, + value : $Id('userName').value + }] + },{ + layout : 'form', + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'textfield', + name : 'responsiblePerson', + id : 'responsiblePerson2', + fieldLabel : "责任人", + anchor : '95%' + }] + },{ + layout : 'form', + columnWidth : 1, + labelWidth : 90, + items : [ { + xtype : 'textarea', + name : 'remark', + id : 'remark2', + width : 150, + height : 50, + fieldLabel : "备注", + anchor : '97%' + }] + }] + }], + buttons : [{ + id : 'saveBtn2', + text : '保存', + handler : function(){ + saveQualityMonitoring(this,materialDefinitionStore); + } + }, { + text : '取消', + id : 'saveAndNewBtn2', + handler : cancelQualityMonitoring + }] + }); + + qualityMonitoringWin = new top.Ext.Window( { + id : 'qualityMonitoringWin', + layout : 'fit', + title : '质量监测信息', + width : 700, + modal : true, + autoHeight : true, + border : false, + plain : true, + items : [ formPanel ] + }); + qualityMonitoringWin.show(); + if(qmInstanceId != null && qmInstanceId != ''){ + var items = new Array(); + Ext.Ajax.request({ + url : WWWROOT + '/disinfectSystem/qualityMonitoringInstanceAction!loadQualityMonitoringInstance.do', + params : {id : qmInstanceId}, + async : false, + success : function(response,options){ + var result = Ext.decode(response.responseText); + if(result.success){ + top.Ext.getCmp('id2').setValue(qmInstanceId); + top.Ext.getCmp('formName2').setValue(result.data.name); + top.Ext.getCmp('name2').setValue(result.data.name); + top.Ext.getCmp('type2').setValue(result.data.type); + if(result.data.name == "无"){ + top.Ext.getCmp("formDefinitionId2").setValue(0); + }else{ + top.Ext.getCmp("formDefinitionId2").setValue(result.data.formDefinition.id); + } + top.Ext.getCmp('dateTime2').setValue(Ext.util.Format.date(new Date(result.data.dateTime.time),"Y-m-d H:i")); +// top.Ext.getCmp('material2').setValue(result.data.material); +// top.Ext.getCmp('amount2').setValue(result.data.amount); +// var barcode = result.data.barcode; +// if(barcode != null && barcode != ''){ +// top.Ext.getCmp('tousseName2').setValue(result.data.tousseName + "(" + barcode + ")"); +// }else{ +// top.Ext.getCmp('tousseName2').setValue(result.data.tousseName); +// } + loadTousseAndMaterialMsg(result.data.qualityMonitoringGoodsList); +// top.Ext.getCmp('barcode2').setValue(result.data.barcode); + top.Ext.getCmp('scope2').setValue(result.data.scope); + top.Ext.getCmp('responsiblePerson2').setValue(result.data.responsiblePerson); + top.Ext.getCmp('registerPerson2').setValue(result.data.createUserName); +// top.Ext.getCmp('tousseInstanceId2').setValue(result.data.tousseDefinitionId); + top.Ext.getCmp('remark2').setValue(result.data.remark); + top.Ext.getCmp('optionAmount2').setValue(''); + if(sstsConfig.hasOwnProperty('isInspectScopeHideTousseMsg') && sstsConfig.isInspectScopeHideTousseMsg){ + if('无' == result.data.scope){ + hideQualityMonitoringTousseMsg(); + }else{ + showQualityMonitoringTousseMsg(); + } + } + + // 如果显示炉次炉号,添加表单 + if(result.showSterNameAndFre == '是'){ + items.push(createQualityMonitoringElementSterNameQW(result.data.sterilizerName)); + items.push(createQualityMonitoringElementSterFreQW(result.data.sterilizerFrequency)); + } + for(var i = 0 ; i < result.data.items.length ; i++){ + var item = result.data.items[i].definitionItem; + if(top.Ext.getCmp('optionAmount2').getValue() == null || top.Ext.getCmp('optionAmount2').getValue() == ''){ + top.Ext.getCmp('optionAmount2').setValue(item.id); + }else{ + top.Ext.getCmp('optionAmount2').setValue(top.Ext.getCmp('optionAmount2').getValue()+';'+item.id); + } + var allowBlank = item.requirement == '必填'?false:true; + items.push(createQualityMonitoringItemElement(item.type,item.id,item.name,allowBlank,item.optionsJson,result.data.items[i].showAnswer,item.isTriggerItem)); + if(item.type == '多选'){ + items.push({ + columnWidth : 1, + xtype : "label", + html : ' ', + anchor : '95%' + }); + } + } + + top.Ext.getCmp('addQualityMonitoringForm').remove('itemsFieldSet2'); + if(items.length > 0){ + top.Ext.getCmp('addQualityMonitoringForm').add({ + id : 'itemsFieldSet2', + xtype:"fieldset", + labelWidth :400, + labelAlign :'left', + title:"监测项", + layout:'column', + autoHeight:true, + items:items + }); + } + top.Ext.getCmp('addQualityMonitoringForm').doLayout(); + if(top.Ext.getCmp('itemsFieldSet2')){ + top.Ext.getCmp('itemsFieldSet2').doLayout(); + } + } + }, + failure : function(response, options) { + showResult('系统加载出错,请稍候再试'); + } + }); + }else{ + setStartDate(top.Ext, 'yyyy/MM/dd HH:mm', 'dateTime2'); //(设置抽检时间,取服务器时间 cjr) + top.Ext.getCmp('amount2').setValue(1); + formDefinitionStore.load(); + } +} +// 打开定期监测,加载包和材料的信息 +function loadRoutineMonitoringTousseAndMaterialMsg(qualityMonitoringGoodsList){ + if(qualityMonitoringGoodsList == null || qualityMonitoringGoodsList == '' || qualityMonitoringGoodsList.length == 0){ + return ; + } + var length = qualityMonitoringGoodsList.length; + if(length == 1){ + // 只有包或者材料 + var tousseName = qualityMonitoringGoodsList[0].tousseName; + if(isUndefinedOrNullOrEmpty(tousseName)){ + //是材料信息 + var material = qualityMonitoringGoodsList[0].material; + var amount = qualityMonitoringGoodsList[0].amount; + top.Ext.getCmp('material').setValue(material); + top.Ext.getCmp('amount').setValue(amount); + }else{ + // 是包信息 + var barcode = qualityMonitoringGoodsList[0].barcode; + var tousseInstanceId = qualityMonitoringGoodsList[0].tousseInstanceId; + var tousseName = qualityMonitoringGoodsList[0].tousseName; + var amount = qualityMonitoringGoodsList[0].amount; + var isRecycle = qualityMonitoringGoodsList[0].isRecycle; + var isRepacking = qualityMonitoringGoodsList[0].isRepacking; + top.Ext.getCmp('barcode').setValue(barcode); + top.Ext.getCmp('tousseInstanceId').setValue(tousseInstanceId); + top.Ext.getCmp('tousseName').setValue(tousseName); + top.Ext.getCmp('tempBarcode').setValue(barcode); + top.Ext.getCmp('amount').setValue(amount); + if('是'==isRecycle){ + top.Ext.getCmp('isRecycle').setValue(isRecycle); + top.Ext.getCmp('isRepacking').setValue('否'); + + top.Ext.getCmp('recycle').setValue(true); + top.Ext.getCmp('repacking').setValue(false); + }else if('是'==isRepacking){ + top.Ext.getCmp('isRecycle').setValue('否'); + top.Ext.getCmp('isRepacking').setValue(isRepacking); + + top.Ext.getCmp('recycle').setValue(false); + top.Ext.getCmp('repacking').setValue(true); + }else{ + top.Ext.getCmp('isRecycle').setValue('否'); + top.Ext.getCmp('isRepacking').setValue('否'); + top.Ext.getCmp('recycle').setValue(false); + top.Ext.getCmp('repacking').setValue(false); + } + } + }else if(length == 2){ + // 第一个是包,第二个是材料 + var barcode = qualityMonitoringGoodsList[0].barcode; + var tousseInstanceId = qualityMonitoringGoodsList[0].tousseInstanceId; + var tousseName = qualityMonitoringGoodsList[0].tousseName; + var isRecycle = qualityMonitoringGoodsList[0].isRecycle; + var isRepacking = qualityMonitoringGoodsList[0].isRepacking; + var amount = qualityMonitoringGoodsList[1].amount; + var material = qualityMonitoringGoodsList[1].material; + top.Ext.getCmp('material').setValue(material); + top.Ext.getCmp('barcode').setValue(barcode); + top.Ext.getCmp('tousseInstanceId').setValue(tousseInstanceId); + top.Ext.getCmp('tousseName').setValue(tousseName); + top.Ext.getCmp('tempBarcode').setValue(barcode); + top.Ext.getCmp('amount').setValue(amount); + if('是'==isRecycle){ + top.Ext.getCmp('isRecycle').setValue(isRecycle); + top.Ext.getCmp('isRepacking').setValue('否'); + + top.Ext.getCmp('recycle').setValue(true); + top.Ext.getCmp('repacking').setValue(false); + }else if('是'==isRepacking){ + top.Ext.getCmp('isRecycle').setValue('否'); + top.Ext.getCmp('isRepacking').setValue(isRepacking); + + top.Ext.getCmp('recycle').setValue(false); + top.Ext.getCmp('repacking').setValue(true); + }else{ + top.Ext.getCmp('isRecycle').setValue('否'); + top.Ext.getCmp('isRepacking').setValue('否'); + top.Ext.getCmp('recycle').setValue(false); + top.Ext.getCmp('repacking').setValue(false); + } + } +} + +//打开质量监测记录,加载包和材料信息 +function loadTousseAndMaterialMsg(qualityMonitoringGoodsList){ + if(qualityMonitoringGoodsList == null || qualityMonitoringGoodsList == '' || qualityMonitoringGoodsList.length == 0){ + return ; + } + var length = qualityMonitoringGoodsList.length; + if(length == 1){ + // 只有包或者材料 + var tousseName = qualityMonitoringGoodsList[0].tousseName; + if(isUndefinedOrNullOrEmpty(tousseName)){ + //是材料信息 + var material = qualityMonitoringGoodsList[0].material; + var amount = qualityMonitoringGoodsList[0].amount; + top.Ext.getCmp('material2').setValue(material); + top.Ext.getCmp('amount2').setValue(amount); + }else{ + // 是包信息 + var barcode = qualityMonitoringGoodsList[0].barcode; + var tousseInstanceId = qualityMonitoringGoodsList[0].tousseInstanceId; + var tousseName = qualityMonitoringGoodsList[0].tousseName; + var amount = qualityMonitoringGoodsList[0].amount; + top.Ext.getCmp('barcode2').setValue(barcode); + top.Ext.getCmp('tousseInstanceId2').setValue(tousseInstanceId); + if(!isUndefinedOrNullOrEmpty(barcode)){ + tousseName += "(" + barcode + ")"; + } + top.Ext.getCmp('tousseName2').setValue(tousseName); + top.Ext.getCmp('amount2').setValue(amount); + } + }else if(length == 2){ + // 第一个是包,第二个是材料 + var barcode = qualityMonitoringGoodsList[0].barcode; + var tousseInstanceId = qualityMonitoringGoodsList[0].tousseInstanceId; + var tousseName = qualityMonitoringGoodsList[0].tousseName; + var amount = qualityMonitoringGoodsList[1].amount; + var material = qualityMonitoringGoodsList[1].material; + top.Ext.getCmp('material2').setValue(material); + top.Ext.getCmp('barcode2').setValue(barcode); + top.Ext.getCmp('tousseInstanceId2').setValue(tousseInstanceId); + if(!isUndefinedOrNullOrEmpty(barcode)){ + tousseName += "(" + barcode + ")"; + } + top.Ext.getCmp('tousseName2').setValue(tousseName); + top.Ext.getCmp('amount2').setValue(amount); + } +} + + +/** + * 隐藏定期监测的质量监测记录的器械包信息 + */ +function hideQualityMonitoringTousseMsg(){ + top.Ext.getCmp('tempBarcode2').setVisible(false); + top.Ext.getCmp('tempBarcode2').getEl().up('.x-form-item').setDisplayed(false); + top.Ext.getCmp('tousseName2').setVisible(false); + top.Ext.getCmp('tousseName2').getEl().up('.x-form-item').setDisplayed(false); + top.Ext.getCmp('material2').setVisible(false); + top.Ext.getCmp('material2').getEl().up('.x-form-item').setDisplayed(false); + top.Ext.getCmp('amount2').setVisible(false); + top.Ext.getCmp('amount2').getEl().up('.x-form-item').setDisplayed(false); +} +/** + * 显示定期监测的质量监测记录的器械包信息 + */ +function showQualityMonitoringTousseMsg(){ + top.Ext.getCmp('tempBarcode2').setVisible(true); + top.Ext.getCmp('tempBarcode2').getEl().up('.x-form-item').setDisplayed(true); + top.Ext.getCmp('tousseName2').setVisible(true); + top.Ext.getCmp('tousseName2').getEl().up('.x-form-item').setDisplayed(true); + top.Ext.getCmp('material2').setVisible(true); + top.Ext.getCmp('material2').getEl().up('.x-form-item').setDisplayed(true); + top.Ext.getCmp('amount2').setVisible(true); + top.Ext.getCmp('amount2').getEl().up('.x-form-item').setDisplayed(true); +} + +/** + * 选择监测项下拉框的某个选项时调用 + */ +function addRoutineMonitoringItem(formId){ + 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){ + top.Ext.getCmp('optionAmount').setValue(''); + var items = new Array(); + // 如果显示炉次炉号,添加表单 + if(result.data.showSterilizerNumFrequency == '是'){ + items.push(createQualityMonitoringElementSterName('')); + items.push(createQualityMonitoringElementSterFre('')); + } + //需要增加判空处理防止js报错 + if(result.data){ + top.Ext.getCmp('scope').setValue(result.data.scope); + if('器械包' == result.data.scope){ + top.Ext.getCmp("tousseName").setVisible(true); + top.Ext.getCmp("tousseName").getEl().up('.x-form-item').setDisplayed(true); + top.Ext.getCmp('tempBarcode').setVisible(true); + top.Ext.getCmp('tempBarcode').getEl().up('.x-form-item').setDisplayed(true); + top.Ext.getCmp("material").setVisible(false); + top.Ext.getCmp("material").getEl().up('.x-form-item').setDisplayed(false); + top.Ext.getCmp('amount').setVisible(true); + top.Ext.getCmp('amount').getEl().up('.x-form-item').setDisplayed(true); + top.Ext.getCmp('recycle').setVisible(true); + top.Ext.getCmp('recycle').getEl().up('.x-form-item').setDisplayed(true); + top.Ext.getCmp('repacking').setVisible(true); + top.Ext.getCmp('repacking').getEl().up('.x-form-item').setDisplayed(true); + top.Ext.getCmp('sterilizationRecordInfo').setVisible(false); + }else if('材料' == result.data.scope){ + top.Ext.getCmp("tousseName").setVisible(false); + top.Ext.getCmp("tousseName").getEl().up('.x-form-item').setDisplayed(false); + top.Ext.getCmp('tempBarcode').setVisible(false); + top.Ext.getCmp('tempBarcode').getEl().up('.x-form-item').setDisplayed(false); + top.Ext.getCmp("material").setVisible(true); + top.Ext.getCmp("material").getEl().up('.x-form-item').setDisplayed(true); + top.Ext.getCmp('amount').setVisible(true); + top.Ext.getCmp('amount').getEl().up('.x-form-item').setDisplayed(true); + top.Ext.getCmp('recycle').setVisible(false); + top.Ext.getCmp('recycle').getEl().up('.x-form-item').setDisplayed(false); + top.Ext.getCmp('repacking').setVisible(false); + top.Ext.getCmp('repacking').getEl().up('.x-form-item').setDisplayed(false); + top.Ext.getCmp('sterilizationRecordInfo').setVisible(false); + }else if(result.data.scope == "材料和器械包"){ + showTousseAndMaterialMsg(); + top.Ext.getCmp('sterilizationRecordInfo').setVisible(false); + }else if(result.data.scope == "无"){ + if(sstsConfig.hasOwnProperty('isInspectScopeHideTousseMsg') && sstsConfig.isInspectScopeHideTousseMsg){ + hideTousseAndMaterialMsg(); + }else{ + showTousseAndMaterialMsg(); + } + top.Ext.getCmp('sterilizationRecordInfo').setVisible(false); + }else if(result.data.scope == "灭菌炉记录"){ + hideTousseAndMaterialMsg(); + top.Ext.getCmp('sterilizationRecordInfo').setVisible(true); + } + for(var i = 0 ; i< result.data.items.length ; i++){ + var item = result.data.items[i]; + if(top.Ext.getCmp('optionAmount').getValue() == null || top.Ext.getCmp('optionAmount').getValue() == ''){ + top.Ext.getCmp('optionAmount').setValue(item.id); + }else{ + top.Ext.getCmp('optionAmount').setValue(top.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%' + }); + } + } + } + + top.Ext.getCmp('addRoutineMonitoringForm').remove('itemsFieldSet'); + top.Ext.getCmp('addRoutineMonitoringForm').remove('resultFieldSet'); + if(items.length > 0){ + top.Ext.getCmp('addRoutineMonitoringForm').add({ + id : 'itemsFieldSet', + xtype:"fieldset", + labelAlign :'left', + title:"监测项", + layout:'column', + autoHeight:true, + items:items + }); + } + + addRoutingResultFieldSet(); + + top.Ext.getCmp('addRoutineMonitoringForm').doLayout(); + if(top.Ext.getCmp('itemsFieldSet')){ + top.Ext.getCmp('itemsFieldSet').doLayout(); + } + + if(top.Ext.getCmp('resultFieldSet')){ + top.Ext.getCmp('resultFieldSet').doLayout(); + } + resetRecycleAndRepackingValue(); + } + }, + failure : function(response, options) { + showResult('系统加载出错,请稍候再试'); + } + }); + +} + +/** + * 添加或者修改定期监测实例. + * @param id + */ +function addRoutineMonitoring(id) { + var materialDefinitionStore = new Ext.data.Store({ + proxy : new Ext.data.HttpProxy({ + url : WWWROOT + '/disinfectSystem/baseData/materialDefinitionAction!getMaterialDefinitionData.do', + 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'] = top.Ext.getCmp('tousseDefinitionId').getValue(); + } + } + }); + + var tousseDefinitionStore = new Ext.data.Store({ + proxy : new Ext.data.HttpProxy({ + url : WWWROOT + '/disinfectSystem/baseData/tousseDefinitionAction!getTousseAndDiposableGoodsData.do', + 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'}] + ) + }); + + var formDefinitionStore = new Ext.data.Store({ + proxy : new Ext.data.HttpProxy({ + url : WWWROOT + '/disinfectSystem/qualityMonitoringDefinitionAction!loadLastDeployFormDefinitionGroupByFormName.do', + method : 'POST' + }), + baseParams:{formType : formType_routineMonitoring}, + reader : new Ext.data.JsonReader({ + root : 'data' + },[ + {name : 'id'}, + {name : 'name'} + ] + ), + listeners:{ + load:function(store,records) { + if(records.length>0) { + top.Ext.getCmp('formName').setValue(records[0].data.name); + addRoutineMonitoringItem(records[0].data.id); + top.Ext.getCmp("formDefinitionId").setValue(records[0].data.id); + top.Ext.getCmp("name").setValue(records[0].data.name); + }else{ + // 没有找到监测项 + top.Ext.getCmp('formName').setValue(''); + } + } + } + }); + + var formPanel = new top.Ext.FormPanel({ + id : 'addRoutineMonitoringForm', + frame : true, + labelSeparator : ':', + bodyStyle : 'padding:5px 5px 0px 5px', + width : 600, + height : 500, + labelAlign : 'right', + buttonAlign : 'center', + autoScroll : true, + items : [{ + layout : 'column', + xtype:"fieldset", //定义类别为fieldset + title:"基本信息", + autoHeight:true, + items : [{ + xtype : 'hidden', + name : 'id', + id : 'id' + },{ + xtype : 'hidden', + name : 'tousseInstanceId', + id : 'tousseInstanceId' + },{ + xtype : 'hidden', + name : 'tousseDefinitionId', + id : 'tousseDefinitionId' + },{ + xtype : 'hidden', + name : 'tousseType', + id : 'tousseType' + },{ + xtype : 'hidden', + name : 'barcode', + id : 'barcode' + },{ + xtype : 'hidden', + name : 'scope', + id : 'scope' + },{ + xtype : 'hidden', + name : 'type', + id : 'type', + value : $Id('parm_s_type').value + },{ + xtype : 'hidden', + name : 'name', + id : 'name' + },{ + xtype : 'hidden', + name : 'optionAmount', + id : 'optionAmount' + },{ + xtype : 'hidden', + name : 'qualityMonitoringItems', + id : 'qualityMonitoringItems' + },{ + xtype:'hidden', + name:'isRecycle', + id:'isRecycle' + },{ + xtype:'hidden', + name:'tousseDefRecycling', + id:'tousseDefRecycling' + },{ + xtype : 'hidden', + name : 'formDefinitionId', + id : 'formDefinitionId' + },{ + xtype:'hidden', + name:'isRepacking', + id:'isRepacking' + },{ + layout : 'form', + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'combo', + id : 'formName', + name : 'formName', + queryParam : 'spell', + fieldLabel : '监测项', + minChars : 0, + valueField : 'id', + displayField : 'name', + anchor : '95%', + store : formDefinitionStore, + lazyInit : true, + forceSelection : true, + triggerAction : 'all', + hideTrigger : false, + typeAhead : false, + allowBlank : false, + listeners : { + beforequery:function(queryEvent){ + if(id != "" && id != 0){ + return false; + } + }, + select : function(combo,record,index){ + top.Ext.getCmp("formDefinitionId").setValue(combo.getValue()); + top.Ext.getCmp("name").setValue(combo.getRawValue()); + addRoutineMonitoringItem(combo.getValue()); + } + } + }] + }, { + layout : 'form', + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'datefieldWithMin', + fieldLabel : '监测时间', + id : 'dateTime', + name : 'dateTime', +// value : new Date(), + editable : false, + 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', + format : 'Y-m-d H:i', + allowBlank : false, + anchor : '95%' + }] + },{ + layout : 'form', + columnWidth : .5, + labelWidth : 90, + items : [{ + id : 'recycle', + name : 'recycle', + fieldLabel : '重新回收', + xtype : 'checkbox', + inputValue : '重新回收', + listeners:{ + check:function( thiz, checked ){ + if(checked){ + top.Ext.getCmp('isRecycle').setValue('是'); + top.Ext.getCmp('repacking').setValue(false); + }else{ + top.Ext.getCmp('isRecycle').setValue('否'); + } + } + } + }] + },{ + layout : 'form', + columnWidth : .5, + labelWidth : 90, + items : [{ + id : 'repacking', + name : 'repacking', + fieldLabel : '重新装配', + xtype : 'checkbox', + inputValue : '重新装配', + listeners:{ + check:function( thiz, checked ){ + if(checked){ + top.Ext.getCmp('isRepacking').setValue('是'); + top.Ext.getCmp('recycle').setValue(false); + }else{ + top.Ext.getCmp('isRepacking').setValue('否'); + } + } + } + }] + },{ + layout : 'form', + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'textfield', + name : 'tempBarcode', + id : 'tempBarcode', + fieldLabel : "器械包条码", + listeners : { + specialkey : function(field,e){ + if(e.getKey() == 13){ + getTousseInstanceNameAndResponsiblePerson(field.getValue(), top.Ext.getCmp('formDefinitionId').getValue(), materialDefinitionStore,false); + field.setValue(''); + } + } + }, + anchor : '95%' + }] + }, { + layout : 'form', + columnWidth : .5, + labelWidth : 90, + 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); + top.Ext.getCmp('tousseDefinitionId').setValue(record.data.id); + //加载责任人 + + }, + blur : function(field){ + if(!top.Ext.getCmp('tousseName').getRawValue()){ + top.Ext.getCmp('tousseDefinitionId').setValue(''); + } + //重新加载包内的材料 + materialDefinitionStore.reload(); + } + } + }] + }, { + layout : 'form', + 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', + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'numberfield', + allowDecimals : false, + name : 'amount', + id : 'amount', + fieldLabel : "数量", + anchor : '95%' + }] + }, { + layout : 'form', + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'textfield', + name : 'createUserName', + id : 'createUserName', + fieldLabel : "登记人", + anchor : '95%', + readOnly : true, + value : $Id('userName').value + }] + },{ + layout : 'form', + columnWidth : .5, + labelWidth : 90, + items : [{ + xtype : 'textfield', + name : 'reviewer', + id : 'reviewer', + fieldLabel : "审核员", + anchor : '95%' + }] + },{ + layout : 'form', + columnWidth : 1, + labelWidth : 90, + items : [ { + xtype : 'textarea', + name : 'remark', + id : 'remark', + width : 150, + height : 50, + fieldLabel : "备注", + anchor : '97%' + }] + }] + }], + buttons : [{ + id : 'saveBtn11', + text : '保存', + handler : function(){ + saveRoutineMonitoring(this); + } + }, { + text : '取消', + id : 'saveAndNewBtn', + handler : cancelRoutineMonitoring + }] + }); + + 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 + top.Ext.getCmp('sterilizerFre').setValue(""); + frequencyStore.baseParams.sterilizerDate = this.value; + var name = top.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 选择的值 + top.Ext.getCmp('sterilizerFre').setValue(""); + frequencyStore.baseParams.sterilizerName = record.data.name; + var date = top.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%' + }] + }] + }] + }); + + routineMonitoringWin = new top.Ext.Window( { + id : 'routineMonitoringWin', + layout : 'fit', + title : '定期监测信息', + width : 700, + modal : true, + autoHeight : true, + border : false, + plain : true, + items : [ formPanel ] + }); + routineMonitoringWin.show(); + if(id != null && id != ''){ + top.Ext.getCmp('formName').addClass("fieldReadOnlyNoRemove"); + Ext.Ajax.request({ + url : WWWROOT + '/disinfectSystem/qualityMonitoringInstanceAction!loadQualityMonitoringInstance.do', + params : {id : id}, + success : function(response,options){ + var result = Ext.decode(response.responseText); + if(result.success){ + if(result.data.status == '已审核'){ + top.Ext.getCmp('saveBtn11').hide(); + } + top.Ext.getCmp('id').setValue(result.data.id); + top.Ext.getCmp('formName').setValue(result.data.name); + top.Ext.getCmp('formName').setEditable(false); + top.Ext.getCmp('name').setValue(result.data.name); + top.Ext.getCmp('type').setValue(result.data.type); + top.Ext.getCmp('srDateTime').setValue(result.data.sterilizerDate); + top.Ext.getCmp('sterilizerName').setValue(result.data.sterilizerName); + top.Ext.getCmp('sterilizerFre').setValue(result.data.sterilizerFrequency); + if(result.data.name == "无"){ + top.Ext.getCmp("formDefinitionId").setValue(0); + }else{ + top.Ext.getCmp("formDefinitionId").setValue(result.data.formDefinition.id); + } + + top.Ext.getCmp('dateTime').setValue(Ext.util.Format.date(new Date(result.data.dateTime.time),"Y-m-d H:i")); + loadRoutineMonitoringTousseAndMaterialMsg(result.data.qualityMonitoringGoodsList); + top.Ext.getCmp('scope').setValue(result.data.scope); + top.Ext.getCmp('createUserName').setValue(result.data.createUserName); + top.Ext.getCmp('reviewer').setValue(result.data.reviewer); + top.Ext.getCmp('remark').setValue(result.data.remark); + top.Ext.getCmp('optionAmount').setValue(''); + var items = new Array(); + // 如果显示炉次炉号,添加表单 + if(result.showSterNameAndFre == '是'){ + items.push(createQualityMonitoringElementSterName(result.data.sterilizerName)); + items.push(createQualityMonitoringElementSterFre(result.data.sterilizerFrequency)); + } + for(var i = 0 ;i < result.data.items.length ;i++){ + var item = result.data.items[i].definitionItem; + if(top.Ext.getCmp('optionAmount').getValue() == null || top.Ext.getCmp('optionAmount').getValue() == ''){ + top.Ext.getCmp('optionAmount').setValue(item.id); + }else{ + top.Ext.getCmp('optionAmount').setValue(top.Ext.getCmp('optionAmount').getValue()+';'+item.id); + } + var allowBlank = item.requirement == '必填' ? false:true; + var doNotSetDefaultValue = true; + items.push(createQualityMonitoringItemElement(item.type,item.id,item.name,allowBlank,item.optionsJson,result.data.items[i].showAnswer,item.isTriggerItem,doNotSetDefaultValue)); + if(item.type == '多选'){ + items.push({ + columnWidth : 1, + xtype : "label", + html : ' ', + anchor : '95%' + }); + } + } + + if('器械包' == result.data.scope){ + top.Ext.getCmp("tousseName").setVisible(true); + top.Ext.getCmp("tousseName").getEl().up('.x-form-item').setDisplayed(true); + top.Ext.getCmp('tempBarcode').setVisible(true); + top.Ext.getCmp('tempBarcode').getEl().up('.x-form-item').setDisplayed(true); + top.Ext.getCmp("material").setVisible(false); + top.Ext.getCmp("material").getEl().up('.x-form-item').setDisplayed(false); + top.Ext.getCmp('amount').setVisible(true); + top.Ext.getCmp('amount').getEl().up('.x-form-item').setDisplayed(true); + top.Ext.getCmp('recycle').setVisible(true); + top.Ext.getCmp('recycle').getEl().up('.x-form-item').setDisplayed(true); + top.Ext.getCmp('repacking').setVisible(true); + top.Ext.getCmp('repacking').getEl().up('.x-form-item').setDisplayed(true); + top.Ext.getCmp('sterilizationRecordInfo').setVisible(false); + }else if('材料' == result.data.scope){ + top.Ext.getCmp("tousseName").setVisible(false); + top.Ext.getCmp("tousseName").getEl().up('.x-form-item').setDisplayed(false); + top.Ext.getCmp('tempBarcode').setVisible(false); + top.Ext.getCmp('tempBarcode').getEl().up('.x-form-item').setDisplayed(false); + top.Ext.getCmp("material").setVisible(true); + top.Ext.getCmp("material").getEl().up('.x-form-item').setDisplayed(true); + top.Ext.getCmp('amount').setVisible(true); + top.Ext.getCmp('amount').getEl().up('.x-form-item').setDisplayed(true); + top.Ext.getCmp('recycle').setVisible(false); + top.Ext.getCmp('recycle').getEl().up('.x-form-item').setDisplayed(false); + top.Ext.getCmp('repacking').setVisible(false); + top.Ext.getCmp('repacking').getEl().up('.x-form-item').setDisplayed(false); + top.Ext.getCmp('sterilizationRecordInfo').setVisible(false); + }else if(result.data.scope == "材料和器械包"){ + showTousseAndMaterialMsg(); + top.Ext.getCmp('sterilizationRecordInfo').setVisible(false); + }else if(result.data.scope == "无"){ + if(sstsConfig.hasOwnProperty('isInspectScopeHideTousseMsg') && sstsConfig.isInspectScopeHideTousseMsg){ + hideTousseAndMaterialMsg(); + }else{ + showTousseAndMaterialMsg(); + } + top.Ext.getCmp('sterilizationRecordInfo').setVisible(false); + }else if(result.data.scope == "灭菌炉记录"){ + hideTousseAndMaterialMsg(); + top.Ext.getCmp('sterilizationRecordInfo').setVisible(true); + } + top.Ext.getCmp('addRoutineMonitoringForm').remove('itemsFieldSet'); + if(items.length > 0){ + top.Ext.getCmp('addRoutineMonitoringForm').add({ + id : 'itemsFieldSet', + xtype:"fieldset", + labelWidth :400, + labelAlign :'left', + title:"监测项", + layout:'column', + autoHeight:true, + items:items + }); + } + + addRoutingResultFieldSet(result.data.result); + top.Ext.getCmp('addRoutineMonitoringForm').doLayout(); + if(top.Ext.getCmp('itemsFieldSet')){ + top.Ext.getCmp('itemsFieldSet').doLayout(); + } + + if(top.Ext.getCmp('resultFieldSet')){ + top.Ext.getCmp('resultFieldSet').doLayout(); + } + qmInstanceStore.removeAll(); + var monitorings = result.data.qualityMonitorings; + if(monitorings != null && monitorings.length > 0){ + top.Ext.getCmp("addQualityMonitoringGrid").show(); + for(var j = 0 ; j < monitorings.length ; j++){ + var qmForRoutine = monitorings[j]; + var tmpDateTime = Ext.util.Format.date(new Date(qmForRoutine.dateTime.time),"Y-m-d H:i"); + addQMInstance(qmForRoutine.id,qmForRoutine.name,tmpDateTime); + } + } + //打开已有质量监测记录,器械包条码,器械包名称,重新回收和重新装配都禁用掉,不能再修改 + top.Ext.getCmp('recycle').disable(); + top.Ext.getCmp('repacking').disable(); + top.Ext.getCmp('tempBarcode').disable(); + top.Ext.getCmp('tousseName').disable(); + }else{ + showResult("找不到该条码所对应的器械包实例"); + } + }, + failure : function(response, options) { + showResult('系统加载出错,请稍候再试'); + } + }); + }else{ + setStartDate(top.Ext, 'yyyy/MM/dd HH:mm', 'dateTime'); //(设置监测时间,取服务器时间 cjr) + top.Ext.getCmp('amount').setValue(1); + disableRecycleAndRepacking(); + formDefinitionStore.load(); + } +} + +function hideTousseAndMaterialMsg(){ + top.Ext.getCmp('recycle').setVisible(false); + top.Ext.getCmp('recycle').getEl().up('.x-form-item').setDisplayed(false); + top.Ext.getCmp('repacking').setVisible(false); + top.Ext.getCmp('repacking').getEl().up('.x-form-item').setDisplayed(false); + top.Ext.getCmp('tempBarcode').setVisible(false); + top.Ext.getCmp('tempBarcode').getEl().up('.x-form-item').setDisplayed(false); + top.Ext.getCmp('tousseName').setVisible(false); + top.Ext.getCmp('tousseName').getEl().up('.x-form-item').setDisplayed(false); + top.Ext.getCmp('material').setVisible(false); + top.Ext.getCmp('material').getEl().up('.x-form-item').setDisplayed(false); + top.Ext.getCmp('amount').setVisible(false); + top.Ext.getCmp('amount').getEl().up('.x-form-item').setDisplayed(false); +} + +function showTousseAndMaterialMsg(){ + top.Ext.getCmp('material').setVisible(true); + top.Ext.getCmp('material').getEl().up('.x-form-item').setDisplayed(true); + top.Ext.getCmp('amount').setVisible(true); + top.Ext.getCmp('amount').getEl().up('.x-form-item').setDisplayed(true); + top.Ext.getCmp('tempBarcode').setVisible(true); + top.Ext.getCmp('tempBarcode').getEl().up('.x-form-item').setDisplayed(true); + top.Ext.getCmp('recycle').setVisible(true); + top.Ext.getCmp('recycle').getEl().up('.x-form-item').setDisplayed(true); + top.Ext.getCmp('tousseName').setVisible(true); + top.Ext.getCmp('tousseName').getEl().up('.x-form-item').setDisplayed(true); + top.Ext.getCmp('repacking').setVisible(true); + top.Ext.getCmp('repacking').getEl().up('.x-form-item').setDisplayed(true); +} + +/** + * 控制“重新回收”和“重新装配”的复选框的是否可用. + */ +function updateControlStatus(){ + var tousseType = top.Ext.getCmp('tousseType').getValue(); + var tousseInstanceId = top.Ext.getCmp('tousseInstanceId').getValue(); + var toussedefRecycling = top.Ext.getCmp('tousseDefRecycling').getValue(); + + if (isUndefinedOrNullOrEmpty(tousseInstanceId)) { + disableRecycleAndRepacking(); + } else if (tousseType=='外来器械包' + || tousseType=='外来器械拆分小包' + || tousseType == '敷料包' || toussedefRecycling == '否') { + disableRecycleCanRepacking(); + } else { + enableRecycleAndRepacking(); + } +} +/** + * 将重新回收和重新装配及是否整炉设置为未选种状态 + */ +function resetRecycleAndRepackingValue(){ + top.Ext.getCmp('isRecycle').setValue(''); + top.Ext.getCmp('isRepacking').setValue(''); + + top.Ext.getCmp('recycle').setValue(false); + top.Ext.getCmp('repacking').setValue(false); +} +//重置重新回收和重新装配 +function disableRecycleAndRepacking(){ + top.Ext.getCmp('isRecycle').setValue(''); + top.Ext.getCmp('isRepacking').setValue(''); + top.Ext.getCmp('recycle').disable(); + top.Ext.getCmp('repacking').disable(); + + top.Ext.getCmp('recycle').setValue(false); + top.Ext.getCmp('repacking').setValue(false); +} +function enableRecycleAndRepacking(){ + top.Ext.getCmp('recycle').enable(); + top.Ext.getCmp('repacking').enable(); +} + +/** + * 不能重新回收,可以重新装配. + */ +function disableRecycleCanRepacking(){ + top.Ext.getCmp('isRecycle').setValue(''); + top.Ext.getCmp('isRepacking').setValue(''); + top.Ext.getCmp('recycle').disable(); + top.Ext.getCmp('repacking').enable(); + + top.Ext.getCmp('recycle').setValue(false); + top.Ext.getCmp('repacking').setValue(false); +} + + +function getTousseInstanceNameAndResponsiblePerson(tempBarcode, qmDefinitionId, materialDefinitionStore,isQMView){ + 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){ + if(isQMView == true){ + if(tempBarcode != null && tempBarcode != ''){ + top.Ext.getCmp('tousseName2').setValue(result.tousseName + "(" + tempBarcode + ")"); + }else{ + top.Ext.getCmp('tousseName2').setValue(result.tousseName); + } + if( !isUndefinedOrNullOrEmpty(top.Ext.getCmp('configItemOptionSterNameQW')) ){ + // 显示炉次和炉号 + top.Ext.getCmp('configItemOptionSterNameQW').setValue(result.sterilizerName); + top.Ext.getCmp('configItemOptionSterFreQW').setValue(result.sterileFrequency); + } + top.Ext.getCmp('barcode2').setValue(tempBarcode); + top.Ext.getCmp('tousseInstanceId2').setValue(result.tousseInstanceId); + if(result.tousseDefinitionId){ + top.Ext.getCmp('tousseDefinitionId2').setValue(result.tousseDefinitionId); + if(materialDefinitionStore){ + materialDefinitionStore.reload(); + } + }else if(materialDefinitionStore){ + top.Ext.getCmp('tousseDefinitionId2').setValue(''); + } + }else{ + if(tempBarcode != null && tempBarcode != ''){ + top.Ext.getCmp('tousseName').setValue(result.tousseName + "(" + tempBarcode + ")"); + }else{ + top.Ext.getCmp('tousseName').setValue(result.tousseName); + } + top.Ext.getCmp('barcode').setValue(tempBarcode); + top.Ext.getCmp('tousseInstanceId').setValue(result.tousseInstanceId); + top.Ext.getCmp('tousseType').setValue(result.tousseType); + top.Ext.getCmp('tousseDefRecycling').setValue(result.isRecycle); + if( !isUndefinedOrNullOrEmpty(top.Ext.getCmp('configItemOptionSterName')) ){ + // 显示炉次和炉号 + top.Ext.getCmp('configItemOptionSterName').setValue(result.sterilizerName); + top.Ext.getCmp('configItemOptionSterFre').setValue(result.sterileFrequency); + } +// top.Ext.getCmp('responsiblePerson').setValue(result.responsiblePerson); + if(result.tousseDefinitionId){ + top.Ext.getCmp('tousseDefinitionId').setValue(result.tousseDefinitionId); + if(materialDefinitionStore){ + materialDefinitionStore.reload(); + } + }else if(materialDefinitionStore){ + top.Ext.getCmp('tousseDefinitionId').setValue(''); + } + updateControlStatus(); + } + + }else{ +// showResult("找不到该条码所对应的器械包实例"); + showResult(result.message); + } + }, + failure : function(response, options) { + showResult('系统加载出错,请稍候再试'); + } + }); + } +} + +/** + * 保存质量监测实例(定期监测不合格保存的质量监测). + * @param thiz + * @param materialDefinitionStore + */ +function saveQualityMonitoring(thiz,materialDefinitionStore) { + //监测项元素id集合(用分号分隔) + var optionAmount = top.Ext.getCmp('optionAmount2').getValue(); + if (optionAmount) { + var optionAmountArr = optionAmount.split(';'); + for(var i = 0 ; i < optionAmountArr.length ; i++){ + var itemId = optionAmountArr[i]; + if(top.Ext.getCmp('configItemOption'+itemId).getXType() != 'hidden'){ + if(!top.Ext.getCmp('configItemOption'+itemId).isValid()){ + showResult("请正确填写表单各值。"); + return false; + } + }else{ + if(!top.Ext.getCmp('configItemOption'+itemId).hidden && top.Ext.getCmp('configItemOption'+itemId).getValue() == '#@'){ + showResult("请正确填写表单各值。"); + return false; + } + } + + //如果是多选,并且必填,需要单独校验 + var extElement = top.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) { + showResult(extElement.title + "是必填项"); + return false; + } + } + } + } + + var scope = top.Ext.getCmp('scope2').getValue(); + var material = top.Ext.getCmp('material2').getValue(); + var tousseName = top.Ext.getCmp('tousseName2').getRawValue(); + var barcode = top.Ext.getCmp('barcode2').getValue(); + if('无' != scope){ + if(!material && !tousseName){ + showResult("请录入抽验器械或器械包名称"); + return false; + } + } + // 获取质量检测记录的id,如果不为空,说明是打开的记录,不再校验包和材料的数量 + var id2 = top.Ext.getCmp('id2').getValue(); + if(isUndefinedOrNullOrEmpty(id2)){ + if(material){ + var amount = top.Ext.getCmp('amount2').getValue(); + if(!amount || amount < 0){ + showResult('输入的“'+material+'”的数量且不能小于1'); + return false; + } + + if(tousseName){ + var isExist = false; + var count = materialDefinitionStore.getCount(); + for(var i=0;i