diff --git a/o2web/source/x_component_portal_PageDesigner/Module/Calendar/default/css.wcss b/o2web/source/x_component_portal_PageDesigner/Module/Calendar/default/css.wcss
index 0bd4ac728011b6c08c3453eaf6d23bd0abc7ed0f..c29e39cc9cba720b1b348c54ce15335284dadc42 100644
--- a/o2web/source/x_component_portal_PageDesigner/Module/Calendar/default/css.wcss
+++ b/o2web/source/x_component_portal_PageDesigner/Module/Calendar/default/css.wcss
@@ -48,7 +48,7 @@
"display": "inline-block",
"height": "18px"
},
- "personfieldIcon": {
+ "textfieldIcon": {
"background": "url("+"../x_component_process_FormDesigner/Module/Calendar/default/icon/calendar.png) center center no-repeat",
"width": "18px",
"height": "18px",
diff --git a/o2web/source/x_component_process_Xform/$Input.js b/o2web/source/x_component_process_Xform/$Input.js
index dc0775c9e2c61d5eccf0abf692a591999f93901f..b4f50b356d7e0e5462de20f0f8a12aa255ae915c 100644
--- a/o2web/source/x_component_process_Xform/$Input.js
+++ b/o2web/source/x_component_process_Xform/$Input.js
@@ -263,7 +263,15 @@ MWF.xApplication.process.Xform.$Input = MWF.APP$Input = new Class(
this.loadDescription();
}
},
-
+ /**
+ * @summary 判断组件是否只读.
+ * @example
+ * var readonly = this.form.get('subject').isReadonly();
+ * @return {Boolean} 是否只读.
+ */
+ isReadonly : function(){
+ return !!(this.readonly || this.json.isReadonly);
+ },
getTextData: function(){
//var value = this.node.get("value");
//var text = this.node.get("text");
@@ -284,13 +292,24 @@ 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] 也可以获取组件值。
+ * 区别如下:
+ * 1、当使用Promise的时候
+ * 使用异步函数生成器(Promise)为组件赋值的时候,用getData方法立即获取数据,可能返回修改前的值,当Promise执行完成以后,会返回修改后的值。
+ * this.data[fieldName] 立即获取数据,可能获取到异步函数生成器,当Promise执行完成以后,会返回修改后的值。
+ * {@link https://www.yuque.com/o2oa/ixsnyt/ws07m0#EggIl|具体差异请查看链接}
+ * 2、当表单上没有对应组件的时候,可以使用this.data[fieldName]获取值,但是this.form.get('fieldName')无法获取到组件。
* @summary 获取组件值。
- * @example
- * var data = this.form.get('subject').getData(); //没有使用promise的情况
+ * @example
+ * var data = this.form.get('fieldName').getData(); //没有使用promise的情况、
+ * @example
+ * //如果无法确定表单上是否有组件,需要判断
+ * var data;
+ * if( this.form.get('fieldName') ){ //判断表单是否有无对应组件
+ * data = this.form.get('fieldName').getData();
+ * }else{
+ * data = this.data['fieldName']; //直接从数据中获取字段值
+ * }
* @example
* //使用Promise的情况
* var field = this.form.get("fieldName");
@@ -321,12 +340,20 @@ MWF.xApplication.process.Xform.$Input = MWF.APP$Input = new Class(
resetData: function(){
this.setData(this.getValue());
},
- /**当参数为Promise的时候,请查看文档: {@link https://www.yuque.com/o2oa/ixsnyt/ws07m0|使用Promise处理表单异步}
+ /**当参数为Promise的时候,请参考文档: {@link https://www.yuque.com/o2oa/ixsnyt/ws07m0|使用Promise处理表单异步}
+ * 当表单上没有对应组件的时候,可以使用this.data[fieldName] = data赋值。
* @summary 为组件赋值。
- * @param data{String|Promise} .
- * @example
+ * @param data{String|Promise} .
+ * @example
* this.form.get("fieldName").setData("test"); //赋文本值
- * @example
+ * @example
+ * //如果无法确定表单上是否有组件,需要判断
+ * if( this.form.get('fieldName') ){ //判断表单是否有无对应组件
+ * this.form.get('fieldName').setData( data );
+ * }else{
+ * this.data['fieldName'] = data;
+ * }
+ * @example
* //使用Promise
* var field = this.form.get("fieldName");
* var dict = new this.Dict("test"); //test为数据字典名称
diff --git a/o2web/source/x_component_process_Xform/Checkbox.js b/o2web/source/x_component_process_Xform/Checkbox.js
index c338efef9e2ee4398ef982cbec4f430b08823d67..daa305adad31ad538327d32e90d8b26a9d69cafe 100644
--- a/o2web/source/x_component_process_Xform/Checkbox.js
+++ b/o2web/source/x_component_process_Xform/Checkbox.js
@@ -301,9 +301,17 @@ MWF.xApplication.process.Xform.Checkbox = MWF.APPCheckbox = new Class(
resetData: function(){
this.setData(this.getValue());
},
- /**
+ /**当参数为Promise的时候,请查看文档: {@link https://www.yuque.com/o2oa/ixsnyt/ws07m0|使用Promise处理表单异步}
* @summary 为字段赋值,并且使值对应的选项选中。
- * @param data{String} .
+ * @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){
return this._setValue(data, "__setData");
diff --git a/o2web/source/x_component_process_Xform/DatagridMobile.js b/o2web/source/x_component_process_Xform/DatagridMobile.js
index 002e132cd613326bb75dee43c99cc5b04c8d3068..46fc2c54c16758c0091fd4c42c3f0102391c445d 100644
--- a/o2web/source/x_component_process_Xform/DatagridMobile.js
+++ b/o2web/source/x_component_process_Xform/DatagridMobile.js
@@ -1,5 +1,17 @@
MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
-MWF.xApplication.process.Xform.DatagridMobile = new Class({
+/** @class process.DatagridMobile 数据网格组件(移动端)。
+ * @example
+ * //可以在脚本中获取该组件
+ * //方法1:
+ * var attachment = this.form.get("name"); //获取组件
+ * //方法2
+ * var attachment = this.target; //在组件事件脚本中获取
+ * @extends MWF.xApplication.process.Xform.$Module
+ * @hideconstructor
+ */
+MWF.xApplication.process.Xform.DatagridMobile = new Class(
+/** @lends MWF.xApplication.process.Xform.DatagridMobile# */
+{
Implements: [Events],
Extends: MWF.APP$Module,
isEdit: false,
@@ -25,6 +37,7 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({
this.createMobileTable();
+
this.editable = (!this.readonly);
if (this.editable) this.editable = this.form.Macro.exec(((this.json.editableScript) ? this.json.editableScript.code : ""), this);
//this.editable = false;
@@ -1331,9 +1344,43 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({
if (this.table) this.table.setStyle("display", "none");
}
},
+ /**
+ * @summary 重置数据网格的值为默认值或置空。
+ * @example
+ * this.form.get('fieldName').resetData();
+ */
resetData: function(){
this.setData(this._getValue());
},
+ /**当参数为Promise的时候,请查看文档: {@link https://www.yuque.com/o2oa/ixsnyt/ws07m0|使用Promise处理表单异步}
+ * 当表单上没有对应组件的时候,可以使用this.data[fieldName] = data赋值。
+ * @summary 为数据网格赋值。
+ * @param data{DatagridData|Promise|Array} 必选,数组或Promise.
+ * @example
+ * this.form.get("fieldName").setData([]); //赋空值
+ * @example
+ * //如果无法确定表单上是否有组件,需要判断
+ * if( this.form.get('fieldName') ){ //判断表单是否有无对应组件
+ * this.form.get('fieldName').setData( data );
+ * }else{
+ * this.data['fieldName'] = data;
+ * }
+ *@example
+ * //使用Promise
+ * var field = this.form.get("fieldName");
+ * var promise = new Promise(function(resolve, reject){ //发起异步请求
+ * var oReq = new XMLHttpRequest();
+ * oReq.addEventListener("load", function(){ //绑定load事件
+ * resolve(oReq.responseText);
+ * });
+ * oReq.open("GET", "/data.json"); //假设数据存放在data.json
+ * oReq.send();
+ * });
+ * promise.then( function(){
+ * var data = field.getData(); //此时由于异步请求已经执行完毕,getData方法获得data.json的值
+ * })
+ * field.setData( promise );
+ */
setData: function(data){
if (!data){
data = this._getValue();
@@ -1459,10 +1506,24 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({
},
+ /**
+ * @summary 获取总计数据.
+ * @example
+ * var totalObject = this.form.get('fieldName').getTotal();
+ * @return {Object} 总计数据
+ */
getTotal: function(){
this._loadTotal();
return this.totalResaults;
},
+ /**
+ * @summary 判断数据网格是否为空.
+ * @example
+ * if( this.form.get('fieldName').isEmpty() ){
+ * this.form.notice('至少需要添加一条数据', 'warn');
+ * }
+ * @return {Boolean} 是否为空
+ */
isEmpty: function(){
var data = this.getData();
if( !data )return true;
@@ -1472,6 +1533,42 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({
}
return false;
},
+ /**
+ * 在脚本中使用 this.data[fieldName] 也可以获取组件值。
+ * 区别如下:
+ * 1、当使用Promise的时候
+ * 使用异步函数生成器(Promise)为组件赋值的时候,用getData方法立即获取数据,可能返回修改前的值,当Promise执行完成以后,会返回修改后的值。
+ * this.data[fieldName] 立即获取数据,可能获取到异步函数生成器,当Promise执行完成以后,会返回修改后的值。
+ * {@link https://www.yuque.com/o2oa/ixsnyt/ws07m0#EggIl|具体差异请查看链接}
+ * 2、当表单上没有对应组件的时候,可以使用this.data[fieldName]获取值,但是this.form.get('fieldName')无法获取到组件。
+ * @summary 获取数据网格数据.
+ * @example
+ * var data = this.form.get('fieldName').getData();
+ *@example
+ * //如果无法确定表单上是否有组件,需要判断
+ * var data;
+ * if( this.form.get('fieldName') ){ //判断表单是否有无对应组件
+ * data = this.form.get('fieldName').getData();
+ * }else{
+ * data = this.data['fieldName']; //直接从数据中获取字段值
+ * }
+ * @example
+ * //使用Promise
+ * var field = this.form.get("fieldName");
+ * var promise = new Promise(function(resolve, reject){ //发起异步请求
+ * var oReq = new XMLHttpRequest();
+ * oReq.addEventListener("load", function(){ //绑定load事件
+ * resolve(oReq.responseText);
+ * });
+ * oReq.open("GET", "/data.json"); //假设数据存放在data.json
+ * oReq.send();
+ * });
+ * promise.then( function(){
+ * var data = field.getData(); //此时由于异步请求已经执行完毕,getData方法获得data.json的值
+ * })
+ * field.setData( promise );
+ * @return {DatagridData}
+ */
getData: function(){
if (this.editable!=false){
if (this.isEdit) this._completeLineEdit();
@@ -1629,7 +1726,15 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({
}
return true;
},
-
+ /**
+ * @summary 根据组件的校验设置进行校验。
+ * @param {String} routeName - 可选,路由名称.
+ * @example
+ * if( !this.form.get('fieldName').validation() ){
+ * return false;
+ * }
+ * @return {Boolean} 是否通过校验
+ */
validation: function(routeName, opinion){
if (this.isEdit){
if (!this.editValidation()){
diff --git a/o2web/source/x_component_process_Xform/DatagridPC.js b/o2web/source/x_component_process_Xform/DatagridPC.js
index 24b8641d721fba17a3adeb8d1009bb9c62dad1d1..deb9b94ec5e9ef3e49b5a935b41c90498a5591e5 100644
--- a/o2web/source/x_component_process_Xform/DatagridPC.js
+++ b/o2web/source/x_component_process_Xform/DatagridPC.js
@@ -1,5 +1,53 @@
+/**
+ * 数据网格数据结构.
+ * @typedef {Object} DatagridData
+ * @property {Array} data - 数据网格列表数据
+ * @property {Object} total - 统计数据
+ * @example
+ * {
+ "data": [ //数据网格条目
+ {
+ "datagrid_datagrid$Title": { //数据网格第1列title标识
+ "org_20": { //数据网格第1列字段标识
+ "distinguishedName": "张三@bf007525-99a3-4178-a474-32865bdddec8@I",
+ "id": "bf007525-99a3-4178-a474-32865bdddec8",
+ "name": "张三",
+ "person": "0c828550-d8ab-479e-9880-09a59332f1ed",
+ "unit": "9e6ce205-86f6-4d84-96e1-83147567aa8d",
+ "unitLevelName": "兰德纵横/市场营销部",
+ "unitName": "市场营销部"
+ }
+ },
+ "datagrid_datagrid$Title_1": { //数据网格第2列title标识
+ "number": "111" //数据网格第2列字段标识和值
+ },
+ "datagrid_datagrid$Title_2": { //数据网格第3列title标识
+ "textfield_2": "杭州" //数据网格第3列字段标识和值
+ },
+ "datagrid_datagrid$Title_3": { //数据网格第4列title标识
+ "attachment_1": [ //数据网格第4列字段标识
+ {
+ "activityName": "拟稿",
+ "extension": "jpg",
+ "id": "9514758e-9e28-4bfe-87d7-824f2811f173",
+ "lastUpdateTime": "2020-12-09 21:48:03",
+ "length": 452863.0,
+ "name": "111.jpg",
+ "person": "李四@lisi@P"
+ }
+ ]
+ }
+ },
+ ...
+ ],
+ "total": { //统计数据,列title设置了总计
+ "datagrid_datagrid$Title_1": "333", //总计列1
+ "datagrid_datagrid$Title_2": "2" //总计列2
+ }
+ }
+ */
MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
-/** @class process.Button 数据网格组件(PC端)。
+/** @class process.DatagridPC 数据网格组件(PC端)。
* @example
* //可以在脚本中获取该组件
* //方法1:
@@ -1121,9 +1169,34 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
resetData: function(){
this.setData(this._getValue());
},
- /**
+ /**当参数为Promise的时候,请查看文档: {@link https://www.yuque.com/o2oa/ixsnyt/ws07m0|使用Promise处理表单异步}
+ * 当表单上没有对应组件的时候,可以使用this.data[fieldName] = data赋值。
* @summary 为数据网格赋值。
- * @param data{Array} - 必选,数组.
+ * @param data{DatagridData|Promise|Array} 必选,数组或Promise.
+ * @example
+ * this.form.get("fieldName").setData([]); //赋空值
+ * @example
+ * //如果无法确定表单上是否有组件,需要判断
+ * if( this.form.get('fieldName') ){ //判断表单是否有无对应组件
+ * this.form.get('fieldName').setData( data );
+ * }else{
+ * this.data['fieldName'] = data;
+ * }
+ *@example
+ * //使用Promise
+ * var field = this.form.get("fieldName");
+ * var promise = new Promise(function(resolve, reject){ //发起异步请求
+ * var oReq = new XMLHttpRequest();
+ * oReq.addEventListener("load", function(){ //绑定load事件
+ * resolve(oReq.responseText);
+ * });
+ * oReq.open("GET", "/data.json"); //假设数据存放在data.json
+ * oReq.send();
+ * });
+ * promise.then( function(){
+ * var data = field.getData(); //此时由于异步请求已经执行完毕,getData方法获得data.json的值
+ * })
+ * field.setData( promise );
*/
setData: function(data){
if (!data){
@@ -1233,11 +1306,42 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
}
return false;
},
+
/**
+ * 在脚本中使用 this.data[fieldName] 也可以获取组件值。
+ * 区别如下:
+ * 1、当使用Promise的时候
+ * 使用异步函数生成器(Promise)为组件赋值的时候,用getData方法立即获取数据,可能返回修改前的值,当Promise执行完成以后,会返回修改后的值。
+ * this.data[fieldName] 立即获取数据,可能获取到异步函数生成器,当Promise执行完成以后,会返回修改后的值。
+ * {@link https://www.yuque.com/o2oa/ixsnyt/ws07m0#EggIl|具体差异请查看链接}
+ * 2、当表单上没有对应组件的时候,可以使用this.data[fieldName]获取值,但是this.form.get('fieldName')无法获取到组件。
* @summary 获取数据网格数据.
- * @example
+ * @example
* var data = this.form.get('fieldName').getData();
- * @return {Object} - 格式如下{ data : [] }.
+ *@example
+ * //如果无法确定表单上是否有组件,需要判断
+ * var data;
+ * if( this.form.get('fieldName') ){ //判断表单是否有无对应组件
+ * data = this.form.get('fieldName').getData();
+ * }else{
+ * data = this.data['fieldName']; //直接从数据中获取字段值
+ * }
+ * @example
+ * //使用Promise
+ * var field = this.form.get("fieldName");
+ * var promise = new Promise(function(resolve, reject){ //发起异步请求
+ * var oReq = new XMLHttpRequest();
+ * oReq.addEventListener("load", function(){ //绑定load事件
+ * resolve(oReq.responseText);
+ * });
+ * oReq.open("GET", "/data.json"); //假设数据存放在data.json
+ * oReq.send();
+ * });
+ * promise.then( function(){
+ * var data = field.getData(); //此时由于异步请求已经执行完毕,getData方法获得data.json的值
+ * })
+ * field.setData( promise );
+ * @return {DatagridData}
*/
getData: function(){
if (this.editable!=false){
diff --git a/o2web/source/x_component_process_Xform/Div.js b/o2web/source/x_component_process_Xform/Div.js
index 765d62ae90500ba2fea115bd726e8bbc59fc7c77..ba14fed224212fa44dfa38742872944b29469f34 100644
--- a/o2web/source/x_component_process_Xform/Div.js
+++ b/o2web/source/x_component_process_Xform/Div.js
@@ -1,5 +1,5 @@
MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
-/** @class process.Button 容器组件。
+/** @class process.Div 容器组件。
* @example
* //可以在脚本中获取该组件
* //方法1:
diff --git a/o2web/source/x_component_process_Xform/Documenteditor.js b/o2web/source/x_component_process_Xform/Documenteditor.js
index 66ecbcc07bc7de34ee2ec08dc91588ff6a59a86b..6342c3b74188a8072905f1a3d78d52dab3422433 100644
--- a/o2web/source/x_component_process_Xform/Documenteditor.js
+++ b/o2web/source/x_component_process_Xform/Documenteditor.js
@@ -1,5 +1,17 @@
MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
-MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Class({
+/** @class process.Documenteditor 公文编辑器。
+ * @example
+ * //可以在脚本中获取该组件
+ * //方法1:
+ * var attachment = this.form.get("name"); //获取组件
+ * //方法2
+ * var attachment = this.target; //在组件事件脚本中获取
+ * @extends MWF.xApplication.process.Xform.$Module
+ * @hideconstructor
+ */
+MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Class(
+/** @lends MWF.xApplication.process.Xform.Documenteditor# */
+{
Extends: MWF.APP$Module,
options: {
"moduleEvents": ["load", "queryLoad", "beforeLoad", "postLoad", "afterLoad", "loadPage"],
@@ -42,6 +54,9 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla
this.active();
}
},
+ /**激活板式文件编辑
+ * 设置了延迟加载的时候,可以通过这个方法来激活
+ */
active: function(){
this._loadModuleEvents();
if (this.fireEvent("queryLoad")){
@@ -2482,6 +2497,9 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla
_loadValue: function(){
var data = this._getBusinessData();
},
+
+ /**重新计算板式文件的所有字段,当字段是脚本时可以使用该方法立即更新
+ */
reload: function(){
this.resetData();
},
@@ -2509,6 +2527,8 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla
if( typeOf(data) !== "object" )return true;
return !data.filetext || data.filetext===this.json.defaultValue.filetext;
},
+ /*获取板式文件数据,返回Object
+ */
getData: function(){
//if (this.editMode){
@@ -2592,6 +2612,8 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla
tmpdiv.destroy();
}
},
+ /**设置
+ */
setData: function(data, diffFiletext){
if (data){
this.data = data;
@@ -2898,6 +2920,8 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla
}
return node;
},
+ /*将板式文件内容以html形式输出
+ */
getDocumentHtml: function(){
var tmpNode = this.contentNode.getFirst().getFirst().clone(true);
var htmlNode = tmpNode.getLast();
@@ -2922,6 +2946,8 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla
tmpNode.destroy();
return "