Explorar o código

Merge branch 'feature/JSDoc' into 'wrdp'

Merge of feature/JSDoc to wrdp

See merge request o2oa/o2oa!2659
蔡祥熠 %!s(int64=5) %!d(string=hai) anos
pai
achega
790db7b1ff

+ 1 - 1
o2web/jsdoc.conf.json

@@ -44,7 +44,7 @@
         "title": "O2OA前台API" //最终生成的文档中标题
     },
     "o2" : {
-        "actionDir" : "./o2web/jsdoc/"
+        "actionOutPath" : "./o2web/jsdoc/{actionRoot}/{actionName}.json"
     }
 }
 //执行命令: jsdoc -c ./o2web/jsdoc.conf.json

+ 17 - 11
o2web/jsdoc_static/home/README.md

@@ -6,13 +6,14 @@
 
 * O2OA 前端脚本基于您使用的浏览器的Javascript引擎,使用Javascript语法。
 
-* 您可以通过脚本访问和操作允许的DOM对象;也可以通过平台定义的API操作表单、业务数据、组织、视图等各种对象。
-
+* 本API是O2OA前台脚本的编写说明,您可以通过脚本访问和操作平台内的各种对象。
 
 ## API总览
 
 ### Modules
 
+* 为脚本封装的对象、方法和类
+
 <table>
     <tr>
         <td><a href="module-data.html">业务数据 - data</a></td>
@@ -20,9 +21,9 @@
         <td><a href="module-documentContext.html">内容管理实例 - documentContext</a></td>
     </tr>
     <tr>
-        <td><a href="module-org.html">组织 - org</a></td>
-        <td><a href="module-form.html">流程表单 - form</a></td>
-        <td><a href="module-page.html">页面 - page</a></td>
+        <td><a href="module-org.html">组织查询 - org</a></td>
+        <td><a href="module-form.html">流程及内容管理表单 - form</a></td>
+        <td><a href="module-page.html">门户页面 - page</a></td>
     </tr>
     <tr>
         <td><a href="module-queryView.html">视图 - queryView</a></td>
@@ -31,13 +32,18 @@
     </tr>
     <tr>
         <td><a href="module-queryStatement.html">查询视图 - queryStatement</a></td>
-        <td><a href="module-statement.html">查询执行 - statement</a></td>
-        <td><a href="module-Actions.html">Actions - Actions</a></td>
+        <td><a href="module-statement.html">查询视图执行 - statement</a></td>
+        <td><a href="module-Actions.html">服务调用 - Actions</a></td>
     </tr>
     <tr>
-        <td><a href="module-include.html">引用 - include</a></td>
+        <td><a href="module-include.html">脚本引用 - include</a></td>
         <td><a href="module-define.html">方法定义 - define</a></td>
-        <td><a href="module-session.html">session - session</a></td>
+        <td><a href="module-session.html">当前用户 - session</a></td>
+    </tr>
+    <tr>
+        <td><a href="module-wait.html">表单等待 - wait</a></td>
+        <td></td>
+        <td></td>
     </tr>
 </table>
 
@@ -119,7 +125,7 @@
 #### CMS 内容管理表单组件
 <table>
     <tr>
-        <td><a href="MWF.xApplication.process.Xform.Form.html">表单 - Form</a></td>
+        <td><a href="CMSForm.html">内容管理表单 - CMSForm</a></td>
         <td><a href="MWF.xApplication.process.Xform.Label.html">文本 - Label</a></td>
         <td><a href="MWF.xApplication.process.Xform.Textfield.html">文本字段 - Textfield</a></td>
     </tr>
@@ -188,7 +194,7 @@
 #### Portal 门户页面组件
 <table>
     <tr>
-        <td><a href="MWF.xApplication.process.Xform.Form.html">表单 - Form</a></td>
+        <td><a href="PortalPage.html">页面 - PortalPage</a></td>
         <td><a href="MWF.xApplication.process.Xform.Div.html">容器 - Div</a></td>
         <td><a href="MWF.xApplication.process.Xform.Label.html">文本 - Label</a></td>
     </tr>

+ 19 - 37
o2web/source/o2_core/o2/xScript/CMSEnvironment.js

