EasyUI中列表属性 状态遍历常量类获得 以及常量类写法,不用写死

  
  
  
  
  1. {field:'state',title:'状态',width:100,align: 'center',sortable:true,formatter: function(val, rec,rowIndex){ 
  2.                         <s:iterator begin="0" end="@com.zbxsoft.cbeex.common.SysConstants@getContCommon_transAgreementState_Num()-1" status="sta">迭代 常量类长度-1 
  3.                             if(val=='<s:property value="@com.zbxsoft.cbeex.common.SysConstants@transAgreementState_value[#sta.count-1]"/>')return '<s:property value="@com.zbxsoft.cbeex.common.SysConstants@transAgreementState_name[#sta.count-1]"/>'
  4.                         </s:iterator> 
  5.                         else return val; 
  6.                     }} 
  
  
  
  
  1. /** 
  2.      *转让 状态(0.待初审,1.初审通过,2.初审不通过 3.复审通过,4.复审不通过) 
  3.      */ 
  4.     public static final String[] transAgreementState_name = {"待初审","初审通过","初审不通过","复审通过","复审不通过"}; 
  5.     /** 
  6.      *转让 状态(0.待初审,1.初审通过,2.初审不通过 3.复审通过,4.复审不通过) 
  7.      */ 
  8.     public static final String[] transAgreementState_value = {"0","1","2","3","4","5"}; 
  9.     /** 
  10.      * 转让 状态总数 
  11.      * @return 
  12.      */ 
  13.     public static int getContCommon_transAgreementState_Num() { 
  14.         int vNum = transAgreementState_value.length; 
  15.         int nNum = transAgreementState_name.length; 
  16.         return vNum >= nNum ? nNum : vNum; 
  17.     } 
  18.     /** 
  19.      * 根据值 获取 转让 状态的名称 
  20.      * @param value 
  21.      * @return 
  22.      */ 
  23.     public static String getContCommon_transAgreementState_name(String value) { 
  24.         String name = ""
  25.         if (value == null || value.trim().equals("")) { 
  26.             return name; 
  27.         } 
  28.         for (int i = 0; i < transAgreementState_value.length; i++) { 
  29.             if (transAgreementState_value[i].equals(value.trim())) { 
  30.                 try { 
  31.                     name = transAgreementState_name[i]; 
  32.                 } catch (Exception e) { 
  33.                     e.printStackTrace(); 
  34.                     break
  35.                 } 
  36.                 break
  37.             } 
  38.         } 
  39.         return name; 
  40.     } 
  41.     /** 
  42.      * 判断 下标为index的值是否与转让 状态value相等 
  43.      * @param index 下标 
  44.      * @param value 
  45.      * @return 
  46.      */ 
  47.     public static boolean isContCommon_transAgreementState_NV(int index, String value) { 
  48.         if (index >= 0 && transAgreementState_value.length > index) { 
  49.             return transAgreementState_value[index].equals(value); 
  50.         } 
  51.         return false
  52.     } 

 

你可能感兴趣的:(1)