Index: ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/godownOutView.js =================================================================== diff -u -r12666 -r12744 --- ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/godownOutView.js (.../godownOutView.js) (revision 12666) +++ ssts-web/src/main/webapp/disinfectsystem/assestManagement/godownEntry/godownOutView.js (.../godownOutView.js) (revision 12744) @@ -1,6 +1,7 @@ var entityName = "退库单管理"; var grid; var g_localID = 1;// 为了区分每一个item,增加的ID。 +var entryid = ''; //单价数据源 var priceStore = null; var PriceRecord = null; @@ -72,7 +73,17 @@ {name : 'id',mapping : 'id'}, {name : 'name',mapping : 'name'}, {name : 'orgUnitCode',mapping : 'orgUnitCode'}, - ]) + ]), + listeners : { + load : function(store,records) { + if(records.length > 0 && (entryid == null || entryid == '')){ + var combo = top.Ext.getCmp("wareHouse1"); + // 触发选中事件 + combo.fireEvent('select', combo,records[0],0); + } + top.Ext.getCmp("name1").enable(); + } + } }); var diposableGoodsStore = new Ext.data.Store({ @@ -127,6 +138,16 @@ {name : 'supplierName'} ]); +/** + * 设置仓库的id和name的隐藏域的内容 + * @param id + * @param name + */ +function setWareHouseInfo(id,name){ + top.Ext.getCmp('wareHouseId').setValue(id); + top.Ext.getCmp('wareHouseName').setValue(name); +} + // 获取当前选中的批次 function getSelectedBatch(){ var batchNumber = top.Ext.getCmp('batchNumber1').getValue(); @@ -223,6 +244,7 @@ function addGodownEntry(type) { // 清除表单数据 clearFormData(); + wareHouseStore.load(); var form = new top.Ext.FormPanel({ id : 'godownEntryForm', frame : true, @@ -274,6 +296,14 @@ name : 'originalFormParams', id : 'originalFormParams' },{ + xtype : 'hidden', + name : 'wareHouseId', + id : 'wareHouseId' + },{ + xtype : 'hidden', + name : 'wareHouseName', + id : 'wareHouseName' + },{ id : 'serialNum', columnWidth : .33, layout : 'form', @@ -416,7 +446,8 @@ width : 100, listeners : { select : function(combo, record, index) { - top.Ext.getCmp('wareHouse1').setValue(record.data.name); + setWareHouseInfo(record.data.id,record.data.name); + top.Ext.getCmp('wareHouse1').setValue(record.data.id); top.Ext.getCmp('name1').focus(); }, specialkey : function(field, ee) { @@ -569,6 +600,8 @@ showResult("请选择添加要退库的一次性物品!"); return false; } + // 设置表单参数json + setFormParams(form,['id','remark','time','wareHouseName','wareHouseId']); var items = buildJSONStringFromStore(top.Ext.getCmp('godownEntryItemGrid').getStore()); top.Ext.getCmp("items").setValue(items); // items为json数组字符串,不会为null @@ -692,6 +725,8 @@ success : function(form, action) { var time = action.result.data.time.time; top.Ext.getCmp("time").setValue(Ext.util.Format.date(new Date(time), 'Y-m-d')); + 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; @@ -720,7 +755,7 @@ top.Ext.getCmp('godownEntryItemGrid').getStore().add(godownEntryItem); } // 保存原始数据,只需要保存需要修改的属性 - setOriginalFormParams(form,['id','remark','time']); + setOriginalFormParams(form,['id','remark','time','wareHouseName','wareHouseId']); var originalItems = buildJSONStringFromStore(top.Ext.getCmp('godownEntryItemGrid').getStore()); //alert(originalItems); top.Ext.getCmp("originalItems").setValue(originalItems);