Browse Source

condatefield组件bind调整

zhuth 7 năm trước cách đây
mục cha
commit
6905a5aded
1 tập tin đã thay đổi với 12 bổ sung2 xóa
  1. 12 2
      frontend/saas-web/app/view/core/form/ConDateField.js

+ 12 - 2
frontend/saas-web/app/view/core/form/ConDateField.js

@@ -12,6 +12,7 @@ Ext.define('saas.view.core.form.ConDateField', {
     defaults: {
         margin: '0 0 0 0'
     },
+    defaultBindProperty: 'value',
     initComponent : function(){
         this.cls = (this.cls || '') + ' x-form-field-multi';
         this.callParent(arguments);
@@ -76,6 +77,7 @@ Ext.define('saas.view.core.form.ConDateField', {
                     }else {
                         me.value=null;
                     }
+                    me.setValue(v, from, to);
                 }
             }
         });
@@ -105,6 +107,7 @@ Ext.define('saas.view.core.form.ConDateField', {
                     }else {
                         me.value=null;
                     }
+                    me.setValue(v, from, to);
                 }
             }
         });
@@ -113,7 +116,7 @@ Ext.define('saas.view.core.form.ConDateField', {
             t = 3;
         }
         this.value = null;
-        this.setValue(t);
+        this.setInitValue(t);
     },
     setDateFieldValue: function(v){
         v = Number(v);
@@ -186,13 +189,20 @@ Ext.define('saas.view.core.form.ConDateField', {
             from.setEditable(false);
             to.setEditable(false);
         }
+        me.setValue(v, minDate, maxDate);
     },
-    setValue: function(v){
+    setInitValue: function(v) {
         if (v) {
             this.combo.setValue(v);
             this.setDateFieldValue(v);
         }
     },
+    setValue: function(v, from, to){
+        this.value = {type: v,
+            from: from,
+            to: to};
+        this.publishState('value', this.value);
+    },
     getValue: function(){
         return this.value;
     },