Browse Source

textfield字段最大长度默认为50

zhuth 7 years ago
parent
commit
41096ecad8
1 changed files with 12 additions and 6 deletions
  1. 12 6
      frontend/saas-web/app/util/FormUtil.js

+ 12 - 6
frontend/saas-web/app/util/FormUtil.js

@@ -36,6 +36,18 @@ Ext.define('saas.util.FormUtil', {
                     });
                     Ext.Array.each(items, function(item) {
 
+                        // 设置必填
+                        if(item.allowBlank==false){
+                            // TODO 需要判断类型
+                            item.beforeLabelTextTpl = "<font color=\"red\" style=\"position:relative; top:2px;right:2px; font-weight: bolder;\">*</font>";
+                        }
+
+                        if(item.xtype == 'textfield') {
+                            Ext.applyIf(item, {
+                                maxLength: 50
+                            });
+                        }
+                        
                         if(item.xtype == 'datefield') {
                             Ext.applyIf(item, {
                                 format: 'Y-m-d'
@@ -51,12 +63,6 @@ Ext.define('saas.util.FormUtil', {
                             formModel.set(item.name, 0);
                         }
 
-                        // 设置必填
-                        if(item.allowBlank==false){
-                            // TODO 需要判断类型
-                            item.beforeLabelTextTpl = "<font color=\"red\" style=\"position:relative; top:2px;right:2px; font-weight: bolder;\">*</font>";
-                        }
-
                         // 如果是从表为其绑定store
                         if(item.xtype == 'detailGridField') {
                             var index = form.detailCount;