Index: ssts-web/src/main/webapp/disinfectsystem/goodsBindingConfig/goodsConfig.js =================================================================== diff -u -r19716 -r21475 --- ssts-web/src/main/webapp/disinfectsystem/goodsBindingConfig/goodsConfig.js (.../goodsConfig.js) (revision 19716) +++ ssts-web/src/main/webapp/disinfectsystem/goodsBindingConfig/goodsConfig.js (.../goodsConfig.js) (revision 21475) @@ -10,65 +10,28 @@ //物品model var goodsModel = [ {name: 'id', mapping: 'id'}, - {name: 'spelling', mapping: 'spelling'}, {name: 'name', mapping: 'name'}, - {name: 'tousseDefinitionID'}, {name: 'type', mapping: 'type'}, {name: 'tousseType', mapping: 'tousseType'}, - {name: 'isApplyEntireTousse', mapping: 'isApplyEntireTousse'}, - {name: 'displayName', mapping: 'displayName'}, - {name: 'amount', mapping: 'amount'}, - {name: 'materials', mapping: 'materials'} + {name: 'displayName', mapping: 'displayName'} ]; - var url = WWWROOT + '/disinfectSystem/baseData/tousseDefinitionAction!searchComboGoodsData.do?'; - //防止ie传进后台变成乱码 - url += encodeURI('tousseType=一次性物品申请单'); - - //物品store - goodsStore = new Ext.data.Store({ - proxy: new Ext.data.HttpProxy({ - url: url, - method: 'POST' - }), - reader: new Ext.data.JsonReader({ - totalProperty: 'totalCount', - root: 'data' - }, goodsModel - ), - listeners: { - beforeload: function () { - if (loadMask) { - loadMask.show(); - } - }, - load: function () { - if (loadMask) { - loadMask.hide(); - } - } - } - }); - - this.getGoodsModel = function () { return this.goodsModel; } - this.getGoodsStore = function () { - return this.goodsStore; - } - - /** * 设置物品下拉框 * @param good 里面有id,name,label */ this.setGoodsCombo = function (good) { - var goods = { + var comboId = good.id; + var comboName = good.name; + + var goods = { xtype: 'combo', - id: good.id, - name: good.name, + id: comboId, + name: comboName, fieldLabel: good.label, queryParam: 'spell', minChars: 0, @@ -77,7 +40,40 @@ width: 320, matchFieldWidth: false, listConfig: {width: 600}, - store: goodsStore, + store: new Ext.data.Store({ + proxy: new Ext.data.HttpProxy({ + url: WWWROOT + '/disinfectSystem/baseData/tousseDefinitionAction!searchGoodsDataForGoodsBind.do?', + method: 'POST' + }), + reader: new Ext.data.JsonReader({ + totalProperty: 'totalCount', + root: 'data' + }, goodsModel + ), + listeners: { + beforeload: function (thiz, options) { + if ('secondaryGoodName' == comboName) { + if (top.Ext.getCmp('mainGoodName').getRawValue() + && top.Ext.getCmp('mainGoodType').getValue() + && top.Ext.getCmp('mainGoodId').getValue()) { + thiz.baseParams.tousseType = top.Ext.getCmp('mainGoodType').getValue(); + } else { + showResult('请先选择主绑物品!'); + return false; + } + } + if (loadMask) { + loadMask.show(); + } + }, + load: function (thiz, records, options) { + thiz.baseParams.tousseType = ''; + if (loadMask) { + loadMask.hide(); + } + } + } + }), forceSelection: true, lazyInit: true, triggerAction: 'all', @@ -86,7 +82,19 @@ allowBlank: true, pageSize: 100, listeners: { - select: comboSelectEvn + select: function(combo, record) { + var id = record.get('id'); + var name = record.get('name'); + var tousseType = record.get('tousseType'); + var comboName = combo.name; + if ('mainGoodName' == comboName) { + top.Ext.getCmp('mainGoodId').setValue(id); + top.Ext.getCmp('mainGoodType').setValue(tousseType); + } else if ('secondaryGoodName' == comboName) { + top.Ext.getCmp('secondaryGoodId').setValue(id); + top.Ext.getCmp('secondaryGoodType').setValue(tousseType); + } + } } }; return goods;