Просмотр исходного кода

整理文档打开时的请求,减少record和attachment请求

huqi 5 лет назад
Родитель
Сommit
e45861c997

+ 5 - 0
o2web/source/o2_core/o2/xAction/services/x_processplatform_assemble_surface.json

@@ -260,6 +260,8 @@
   "getFormMobile": {"uri": "/jaxrs/form/{id}/application/{applicationFlag}/mobile"},
   "getScript": {"uri": "/jaxrs/script/{flag}/application/{applicationFlag}"},
   "getScriptByName": {"uri": "/jaxrs/script/{name}/application/{applicationId}","method": "POST"},
+  "getFormV2": {"uri": "/jaxrs/form/v2/{id}"},
+  "getFormV2Mobile": {"uri": "/jaxrs/form/v2/{id}/mobile"},
 
   "sendReaderByWork" : {"uri":"/jaxrs/read/work/{workId}", "method": "POST"},
   "sendReaderByWorkCompleted" : {"uri":"/jaxrs/read/workcompleted/{workCompletedId}", "method": "POST"},
@@ -286,6 +288,9 @@
   "getWorkForm": {"uri": "/jaxrs/form/workorworkcompleted/{workOrWorkCompleted}"},
   "getWorkFormMobile": {"uri": "/jaxrs/form/workorworkcompleted/{workOrWorkCompleted}/mobile"},
 
+  "loadWorkV2": {"uri": "/jaxrs/work/v2/workorworkcompleted/{workOrWorkCompleted}"},
+  "lookupFormWithWork": {"uri": "/jaxrs/form/v2/lookup/workorworkcompleted/{workOrWorkCompleted}"},
+
   "listTaskByJob": {"uri": "/jaxrs/task/list/job/{job}"},
   "listTaskCompletedByJob": {"uri": "/jaxrs/taskcompleted/list/job/{job}"},
   "listReadByJob": {"uri": "/jaxrs/read/list/job/{job}"},

+ 128 - 52
o2web/source/x_component_process_Work/Main.js

@@ -143,66 +143,142 @@ MWF.xApplication.process.Work.Main = new Class({
     },
     loadWorkByWork: function(id){
         //var getWorkLogMothed = "getWorkLog";    //以前使用worklog,现在改成record了
-        var getWorkLogMothed = (this.options.worklogType.toLowerCase()==="worklog") ? "getWorkLog" : "getRecordLog";
+        //var getWorkLogMothed = (this.options.worklogType.toLowerCase()==="worklog") ? "getWorkLog" : "getRecordLog";
+
+        var loadFormFlag = false;
+        var loadWorkFlag = false;
+
+        var json_work, json_log, json_control, json_form;
+
+        var check = function(){
+            if (loadWorkFlag && loadFormFlag){
+                if (json_work && json_control && json_form && json_log){
+                    this.parseData(json_work.data, json_control.data, json_form.data, json_log.data, json_work.data.recordList, json_work.data.attachmentList);
+                    if (this.mask) this.mask.hide();
+                    //if (layout.mobile) this.loadMobileActions();
+                    this.openWork();
+                    this.unLoading();
+                } else{
+                    if (this.options.jobId || this.options.jobid || this.options.job){
+                        delete this.options.workCompletedId;
+                        delete this.options.workId;
+                        delete this.options.workid;
+                        delete this.options.workcompletedid;
+                        this.loadWork();
+                    }else{
+                        this.close();
+                    }
+                }
+            }
+        }.bind(this);
+
         if (this.options.form && this.options.form.id && this.options.form.app){
             o2.Actions.invokeAsync([
-                {"action": this.action, "name": "getForm"},
-                {"action": this.action, "name": "loadWork"},
-                {"action": this.action, "name": "getWorkControl"},
+                {"action": this.action, "name": "loadWorkV2"},
                 {"action": this.action, "name": "getWorkLog"},
-                {"action": this.action, "name": "getRecordLog"},
-                {"action": this.action, "name": "listAttachments"}
-            ], {"success": function(json_form, json_work, json_control, json_log, json_record, json_att){
-                    if (json_work && json_control && json_form && json_log && json_att){
-                        this.parseData(json_work.data, json_control.data, json_form.data, json_log.data, json_record.data, json_att.data);
-                        if (this.mask) this.mask.hide();
-                        //if (layout.mobile) this.loadMobileActions();
-                        this.openWork();
-                        this.unLoading();
-                    } else{
-                        if (this.options.jobId || this.options.jobid || this.options.job){
-                            delete this.options.workCompletedId;
-                            delete this.options.workId;
-                            delete this.options.workid;
-                            delete this.options.workcompletedid;
-                            this.loadWork();
-                        }else{
-                            this.close();
-                        }
-                    }
+                {"action": this.action, "name": "getWorkControl"},
+                {"action": this.action, "name": "getForm"}
+            ], {"success": function(jsonWork, jsonLog, jsonControl, jsonForm){
+                    json_work = jsonWork;
+                    json_log = jsonLog;
+                    json_control = jsonControl;
+                    json_form = jsonForm;
+                    loadWorkFlag = true;
+                    loadFormFlag = true;
+                    check();
                 }.bind(this), "failure": function(){
                     //this.close();
-                }.bind(this)}, [this.options.form.id, this.options.form.app], id);
+                }.bind(this)}, id, id, id, [this.options.form.id, this.options.form.app]);
         }else{
+            this.action.lookupFormWithWork(id, function(json){
+                var formId = json.data.id;
+                this.action[((layout.mobile) ? "getFormV2Mobile": "getFormV2")](formId, function(formJson){
+                    json_form = formJson;
+                    loadFormFlag = true;
+                    check();
+                }, function(){
+                    loadFormFlag = true;
+                    check();
+                });
+            }.bind(this), function(){
+                loadFormFlag = true;
+                check();
+            });
             o2.Actions.invokeAsync([
-                {"action": this.action, "name": (layout.mobile) ? "getWorkFormMobile": "getWorkForm"},
-                {"action": this.action, "name": "loadWork"},
-                {"action": this.action, "name": "getWorkControl"},
-                {"action": this.action, "name": "getWorkLog"},
-                {"action": this.action, "name": "getRecordLog"},
-                {"action": this.action, "name": "listAttachments"}
-            ], {"success": function(json_form, json_work, json_control, json_log, json_record, json_att){
-                    if (json_work && json_control && json_form && json_log && json_att){
-                        this.parseData(json_work.data, json_control.data, json_form.data, json_log.data, json_record.data, json_att.data);
-                        if (this.mask) this.mask.hide();
-                        //if (layout.mobile) this.loadMobileActions();
-                        this.openWork();
-                        this.unLoading();
-                    } else{
-                        if (this.options.jobId || this.options.jobid || this.options.job){
-                            delete this.options.workCompletedId;
-                            delete this.options.workId;
-                            delete this.options.workid;
-                            delete this.options.workcompletedid;
-                            this.loadWork();
-                        }else{
-                            this.close();
-                        }
-                    }
-                }.bind(this), "failure": function(){
-                    //this.close();
-                }.bind(this)}, id);
+                    {"action": this.action, "name": "loadWorkV2"},
+                    {"action": this.action, "name": "getWorkLog"},
+                    {"action": this.action, "name": "getWorkControl"}
+                ], {"success": function(jsonWork, jsonLog, jsonControl){
+                        json_work = jsonWork;
+                        json_log = jsonLog;
+                        json_control = jsonControl;
+                        loadWorkFlag = true;
+                        check();
+                    }.bind(this), "failure": function(){
+                        //this.close();
+                    }.bind(this)}, id
+            );
         }