@@ -32,35 +32,6 @@ MWF.xScript.CMSEnvironment = function(ev){
     //this.inquiredRouteList = null;
 
     //workContext
-    /**
-     * DocumentControl  内容管理的权限对象。
-     * @typedef {Object} DocumentControl
-     * @example
-     {
-        "allowRead": true,              //是否允许阅读文档
-        "allowPublishDocument": true,   //是否允许发布文档
-        "allowSave": true,              //是否允许保存文档
-        "allowPopularDocument": true,   //是否允许设置为热点
-        "allowEditDocument": true,      //是否允许编辑文档
-        "allowDeleteDocument": true     //是否允许删除文档
-    }
-     */
-    /**
-     * DocumentAttachmentData  内容管理的权限对象。
-     * @typedef {Object} DocumentAttachmentData
-     * @example
-     {
-        "id": "a5cc5858-cac5-445a-a0a5-888d224eb2f6",   //附件ID
-        "site": "attachment",                           //附件存储位置(一般用于区分附件在哪个表单元素中显示)
-        "name": "13145352_115454884000_2.jpg",          //附件名称
-        "appId": "c295f34c-9ce1-4122-b795-820267e32b68",  //栏目ID
-        "categoryId": "33fb19f0-0670-464d-875c-32fb86148f7a",  //分类ID
-        "documentId": "ca74cbef-2a7f-401a-80e3-577ac9839348",  //文档ID
-        "creatorUid": "XX@huqi@P",                      //附件上传人
-        "extension": "jpg",
-        "length": 364507,                               //附件大小
-    }
-     */
     /**
      * 你可以通过documentContext获取内容管理实例相关的对象数据。
      * @module documentContext
@@ -75,25 +46,35 @@ MWF.xScript.CMSEnvironment = function(ev){
          * 获取当前内容管理实例的文档对象:document对象。
          * @method getDocument
          * @static
-         * @return {Document} 内容管理实例对象.
+         * @return {Document} 文档对象.
+         * @o2ActionOut x_cms_assemble_control.WoDocument|true
          * @o2syntax
          * var doc = this.documentContext.getDocument();
          */
         "getDocument": function(){return ev.document },
         /**
-         * 获取当前人对内容管理实例的权限。
+         * 获取当前人对文档的权限。
          * @method getControl
          * @static
-         * @return {DocumentControl} 当前人对内容管理实例的所拥有的权限.
+         * @return {DocumentControl} 当前人对文档所拥有的权限.
+         * <pre><code class='language-js'>{
+         *    "allowRead": true,              //是否允许阅读文档
+         *    "allowPublishDocument": true,   //是否允许发布文档
+         *    "allowSave": true,              //是否允许保存文档
+         *    "allowPopularDocument": true,   //是否允许设置为热点
+         *    "allowEditDocument": true,      //是否允许编辑文档
+         *    "allowDeleteDocument": true     //是否允许删除文档
+         * }</code></pre>
          * @o2syntax
          * var control = this.documentContext.getControl();
          */
         "getControl": function(){return ev.control;},
         /**
-         * 获取当前流程实例的附件对象列表。
+         * 获取当前文档的附件对象列表。
          * @method getAttachmentList
          * @static
-         * @return {DocumentAttachment[]} 当前人对内容管理实例的所拥有的权限.
+         * @return {DocumentFileInfo[]} 当前文档的附件对象列表.
+         * @o2ActionOut x_cms_assemble_control.FileInfoAction.get
          * @o2syntax
          * var attachmentList = this.documentContext.getAttachmentList();
          */
@@ -1561,11 +1542,12 @@ MWF.xScript.CMSEnvironment = function(ev){
         /**发布当前文档。<b>(仅内容管理表单中可用)</b>
          * @method publish
          * @memberOf module:form
+         * @param {Function} callback - 发布后的回调方法
          * @o2syntax
-         this.form.publish();
+         this.form.publish( callback );
          */
-        "publish": function(option){
-            _form.publishDocument()
+        "publish": function(callback){
+            _form.publishDocument(callback)
         },
         //"archive": function(option){
         //    _form.archiveDocument()

+ 115 - 308
o2web/source/o2_core/o2/xScript/Environment.js

@@ -1,224 +1,3 @@
-/**
- * Work 数据结构,流程实例对象
- * @typedef {Object} Work
- * @example
- * {
-    "id": "854e2c22-718e-48bb-98db-96f4b43e7ee8",   //流程实例ID
-    "splitValue": "xxxxxxxxxxxxxx", //流程拆分后的拆分依据
-    "title": "xx7月北京出差报销审批",               //流程实例名称
-    "startTime": "2018-09-07 14:03:22",             //流程启动时间
-    "startTimeMonth": "2018-09",                    //流程启动的月份
-    "creatorPerson": "xx@huqi@P",                   //流程实例创建人
-    "creatorIdentity": "xx@481c9edc-5fb5-41f1-b5c2-6ea609082cdb@I", //流程实例创建人身份
-    "creatorUnit": "xx@c448d8bb-98b8-4305-9d3f-12537723cfcc@U",     //流程实例创建人所在组织
-    "creatorUnitLevelName": "浙江兰德纵横/开发部",          //流程实例创建人所在组织层次
-    "application": "1dc23336-6be6-402b-bed6-36e707a1dd17",  //流程应用ID
-    "applicationName": "财务管理",                          //流程应用名称
-    "applicationAlias": "finance",                          //流程应用别名
-    "process": "2207db11-dddf-4ebd-864d-3819f3e173c6",      //流程ID
-    "processName": "报销审批流程",                          //流程名称
-    "processAlias": "",                                     //流程别名
-    "activity": "13d15daf-2ac5-4c1b-a669-1607a0e5ed15",     //当前活动ID
-    "activityType": "manual",                               //当前活动类型
-    "activityName": "部门领导审核",                         //当前活动名称
-    "activityAlias": "",                                    //当前活动别名
-    "activityDescription": "",                              //当前活动描述
-    "activityArrivedTime": "2018-09-27 22:49:21",           //当前活动到达时间
-    "serial": "",                                           //编号
-    "workStatus": "processing",                             //流程实例状态
-    "errorRetry": 0,                                        //流转失败重试次数
-    "splitting": false,                                     //流程是否拆分
-    "form": "db3b2766-93a1-4058-b522-0edb922bd84f",          //流程展现所使用的表单
-    "manualTaskIdentityList" : "张三@db3b2766-93a1-4058-b522-0edb922bd84f@I", //预期的处理人
-    "manualTaskIdentityText" : "张三" //当前处理人身份合并文本,用','分割,超长截断,此字段仅用于显示当前工作的处理人,不索引.
-}
- */
-
-/**
- * WorkCompleted 数据结构,已结束流程实例对象
- * @typedef {Object} WorkCompleted
- * @example
- * {
-    "id": "be0195f1-f2e2-4eac-911c-99897a43ff8f",   //流程实例ID
-    "title": "xx7月北京出差报销审批",               //流程实例名称
-    "startTime": "2018-09-19 16:14:16",             //流程启动时间
-    "startTimeMonth": "2018-09",                    //流程启动的月份
-    "completedTime": "2018-09-19 16:15:28",         //流程完成时间
-    "completedTimeMonth": "2018-09",                //流程完成的月份
-    "creatorPerson": "xx@huqi@P",                   //流程实例创建人
-    "creatorIdentity": "xx@481c9edc-5fb5-41f1-b5c2-6ea609082cdb@I", //流程实例创建人身份
-    "creatorUnit": "xx@c448d8bb-98b8-4305-9d3f-12537723cfcc@U",     //流程实例创建人所在组织
-    "creatorUnitLevelName": "浙江兰德纵横/开发部",  //流程实例创建人所在组织层次
-    "application": "1dc23336-6be6-402b-bed6-36e707a1dd17",  //流程应用ID
-    "applicationName": "财务管理",                          //流程应用名称
-    "applicationAlias": "finance",                          //流程应用别名
-    "process": "2207db11-dddf-4ebd-864d-3819f3e173c6",      //流程ID
-    "processName": "报销审批流程",                          //流程名称
-    "processAlias": "",                                     //流程别名
-    "serial": "",                                           //编号
-    "form": "320be1ca-ee49-478f-a751-f65ab67cf818",         //流程展现所使用的表单
-}
- */
-
-/**
- * Task数据结构,待办任务对象
- * @typedef {Object} Task
- * @example
- * {
-    "id": "dd476045-7c79-44f7-9dba-f51d322de40f",   //待办ID
-    "title": "XX7月北京出差报销审批",               //流程实例标题
-    "startTime": "2018-09-27 22:49:22",             //待办到达时间
-    "startTimeMonth": "2018-09",                    //待办到达的月份
-    "work": "854e2c22-718e-48bb-98db-96f4b43e7ee8", //流程实例ID
-    "application": "1dc23336-6be6-402b-bed6-36e707a1dd17",  //流程应用ID
-    "applicationName": "财务管理",                          //流程应用名称
-    "applicationAlias": "finance",                          //流程应用别名
-    "process": "2207db11-dddf-4ebd-864d-3819f3e173c6",      //流程ID
-    "processName": "报销审批流程",                          //流程名称
-    "processAlias": "",                                     //流程别名
-    "serial": "",                                           //流程编号
-    "person": "XXX@huqi@P",                             //待办人名称
-    "identity": "XX@481c9edc-5fb5-41f1-b5c2-6ea609082cdb@I",    //待办人身份
-    "unit": "XX@c448d8bb-98b8-4305-9d3f-12537723cfcc@U",        //待办人所在组织
-    "activity": "13d15daf-2ac5-4c1b-a669-1607a0e5ed15",         //当前活动的ID
-    "activityName": "部门领导审核",                             //当前活动的名称
-    "activityAlias": "",                                        //当前活动的别名
-    "activityDescription": "",                                  //当前活动描述
-    "activityType": "manual",                                   //当前活动类型
-    "creatorPerson": "XX@huqi@P",                               //流程实例创建人
-    "creatorIdentity": "XX@481c9edc-5fb5-41f1-b5c2-6ea609082cdb@I", //流程实例创建人的身份
-    "creatorUnit": "XX@c448d8bb-98b8-4305-9d3f-12537723cfcc@U", //流程实例创建人所在组织
-    "expired": false,                                           //是否已超时
-    "urged": false,                                             //是否进行催办
-    "routeList": [                                              //可选的路由ID
-        "89b58fe0-6dcb-4fe7-8c2e-3f77204df6d4",
-        "f3105b7a-2929-4682-aab8-15fef5ea0f23"
-    ],
-    "routeNameList": [                                          //可选的路由名称
-        "退回申请人",
-        "送财务部门复审"
-    ],
-    "routeOpinionList": [                                       //可选路由的默认意见
-        "",
-        ""
-    ],
-    "first" : true,      //是否是第一条待办.
-    "properties": { //属性对象存储字段
-          "prevTaskIdentity": "张三@903dbb04-085c-4bb1-9c24-3009bd5f7372@I", //提交的处理人
-          "prevTaskIdentityList": [  //上一步处理人
-            "张三@903dbb04-085c-4bb1-9c24-3009bd5f7372@I"
-          ],
-          "prevTaskList": [ //上一步任务信息
-            {
-              "routeName": "送办理",
-              "unit": "产品研发组@320189216@U",
-              "identity": "张三@903dbb04-085c-4bb1-9c24-3009bd5f7372@I",
-              "person": "张三@zhangsan@P",
-              "opinion": "",
-              "startTime": "2020-09-29 17:03:14",
-              "completedTime": "2020-09-29 17:04:38"
-            }
-          ],
-          "prevTask": { //提交的任务信息
-            "routeName": "送办理",
-            "unit": "产品研发组@320189216@U",
-            "identity": "张三@903dbb04-085c-4bb1-9c24-3009bd5f7372@I",
-            "person": "张三@zhangsan@P",
-            "opinion": "",
-            "startTime": "2020-09-29 17:03:14",
-            "completedTime": "2020-09-29 17:04:38"
-          }
-        }
- * }
- */
-
-/**
- * Read 数据结构,待阅任务对象
- * @typedef {Object} Read
- * @example
- * {
-    "id": "dd476045-7c79-44f7-9dba-f51d322de40f",   //待阅ID
-    "title": "XX7月北京出差报销审批",               //流程实例标题
-    "startTime": "2018-09-27 22:49:22",             //待阅产生时间
-    "startTimeMonth": "2018-09",                    //待阅产生的月份
-    "work": "854e2c22-718e-48bb-98db-96f4b43e7ee8", //流程实例ID
-    "application": "1dc23336-6be6-402b-bed6-36e707a1dd17",  //流程应用ID
-    "applicationName": "财务管理",                          //流程应用名称
-    "applicationAlias": "finance",                          //流程应用别名
-    "process": "2207db11-dddf-4ebd-864d-3819f3e173c6",      //流程ID
-    "processName": "报销审批流程",                          //流程名称
-    "processAlias": "",                                     //流程别名
-    "completed": false,                             //流程是否已完成
-    "serial": "",                                   //流程编号
-    "person": "XXX@huqi@P",                         //待阅人名称
-    "identity": "XX@481c9edc-5fb5-41f1-b5c2-6ea609082cdb@I",    //待阅人身份
-    "unit": "XX@c448d8bb-98b8-4305-9d3f-12537723cfcc@U",        //待阅人所在组织
-    "activity": "13d15daf-2ac5-4c1b-a669-1607a0e5ed15",         //当前活动的ID
-    "activityName": "部门领导审核",                             //当前活动的名称
-    "activityAlias": "",                                        //当前活动的别名
-    "activityDescription": "",                                  //当前活动描述
-    "activityType": "manual",                                   //当前活动类型
-    "creatorPerson": "XX@huqi@P",                               //流程实例创建人
-    "creatorIdentity": "XX@481c9edc-5fb5-41f1-b5c2-6ea609082cdb@I", //流程实例创建人的身份
-    "creatorUnit": "XX@c448d8bb-98b8-4305-9d3f-12537723cfcc@U"  //流程实例创建人所在组织
-}
- */
-
-/**
-* Activity 数据结构,流程实例所在的活动节点对象
- * @typedef {Object} Activity
- * @example
-  *
-     {
-      "id": "801087c5-a4e6-4b91-bf4d-a81cdaa04471", //节点ID
-      "name": "办理",  //节点名称
-      "description": "", //节点描述
-      "alias": "",  //节点别名
-      "resetRange": "department", //重置处理人范围
-      "resetCount": 0,  //重置处理人数字
-      "allowReset": true, //是否允许重置
-      "manualMode": "single" //处理方式 单人single, 并行parallel, 串行queue, grab抢办
-    }
- */
-
-/**
-WorkControl  流程实例的权限对象。
- * @typedef {Object} WorkControl
- * @example
- *
-     {
-        "allowVisit": true,             //是否允许访问
-        "allowProcessing": true,        //是否允许流转
-        "allowReadProcessing": false,   //是否有待阅
-        "allowSave": true,              //是否允许保存业务数据
-        "allowReset": false,            //是否允许重置处理人
-        "allowRetract": false,          //是否允许撤回
-        "allowReroute": false,          //是否允许调度
-        "allowDelete": true,             //是否允许删除流程实例
-        "allowRollback": false,         //是否允许流程回溯
-        "allowAddSplit": false,         //是否允许增加分支
-        "allowPress": false,             //是否允许催办
-    }
- */
-
-
-
-/**
- * FormInfor  表单的基本信息。
- * @typedef {Object} FormInfor
- * @example
- {
-        "id": "db3b2766-93a1-4058-b522-0edb922bd84f",   //表单ID
-        "name": "报销申请表单",                         //表单名称
-        "alias": "报销申请表单",                        //表单别名
-        "description": "",                              //表单描述
-        "application": "1dc23336-6be6-402b-bed6-36e707a1dd17",  //应用ID
-        "lastUpdatePerson": "XX@huqi@P",                //最后修改人
-        "lastUpdateTime": "2018-09-30 22:46:30",        //最后修改时间
-        "icon": "...",                                  //表单图标
-    }
- */
-
 MWF.xScript = MWF.xScript || {};
 MWF.xScript.Environment = function(ev){
     var _data = ev.data;
@@ -412,64 +191,10 @@ MWF.xScript.Environment = function(ev){
         /**
          * 获取当前流程实例对象:work对象或workCompleted对象。
          * @method getWork
-         * @o2ActionOut x_processplatform_assemble_surface.WorkAction.V2GetWorkOrWorkCompleted
          * @static
          * @return {(Work|WorkCompleted)} 流程实例对象;如果流程已结束,返回已结束的流程实例对象.
-         * <div>Work对象:</div>
-         * <pre><code class='language-js'>{
-         *     "id": "854e2c22-718e-48bb-98db-96f4b43e7ee8",   //流程实例ID
-         *     "splitValue": "xxxxxxxxxxxxxx", //流程拆分后的拆分依据
-         *     "title": "xx7月北京出差报销审批",               //流程实例名称
-         *     "startTime": "2018-09-07 14:03:22",             //流程启动时间
-         *     "startTimeMonth": "2018-09",                    //流程启动的月份
-         *     "creatorPerson": "xx@huqi@P",                   //流程实例创建人
-         *     "creatorIdentity": "xx@481c9edc-5fb5-41f1-b5c2-6ea609082cdb@I", //流程实例创建人身份
-         *     "creatorUnit": "xx@c448d8bb-98b8-4305-9d3f-12537723cfcc@U",     //流程实例创建人所在组织
-         *     "creatorUnitLevelName": "浙江兰德纵横/开发部",          //流程实例创建人所在组织层次
-         *     "application": "1dc23336-6be6-402b-bed6-36e707a1dd17",  //流程应用ID
-         *     "applicationName": "财务管理",                          //流程应用名称
-         *     "applicationAlias": "finance",                          //流程应用别名
-         *     "process": "2207db11-dddf-4ebd-864d-3819f3e173c6",      //流程ID
-         *     "processName": "报销审批流程",                          //流程名称
-         *     "processAlias": "",                                     //流程别名
-         *     "activity": "13d15daf-2ac5-4c1b-a669-1607a0e5ed15",     //当前活动ID
-         *     "activityType": "manual",                               //当前活动类型
-         *     "activityName": "部门领导审核",                         //当前活动名称
-         *     "activityAlias": "",                                    //当前活动别名
-         *     "activityDescription": "",                              //当前活动描述
-         *     "activityArrivedTime": "2018-09-27 22:49:21",           //当前活动到达时间
-         *     "serial": "",                                           //编号
-         *     "workStatus": "processing",                             //流程实例状态
-         *     "errorRetry": 0,                                        //流转失败重试次数
-         *     "splitting": false,                                     //流程是否拆分
-         *     "form": "db3b2766-93a1-4058-b522-0edb922bd84f",          //流程展现所使用的表单
-         *     "manualTaskIdentityList" : "张三@db3b2766-93a1-4058-b522-0edb922bd84f@I", //预期的处理人
-         *     "manualTaskIdentityText" : "张三" //当前处理人身份合并文本,用','分割,超长截断,此字段仅用于显示当前工作的处理人,不索引.
-         * }
-         * </pre></code>
-         * WorkCompleted对象:
-         * <pre><code class='language-js'>
-         * {
-         *    "id": "be0195f1-f2e2-4eac-911c-99897a43ff8f",   //流程实例ID
-         *    "title": "xx7月北京出差报销审批",               //流程实例名称
-         *    "startTime": "2018-09-19 16:14:16",             //流程启动时间
-         *    "startTimeMonth": "2018-09",                    //流程启动的月份
-         *    "completedTime": "2018-09-19 16:15:28",         //流程完成时间
-         *    "completedTimeMonth": "2018-09",                //流程完成的月份
-         *    "creatorPerson": "xx@huqi@P",                   //流程实例创建人
-         *    "creatorIdentity": "xx@481c9edc-5fb5-41f1-b5c2-6ea609082cdb@I", //流程实例创建人身份
-         *    "creatorUnit": "xx@c448d8bb-98b8-4305-9d3f-12537723cfcc@U",     //流程实例创建人所在组织
-         *    "creatorUnitLevelName": "浙江兰德纵横/开发部",  //流程实例创建人所在组织层次
-         *     "application": "1dc23336-6be6-402b-bed6-36e707a1dd17",  //流程应用ID
-         *     "applicationName": "财务管理",                          //流程应用名称
-         *     "applicationAlias": "finance",                          //流程应用别名
-         *     "process": "2207db11-dddf-4ebd-864d-3819f3e173c6",      //流程ID
-         *     "processName": "报销审批流程",                          //流程名称
-         *     "processAlias": "",                                     //流程别名
-         *     "serial": "",                                           //编号
-         *     "form": "320be1ca-ee49-478f-a751-f65ab67cf818",         //流程展现所使用的表单
-         * }
-         * </pre></code>
+         * @o2ActionOut x_processplatform_assemble_surface.WoWork|true|Work对象:
+         * @o2ActionOut x_processplatform_assemble_surface.WorkCompletedAction.get|[properties]|WorkCompleted对象:
          * @o2syntax
          * var work = this.workContext.getWork();
          */
@@ -488,7 +213,7 @@ MWF.xScript.Environment = function(ev){
          *      "resetCount": 0,  //重置处理人数字
          *      "allowReset": true, //是否允许重置
          *      "manualMode": "single" //处理方式 单人single, 并行parallel, 串行queue, grab抢办
-         * }</pre></code>
+         * }</code></pre>
          * @o2syntax
          * var activity = this.workContext.getActivity();
          */
@@ -748,7 +473,7 @@ MWF.xScript.Environment = function(ev){
          *        "allowRollback": false,         //是否允许流程回溯
          *        "allowAddSplit": false,         //是否允许增加分支
          *        "allowPress": false,             //是否允许催办
-         * }</pre></code>
+         * }</code></pre>
          * @o2syntax
          * var control = this.workContext.getControl();
          */
@@ -2110,7 +1835,7 @@ MWF.xScript.Environment = function(ev){
      *  },
      *  "initScript2"
      * ])
-     * </pre></code>
+     * </code></pre>
      * @param {Function} [callback] 加载后执行的回调方法
      * @param {Boolean} [async] 是否异步加载
      * @o2syntax
@@ -2297,6 +2022,82 @@ MWF.xScript.Environment = function(ev){
     //可在调用前执行 var resolve = this.wait();
     //在异步调用结束后 执行 resolve.cb();
     //目前只有表单的queryload事件支持此方法。
+
+    /**
+     * this.wait是一个方法,可以用来处理异步调用后的页面加载。<br/>
+     * 该方法使用的具体场景:为了加快速度,需要一次性加载全部外部资源(如:数据字典、外部JS、内容管理文档)后,再进行表单的加载。<br/>
+     * this.wait需和this.goon配合使用。<br/>
+     * <b>目前只有流程表单的queryload事件支持此方法。</b>
+     * @module wait
+     * @o2range {Process}
+     * @o2syntax
+     * var resolve = this.wait(); //让表单停止加载页面
+     *
+     * if (resolve && resolve.cb){
+     *      resolve.cb(); //通过 resolve.cb() 方法继续执行表单加载
+     * }else{
+     *      //如果没有发生异步,则resolve.cb方法不存在,
+     *      //所以在回调中中使用this.goon();使表单继续加载
+     *      this.goon();
+     * }
+     * @example
+     * <caption>需要在加载数据字典,内容管理文档数据,按照条件获取的脚本后,再进行加载表单。</caption>
+     *
+     * var resolve = this.wait(); //this.wait()让表单加载等待回调
+     * var scriptLoaded = false; //脚本是否加载完成标识,按条件判断的脚本才建议用this.include();,否则使用预加载脚本更快。
+     * var documentLoaded = false; //内容管理文档是否加载完成标识
+     * var dictLoaded = true; //数据字典是否加载完成标识
+     *
+     * //检查是否全部资源已加载,如果是继续加载表单
+     * var checkLoad = function(){
+     *     if (scriptLoaded && documentLoaded && dictLoaded){ //各种资源以及加载完成
+     *       if (resolve && resolve.cb){
+     *            resolve.cb(); //通过 resolve.cb() 方法继续执行表单加载
+     *        }else{
+     *            //如果没有发生异步,则resolve.cb方法不存在,
+     *            //所以在回调中中使用this.goon();使表单继续加载
+     *            this.goon();
+     *        }
+     *      }
+     * }.bind(this);
+     *
+     * //判断内容管理文档加载
+     * if( this.data.documentId ){
+     *      //异步载入内容管理文档
+     *      o2.Actions.get("x_cms_assemble_control").getDocument(this.data.documentId, function (json) {
+     *          this.form.documentJson = json; //将数据存在this.form上,以便其他地方使用
+     *          documentLoaded = true; //标记内容管理加载完成
+     *          checkLoad(); //检查全部资源是否完成加载
+     *      }.bind(this));
+     *  }else{
+     *     documentLoaded = true; ////标记内容管理加载完成
+     *     checkLoad(); //检查全部资源是否完成加载
+     * }
+     *
+     * //判断脚本加载
+     * if( this.data.scriptName ){ //假设scriptName为判断条件
+     *      //加载脚本
+     *     this.include( this.data.scriptName, function(){  //第二个参数为异步加载后的回调
+     *         scriptLoaded = true; //标记脚本加载完成
+     *         checkLoad(); //检查全部资源是否完成加载
+     *     }, true ); //第三个参数表示异步
+     * }else{
+     *      scriptLoaded = true; ////标记脚本加载完成
+     *     checkLoad(); //检查全部资源是否完成加载
+     * }
+     *
+     * //加载数据字典bulletinDictionary的category数据
+     * var dict = new Dict("bulletinDictionary");
+     * dict.get("category", function(data){ //成功的回调
+     *          this.form.bulletinCategory = data; //将数据存在this.form上,以便其他地方使用
+     *          dictLoaded = true; //标记数据字典加载完成
+     *          checkLoad(); //检查全部资源是否完成加载
+     *    }.bind(this), function(xhr){ //错误的回调
+     *          dictLoaded = true; ////标记数据字典加载完成
+     *          checkLoad(); //检查全部资源是否完成加载
+     *    }, true //异步执行
+     * )
+     */
     this.wait = function(){
         var _self = this;
         resolve = {"cb":  _self.goon.bind(_self)};
@@ -2331,7 +2132,17 @@ MWF.xScript.Environment = function(ev){
          * 获取当前表单的基本信息。
          * @method getInfor
          * @static
-         * @return {FormInfor} 表单的基本信息.
+         * @return {Object} 表单的基本信息.
+         * <pre><code class='language-js'>{
+         *    "id": "db3b2766-93a1-4058-b522-0edb922bd84f",   //表单ID
+         *    "name": "报销申请表单",                         //表单名称
+         *    "alias": "报销申请表单",                        //表单别名
+         *    "description": "",                              //表单描述
+         *    "application": "1dc23336-6be6-402b-bed6-36e707a1dd17",  //应用ID
+         *    "lastUpdatePerson": "XX@huqi@P",                //最后修改人
+         *    "lastUpdateTime": "2018-09-30 22:46:30",        //最后修改时间
+         *    "icon": "...",                                  //表单图标
+         * }</code></pre>
          * @o2syntax
          * var form = this.form.getInfor();
          */
@@ -2964,20 +2775,18 @@ MWF.xScript.Environment = function(ev){
          * @param {String} id - 内容管理文档实例的ID。
          * @param {Boolean} [title] - 手机APP端打开时的窗口标题。
          * @param {Object} [options] - 其他参数,内容如下<br>
-         * <pre><code class="language-js">
-         {
-            "readonly": true, //是否以只读方式打开,默认为true
-             "saveOnClose" : true, //关闭的时候是否自动保存
-             "postPublish" : function( documentData ){ //发布前执行方法,但数据已经准备好
-                //documentData 为文档数据
-             },
-             "afterPublish" : function( form, documentData ){ //发布后执行的方法
-                //form为内容管理Form对象,documentData 为文档数据
-             },
-             "postDelete" : function(){ //删除文档后执行的方法
-             }
-         }
-         * </code></pre>
+         * <pre><code class="language-js">{
+         *   "readonly": true, //是否以只读方式打开,默认为true
+         *    "saveOnClose" : true, //关闭的时候是否自动保存
+         *    "postPublish" : function( documentData ){ //发布前执行方法,但数据已经准备好
+         *       //documentData 为文档数据
+         *    },
+         *    "afterPublish" : function( form, documentData ){ //发布后执行的方法
+         *       //form为内容管理Form对象,documentData 为文档数据
+         *    },
+         *    "postDelete" : function(){ //删除文档后执行的方法
+         *    }
+         * }</code></pre>
          * @example
          this.form.openDocument(id, "document title");
          */
@@ -3091,19 +2900,17 @@ MWF.xScript.Environment = function(ev){
          * 如果不传参数,则弹出范围为平台所有栏目的选中界面。<br/>
          * 当使用String时为内容管理应用(栏目)的名称、别名或ID。<br/>
          * 当使用Object时,本参数后面的参数省略,传入如下格式的内容:
-         * <pre><code class="language-js">
-         {
-            "column" : column, //(string)可选,内容管理应用(栏目)的名称、别名或ID
-            "category" : category, //(string)可选,要创建的文档所属的分类的名称、别名或ID
-            "data" : data, //(json object)可选,创建文档时默认的业务数据
-            "identity" : identity, //(string)可选,创建文档所使用的身份。如果此参数为空,且当前人有多个身份的情况下,会弹出身份选择对话框;否则使用默认身份。
-            "callback" : callback, //(funcation)可选,文档创建后的回调函数。
-            "target" : target, //(boolean)可选,为true时,在当前页面打开创建的文档;否则打开新窗口。默认false。
-            "latest" : latest, //(boolean)可选,为true时,如果当前用户已经创建了此分类的文档,并且没有发布过,直接调用此文档为新文档;否则创建一个新文档。默认true。
-            "selectColumnEnable" : selectColumnEnable, //(boolean)可选,是否可以选择应用和分类进行创建文档。有category参数时为默认false,否则默认为true。
-            "ignoreTitle" : ignoreTitle //(boolean)可选,值为false时,创建的时候需要强制填写标题,默认为false。
-        }
-         </code></pre>
+         * <pre><code class="language-js">{
+         *   "column" : column, //(string)可选,内容管理应用(栏目)的名称、别名或ID
+         *   "category" : category, //(string)可选,要创建的文档所属的分类的名称、别名或ID
+         *   "data" : data, //(json object)可选,创建文档时默认的业务数据
+         *   "identity" : identity, //(string)可选,创建文档所使用的身份。如果此参数为空,且当前人有多个身份的情况下,会弹出身份选择对话框;否则使用默认身份。
+         *   "callback" : callback, //(funcation)可选,文档创建后的回调函数。
+         *   "target" : target, //(boolean)可选,为true时,在当前页面打开创建的文档;否则打开新窗口。默认false。
+         *   "latest" : latest, //(boolean)可选,为true时,如果当前用户已经创建了此分类的文档,并且没有发布过,直接调用此文档为新文档;否则创建一个新文档。默认true。
+         *   "selectColumnEnable" : selectColumnEnable, //(boolean)可选,是否可以选择应用和分类进行创建文档。有category参数时为默认false,否则默认为true。
+         *   "ignoreTitle" : ignoreTitle //(boolean)可选,值为false时,创建的时候需要强制填写标题,默认为false。
+         * }</code></pre>
          * @param {String} [category] - 要创建的文档所属的分类的名称、别名或ID
          * @param {Object} [data] - 创建文档时默认的业务数据
          * @param {String} [identity] - 可选,创建文档所使用的身份。如果此参数为空,且当前人有多个身份的情况下,会弹出身份选择对话框;否则使用默认身份。

+ 89 - 202
o2web/source/o2_core/o2/xScript/ViewEnvironment.js

@@ -1,48 +1,3 @@
-/**
- * StatementInfor 查询配置信息
- * @typedef {Object} StatementInfor
- * @example
- * {
-    "query": "26d21c71-5114-4496-8ca1-a69e56324841", //所属应用id
-    "id": "ee334220-66d3-4f78-afce-8ccf6b995c8c", //查询id
-    "name": "测试查询", //名称
-    "alias": "", //别名
-    "description": "", //描述
-    "table": "", //自建表的id
-    "entityClassName": "com.x.processplatform.core.entity.content.Task", //系统表表名
-    "entityCategory": "official", //表类型 official(系统表) 或 dynamic(自建表)
-    "format": "jpql", //语句类型,jpql 或者 script(脚本)
-    "type": "select", //select/update/delete
-    "data": "SELECT o FROM Task o where o.person = :person", //查询语句
-    "countData": "SELECT count(o.id) FROM Task o where o.person = :person", //总数语句
-    "countScriptText" : "", //总数语句脚本
-    "scriptText" : "", //查询语句脚本
-    "viewJson": { ... } //视图相关信息
-}
- */
-
-/**
- * ViewInfor 视图配置信息
- * @typedef {Object} ViewInfor
- * @example
- * {
-      "application": "db9fc893-7dbc-4e0f-a617-99089d2c6323", //视图所在应用
-      "query": "db9fc893-7dbc-4e0f-a617-99089d2c6323",  //视图所在应用,同application
-      "name": "视图自定义测试", //视图名称
-      "viewName": "视图自定义测试",  //视图名称,同name
-      "isExpand": "no",  //如果有分类,默认是否展开开
-      "id": "705ce967-2f9c-425c-8873-3bd729249e1d", //视图id
-      "alias": "", //视图别名
-      "description": "",  //视图描述
-      "display": true, //视图是否显示
-      "type": "cms", //视图嵌入的数据类型, cms 或 process
-      "count": 2000, //最多返回2000条
-      "pageSize": 20, //每页的条数
-      "createTime": "2019-09-02 10:18:27",
-      "updateTime": "2020-03-26 15:53:03"
-    }
- */
-
 /**
  * @readonly
  * @enum {String} ViewFilterDataLogic
@@ -156,34 +111,6 @@
  * { "name": "工作汇报读者" } //群组名称
  */
 
-/**在本API的this.org模块中返回的群组数据
- *  @typedef {Object} GroupData
- *  @example
- * {
- *   "name": "工作汇报读者", //群组名称
- *   "unique": "ReportReader",   //群组唯一标志
- *   "description": "可查看所有部门所有状态的工作汇报", //群组说明
- *   "distinguishedName": "工作汇报读者@ReportReader@G", //群组全称
- *   "orderNumber": 13699599,  //排序号
- *   "identityList": [     //身份成员
- *       "张三@cce8bc22-225a-4f85-8132-7374d546886e@I",
- *       "李四@aba8bc22-225a-4f85-8132-7374d546886e@I",
- *   ],
- *   "personList": [     //个人成员
- *       "张三@zhangsan@P",
- *       "李四@lisi@P",
- *   ],
- *   "groupList": [  //群组成员
- *       "所有部门领导@AllDepartLeader@G",
- *       "所有部门汇报管理员@AllDepartReportManager@G"
- *   ],
- *   "unitList": [  //组织成员
- *       "开发部@kfb@U",
- *       "综合部@zhb@U"
- *   ]
- * }
- */
-
 
 /**
  * 在本API的this.org模块中,当使用人员(个人)作为检索参数的时候,允许使用人员的distinguishedName、name、id、unique属性值或包含这些属性的对象。
@@ -204,32 +131,6 @@
  * { "name": "李四" } //人员名称,不重名时才有效
  */
 
-/**在本API的this.org模块中返回的个人数据
- *  @typedef {Object} PersonData
- *  @example
- * {
- *   "name": "李四",    //姓名
- *   "genderType": "m", //性别, m为男性, f为女性, d未知
- *   "signature": "", //签名
- *   "description": "", //说明
- *   "employee": "1111", //员工号
- *   "unique": "lisi", //唯一标识
- *   "distinguishedName": "李四@lisi@P", //识别名
- *   "orderNumber": 14214946, //排序号
- *   "mail": "", //邮箱
- *   "weixin": "", //微信号
- *   "qq": "", //qq号码
- *   "mobile": "85252281460", //手机号码
- *   "officePhone": "", //办公电话
- *   "boardDate" : "", //入职日期
- *   "birthday" : "", //生日
- *   "age" : "", //年龄
- *   "qiyeweixinId" : "", //企业微信id
- *   "dingdingId" : "", //钉钉id
- *   "zhengwuDingdingId" //政务钉钉id
- * }
- */
-
 /**
  * 在本API的this.org模块中,当使用角色作为检索参数的时候,允许使用角色的distinguishedName、name、id、unique属性值或包含这些属性的对象。
  * @typedef {(String|Object)} RoleFlag
@@ -249,25 +150,6 @@
  * { "name": "PersonManager" } //角色名称
  */
 
-/**在本API的this.org模块中返回的角色数据
- *  @typedef {Object} RoleData
- *  @example
- * {
- *   "name": "Manager",   //角色名称
- *   "unique": "ManagerSystemRole", //角色唯一标识
- *   "description": "", //角色描述
- *   "distinguishedName": "Manager@ManagerSystemRole@R", //角色识别名
- *   "orderNumber": 7897556, //排序号
- *   "personList": [  //人员成员
- *       "张三@zhangsan@P",
- *       "李四@lisi@P"
- *   ],
- *   "groupList": [  //群组成员
- *       "测试群组@ceshizu@G"
- *   ]
- * }
- */
-
 /**
  * 在本API的this.org模块中,当使用身份作为检索参数的时候,允许使用身份的distinguishedName、name、id、unique属性值或包含这些属性的对象。
  * @typedef {(String|Object)} IdentityFlag
@@ -287,24 +169,6 @@
  * { "name": "张三" } //身份名称,有可能存在重名,需要精确匹配的请不要使用
  */
 
-/**在本API的this.org模块中返回的身份数据
- *  @typedef {Object} IdentityData
- *  @example
- * {
- *   "name": "李四",  //身份名称,不唯一
- *   "unique": "23dd1b53-feed-485d-8c9c-1a4e64ff58a2", //身份唯一标识
- *   "description": "", //身份描述
- *   "distinguishedName": "李四@23dd1b53-feed-485d-8c9c-1a4e64ff58a2@I", //身份全称
- *   "person": "李四@lisi@P", //人员
- *   "unit": "开发部@kfb@U",  //组织
- *   "unitName": "开发部",   //组织名称, 不唯一
- *   "unitLevel": 2,         //组织层级
- *   "unitLevelName": "浙江兰德纵横/开发部", //组织层级名
- *   "orderNumber": 24920439 //排序号
- *}
- */
-
-
 /**
  * 在本API的this.org模块中,当使用组织作为检索参数的时候,允许使用组织的distinguishedName、name、id、unique属性值或包含这些属性的对象。
  * @typedef {(String|Object)} UnitFlag
@@ -324,26 +188,6 @@
  * { "name": "开发部" } //组织名称,有可能存在重名,需要精确匹配的请不要使用
  */
 
-/**在本API的this.org模块中返回的组织数据
- *  @typedef {Object} UnitData
- *  @example
- * {
- *   "name": "开发部", //组织名称
- *   "unique": "kfb",  //组织唯一标识
- *   "distinguishedName": "开发部@kfb@U", //组织识别名
- *   "typeList": [   //组织类型
- *       "部门"
- *   ],
- *   "description": "", //组织描述
- *   "shortName": "kfb", //组织简称
- *   "level": 2, //组织层级
- *   "levelName": "浙江兰德纵横/开发部", //层级名
- *   "superior": "浙江兰德纵横@a706f5f0-4a3b-4785-8e1d-0a944bfad4eb@U" //上级组织
- * }
- */
-
-
-
 MWF.xScript = MWF.xScript || {};
 MWF.xScript.ViewEnvironment = function (ev) {
     var _form = ev.view;
@@ -381,7 +225,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
      * <div>如果对本应用的数据字典操作,将optionsOrName设置为string。</div>
      * <pre><code class='language-js'>
      *     var dict = new this.Dict("bulletinDictionary"); //数据字典的名称、别名或id
-     * </pre></code>
+     * </code></pre>
      * <div>如果需要对其他应用的数据字典进行操作,将options设置为JsonObject</div>
      * <pre><code class='language-js'>
      * var dict = new this.Dict({
@@ -393,7 +237,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
      *    name : "bulletinDictionary", // 数据字典的名称、别名、id
      *    enableAnonymous : true //允许用户在未登录的情况下读取cms的数据字典, type为process的时候此参数无效,默认为false
      * });
-     * </pre></code>
+     * </code></pre>
      * @return {Object} Dict对象
      * @o2syntax
      * //您可以在页面、表单、流程各个嵌入脚本中,通过this.Dict()对本应用或其他应用的数据字典中的数据进行增删改查,如下:
@@ -885,6 +729,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @return {Promise|IdentityData|IdentityData[]} 当async为true时,返回
          * {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise|Promise}。
          * 否则返回身份,单个是Object,多个是Array。
+         * @o2ActionOut x_organization_assemble_express.IdentityAction.listObject|true|[woUnitDutyList,woUnit,woGroupList]
          * @o2syntax
          * //同步执行,返回身份,单个是对象,多个是数组。
          * var identityList = this.org.getIdentity( name );
@@ -926,6 +771,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @return {Promise|IdentityData[]} 当async为true时,返回
          * {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise|Promise}。
          * 否则返回身份对象数组。
+         * @o2ActionOut x_organization_assemble_express.IdentityAction.listWithPersonObject
          * @o2syntax
          * //同步执行,返回身份对象数组。
          * var identityList = this.org.listIdentityWithPerson( person );
@@ -968,6 +814,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @return {Promise|IdentityData[]} 当async为true时,返回
          * {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise|Promise}。
          * 否则返回身份对象数组。
+         * @o2ActionOut x_organization_assemble_express.IdentityAction.listWithUnitSubNestedObject
          * @o2syntax
          * //同步执行,返回直接组织身份对象数组。
          * var identityList = this.org.listIdentityWithUnit( unit );
@@ -1030,6 +877,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @return {Promise|UnitData|UnitData[]} 当async为true时,返回
          * {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise|Promise}。
          * 否则返回组织,单个是Object,多个是Array。
+         * @o2ActionOut x_organization_assemble_express.UnitAction.listObject
          * @o2syntax
          * //同步执行,返回组织,单个是对象,多个是数组。
          * var unitList = this.org.getUnit( name );
@@ -1073,6 +921,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @return {Promise|UnitData[]} 当async为true时,返回
          * {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise|Promise}。
          * 否则返回组织数组。
+         * @o2ActionOut x_organization_assemble_express.UnitAction.listWithUnitSubNestedObject
          * @o2syntax
          * //同步执行,返回嵌套下级组织数组。
          * var unitList = this.org.listSubUnit( name, true );
@@ -1121,6 +970,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @return {Promise|UnitData[]} 当async为true时,返回
          * {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise|Promise}。
          * 否则返回组织数组。
+         * @o2ActionOut x_organization_assemble_express.UnitAction.listWithUnitSupNestedObject
          * @o2syntax
          * //同步执行,返回嵌套上级组织数组。
          * var unitList = this.org.listSupUnit( name, true );
@@ -1187,6 +1037,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @return {Promise|UnitData|UnitData[]} 当async为true时,返回
          * {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise|Promise}。
          * 否则返回对应组织,单个为对象,多个为数组。
+         * @o2ActionOut x_organization_assemble_express.UnitAction.getWithIdentityWithLevelObject
          * @o2syntax
          * //同步执行,返回直接所在组织,单个为对象,多个为数组。
          * var unitList = this.org.getUnitByIdentity( name );
@@ -1282,6 +1133,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @return {Promise|UnitData[]} 当async为true时,返回
          * {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise|Promise}。
          * 否则返回组织数组。
+         * @o2ActionOut x_organization_assemble_express.UnitAction.listWithIdentitySupNestedObject
          * @o2syntax
          * //同步执行,返回组织数组。
          * var unitList = this.org.listAllSupUnitWithIdentity( name );
@@ -1322,6 +1174,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @return {Promise|UnitData[]} 当async为true时,返回
          * {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise|Promise}。
          * 否则返回组织数组。
+         * @o2ActionOut x_organization_assemble_express.UnitAction.listWithPersonObject
          * @o2syntax
          * //同步执行,返回组织数组。
          * var unitList = this.org.listUnitWithPerson( name );
@@ -1362,6 +1215,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @return {Promise|UnitData[]} 当async为true时,返回
          * {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise|Promise}。
          * 否则返回个人所在组织及所有上级组织。
+         * @o2ActionOut x_organization_assemble_express.UnitAction.listWithPersonSupNestedObject
          * @o2syntax
          * //同步执行,返回组织数组。
          * var unitList = this.org.listAllSupUnitWithPerson( name );
@@ -1403,6 +1257,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @return {Promise|UnitData[]} 当async为true时,返回
          * {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise|Promise}。
          * 否则返回组织数组。
+         * @o2ActionOut x_organization_assemble_express.UnitAction.listWithUnitAttributeObject
          * @o2syntax
          * //同步执行,返回组织数组。
          * var unitList = this.org.listUnitWithAttribute( attributeName, attributeName );
@@ -1444,6 +1299,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @return {Promise|UnitData[]} 当async为true时,返回
          * {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise|Promise}。
          * 否则返回组织数组。
+         * @o2ActionOut x_organization_assemble_express.UnitAction.listWithUnitDutyObject
          * @o2syntax
          * //同步执行,返回组织数组。
          * var unitList = this.org.listUnitWithDuty( dutyName, identity );
@@ -1483,6 +1339,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @return {Promise|UnitData[]} 当async为true时,返回
          * {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise|Promise}。
          * 否则返回顶层组织数组。
+         * @o2ActionOut x_organization_assemble_express.UnitAction.listObject
          * @o2syntax
          * //同步执行,返回顶层组织数组。
          * var unitList = this.org.listTopUnit();
@@ -1524,6 +1381,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @return {Promise|PersonData|PersonData[]} 当async为true时,返回
          * {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise|Promise}。
          * 否则返回人员,单个是Object,多个是Array。
+         * @o2ActionOut x_organization_assemble_express.PersonAction.listObject
          * @o2syntax
          * //同步执行,返回人员,单个是对象,多个是数组。
          * var personList = this.org.getPerson( name );
@@ -1571,6 +1429,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @return {Promise|PersonData[]} 当async为true时,返回
          * {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise|Promise}。
          * 否则返回人员数组。
+         * @o2ActionOut x_organization_assemble_express.PersonAction.listWithPersonSubDirectObject
          * @o2syntax
          * //同步执行,返回嵌套下级人员数组。
          * var personList = this.org.listSubPerson( name, true );
@@ -1619,6 +1478,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @return {Promise|PersonData[]} 当async为true时,返回
          * {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise|Promise}。
          * 否则返回人员数组。
+         * @o2ActionOut x_organization_assemble_express.PersonAction.listWithPersonSupDirectObject
          * @o2syntax
          * //同步执行,返回嵌套上级人员数组。
          * var personList = this.org.listSupPerson( name, true );
@@ -1664,6 +1524,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @return {Promise|PersonData[]} 当async为true时,返回
          * {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise|Promise}。
          * 否则返回人员对象数组。
+         * @o2ActionOut x_organization_assemble_express.PersonAction.listWithGroupObject
          * @o2syntax
          * //同步执行,返回人员数组。
          * var personList = this.org.listPersonWithGroup( group );
@@ -1705,6 +1566,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @return {Promise|PersonData[]} 当async为true时,返回
          * {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise|Promise}。
          * 否则返回人员对象数组。
+         * @o2ActionOut x_organization_assemble_express.PersonAction.listWithRoleObject
          * @o2syntax
          * //同步执行,返回人员数组。
          * var personList = this.org.listPersonWithRole( role );
@@ -1746,6 +1608,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @return {Promise|PersonData[]} 当async为true时,返回
          * {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise|Promise}。
          * 否则返回人员对象数组。
+         * @o2ActionOut x_organization_assemble_express.PersonAction.listWithIdentityObject
          * @o2syntax
          * //同步执行,返回人员数组。
          * var personList = this.org.listPersonWithIdentity( identity );
@@ -1803,6 +1666,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @return {Promise|PersonData[]} 当async为true时,返回
          * {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise|Promise}。
          * 否则返回人员对象数组。
+         * @o2ActionOut x_organization_assemble_express.PersonAction.listWithUnitSubDirectObject
          * @o2syntax
          * //同步执行,返回组织的直接人员数组。
          * var personList = this.org.listPersonWithUnit( unit );
@@ -1854,6 +1718,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @return {Promise|PersonData[]} 当async为true时,返回
          * {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise|Promise}。
          * 否则返回人员对象数组。
+         * @o2ActionOut x_organization_assemble_express.PersonAction.listWithPersonAttributeObject
          * @o2syntax
          * //同步执行,返回拥有对应属性名和属性值人员数组。
          * var personList = this.org.listPersonWithAttribute( name, value );
@@ -1913,6 +1778,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @return {Promise|IdentityData[]} 当async为true时,返回
          * {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise|Promise}。
          * 否则返回身份数组。
+         * @o2ActionOut x_organization_assemble_express.UnitDutyAction.getWithUnitWithName
          * @o2syntax
          * //同步执行,返回身份数组。
          * var identityList = this.org.getDuty( dutyName, unit );
@@ -2033,26 +1899,8 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @param {(Boolean|Function)} [asyncOrCallback] 当参数为boolean,表示是否异步执行,默认为false。当参数为function,表示回调方法。
          * @return {Promise|Object[]} 当async为true时,返回
          * {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise|Promise}。
-         * 否则返回职务数组,如:
-         * <pre><code class='language-js'>{
-         *    "name": "正职领导", //职务名称
-         *    "unit": "开发部@kfb@U", //组织识别名
-         *    "identityList": [   //身份对象数组
-         *        {
-         *            "name": "李四",
-         *            "unique": "lisi",
-         *            "description": "",
-         *            "distinguishedName": "李四@6eafc523-b8a7-4a95-ad9e-a5af87c04410@I",
-         *            "person": "李四@lisi@P",
-         *            "unit": "财务部@310088ea-2786-4ed9-8489-f294e9436ce9@U",
-         *            "unitName": "财务部",
-         *            "unitLevel": 2,
-         *            "unitLevelName": "浙江兰德纵横/财务部",
-         *            "orderNumber": 16972237
-         *        }
-         *    ]
-         * }
-         * </pre></code>
+         * 否则返回职务数组
+         * @o2ActionOut x_organization_assemble_express.UnitDutyAction.listWithUnitObject
          * @o2syntax
          * //同步执行,返回职务数组。
          * var dutyList = this.org.listUnitAllDuty( unit );
@@ -2095,6 +1943,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @return {Promise|GroupData|GroupData[]} 当async为true时,返回
          * {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise|Promise}。
          * 否则返回群组,单个是Object,多个是Array。
+         * @o2ActionOut x_organization_assemble_express.GroupAction.listObject
          * @o2syntax
          * //同步执行,返回群组,单个是Object,多个是Array。
          * var groupList = this.org.getGroup( name );
@@ -2144,6 +1993,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @return {Promise|GroupData[]} 当async为true时,返回
          * {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise|Promise}。
          * 否则返回群组数组。
+         * @o2ActionOut x_organization_assemble_express.GroupAction.listWithGroupSubDirectObject
          * @o2syntax
          * //同步执行,返回嵌套下级群组数组。
          * var groupList = this.org.listSubGroup( name, true );
@@ -2204,6 +2054,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @return {Promise|GroupData[]} 当async为true时,返回
          * {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise|Promise}。
          * 否则返回群组数组。
+         * @o2ActionOut x_organization_assemble_express.GroupAction.listWithGroupSupDirectObject
          * @o2syntax
          * //同步执行,返回嵌套上级群组数组。
          * var groupList = this.org.listSupGroup( name, true );
@@ -2257,6 +2108,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @return {Promise|GroupData[]} 当async为true时,返回
          * {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise|Promise}。
          * 否则返回群组对象数组。
+         * @o2ActionOut x_organization_assemble_express.GroupAction.listWithPersonObject
          * @o2syntax
          * //同步执行,返回群组数组。
          * var groupList = this.org.listGroupWithPerson( name );
@@ -2303,6 +2155,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @return {Promise|RoleData|RoleData[]} 当async为true时,返回
          * {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise|Promise}。
          * 否则返回角色,单个为Object,多个为Array。
+         * @o2ActionOut x_organization_assemble_express.RoleAction.listObject
          * @o2syntax
          * //同步执行,返回角色,单个为对象,多个为数组。
          * var roleList = this.org.getRole( name );
@@ -2349,6 +2202,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @return {Promise|RoleData[]} 当async为true时,返回
          * {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise|Promise}。
          * 否则返回角色对象数组。
+         * @o2ActionOut x_organization_assemble_express.RoleAction.listWithPersonObject
          * @o2syntax
          * //同步执行,返回角色数组。
          * var roleList = this.org.listRoleWithPerson( name );
@@ -2974,7 +2828,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          *       }
          *  ]
          * }
-         * </pre></code>
+         * </code></pre>
          * @param {Function} callback - 访问成功后的回调函数
          * @param {Boolean} [async] - 同步或异步调用。true:异步;false:同步。默认为true。
          * @o2syntax
@@ -3076,7 +2930,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          *       }
          *  ]
          * }
-         * </pre></code>
+         * </code></pre>
          * @param {Function} callback - 必选,当选择完成,点击“确定”之后的回调函数。
          * @o2syntax
          * this.view.select(view, callback);
@@ -3222,7 +3076,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          *       "processName" : "test流程" //其他写确定的值
          *     }
          * }
