Index: ssts-web/src/main/webapp/disinfectsystem/routineMonitoring/routineMonitoringView.js =================================================================== diff -u -r14469 -r14531 --- ssts-web/src/main/webapp/disinfectsystem/routineMonitoring/routineMonitoringView.js (.../routineMonitoringView.js) (revision 14469) +++ ssts-web/src/main/webapp/disinfectsystem/routineMonitoring/routineMonitoringView.js (.../routineMonitoringView.js) (revision 14531) @@ -336,25 +336,28 @@ success : function(response,options){ var result = Ext.decode(response.responseText); if(result.success){ - top.Ext.getCmp('scope').setValue(result.data.scope); top.Ext.getCmp('optionAmount').setValue(''); - var items = new Array(); - for(var i = 0 ; i< result.data.items.length ; i++){ - if(top.Ext.getCmp('optionAmount').getValue() == null || top.Ext.getCmp('optionAmount').getValue() == ''){ - top.Ext.getCmp('optionAmount').setValue(result.data.items[i].id); - }else{ - top.Ext.getCmp('optionAmount').setValue(top.Ext.getCmp('optionAmount').getValue()+';'+result.data.items[i].id); + //需要增加判空处理防止js报错 + if(result.data){ + top.Ext.getCmp('scope').setValue(result.data.scope); + var items = new Array(); + for(var i = 0 ; result.data.items && i< result.data.items.length ; i++){ + if(top.Ext.getCmp('optionAmount').getValue() == null || top.Ext.getCmp('optionAmount').getValue() == ''){ + top.Ext.getCmp('optionAmount').setValue(result.data.items[i].id); + }else{ + top.Ext.getCmp('optionAmount').setValue(top.Ext.getCmp('optionAmount').getValue()+';'+result.data.items[i].id); + } + var allowBlank = result.data.items[i].requirement == '必填'?false:true; + items.push(createQualityMonitoringItemElement(result.data.items[i].type,result.data.items[i].id,result.data.items[i].name,allowBlank,result.data.items[i].options,null)); + if(result.data.items[i].type == '多选'){ + items.push({ + columnWidth : 1, + xtype : "label", + html : ' ', + anchor : '95%' + }); + } } - var allowBlank = result.data.items[i].requirement == '必填'?false:true; - items.push(createQualityMonitoringItemElement(result.data.items[i].type,result.data.items[i].id,result.data.items[i].name,allowBlank,result.data.items[i].options,null)); - if(result.data.items[i].type == '多选'){ - items.push({ - columnWidth : 1, - xtype : "label", - html : ' ', - anchor : '95%' - }); - } } top.Ext.getCmp('addRoutineMonitoringForm').remove('itemsFieldSet');