日期:2014-05-16  浏览次数:20288 次

DIRECT 新技术 Extjs扩展实现资本币制下拉存取值 Ext.ux.BaseDataComboBox
   /* currCode : new Ext.form.TextField({
                fieldLabel:'资本币制<font color="red">*</font>',
                width:100,
                name:'currCode',
                 readOnly : true,
                 cls:'x-form-field-readonly',
                anchor:'100%'
              }),*/
//真正存入数据库的的currcode字段设置为隐藏字段
              currCodeAlias : new Ext.ux.BaseDataComboBox({
					fieldLabel : "资本币制<font color=red>*</font>",
					name : "currCodeAlias",
					storeParams:{className:'TCurrCode',author:'',orderBy:' order by {currCode}'},
					fields : ['currCode','currName'],
					title : "(<font color=black>币制代码</font>)<font color=blue>币制名称</font>",
					tpl:'<tpl for="."><div class="x-combo-list-item">({currCode})<font color=blue>{currName}</font></div></tpl>',
					disabled : this.readOnly,
					allowBlank : false,
					upperText : true,
					editable : false,
					emptyText : '请选择',
					selectOnFocus:true,
					//valueField:'currName',
					directFn: BaseCodeDirectAction.getJsonArrayResultPagesByValues,
					listeners : {
						change : function(field, newValue, oldValue) {
							this.editStatus = "系统正在校验<" + field.fieldLabel + ">,请稍后尝试保存!";
							BaseCodeDirectAction.getJsonObjectForBaseData('TCurrCode','currCode',newValue, function(result, e){
								this.editStatus = null;
								if (!Ext.isEmpty(result)) {
									if (result.success) {
										field.setValue("");
										if (!Ext.isEmpty(result.data) && result.data.length>0) {
											var c = '('+result.data[0].currCode+')'+result.data[0].currName;
											field.setValue(c);
										}
									}
								}
							}.createDelegate(this));
						}.createDelegate(this)
					}					
		     }),

 {xtype:'hidden',name:'currCode'},
 
// 修改 值 对象文件 添加别名字段  currCodeAlias  
private String currCodeAlias  ;
//有XML配置需要的 修改对应的XML  添加属性 currCodeAlias  其值由SQL获取 根据的是
currCode的值  如下所示:
         <property name="currCodeAlias"
			formula="(select '(' || cc.CURR_CODE || ')' || cc.CURR_NAME from EPLATFORM.T_CURR_CODE cc where cc.CURR_CODE = CURR_CODE  )"
			type="string">
        </property>
//保存的时候 

onSave : function(){
   //企业信息 资本币制
		var  currCodeAlias =   this.mainForm.getForm().findField("currCodeAlias").getValue();
		var currCode = currCodeAlias.substring(1,4);
		this.mainForm.getForm().findField('currCode').setValue(currCode);
}

//后台代码--- 通过资本币制序号 查找 设显示名给资本币制别人 以显示到列表框
if(list.size()>0){
				for(ModifyContent modifyContent :list){
					if(modifyContent.getModifyOject().equals("EnterpriseInfo")){
					String setName="set"+modifyContent.getItemCode().substring(0, 1).toUpperCase()+modifyContent.getItemCode().substring(1);
					 doMethod( setName,enterpriseInfo,modifyContent);
					}else if(modifyContent.getModifyOject().equals("ManagInfo")){
						if(modifyContent.getManagerType().equals("A")){
							 String setMethodName="set"+modifyContent.getItemCode().substring(0, 1).toUpperCase()+modifyContent.getItemCode().substring(1); 
							 doMethod( setMethodName,managInfo1,modifyContent);
						 }else if(modifyContent.getManagerType().equals("B")){
							 String setMethodName="set"+modifyContent.getItemCode().substring(0, 1).toUpperCase()+modifyContent.getItemCode().substring(1); 
							 doMethod( setMethodName,managInfo2,modifyContent);
						 }else if(modifyContent.getManagerType().equals("C")){
							 String setMethodName="set"+modifyContent.getItemCode().substring(0, 1).toUpperCase()+modifyContent.getItemCode().substring(1); 
							 doMethod( setMethodName,managInfo3,modifyContent);
						 }
					}
				}
				if(null!= enterpriseInfo.getCurrCode()){
					TCurrCode ccode  = (TCurrCode) this.getObject(TCurrCode.class,  enterpriseInfo.getCurrCode());
					enterpriseInfo.setCurrCodeAlias("("+ccode.getCurrCode()+")"+ccode.getCurrName());
				}