-         * </pre></code>
+         * </code></pre>
          * @param {Function} callback - 访问成功后的回调函数
          * @param {Boolean} [async] - 同步或异步调用。true:异步;false:同步。默认为true。
          * @o2syntax
@@ -3338,7 +3192,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          *       "processName" : "test流程" //其他写确定的值
          *     }
          * }
-         * </pre></code>
+         * </code></pre>
          * @param {Function} callback - 访问成功后的回调函数
          * @o2syntax
          * this.statement.select(statement, callback);
@@ -3595,7 +3449,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
      *     "perPageCount": 50, //每页的条数
      *     "currentPageNumber": 1 // 当前页数
      * }
-     * </pre></code>
+     * </code></pre>
      * @o2syntax
      * this.queryStatement.getPageInfor();
      */
@@ -3619,14 +3473,14 @@ MWF.xScript.ViewEnvironment = function (ev) {
     },
      ...
      *]
-     * </pre></code>
+     * </code></pre>
      * 如:"select id, title from table o" 返回 二维数组:
      *<pre><code class='language-js'>[
      ["id1", "title1"],
      ["id2", "title2"],
      ...
      *]
-     *</pre></code>
+     *</code></pre>
      * @o2syntax
      * var data = this.queryStatement.getPageData();
      */
@@ -3684,14 +3538,14 @@ MWF.xScript.ViewEnvironment = function (ev) {
     },
      ...
      *]
