unknown 5 ani în urmă
părinte
comite
5f6c435327

+ 26 - 8
o2web/source/x_component_process_Xform/$Input.js

@@ -90,7 +90,7 @@ MWF.xApplication.process.Xform.$Input = MWF.APP$Input =  new Class(
                 }
 
                 /**
-                 * 描述信息节点,select\radio\checkbox无此节点,只读情况下无此节点.
+                 * @summary 描述信息节点,允许用户手工输入的组件才有此节点,只读情况下无此节点.
                  * @member {Element}
                  */
                 this.descriptionNode = new Element("div", {"styles": this.form.css.descriptionNode, "text": this.json.description}).inject(this.node);
@@ -284,12 +284,22 @@ MWF.xApplication.process.Xform.$Input = MWF.APP$Input =  new Class(
 	    return !data || !data.trim();
     },
     /**
-     *  该方法和 this.data.{fieldName} 在绝大部分的时候效果一样。区别如下:
-     * 当使用异步函数生成器(Promise)为组件赋值的时候,getData立即获取数据,可能返回修改前的值,当Promise执行完成以后,会返回修改后的值。
-     * this.data.{fieldName} 立即获取数据,可能获取到异步函数生成器,当Promise执行完成以后,会返回修改后的值。{@link https://www.yuque.com/o2oa/ixsnyt/ws07m0#EggIl|具体差异请查看链接}
+     *  该方法和 this.data.{fieldName} 在绝大部分的时候效果一样。区别如下:<br/>
+     * 当使用异步函数生成器(Promise)为组件赋值的时候,getData立即获取数据,可能返回修改前的值,当Promise执行完成以后,会返回修改后的值。<br/>
+     * this.data.{fieldName} 立即获取数据,可能获取到异步函数生成器,当Promise执行完成以后,会返回修改后的值。<br/>
+     * {@link https://www.yuque.com/o2oa/ixsnyt/ws07m0#EggIl|具体差异请查看链接}
      * @summary 获取组件值。
      *  @example
-     * var data = this.form.get('subject').getData();
+     * var data = this.form.get('subject').getData(); //没有使用promise的情况
+     * @example
+     *  //使用Promise的情况
+     *  var field = this.form.get("fieldName");
+     *  var dict = new this.Dict("test"); //test为数据字典名称
+     *  var promise = dict.get("tools", true); //异步使用数据字典的get方法时返回Promise,参数true表示异步
+     *  promise.then( function(){
+     *      var data = field.getData(); //此时由于异步请求已经执行完毕,getData方法获取到了数据字典的值
+     *  })
+     *  field.setData( promise );
      * @return 组件的数据.
      */
 	getData: function(when){
@@ -311,9 +321,17 @@ MWF.xApplication.process.Xform.$Input = MWF.APP$Input =  new Class(
     resetData: function(){
         this.setData(this.getValue());
     },
-    /**
-     * @summary 为控件赋值。
-     *  @param data{String|Number|JsonObject|Array} .
+    /**当参数为Promise的时候,请查看文档: {@link  https://www.yuque.com/o2oa/ixsnyt/ws07m0|使用Promise处理表单异步}
+     * @summary 为组件赋值。
+     *  @param data{String|Promise} .
+     *  @example
+     *  this.form.get("fieldName").setData("test"); //赋文本值
+     *  @example
+     *  //使用Promise
+     *  var field = this.form.get("fieldName");
+     *  var dict = new this.Dict("test"); //test为数据字典名称
+     *  var promise = dict.get("tools", true); //异步使用数据字典的get方法时返回Promise,参数true表示异步
+     *  field.setData( promise );
      */
 	setData: function(data){
         // if (data && data.isAG){

+ 0 - 1
o2web/source/x_component_process_Xform/$Module.js

@@ -1,4 +1,3 @@
-
 MWF.require("MWF.widget.Common", null, false);
 /** @classdesc process.$Module 组件类,此类为所有组件的父类。
  * @class

+ 4 - 4
o2web/source/x_component_process_Xform/Attachment.js

@@ -1121,7 +1121,7 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class(
         //this.attachmentController = new MWF.widget.ATTER(this.node, this, options);
 
         /**
-         * 附件容器.
+         * @summary 附件容器.
          * @member {MWF.xApplication.process.Xform.AttachmentController}
          * @example
          * var attachmentController = this.form.get("fieldName").AttachmentController; //获取附件容器
@@ -1176,7 +1176,7 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class(
         }
     },
     /**
-     * 获取当前组件所有附件的标题.如果没有附件返回null
+     * @summary 获取当前组件所有附件的标题.如果没有附件返回null
      * @example
      * var getAttachmentNames = this.form.get("name").getData();
      * @return {StringArray|Null} 附件标题.
@@ -1659,7 +1659,7 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class(
         return data;
     },
     /**
-     * 为组件重新设置附件,该附件必须已经上传。
+     * @summary 为组件重新设置附件,该附件必须已经上传。
      *  @param data{AttachmentData} .
      */
     setData: function(data){
@@ -1802,7 +1802,7 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class(
         return true;
     },
     /**
-     * 根据组件的校验设置进行校验。
+     * @summary 根据组件的校验设置进行校验。
      *  @param {String} routeName - 可选,路由名称.
      *  @example
      *  if( !this.form.get('fieldName').validation() ){

+ 1 - 1
o2web/source/x_component_process_Xform/Calendar.js

@@ -154,7 +154,7 @@ MWF.xApplication.process.Xform.Calendar = MWF.APPCalendar =  new Class(
                 };
                 options.baseDate = this.getBaseDate();
                 /**
-                 * 日期弹出选择组件,只读情况下无此节点.
+                 * @summary 日期弹出选择界面,只读情况下无此成员.
                  * @member {MWF.widget.Calendar}
                  * @example
                  * var calendar = this.form.get("fieldName").calendar; //获取组件

+ 4 - 4
o2web/source/x_component_process_Xform/Checkbox.js

@@ -98,7 +98,7 @@ MWF.xApplication.process.Xform.Checkbox = MWF.APPCheckbox =  new Class(
         }
     },
     /**
-     * 重新计算下拉选项,该功能通常用在下拉选项为动态计算的情况.
+     * @summary 重新计算下拉选项,该功能通常用在下拉选项为动态计算的情况.
      * @example
      * this.form.get('fieldName').resetOption();
      */
@@ -107,7 +107,7 @@ MWF.xApplication.process.Xform.Checkbox = MWF.APPCheckbox =  new Class(
         this.setOptions();
     },
     /**
-     * 获取选择项数组.
+     * @summary 获取选择项数组.
      * @example
      * var array = this.form.get('fieldName').getOptions();
      * @return {Array} 选择项数组,如果是脚本返回计算结果.
@@ -239,7 +239,7 @@ MWF.xApplication.process.Xform.Checkbox = MWF.APPCheckbox =  new Class(
         }
     },
     /**
-     * 获取选中的值和文本.
+     * @summary 获取选中的值和文本.
      * @example
      * var array = this.form.get('fieldName').getTextData();
      * @return {Object} 返回选中项值和文本,格式为 { 'value' : value, 'text' : text }.
@@ -302,7 +302,7 @@ MWF.xApplication.process.Xform.Checkbox = MWF.APPCheckbox =  new Class(
         this.setData(this.getValue());
     },
     /**
-     * 为字段赋值,并且使值对应的选项选中。
+     * @summary 为字段赋值,并且使值对应的选项选中。
      *  @param data{String} .
      */
     setData: function(data){

+ 6 - 6
o2web/source/x_component_process_Xform/DatagridPC.js

@@ -1114,7 +1114,7 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
 		}
 	},
 	/**
-	 * 重置组件的值为默认值或置空。
+	 * @summary 重置数据网格的值为默认值或置空。
 	 *  @example
 	 * this.form.get('fieldName').resetData();
 	 */
@@ -1122,7 +1122,7 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
 		this.setData(this._getValue());
 	},
 	/**
-	 * 为数据网格赋值。
+	 * @summary 为数据网格赋值。
 	 *  @param data{Array}  - 必选,数组.
 	 */
 	setData: function(data){
@@ -1207,7 +1207,7 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
 		}
 	},
 	/**
-	 * 获取总计数据.
+	 * @summary 获取总计数据.
 	 * @example
 	 * var totalObject = this.form.get('fieldName').getTotal();
 	 * @return {Object} 总计数据
@@ -1217,7 +1217,7 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
 		return this.totalResaults;
 	},
 	/**
-	 * 判断数据网格是否为空.
+	 * @summary 判断数据网格是否为空.
 	 * @example
 	 * if( this.form.get('fieldName').isEmpty() ){
 	 *     this.form.notice('至少需要添加一条数据', 'warn');
@@ -1234,7 +1234,7 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
 		return false;
 	},
 	/**
-	 * 获取数据网格数据.
+	 * @summary 获取数据网格数据.
 	 *  @example
 	 * var data = this.form.get('fieldName').getData();
 	 * @return {Object} - 格式如下{ data : [] }.
@@ -1396,7 +1396,7 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
 		return true;
 	},
 	/**
-	 * 根据组件的校验设置进行校验。
+	 * @summary 根据组件的校验设置进行校验。
 	 *  @param {String} routeName - 可选,路由名称.
 	 *  @example
 	 *  if( !this.form.get('fieldName').validation() ){