Index: ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/godownEntryView.js =================================================================== diff -u -r12738 -r12743 --- ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/godownEntryView.js (.../godownEntryView.js) (revision 12738) +++ ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/godownEntryView.js (.../godownEntryView.js) (revision 12743) @@ -2,6 +2,7 @@ var grid; var batchNumStore; var g_localID = 1;// 为了区分每一个item,增加的ID。 +var entryid = ''; var wareHouseStore = new Ext.data.Store({ proxy : new Ext.data.HttpProxy({ @@ -18,15 +19,12 @@ ]), listeners : { load : function(store,records) { - var id = top.Ext.getCmp('wareHouseId').getValue(); - var name = top.Ext.getCmp('wareHouseName').getValue(); - if(records.length > 0 && (id == null || id == '')){ - id=records[0].data.id; - name = records[0].data.name; + if(records.length > 0 && (entryid == null || entryid == '')){ + var combo = top.Ext.getCmp("wareHouse1"); + // 触发选中事件 + combo.fireEvent('select', combo,records[0],0); } - top.Ext.getCmp('wareHouse1').setValue(id); - top.Ext.getCmp('wareHouseId').setValue(id); - top.Ext.getCmp('wareHouseName').setValue(name); + top.Ext.getCmp("name1").enable(); } } }); @@ -142,6 +140,16 @@ {name : 'producingArea'} ]); +/** + * 设置仓库的id和name的隐藏域的内容 + * @param id + * @param name + */ +function setWareHouseInfo(id,name){ + top.Ext.getCmp('wareHouseId').setValue(id); + top.Ext.getCmp('wareHouseName').setValue(name); +} + function addItems(diposableGoodsID,batchID,name,amount,cost,batchNumber,expDate,supplierName,sterileBatchNumber,manufacturer,certification,identification,producingArea){ if(top.Ext.getCmp('name1').getValue() == null || top.Ext.getCmp('name1').getValue() == ''){ showResult("请填写物品名称!"); @@ -311,6 +319,7 @@ } var selectModel = new top.Ext.grid.CheckboxSelectionModel(); function addGodownEntry(type) { + wareHouseStore.load(); var form = new top.Ext.FormPanel({ id : 'godownEntryForm', frame : true, @@ -392,9 +401,16 @@ width : 100, listeners : { select : function(combo, record, index) { - top.Ext.getCmp('wareHouse1').setValue(record.data.name); - top.Ext.getCmp('wareHouseId').setValue(record.data.id); - top.Ext.getCmp('wareHouseName').setValue(record.data.name); + setWareHouseInfo(record.data.id,record.data.name); + top.Ext.getCmp('wareHouse1').setValue(record.data.id); + //diposableGoodsStore.proxy.extraParams.wareHouseId = record.data.id; + //diposableGoodsStore.proxy.conn.extraParams.spell = top.Ext.getCmp('name1').getValue(); + /*diposableGoodsStore.reload({ + callback:function(e){ + console.log(e); + } + });*/ + top.Ext.getCmp('name1').focus(); }, specialkey : function(field, ee) { @@ -1325,6 +1341,7 @@ editRecord(id); }; function editRecord(id){ + entryid = id; addGodownEntry(); top.Ext.getCmp("serialNum").show(); top.Ext.getCmp('godownEntryForm').form.load({ @@ -1334,9 +1351,9 @@ params : {id : id}, success : function(form, action) { top.Ext.getCmp("time").setValue(Ext.util.Format.date(new Date(action.result.data.time.time), 'Y-m-d H:i')); - top.Ext.getCmp("wareHouseId").setValue(action.result.data.wareHouseId); - top.Ext.getCmp("wareHouseName").setValue(action.result.data.wareHouseName); - wareHouseStore.load(); + setWareHouseInfo(action.result.data.wareHouseId,action.result.data.wareHouseName); + top.Ext.getCmp("wareHouse1").setValue(action.result.data.wareHouseId); + for(var i = 0 ;i < action.result.data.itemsList.length ;i++){ var specification = action.result.data.itemsList[i].diposableGoods.specification; var b = true; @@ -1429,7 +1446,6 @@ iconCls : 'btn_ext_application_add', handler : function() { addGodownEntry('insert'); - wareHouseStore.load(); } }, '-', { text : '修改',