-     * </pre></code>
+     * </code></pre>
      * 如:"select id, title from table o" 返回 二维数组:
      *<pre><code class='language-js'>[
      ["id1", "title1"],
      ["id2", "title2"],
      ...
      *]
-     *</pre></code>
+     *</code></pre>
      * @o2syntax
      * var data = this.queryStatement.getSelectedData();
      */
@@ -3732,7 +3586,24 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @method getStatementInfor
          * @memberOf module:queryStatement
          * @static
-         * @return {StatementInfor} 查询的配置信息.
+         * @return {Object} 查询的配置信息.
+         * <pre><code class='language-js'>{
+         *    "query": "26d21c71-5114-4496-8ca1-a69e56324841", //所属应用id
+         *    "id": "ee334220-66d3-4f78-afce-8ccf6b995c8c", //查询id
+         *    "name": "测试查询", //名称
+         *    "alias": "", //别名
+         *    "description": "", //描述
+         *    "table": "", //自建表的id
+         *    "entityClassName": "com.x.processplatform.core.entity.content.Task", //系统表表名
+         *    "entityCategory": "official", //表类型 official(系统表) 或 dynamic(自建表)
+         *    "format": "jpql", //语句类型,jpql 或者 script(脚本)
+         *    "type": "select", //select/update/delete
+         *    "data": "SELECT o FROM Task o where o.person = :person", //查询语句
+         *    "countData": "SELECT count(o.id) FROM Task o where o.person = :person", //总数语句
+         *    "countScriptText" : "", //总数语句脚本
+         *    "scriptText" : "", //查询语句脚本
+         *    "viewJson": { ... } //视图相关信息
+         * }</code></pre>
          * @o2syntax
          * this.queryStatement.getStatementInfor();
          */