+
+        // if (this.options.form && this.options.form.id && this.options.form.app){
+        //     o2.Actions.invokeAsync([
+        //         {"action": this.action, "name": "loadWork"},
+        //         {"action": this.action, "name": "getWorkLog"},
+        //         {"action": this.action, "name": "getRecordLog"},
+        //         {"action": this.action, "name": "getWorkControl"},
+        //         {"action": this.action, "name": "listAttachments"},
+        //         {"action": this.action, "name": "getForm"}
+        //     ], {"success": function(json_work, json_log, json_record, json_control, json_att, json_form){
+        //             if (json_work && json_control && json_form && json_log && json_att){
+        //                 this.parseData(json_work.data, json_control.data, json_form.data, json_log.data, json_record.data, json_att.data);
+        //                 if (this.mask) this.mask.hide();
+        //                 //if (layout.mobile) this.loadMobileActions();
+        //                 this.openWork();
+        //                 this.unLoading();
+        //             } else{
+        //                 if (this.options.jobId || this.options.jobid || this.options.job){
+        //                     delete this.options.workCompletedId;
+        //                     delete this.options.workId;
+        //                     delete this.options.workid;
+        //                     delete this.options.workcompletedid;
+        //                     this.loadWork();
+        //                 }else{
+        //                     this.close();
+        //                 }
+        //             }
+        //         }.bind(this), "failure": function(){
+        //             //this.close();
+        //         }.bind(this)}, id, id, id, id, id, [this.options.form.id, this.options.form.app]);
+        // }else{
+            // o2.Actions.invokeAsync([
+            //     {"action": this.action, "name": "loadWork"},
+            //     {"action": this.action, "name": "getWorkLog"},
+            //     {"action": this.action, "name": "getRecordLog"},
+            //     {"action": this.action, "name": "getWorkControl"},
+            //     {"action": this.action, "name": "listAttachments"},
+            //     {"action": this.action, "name": (layout.mobile) ? "getWorkFormMobile": "getWorkForm"}
+            // ], {"success": function(json_work, json_log, json_record, json_control, json_att, json_form){
+            //         if (json_work && json_control && json_form && json_log && json_att){
+            //             this.parseData(json_work.data, json_control.data, json_form.data, json_log.data, json_record.data, json_att.data);
+            //             if (this.mask) this.mask.hide();
+            //             //if (layout.mobile) this.loadMobileActions();
+            //             this.openWork();
+            //             this.unLoading();
+            //         } else{
+            //             if (this.options.jobId || this.options.jobid || this.options.job){
+            //                 delete this.options.workCompletedId;
+            //                 delete this.options.workId;
+            //                 delete this.options.workid;
+            //                 delete this.options.workcompletedid;
+            //                 this.loadWork();
+            //             }else{
+            //                 this.close();
+            //             }
+            //         }
+            //     }.bind(this), "failure": function(){
+            //         //this.close();
+            //     }.bind(this)}, id);
+        //}
     },
     loadWorkByJob: function(jobId){
         MWF.Actions.get("x_processplatform_assemble_surface").listWorkByJob(jobId, function(json){

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
o2web/source/x_desktop/js/base_work_begin.js


Некоторые файлы не были показаны из-за большого количества измененных файлов