Index: ssts-web/src/main/webapp/disinfectsystem/reportforms/materialStockReportView.js =================================================================== diff -u -r26213 -r26214 --- ssts-web/src/main/webapp/disinfectsystem/reportforms/materialStockReportView.js (.../materialStockReportView.js) (revision 26213) +++ ssts-web/src/main/webapp/disinfectsystem/reportforms/materialStockReportView.js (.../materialStockReportView.js) (revision 26214) @@ -16,10 +16,13 @@ var startDate = $Id('startDate').value; //开始时间 var endDate = $Id('endDate').value;; //结束时间 var warehouseId = Ext.getCmp('warehouse').getValue();//仓库id - if (warehouseId == "") { + if (warehouseId == "" ) { showResult("仓库不能为空!"); return false; } + if (warehouseId == "all") { + warehouseId = ""; + } if (startDate == "" || endDate == "") { showResult("开始日期、结束日期不能为空!"); return false; @@ -66,9 +69,16 @@ ] }); + //仓库store - var warehouseStore = new Ext.data.Store({ - proxy : new Ext.data.HttpProxy({ + var records = Ext.data.Record.create([ + {name : 'id',mapping : 'id'}, + {name : 'name',mapping : 'name'} + ]); + var newRecord = new records({id:"all",name:"全部"}); + + var warehouseStore = new Ext.data.Store({ + proxy : new Ext.data.HttpProxy({ url:WWWROOT + '/disinfectSystem/baseData/wareHouseAction!getWareHouseData.do', method : 'POST' }), @@ -78,15 +88,20 @@ {name : 'id',mapping : 'id'}, {name : 'name',mapping : 'name'} ]), - listeners :{ - load:function(store,record,opts){ - if(record.length > 0) { + autoLoad:true, + listeners:{'load':function(store,record){ + if(record.length > 1){//大于1个仓库才显示全部 + warehouseStore.insert(0,newRecord); + } + if(record.length > 0) { Ext.getCmp('warehouse').setValue(record[0].data.id); } - } - } - }); + } + } + }); warehouseStore.load(); + + var dt = new Date(); var startDayofMonth = dt.getFullYear() + "/" + (dt.getMonth() + 1) + "/1"; @@ -211,7 +226,8 @@ typeAhead : false, allowBlank : true, editable : false, - enableKeyEvents:true + enableKeyEvents:true, + autoLoad : true }] }] }],