@@ -3743,7 +3614,23 @@ MWF.xScript.ViewEnvironment = function (ev) {
          * @method getViewInfor
          * @memberOf module:queryView
          * @static
-         * @return {ViewInfor} 视图的配置信息.
+         * @return {Object} 视图的配置信息.
+         * <pre><code class='language-js'>{
+         *      "application": "db9fc893-7dbc-4e0f-a617-99089d2c6323", //视图所在应用
+         *      "query": "db9fc893-7dbc-4e0f-a617-99089d2c6323",  //视图所在应用,同application
+         *      "name": "视图自定义测试", //视图名称
+         *      "viewName": "视图自定义测试",  //视图名称,同name
+         *      "isExpand": "no",  //如果有分类,默认是否展开开
+         *      "id": "705ce967-2f9c-425c-8873-3bd729249e1d", //视图id
+         *      "alias": "", //视图别名
+         *      "description": "",  //视图描述
+         *      "display": true, //视图是否显示
+         *      "type": "cms", //视图嵌入的数据类型, cms 或 process
+         *      "count": 2000, //最多返回2000条
+         *      "pageSize": 20, //每页的条数
+         *      "createTime": "2019-09-02 10:18:27",
+         *      "updateTime": "2020-03-26 15:53:03"
+         * }</code></pre>
          * @o2syntax
          * this.queryView.getViewInfor();
          */
@@ -3760,7 +3647,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          *     "perPageCount": 50, //每页的条数
          *     "currentPageNumber": 1 // 当前页数
          * }
-         * </pre></code>
+         * </code></pre>
          * @o2syntax
          * this.queryView.getPageInfor();
          */
@@ -3783,7 +3670,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          *    },
          *   ...
          *]
-         * </pre></code>
+         * </code></pre>
          * 有分类的时候,数据格式如下:
          *<pre><code class='language-js'>[
          *  {
@@ -3802,7 +3689,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          *  },
          *  ...
          *]
-         *</pre></code>
+         *</code></pre>
          * @o2syntax
          * var data = this.queryView.getPageData();
          */
@@ -3863,7 +3750,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
           },
          ...
          * ]
-         </pre></code>
+         </code></pre>
          * @o2syntax
          * var data = this.queryView.getSelectedData();
          */
@@ -3886,7 +3773,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          *       "formatType":"textValue"
          *   }
          *]
-         * </pre></code>
+         * </code></pre>
          * @param {Function} [callback] 过滤完成并重新加载数据后的回调方法。
          * @o2syntax
          * this.queryView.setFilter( filter );
@@ -3909,7 +3796,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          *      "formatType":"textValue"
          *  }
          *]
-         * </pre></code>
+         * </code></pre>
          * @param {StatementParameter} [parameter] 过滤条件。对查询语句where子句的形如":person"的参数部分进行赋值,参数如下:
          * <pre><code class='language-js'>
          * //假设语句为 select count(o.id) from Read o where (o.person = :person) and (o.startTime > :startTime) and (o.applicationName like :applicationName) and (o.processName = :processName)。
@@ -3920,7 +3807,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          *    "applicationName" : "%test%", //如果运算符用的是 like, noLike,模糊查询
          *    "processName" : "test流程" //其他写确定的值
          * }
-         * </pre></code>
+         * </code></pre>
          * @param {Function} [callback] 过滤完成并重新加载数据后的回调方法。
          * @o2syntax
          * this.queryStatement.setStatementFilter( filter, parameter, callback );
@@ -3958,7 +3845,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          *     }, //可选,内容行样式,如果不传,则使用原视图的配置
          *     "isExpand": "no", //可选,默认是否展开分类,如果不传,则使用原视图的配置, 可选值有:yes no
          *   }
-         * </pre></code>
+         * </code></pre>
          * @o2syntax
          * this.queryView.switchView( options );
          */
@@ -3995,7 +3882,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
          *       "processName" : "test流程" //其他写确定的值
          *     }
          *   })
-         * </pre></code>
+         * </code></pre>
          * @o2syntax
          * this.queryStatement.switchStatement( options );
          */
@@ -4505,7 +4392,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
      *      }
      *    ]
      *  }
-     * </pre></code>
+     * </code></pre>
      */
     this.session = layout.desktop.session;
 
@@ -4531,7 +4418,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
      * @param {String} root 平台RESTful服务根,具体服务列表参见:http://server:20030/x_program_center/jest/list.html。
      *如:<pre><code class='language-js'>
      *  "x_processplatform_assemble_surface" //流程平台相关服务根
-     * </pre></code>
+     * </code></pre>
      * @return {String} 对应服务根的host。如:http://127.0.0.1:20020
      * @o2syntax
      * var actions = this.Actions.getHost( root );
@@ -4546,7 +4433,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
      * 如:
      *<pre><code class='language-js'>
      *  "x_processplatform_assemble_surface" //流程平台相关服务根
-     * </pre></code>
+     * </code></pre>
      * @return {Object} 返回action对象,用于后续服务调用
      * @o2syntax
      * var actions = o2.Actions.load( root );
@@ -4699,7 +4586,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
      * @param {String} root 平台RESTful服务根,具体服务列表参见:http://server:20030/x_program_center/jest/list.html。
      *如:<pre><code class='language-js'>
      *  "x_processplatform_assemble_surface" //流程平台相关服务根
-     * </pre></code>
+     * </code></pre>
      * @return {String} 对应服务根的host。如:http://127.0.0.1:20020
      * @o2syntax
      * var actions = o2.Actions.get( root );

+ 188 - 5
o2web/source/x_component_cms_Xform/Form.js

@@ -8,7 +8,22 @@ MWF.xDesktop.requireApp("process.Xform", "Form", null, false);
 MWF.require("MWF.widget.O2Identity", null, false);
 
 MWF.xDesktop.requireApp("cms.Xform", "Package", null, false);
-MWF.xApplication.cms.Xform.Form = MWF.CMSForm = new Class({
+
+/** @class CMSForm 内容管理表单。
+ * @o2category FormComponents
+ * @o2range {CMS}
+ * @alias CMSForm
+ * @example
+ * //可以在脚本中获取表单
+ * //方法1:
+ * var form = this.form.getApp().appForm; //获取表单
+ * //方法2
+ * var form = this.target; //在表单本身的事件脚本中获取
+ * @hideconstructor
+ */
+MWF.xApplication.cms.Xform.Form = MWF.CMSForm = new Class(
+    /** @lends CMSForm# */
+{
     Implements: [Options, Events],
     Extends: MWF.APPForm,
     options: {
@@ -18,29 +33,131 @@ MWF.xApplication.cms.Xform.Form = MWF.CMSForm = new Class({
         "autoSave": false,
         "saveOnClose": false,
         "showAttachment": true,
-        "moduleEvents": ["queryLoad",
+        "moduleEvents": [
+             /**
+             * 表单加载前触发。表单html已经就位。
+             * @event CMSForm#queryLoad
+             * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
+             */
+            "queryLoad",
+             /**
+             * 表单加载前触发。数据(businessData)已经就绪。
+             * @event CMSForm#beforeLoad
+             * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
+             */
             "beforeLoad",
+            /**
+             * 表单的所有组件加载前触发,此时表单的样式和js head已经加载。
+             * @event CMSForm#beforeModulesLoad
+             * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
+             */
+            "beforeModulesLoad",
+            /**
+             * 表单加载后触发。
+             * @event CMSForm#postLoad
+             * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
+             */
             "postLoad",
+            /**
+             * 表单的所有组件加载后触发。
+             * @event CMSForm#afterModulesLoad
+             * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
+             */
+            "afterModulesLoad",
+            /**
+             * 表单加载后触发。
+             * @event CMSForm#afterLoad
+             * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
+             */
             "afterLoad",
+            /**
+             * 保存前触发。
+             * @event CMSForm#beforeSave
+             * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
+             */
             "beforeSave",
+            /**
+             * 数据已经整理完成,但还未保存到后台时触发。this.event指向整理完成的数据
+             * @event CMSForm#afterSave
+             * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
+             */
             "postSave",
+            /**
+             * 数据保存到后台后触发。
+             * @event CMSForm#afterSave
+             * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
+             */
             "afterSave",
+            /**
+             * 关闭前触发。
+             * @event CMSForm#beforeClose
+             * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
+             */
             "beforeClose",
+            /**
+             * 发布前触发。
+             * @event CMSForm#beforePublish
+             * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
+             */
             "beforePublish",
+            /**
+             * 数据已经整理完成,但还未调用服务发布触发。this.event指向整理完成的数据
+             * @event CMSForm#postPublish
+             * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
+             */
             "postPublish",
+            /**
+             * 执行后台服务发布后触发。
+             * @event CMSForm#afterPublish
+             * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
+             */
             "afterPublish",
+            /**
+             * 删除前触发。
+             * @event CMSForm#beforeDelete
+             * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
+             */
             "beforeDelete",
+            /**
+             * 删除后触发。
+             * @event CMSForm#afterDelete
+             * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
+             */
             "afterDelete",
-            "beforeModulesLoad",
-            "resize",
-            "afterModulesLoad"]
+            "resize"
+        ]
     },
+    /**
+     * @summary 获取表单的所有数据.
+     * @method getData
+     * @memberof CMSForm
+     * @example
+     * var data = this.form.getApp().appForm.getData();
+     * @return {Object}
+     */
     initialize: function (node, data, options) {
         this.setOptions(options);
 
+        /**
+         * @summary 表单容器
+         * @see https://mootools.net/core/docs/1.6.0/Element/Element
+         * @member {Element}
+         * @example
+         *  //可以在脚本中获取表单容器
+         * var formContainer = this.form.getApp().appForm.container;
+         */
         this.container = $(node);
         this.container.setStyle("-webkit-user-select", "text");
         this.data = data;
+
+        /**
+         * @summary 表单的配置信息,比如表单名称等等.
+         * @member {Object}
+         * @example
+         *  //可以在脚本中获取表单配置信息
+         * var json = this.form.getApp().appForm.json; //表单配置信息
+         * var name = json.name; //表单名称
+         */
         this.json = data.json;
         this.html = data.html;
 
@@ -48,7 +165,35 @@ MWF.xApplication.cms.Xform.Form = MWF.CMSForm = new Class({
         this.cssPath = this.options.cssPath || "../x_component_cms_Xform/$Form/" + this.options.style + "/css.wcss";
         this._loadCss();
 
+        /**
+         * @summary 表单中的所有组件数组.
+         * @member {Array}
+         * @example
+         * //下面的样例对表单组件进行循环,并且判断是输入类型的组件
+         * var modules = this.form.getApp().appForm.modules; //获取所有表单组件
+         * for( var i=0; i<modules.length; i++ ){ //循环处理组件
+         *   //获取组件的类型
+            var moduleName = module.json.moduleName;
+            if( !moduleName ){
+                moduleName = typeOf(module.json.type) === "string" ? module.json.type.toLowerCase() : "";
+            }
+            if( ["calendar","combox","number","textfield"].contains( moduleName )){ //输入类型框
+                //do something
+             }
+         * }
+         */
         this.modules = [];
+
+        /**
+         * 该对象的key是组件标识,value是组件对象,可以使用该对象根据组件标识获取组件。<br/>
+         * 需要注意的是,在子表单中嵌入不绑定数据的组件(比如div,common,button等等),系统允许重名。<br/>
+         * 在打开表单的时候,系统会根据重名情况,自动在组件的标识后跟上 "_1", "_2"。
+         * @summary 表单中的所有组件对象.
+         * @member {Object}
+         * @example
+         * var moduleAll = this.form.getApp().appForm.all; //获取组件对象
+         * var subjectField = moduleAll["subject"] //获取名称为subject的组件
+         */
         this.all = {};
         this.forms = {};
 
@@ -555,6 +700,14 @@ MWF.xApplication.cms.Xform.Form = MWF.CMSForm = new Class({
             }.bind(this));
         }
     },
+
+    /**
+     * @summary 弹出删除文档确认框.
+     * @method deleteDocument
+     * @memberof CMSForm
+     * @example
+     * this.form.getApp().appForm.deleteDocument();
+     */
     deleteDocument: function () {
         var _self = this;
         var p = MWF.getCenterPosition(this.app.content, 380, 150);
@@ -593,6 +746,13 @@ MWF.xApplication.cms.Xform.Form = MWF.CMSForm = new Class({
         });
     },
 
+    /**
+     * @summary 编辑文档.
+     * @method editDocument
+     * @memberof CMSForm
+     * @example
+     * this.form.getApp().appForm.editDocument();
+     */
     editDocument: function () {
         if (this.app.inBrowser) {
             this.modules.each(function (module) {
@@ -613,6 +773,13 @@ MWF.xApplication.cms.Xform.Form = MWF.CMSForm = new Class({
     },
 
     //2019-11-29 移动端 开启编辑模式
+    /**
+     * @summary 移动端开启编辑模式.
+     * @method editDocumentForMobile
+     * @memberof CMSForm
+     * @example
+     * this.form.getApp().appForm.editDocumentForMobile();
+     */
     editDocumentForMobile: function () {
         if (this.app.mobile) {
             this.app.options.readonly = false;
@@ -620,6 +787,13 @@ MWF.xApplication.cms.Xform.Form = MWF.CMSForm = new Class({
         }
     },
 
+    /**
+     * @summary 弹出设置热点的界面.
+     * @method setPopularDocument
+     * @memberof CMSForm
+     * @example
+     * this.form.getApp().appForm.setPopularDocument();
+     */
     setPopularDocument: function () {
         this.app.setPopularDocument();
     },
@@ -644,6 +818,15 @@ MWF.xApplication.cms.Xform.Form = MWF.CMSForm = new Class({
         }
     },
 
+    /**
+     * @summary 将新上传的附件在指定的附件组件中展现.
+     * @method uploadedAttachment
+     * @memberof CMSForm
+     * @param {String} site - 附件组件的标识
+     * @param {String} id - 新上传的附件id
+     * @example
+     * this.form.getApp().appForm.uploadedAttachment(site, id);
+     */
     uploadedAttachment: function (site, id) {
         this.documentAction.getAttachment(id, this.businessData.document.id, function (json) {
             var att = this.all[site];

+ 1 - 1
o2web/source/x_component_cms_Xform/Log.js

@@ -14,7 +14,7 @@ MWF.xDesktop.requireApp("cms.Xform", "widget.Log", null, false);
  * @hideconstructor
  */
 MWF.xApplication.cms.Xform.Log = MWF.CMSLog =  new Class(
-    /** @lends MWF.xApplication.cms.Xform.Log# */
+    /** @lends CMSLog# */
 {
 	Extends: MWF.APP$Module,
 	_loadUserInterface: function(){

+ 16 - 33
o2web/source/x_component_process_Xform/Attachment.js

@@ -1035,38 +1035,7 @@ MWF.xApplication.process.Xform.AttachmentController = new Class({
     }
 
 });
-/**
- * 流程实例的附件数据结构.
- * @typedef {Object} WorkAttachmentData
- * @property {String} id - 附件id.
- * @property {String} name - 附件标题.
- * @property {String} person - 上传人.
- * @property {Number} orderNumber - 排序号.
- * @property {String} activityName - 上传的节点.
- * @property {Object} control - 当前登录人员对附件拥有的权限.
- * @property {Boolean} control.allowRead - 是否允许阅读.
- * @property {Boolean} control.allowEdit - 是否允许编辑.
- * @property {Boolean} control.allowControl - 是否允许设置.
- * @property {Number} length - 附件大小.
- * @property {String} createTime - 创建时间.
- * @property {String} updateTime - 修改时间.
- * @property {String} extension - 附件扩展名.
- * @example
- * {
-    "id": "56c4e86f-a4c8-4cc2-a150-1a0d2c5febcb",   //附件ID
-    "name": "133203a2-92e6-4653-9954-161b72ddb7f9.png", //附件名称
-    "extension": "png",                             //附件扩展名
-    "length": 43864,                                //附件大小
-    "person": "xx@huqi@P",                          //附件上传人
-    "lastUpdateTime": "2018-09-27 15:50:34",        //最后的修改时间
-    "lastUpdatePerson": "xx@huqi@P",                //最后的修改人
-    "activity": "e31ad938-c495-45a6-8d77-b8a9b61a165b", //附件上传的活动ID
-    "activityName": "申请人",                           //附件上传的活动名称
-    "activityType": "manual",                           //附件上传的活动类型
-    "site": "$mediaOpinion",                        //附件存储位置(一般用于区分附件在哪个表单元素中显示)
-    "type": "image/png"                             //附件类型(contentType)
-}
- */
+
 
 /** @class Attachment 附件组件。
  * @example
@@ -1723,7 +1692,21 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class(
     },
     /**
      * @summary 为组件重新设置附件,该附件必须已经上传。
-     *  @param data{WorkAttachmentData} .
+     *  @param {Object} data.
+     *  <pre><code class='language-js'>{
+     *     "id": "56c4e86f-a4c8-4cc2-a150-1a0d2c5febcb",   //附件ID
+     *     "name": "133203a2-92e6-4653-9954-161b72ddb7f9.png", //附件名称
+     *     "extension": "png",                             //附件扩展名
+     *     "length": 43864,                                //附件大小
+     *     "person": "xx@huqi@P",                          //附件上传人
+     *     "lastUpdateTime": "2018-09-27 15:50:34",        //最后的修改时间
+     *     "lastUpdatePerson": "xx@huqi@P",                //最后的修改人
+     *     "activity": "e31ad938-c495-45a6-8d77-b8a9b61a165b", //附件上传的活动ID
+     *     "activityName": "申请人",                           //附件上传的活动名称
+     *     "activityType": "manual",                           //附件上传的活动类型
+     *     "site": "$mediaOpinion",                        //附件存储位置(一般用于区分附件在哪个表单元素中显示)
+     *     "type": "image/png"                             //附件类型(contentType)
+     * }</code></pre>
      */
     setData: function(data){
         this.attachmentController.clear();

+ 96 - 10
o2web/source/x_component_process_Xform/Form.js

@@ -35,7 +35,7 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class(
              */
             "queryLoad",
             /**
-             * 表单加载前触发。已提示抢办锁定。
+             * 表单加载前触发。如果是流程表单,已提示抢办锁定。
              * @event MWF.xApplication.process.Xform.Form#beforeLoad
              * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
              */
@@ -53,7 +53,7 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class(
              */
             "postLoad",
             /**
-             * 表单的所有组件后触发。表单包含有子表单、子页面、部件时,此事件会在这些组件加载后触发。
+             * 表单的所有组件加载后触发。表单包含有子表单、子页面、部件时,此事件会在这些组件加载后触发。
              * @event MWF.xApplication.process.Xform.Form#afterModulesLoad
              * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
              */
@@ -65,13 +65,13 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class(
              */
             "afterLoad",
             /**
-             * 保存前触发。流转前也会触发本事件。
+             * 保存前触发。如果是流程表单,流转前也会触发本事件。
              * @event MWF.xApplication.process.Xform.Form#beforeSave
              * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
              */
             "beforeSave",
             /**
-             * 保存后触发。流转后也会触发本事件。
+             * 保存后触发。如果是流程表单,流转后也会触发本事件。
              * @event MWF.xApplication.process.Xform.Form#afterSave
              * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
              */
@@ -180,7 +180,7 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class(
 
         /**
          * @summary 表单的配置信息,比如表单名称,提交方式等等.
-         * @member {JsonObject}
+         * @member {Object}
          * @example
          *  //可以在脚本中获取表单配置信息
          * var json = this.form.getApp().appForm.json; //表单配置信息
@@ -3126,11 +3126,6 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class(
             }
         });
     },
-    /**
-     * @summary 一键下载.
-     * @example
-     * this.form.getApp().appForm.downloadAll();
-     */
     downloadAll: function () {
         var htmlFormId = "";
         o2.Actions.load("x_processplatform_assemble_surface").AttachmentAction.uploadWorkInfo(this.businessData.work.id, "pdf", {
@@ -4263,3 +4258,94 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class(
     }
 
 });
+
+
+/**
+ * @class PortalPage 门户页面。
+ * @alias PortalPage
+ * @o2category FormComponents
+ * @o2range {Portal}
+ * @extends MWF.xApplication.process.Xform.Form
+ * @example
+ * //可以在脚本中获取页面
+ * //方法1:
+ * var page = this.form.getApp().appForm; //获取页面
+ * //方法2
+ * var page = this.target; //在页面本身的事件脚本中获取
+ * @hideconstructor
+ */
+var PortalPage="";
+
+/**
+ * @event PortalPage#beforeProcessWork
+ * @ignore
+ */
+/**
+ * @event PortalPage#beforeProcess
+ * @ignore
+ */
+/**
+ * @event PortalPage#afterProcess
+ * @ignore
+ */
+/**
+ * @event PortalPage#beforeReset
+ * @ignore
+ */
+/**
+ * @event PortalPage#afterReset
+ * @ignore
+ */
+/**
+ * @event PortalPage#beforeRetract
+ * @ignore
+ */
+/**
+ * @event PortalPage#afterRetract
+ * @ignore
+ */
+/**
+ * @event PortalPage#beforeReroute
+ * @ignore
+ */
+/**
+ * @event PortalPage#afterReroute
+ * @ignore
+ */
+/**
+ *  @event PortalPage#beforeDelete
+ * @ignore
+ */
+/**
+ * @event PortalPage#afterDelete
+ * @ignore
+ */
+/**
+ *  @event PortalPage#beforeReaded
+ * @ignore
+ */
+/**
+ * @event PortalPage#afterReaded
+ * @ignore
+ */
+/**
+ * @method PortalPage#getRouteDataList
+ * @ignore
+ */
+/**
+ * @method PortalPage#pressWork
+ * @ignore
+ */
+/**
+ * @method PortalPage#rerouteWork
+ * @ignore
+ */
+/**
+ * @method PortalPage#readedWork
+ * @ignore
+ */
+/**
+ * @method PortalPage#uploadedAttachment
+ * @ignore
+ */
+