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

+ 3 - 3
gulpfile.js

@@ -461,6 +461,7 @@ function build_concat_xform(){
         'o2web/source/' + path + '/Textfield.js',
         'o2web/source/' + path + '/Personfield.js',
         'o2web/source/' + path + '/*.js',
+        'o2web/source/x_component_process_Work/Processor.js',
         '!o2web/source/' + path + '/Office.js'
     ];
     var dest = 'target/o2server/servers/webServer/'+path+'/';
@@ -493,7 +494,6 @@ function build_bundle(){
 function build_concat_basework() {
     var src = [
         'o2web/source/x_desktop/js/base_work_begin.js',
-        'o2web/source/x_desktop/js/base.js',
         'o2web/source/o2_core/o2/widget/Common.js',
         'o2web/source/o2_core/o2/widget/Dialog.js',
         'o2web/source/o2_core/o2/widget/UUID.js',
@@ -520,12 +520,12 @@ function build_concat_basework() {
         'o2web/source/o2_core/o2/xScript/Actions/ScriptActions.js',
         'o2web/source/o2_core/o2/xScript/Actions/CMSScriptActions.js',
         'o2web/source/o2_core/o2/xScript/Actions/PortalScriptActions.js',
-        'o2web/source/x_component_process_Work/Processor.js',
         'o2web/source/x_component_Template/MTooltips.js',
         'o2web/source/o2_core/o2/xAction/services/x_organization_assemble_authentication.js',
         'o2web/source/o2_core/o2/xAction/services/x_processplatform_assemble_surface.js',
         'o2web/source/o2_core/o2/xAction/services/x_cms_assemble_control.js',
-        'o2web/source/x_desktop/js/base_work_end.js'
+        'o2web/source/x_desktop/js/base_work_end.js',
+        'o2web/source/x_desktop/js/base.js'
     ];
     var dest = 'target/o2server/servers/webServer/x_desktop/js/';
     return gulp.src(src)

+ 3 - 3
o2web/gulpfile.js

@@ -155,6 +155,7 @@ function createXFormConcatTask(path, isMin, thisOptions) {
             'source/' + path + '/Textfield.js',
             'source/' + path + '/Personfield.js',
             'source/' + path + '/*.js',
+            'source/x_component_process_Work/Processor.js',
             '!source/' + path + '/Office.js'
         ];
         var dest = option.dest+'/' + path + '/';
@@ -356,7 +357,6 @@ function createBaseWorkConcatTask(path, isMin, thisOptions) {
         var option = thisOptions || options;
         var src = [
             'source/' + path + '/js/base_work_begin.js',
-            'source/' + path + '/js/base.js',
             'source/o2_core/o2/widget/Common.js',
             'source/o2_core/o2/widget/Dialog.js',
             'source/o2_core/o2/widget/UUID.js',
@@ -383,12 +383,12 @@ function createBaseWorkConcatTask(path, isMin, thisOptions) {
             'source/o2_core/o2/xScript/Actions/ScriptActions.js',
             'source/o2_core/o2/xScript/Actions/CMSScriptActions.js',
             'source/o2_core/o2/xScript/Actions/PortalScriptActions.js',
-            'source/x_component_process_Work/Processor.js',
             'source/x_component_Template/MTooltips.js',
             'source/o2_core/o2/xAction/services/x_organization_assemble_authentication.js',
             'source/o2_core/o2/xAction/services/x_processplatform_assemble_surface.js',
             'source/o2_core/o2/xAction/services/x_cms_assemble_control.js',
-            'source/' + path + '/js/base_work_end.js'
+            'source/' + path + '/js/base_work_end.js',
+            'source/' + path + '/js/base.js'
         ];
         var dest = option.dest+'/' + path + '/';
         return gulp.src(src)

+ 2 - 1
o2web/source/o2_core/o2.js

@@ -1247,7 +1247,8 @@
         /jaxrs\/page\/.+\/portal\/.+/ig,
         /jaxrs\/document\/.+/ig,
         /jaxrs\/applicationdict\/.+/ig,
-        /jaxrs\/custom\/.+/ig
+        /jaxrs\/custom\/.+/ig,
+        /jaxrs\/definition\/idea.+/ig
 
         ///jaxrs\/form\/workorworkcompleted\/.+/ig,
         //    /jaxrs\/script/ig,

+ 45 - 3
o2web/source/o2_core/o2/xAction/services/x_processplatform_assemble_designer.js

@@ -205,6 +205,23 @@ MWF.xAction.RestActions.Action["x_processplatform_assemble_designer"] = new Clas
         var data, mobileDataStr;
         if (formData) data = MWF.encodeJsonString(JSON.encode(formData));
         if (mobileData) mobileDataStr = MWF.encodeJsonString(JSON.encode(mobileData));
+
+        var relatedScriptMap = null;
+        if (formData && formData.json.includeScripts && formData.json.includeScripts.length){
+            relatedScriptMap = {};
+            formData.json.includeScripts.each(function(s){
+                relatedScriptMap[s.id] = ((s.appType==="process") ? "processPlatform" : s.appType);
+            });
+        };
+
+        var mobileRelatedScriptMap = null;
+        if (mobileData && mobileData.json.includeScripts && mobileData.json.includeScripts.length){
+            mobileRelatedScriptMap = {};
+            mobileData.json.includeScripts.each(function(s){
+                mobileRelatedScriptMap[s.id] = ((s.appType==="process") ? "processPlatform" : s.appType);
+            });
+        }
+
         var json = {
             "id": formData.json.id,
             "name": formData.json.name,
@@ -214,7 +231,11 @@ MWF.xAction.RestActions.Action["x_processplatform_assemble_designer"] = new Clas
             "application": formData.json.application,
             "category": formData.json.category,
             "icon": formData.json.formIcon,
-            "formFieldList": fieldList
+            "formFieldList": fieldList,
+            "relatedScriptMap": relatedScriptMap,
+            "relatedFormList": (formData && formData.json.subformList) ? formData.json.subformList : [],
+            "mobileRelatedScriptMap": mobileRelatedScriptMap,
+            "mobileRelatedFormList": (mobileData && mobileData.json.subformList) ? mobileData.json.subformList : []
         };
         if (mobileData && mobileData.json.moduleList){
             if (Object.keys(mobileData.json.moduleList).length){
@@ -239,6 +260,23 @@ MWF.xAction.RestActions.Action["x_processplatform_assemble_designer"] = new Clas
                 if (formData) data = MWF.encodeJsonString(JSON.encode(formData));
                 if (mobileData) mobileDataStr = MWF.encodeJsonString(JSON.encode(mobileData));
 
+                var relatedScriptMap = null;
+                if (formData && formData.json.includeScripts && formData.json.includeScripts.length){
+                    relatedScriptMap = {};
+                    formData.json.includeScripts.each(function(s){
+                        relatedScriptMap[s.id] = ((s.appType==="process") ? "processPlatform" : s.appType);
+                    });
+                };
+
+                var mobileRelatedScriptMap = null;
+                if (mobileData && mobileData.json.includeScripts && mobileData.json.includeScripts.length){
+                    mobileRelatedScriptMap = {};
+                    mobileData.json.includeScripts.each(function(s){
+                        mobileRelatedScriptMap[s.id] = ((s.appType==="process") ? "processPlatform" : s.appType);
+                    });
+                }
+
+
                 var json = {
                     "id": formData.json.id,
                     "name": formData.json.name,
@@ -248,7 +286,11 @@ MWF.xAction.RestActions.Action["x_processplatform_assemble_designer"] = new Clas
                     "application": formData.json.application,
                     "category": formData.json.category,
                     "icon": formData.json.formIcon,
-                    "formFieldList": fieldList
+                    "formFieldList": fieldList,
+                    "relatedScriptMap": relatedScriptMap,
+                    "relatedFormList": (formData && formData.json.subformList) ? formData.json.subformList : [],
+                    "mobileRelatedScriptMap": mobileRelatedScriptMap,
+                    "mobileRelatedFormList": (mobileData && mobileData.json.subformList) ? mobileData.json.subformList : []
                 };
 
                 if (mobileData && mobileData.json.moduleList){
@@ -471,4 +513,4 @@ MWF.xAction.RestActions.Action["x_processplatform_assemble_designer"] = new Clas
         this.action.invoke({"name": "removeProjection", "async": async, "parameter": {"id": id}, "success": success, "failure": failure});
     },
 
-});
+});

+ 2 - 1
o2web/source/o2_core/o2/xDesktop/Actions/RestActions.js

@@ -5,7 +5,6 @@ MWF.xDesktop.Actions.RestActions = new Class({
 		this.actionPath = actionPath;
 		this.serviceName = serviceName;
         this.root = root;
-		this.getAddress();
 	},
 	
 	listApplicationAddress: function(success, failure){
@@ -56,6 +55,7 @@ MWF.xDesktop.Actions.RestActions = new Class({
         }
     },
     invokeUri: function(option){
+        if (!this.address) this.getAddress();
         var uri = this.address+option.uri;
         var async = (option.async===false) ? false : true;
         var method = option.method || "GET";
@@ -69,6 +69,7 @@ MWF.xDesktop.Actions.RestActions = new Class({
         MWF.restful(method, uri, data, callback, async, credentials);
     },
 	invoke: function(option){
+        if (!this.address) this.getAddress();
         var res = null;
         this.getActions(function(){
             //name, parameter, data, async, success, failure, withCredentials, urlEncode

+ 9 - 1
o2web/source/x_component_process_FormDesigner/Main.js

@@ -1373,8 +1373,12 @@ MWF.xApplication.process.FormDesigner.Main = new Class({
     checkSubform: function(){
         var pcSubforms = [];
         if (this.pcForm){
+            this.pcForm.data.json.subformList = [];
             this.pcForm.moduleList.each(function(module){
                 if (module.moduleName==="subform"){
+                    if (module.json.subformSelected && module.json.subformSelected!=="none" && module.json.subformType!=="script"){
+                        if (this.pcForm.data.json.subformList.indexOf(module.json.subformSelected) === -1) this.pcForm.data.json.subformList.push(module.json.subformSelected);
+                    }
                     if (module.regetSubformData()){
                         module.subformData.updateTime = "";
                         var moduleNames = module.getConflictFields();
@@ -1386,14 +1390,17 @@ MWF.xApplication.process.FormDesigner.Main = new Class({
                             pcSubforms.push(o);
                         }
                     }
-
                 }
             }.bind(this));
         }
         var mobileSubforms = [];
         if (this.mobileForm){
+            this.mobileForm.data.json.subformList = [];
             this.mobileForm.moduleList.each(function(module){
                 if (module.moduleName==="subform"){
+                    if (module.json.subformSelected && module.json.subformSelected!=="none" && module.json.subformType!=="script"){
+                        if (this.mobileForm.data.json.subformList.indexOf(module.json.subformSelected) === -1) this.mobileForm.data.json.subformList.push(module.json.subformSelected);
+                    }
                     if (module.regetSubformData()){
                         module.subformData.updateTime = "";
                         var moduleNames = module.getConflictFields();
@@ -1537,6 +1544,7 @@ MWF.xApplication.process.FormDesigner.Main = new Class({
 
             this.isSave = true;
             var fieldList = this.getFieldList();
+            //var subFormList = this.getSubformList();
             this.actions.saveForm(pcData, mobileData, fieldList, function(responseJSON){
                 this.notice(MWF.APPFD.LP.notice["save_success"], "ok", null, {x: "left", y:"bottom"});
                 if (!this.pcForm.json.name) this.pcForm.treeNode.setText("<"+this.json.type+"> "+this.json.id);

+ 4 - 1
o2web/source/x_component_process_FormDesigner/Module/Documenteditor.js

@@ -121,14 +121,17 @@ MWF.xApplication.process.FormDesigner.Module.Documenteditor = MWF.FCDocumentedit
 				delete this.json.styles[key];
 			}
 		}.bind(this));
+		// var size = this.node.getSize();
 		this.node.empty();
-		this.node.setStyles(this.css.documentEditorNode);
+		//this.node.getFirst().getFirst().empty();
+		//this.node.setStyles(this.css.documentEditorNode);
 
 		this.json.preprocessing = "y";
 	},
 	_recoveryModuleData: function(){
 		if (this.json.recoveryStyles) this.json.styles = this.json.recoveryStyles;
 		this.json.recoveryStyles = null;
+		this.node.empty();
 		this._resetContent();
 	}
 });

+ 15 - 5
o2web/source/x_component_process_FormDesigner/Module/Form/form.html

@@ -65,15 +65,25 @@
                     <div class="MWFFormSelect" name="printForm"></div>
                 </td>
             </tr>
+<!--            <tr>-->
+<!--                <td class="editTableTitle">数据字典:</td>-->
+<!--                <td class="editTableValue">-->
+<!--                    <div class="MWFDictionarySelect" name="dictionaries"></div>-->
+<!--                </td>-->
+<!--            </tr>-->
+        </table>
+<!--        <div style="height:24px; text-align: center; line-height: 24px; background-color: #EEE; border-top: 1px solid #999;font-weight:bold;">预加载数据字典</div>-->
+
+        <div style="height:24px; text-align: center; line-height: 24px; background-color: #EEE; border-top: 1px solid #999;font-weight:bold;">预加载脚本</div>
+        <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
             <tr>
-                <td class="editTableTitle">数据字典:</td>
+                <td class="editTableTitle">脚本:</td>
                 <td class="editTableValue">
-                    <div class="MWFDictionarySelect" name="dictionaries"></div>
+                    <div class="MWFScriptSelect" data-count=0 name="includeScripts"></div>
                 </td>
             </tr>
         </table>
-        <div style="height:24px; text-align: center; line-height: 24px; background-color: #EEE; border-top: 1px solid #999;font-weight:bold;">加载脚本</div>
-        <div class="MWFScriptIncluder" name="scripts"></div>
+<!--        <div class="MWFScriptIncluder" name="scripts"></div>-->
 
 
 		<!--<div class="MWFArraylist" name="cssLinks" title="CSS引用"></div>-->
@@ -226,4 +236,4 @@
 	<div title="JSON"  class="MWFTab">
 		<div class="MWFJSONArea" style="font-family: Verdana, Geneva, sans-serif; font-size:14px"></div>
 	</div>
-</div>
+</div>

+ 19 - 19
o2web/source/x_component_process_FormDesigner/Module/Log.js

@@ -99,23 +99,23 @@ MWF.xApplication.process.FormDesigner.Module.Log = MWF.FCLog = new Class({
 		this.iconNode.getFirst("div").setStyles(this.css.iconNodeIcon);
 		this.iconNode.getLast("div").setStyles(this.css.iconNodeText);
 	},
-	_preprocessingModuleData: function(){
-		this.node.clearStyles();
-		this.json.recoveryStyles = Object.clone(this.json.styles);
-		if (this.json.recoveryStyles) Object.each(this.json.recoveryStyles, function(value, key){
-			if ((value.indexOf("x_processplatform_assemble_surface")!=-1 || value.indexOf("x_portal_assemble_surface")!=-1)){
-				//需要运行时处理
-			}else{
-				this.node.setStyle(key, value);
-				delete this.json.styles[key];
-			}
-		}.bind(this));
-		this.node.empty();
-		this.json.preprocessing = "y";
-	},
-	_recoveryModuleData: function(){
-		if (this.json.recoveryStyles) this.json.styles = this.json.recoveryStyles;
-		this.json.recoveryStyles = null;
-		this._createIcon();
-	}
+	// _preprocessingModuleData: function(){
+	// 	this.node.clearStyles();
+	// 	this.json.recoveryStyles = Object.clone(this.json.styles);
+	// 	if (this.json.recoveryStyles) Object.each(this.json.recoveryStyles, function(value, key){
+	// 		if ((value.indexOf("x_processplatform_assemble_surface")!=-1 || value.indexOf("x_portal_assemble_surface")!=-1)){
+	// 			//需要运行时处理
+	// 		}else{
+	// 			this.node.setStyle(key, value);
+	// 			delete this.json.styles[key];
+	// 		}
+	// 	}.bind(this));
+	// 	this.node.empty();
+	// 	this.json.preprocessing = "y";
+	// },
+	// _recoveryModuleData: function(){
+	// 	if (this.json.recoveryStyles) this.json.styles = this.json.recoveryStyles;
+	// 	this.json.recoveryStyles = null;
+	// 	this._createIcon();
+	// }
 });

+ 41 - 19
o2web/source/x_component_process_FormDesigner/Property.js

@@ -1318,8 +1318,8 @@ debugger;
             scriptNodes.each(function(node){
                 new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.form.designer, {
                     "type": "Script",
-                    "count": 1,
-                    "names": [this.data[node.get("name")]],
+                    "count": node.dataset["count"] || 1,
+                    "names": (!node.dataset["count"] || node.dataset["count"].toInt()==1) ? [this.data[node.get("name")]] : this.data[node.get("name")],
                     "onChange": function(ids){
                         this.saveScriptSelectItem(node, ids);
                     }.bind(this)
@@ -1530,27 +1530,49 @@ debugger;
 
     },
     saveScriptSelectItem: function(node, ids){
-	    debugger;
-        if (ids[0]){
-            var script = ids[0].data;
-            var data = {
-                "type" : "script",
-                "name": script.name,
-                "alias": script.alias,
-                "id": script.id,
-                "appName" : script.appName || script.applicationName,
-                "appId": script.appId,
-                "application": script.application
-            };
+        var count = (node.dataset["count"] || 1).toInt();
+        if (count==1){
+            if (ids[0]){
+                var script = ids[0].data;
+                var data = {
+                    "appType": script.appType,
+                    "type" : "script",
+                    "name": script.name,
+                    "alias": script.alias,
+                    "id": script.id,
+                    "appName" : script.appName || script.applicationName,
+                    "appId": script.appId,
+                    "application": script.application
+                };
+
+                var name = node.get("name");
+                var oldValue = this.data[name];
+                this.data[name] = data;
 
+                // this.changeJsonDate(name, data );
+                this.changeData(name, node, oldValue);
+            }else{
+                // this.data[node.get("name")] = null;
+            }
+        }else{
+            var scriptValues = [];
+            ids.each(function(s){
+                var scriptValue = {
+                    "appType": s.data.appType,
+                    "type" : "script",
+                    "name": s.data.name,
+                    "alias": s.data.alias,
+                    "id": s.data.id,
+                    "appName" : s.data.appName || s.data.applicationName,
+                    "appId": s.data.appId,
+                    "application": s.data.application
+                }
+                scriptValues.push(scriptValue);
+            }.bind(this));
             var name = node.get("name");
             var oldValue = this.data[name];
-            this.data[name] = data;
-
-            // this.changeJsonDate(name, data );
+            this.data[name] = scriptValues;
             this.changeData(name, node, oldValue);
-        }else{
-            // this.data[node.get("name")] = null;
         }
     },
     removeDutyItem: function(node, item){

+ 1 - 0
o2web/source/x_component_process_ProcessDesigner/widget/PersonSelector.js

@@ -72,6 +72,7 @@ MWF.xApplication.process.ProcessDesigner.widget.PersonSelector = new Class({
                     names = JSON.parse( names );
                 }
                 names.each(function(name){
+                    debugger;
                     if (name){
                         var data = (typeOf(name)==="string") ? {"name": name, "id": name}: name;
                         MWF.require("MWF.widget.O2Identity", function(){

+ 19 - 3
o2web/source/x_component_process_Work/Main.js

@@ -342,6 +342,8 @@ MWF.xApplication.process.Work.Main = new Class({
         return "";
     },
     parseData: function(workData, controlData, formData, logData, recordData, attData){
+        debugger;
+
         var title = workData.work.title;
         //this.setTitle(this.options.title+"-"+title);
         this.setTitle(title || this.options.title);
@@ -370,11 +372,25 @@ MWF.xApplication.process.Work.Main = new Class({
         this.attachmentList = attData;
         //this.inheritedAttachmentList = data.inheritedAttachmentList;
 
+
         this.control = controlData;
         if (formData){
-            this.form = (formData.data) ? JSON.decode(MWF.decodeJsonString(formData.data)): null;
-            delete formData.data;
-            this.formInfor = formData;
+            if (formData.form){
+                this.form = (formData.form.data) ? JSON.decode(MWF.decodeJsonString(formData.form.data)): null;
+                //
+                // var rex = /mwftype="subform"/gi;
+                //
+                //
+                // debugger;
+                this.relatedFormMap = formData.relatedFormMap;
+                this.relatedScriptMap = formData.relatedScriptMap;
+                delete formData.form.data;
+                this.formInfor = formData.form;
+            }else{
+                this.form = (formData.data) ? JSON.decode(MWF.decodeJsonString(formData.data)): null;
+                delete formData.data;
+                this.formInfor = formData;
+            }
         }
     },
 

+ 3 - 7
o2web/source/x_component_process_Work/Processor.js

@@ -1,10 +1,6 @@
 MWF.xApplication.process = MWF.xApplication.process || {};
 MWF.xApplication.process.Work = MWF.xApplication.process.Work || {};
 MWF.xDesktop.requireApp("process.Work", "lp."+MWF.language, null, false);
-//兼容快速流转,所以需要判断
-if( MWF.xApplication.process.Xform && MWF.xApplication.process.Xform.Form ){
-    MWF.xDesktop.requireApp("process.Xform", "Org", null, false);
-}
 
 MWF.xApplication.process.Work.Processor = new Class({
     Extends: MWF.widget.Common,
@@ -1673,8 +1669,10 @@ MWF.xApplication.process.Work.Processor = new Class({
 
 });
 
-
+//兼容快速流转,所以需要判断
 if( MWF.xApplication.process.Xform && MWF.xApplication.process.Xform.Form ){
+    MWF.xDesktop.requireApp("process.Xform", "Org", null, false);
+
     MWF.xApplication.process.Work.Processor.Org = new Class({
         Implements: [Options, Events],
         options: {
@@ -2662,6 +2660,4 @@ if( MWF.xApplication.process.Xform && MWF.xApplication.process.Xform.Form ){
     MWF.xApplication.process.Work.Processor.IdentityOptions = new Class({
         Extends : MWF.APPOrg.IdentityOptions
     });
-
-
 }

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

@@ -215,7 +215,8 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
 
                 this._loadEvents();
 
-                this.loadResource( function () {
+                this.loadRelatedScript();
+                //this.loadResource( function () {
                     this.fireEvent("queryLoad");
                     if (this.event_resolve){
                         this.event_resolve(function(){
@@ -224,20 +225,36 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
                     }else{
                         this.loadForm(callback);
                     }
-                }.bind(this));
+                //}.bind(this));
 
             }.bind(this));
         }.bind(this));
     },
-    loadResource : function( callback ){
-        var cb = function () {
-            if( this.syncScriptLoaded && this.asyncScriptLoaded && this.dictionaryLoaded ){
-                if(callback)callback();
-            }
-        }.bind(this);
-        this.loadScriptList( cb );
-        this.loadDictionaryList( cb );
+    loadRelatedScript: function(){
+        debugger;
+        if (this.json.includeScripts && this.json.includeScripts.length){
+            var includeScriptText = "";
+            var includedIds = [];
+            this.json.includeScripts.each(function(s){
+                if (this.app.relatedScriptMap && this.app.relatedScriptMap[s.id]){
+                    includeScriptText+="\n"+this.app.relatedScriptMap[s.id].text;
+                    includedIds.push(s.id);
+                }
+            }.bind(this));
+
+            if (includeScriptText) this.Macro.exec(includeScriptText, this);
+        }
     },
+    //@todo 载入脚本和数据字典
+    // loadResource : function( callback ){
+    //     var cb = function () {
+    //         if( this.syncScriptLoaded && this.asyncScriptLoaded && this.dictionaryLoaded ){
+    //             if(callback)callback();
+    //         }
+    //     }.bind(this);
+    //     // this.loadScriptList( cb );
+    //     this.loadDictionaryList( cb );
+    // },
     loadDictionaryList: function( callback ){
         this.dictionaryLoaded = false;
         var loadedCount = 0;

+ 19 - 14
o2web/source/x_component_process_Xform/Subform.js

@@ -13,6 +13,7 @@ MWF.xApplication.process.Xform.Subform = MWF.APPSubform = new Class({
             this.form.checkSubformLoaded();
             this.checked = true;
         } else {
+            debugger;
             this.getSubform(function () {
                 this.loadSubform();
             }.bind(this));
@@ -31,8 +32,7 @@ MWF.xApplication.process.Xform.Subform = MWF.APPSubform = new Class({
             this.loadSubform();
             if(callback)callback();
         }.bind(this));
-    }
-    ,
+    },
     loadCss: function () {
         if (this.subformData.json.css && this.subformData.json.css.code) {
             var cssText = this.form.parseCSS(this.subformData.json.css.code);
@@ -176,22 +176,27 @@ MWF.xApplication.process.Xform.Subform = MWF.APPSubform = new Class({
             }
         } else {
             if (this.json.subformSelected && this.json.subformSelected !== "none") {
-                var app;
-                if (this.json.subformAppSelected) {
-                    app = this.json.subformAppSelected;
-                } else {
-                    app = (this.form.businessData.work || this.form.businessData.workCompleted).application;
-                }
-                MWF.Actions.get("x_processplatform_assemble_surface")[method](this.json.subformSelected, app, function (json) {
-                    this.getSubformData(json.data);
+                var subformData = (this.form.app.relatedFormMap) ? this.form.app.relatedFormMap[this.json.subformSelected] : null;
+                if (subformData){
+                    this.getSubformData({"data": subformData.data});
                     if (callback) callback();
-                }.bind(this));
+                }else{
+                    var app;
+                    if (this.json.subformAppSelected) {
+                        app = this.json.subformAppSelected;
+                    } else {
+                        app = (this.form.businessData.work || this.form.businessData.workCompleted).application;
+                    }
+                    MWF.Actions.get("x_processplatform_assemble_surface")[method](this.json.subformSelected, app, function (json) {
+                        this.getSubformData(json.data);
+                        if (callback) callback();
+                    }.bind(this));
+                }
             } else {
                 if (callback) callback();
             }
         }
-    }
-    ,
+    },
     getSubformData: function (data) {
         if (!data || typeOf(data) !== "object")return;
         var subformDataStr = null;
@@ -332,4 +337,4 @@ MWF.xApplication.process.Xform.SubmitForm = MWF.APPSubmitform = new Class({
             }
         }
     }
-});
+});

+ 77 - 145
o2web/source/x_desktop/js/base.js

@@ -392,7 +392,6 @@ o2.addReady(function () {
             loadingNode.destroy();
             loadingNode = null;
         }
-
     };
     var _loadProgressBar = function (complete) {
         if (loadingNode) {
@@ -410,40 +409,6 @@ o2.addReady(function () {
         }
     };
 
-    //异步载入必要模块
-    layout.config = null;
-    var configLoaded = false;
-    var lpLoaded = false;
-    var commonLoaded = false;
-    var lp = o2.session.path + "/lp/" + o2.language + ".js";
-
-    if (o2.session.isDebugger && (o2.session.isMobile || layout.mobile)) o2.load("../o2_lib/eruda/eruda.js");
-
-    o2.load(lp, function () {
-        _loadProgressBar();
-        lpLoaded = true;
-
-        var modules = ["o2.xDesktop.$all"];
-        o2.require(modules, {
-            "onSuccess": function () {
-                commonLoaded = true;
-                if (configLoaded && commonLoaded && lpLoaded) _getDistribute(function () { _load(); });
-            },
-            "onEvery": function () {
-                _loadProgressBar();
-            }
-        });
-
-        //if (configLoaded && lpLoaded && commonLoaded) _getDistribute(function () { _load(); });
-    });
-
-    o2.getJSON("../x_desktop/res/config/config.json", function (config) {
-        _loadProgressBar();
-        layout.config = config;
-        configLoaded = true;
-        if (configLoaded && commonLoaded && lpLoaded) _getDistribute(function () { _load(); });
-    });
-
     var _getDistribute = function (callback) {
         if (layout.config.app_protocol === "auto") {
             layout.config.app_protocol = window.location.protocol;
@@ -462,51 +427,15 @@ o2.addReady(function () {
         var _loadApp = function (json) {
             //用户已经登录
             layout.user = json.data;
-            //layout.session = {};
+            layout.session = layout.session || {};
             layout.session.user = json.data;
             layout.session.token = json.data.token;
             layout.desktop.session = layout.session;
-            //(function (layout) {
-                // var _loadResource = function (callback) {
-                //     // var isLoadedA = false;
-                //     // var isLoadedB = false;
-                //     //var isLoadedC = false;
-                //
-                //     var modules = [
-                //         "o2.widget._base",
-                //         "o2.xDesktop._base"
-                //     ];
-                //     //o2.xDesktop.requireApp("Common", "", null, false);
-                //     //var _check = function () { if (isLoadedA && isLoadedB) if (callback) callback(); };
-                //
-                //     //o2.load(["../o2_lib/mootools/plugin/mBox.min.js"], function () { _loadProgressBar(); isLoadedA = true; _check(); });
-                //     // o2.require("o2.widget.Common", function () {
-                //     //     _loadProgressBar();
-                //     o2.require(modules, {
-                //         "onSuccess": function () {
-                //             _loadProgressBar();
-                //             if (callback) callback();
-                //             //o2.requireApp("Common", "", function () { _loadProgressBar(); isLoadedB = true; _check(); })
-                //         },
-                //         "onEvery": function () {
-                //             _loadProgressBar();
-                //         }
-                //     });
-                //     // });
-                // };
-
-            //    var _loadContent = function () {
-                    //_loadResource(function () {
-                        _loadProgressBar(true);
-                        while (layout.readys && layout.readys.length) {
-                            layout.readys.shift().apply(window);
-                        }
-
-                    //});
-            //    };
 
-            //    _loadContent();
-            //})(layout);
+            _loadProgressBar(true);
+            while (layout.readys && layout.readys.length) {
+                layout.readys.shift().apply(window);
+            }
         };
 
         //修改支持x-token
@@ -538,85 +467,88 @@ o2.addReady(function () {
                     }
                 });
             } else {
-                //用户未经登录
-                //打开登录页面
-                // var _loadResource = function (callback) {
-                //     var isLoadedA = false;
-                //     var isLoadedB = false;
-                //     //var isLoadedC = false;
-                //
-                //     //var lp = o2.session.path+"/lp/"+o2.language+".js";
-                //     var modules = [
-                //         "o2.xDesktop.desktopInit"
-                //     ];
-                //     //o2.xDesktop.requireApp("Common", "", null, false);
-                //     var _check = function () { if (isLoadedA && isLoadedB) if (callback) callback(); };
-                //
-                //     o2.load(["../o2_lib/mootools/plugin/mBox.min.js"], function () { _loadProgressBar(); isLoadedA = true; _check(); });
-                //     o2.require("o2.widget.Common", function () {
-                //         _loadProgressBar();
-                //         o2.require(modules, {
-                //             "onSuccess": function () {
-                //                 o2.requireApp("Common", "", function () { isLoadedB = true; _check(); })
-                //             },
-                //             "onEvery": function () {
-                //                 _loadProgressBar();
-                //             }
-                //         });
-                //     });
-                // };
-                //_loadResource(function () {
-                    _loadProgressBar(true);
-                    if (layout.yqwx) {
-                        layout.openLoginQywx();
-                    } else {
-                        layout.openLogin();
-                    }
-                //});
+                _loadProgressBar(true);
+                if (layout.yqwx) {
+                    layout.openLoginQywx();
+                } else {
+                    layout.openLogin();
+                }
             }
         });
 
         layout.openLogin = function () {
-        //    o2.require("o2.widget.Common", null, false);
-        //    o2.require("o2.xDesktop.Authentication", function () {
-                layout.authentication = new o2.xDesktop.Authentication({
-                    "style": "flat",
-                    "onLogin": _load.bind(layout)
-                });
-                layout.authentication.loadLogin(document.body);
-                var loadingNode = $("browser_loading");
-                if (loadingNode) loadingNode.fade("out");
-        //    });
+            layout.authentication = new o2.xDesktop.Authentication({
+                "style": "flat",
+                "onLogin": _load.bind(layout)
+            });
+            layout.authentication.loadLogin(document.body);
+            var loadingNode = $("browser_loading");
+            if (loadingNode) loadingNode.fade("out");
         };
 
         layout.openLoginQywx = function () {
             console.log("开始login。。。。。。。。。。。。。");
             var uri = locate.href.toURI();
 
-        //    MWF.require("MWF.xDesktop.Actions.RestActions", function () {
-                console.log("执行单点。。。。。。。。。。");
-                var action = new MWF.xDesktop.Actions.RestActions("", "x_organization_assemble_authentication", "");
-                action.getActions = function (actionCallback) {
-                    this.actions = { "sso": { "uri": "/jaxrs/qiyeweixin/code/{code}", "method": "GET" } };
-                    if (actionCallback) actionCallback();
-                };
-                action.invoke({
-                    "name": "sso", "async": true, "parameter": { "code": uri.getData("code") }, "success": function (json) {
-                        console.log("单点成功。");
-                        console.log(json);
-                        //基础数据。。。。
-                        layout.session.user = json.data;
-                        //
-                        _load();
-
-                    }.bind(this), "failure": function (xhr, text, error) {
-                        var n = document.getElementById("loaddingArea");
-                        if (n) { n.destroy(); }
-                        document.id("layout").set("html", "<div>企业微信单点异常!</div>")
-                    }.bind(this)
-                });
-        //    });
+            console.log("执行单点。。。。。。。。。。");
+            var action = new MWF.xDesktop.Actions.RestActions("", "x_organization_assemble_authentication", "");
+            action.getActions = function (actionCallback) {
+                this.actions = { "sso": { "uri": "/jaxrs/qiyeweixin/code/{code}", "method": "GET" } };
+                if (actionCallback) actionCallback();
+            };
+            action.invoke({
+                "name": "sso", "async": true, "parameter": { "code": uri.getData("code") }, "success": function (json) {
+                    console.log("单点成功。");
+                    console.log(json);
+                    //基础数据。。。。
+                    layout.session.user = json.data;
+                    //
+                    _load();
+
+                }.bind(this), "failure": function (xhr, text, error) {
+                    var n = document.getElementById("loaddingArea");
+                    if (n) { n.destroy(); }
+                    document.id("layout").set("html", "<div>企业微信单点异常!</div>")
+                }.bind(this)
+            });
         };
-
     };
+
+    //异步载入必要模块
+    layout.config = null;
+    var configLoaded = false;
+    var lpLoaded = false;
+    var commonLoaded = false;
+    var lp = o2.session.path + "/lp/" + o2.language + ".js";
+
+    if (o2.session.isDebugger && (o2.session.isMobile || layout.mobile)) o2.load("../o2_lib/eruda/eruda.js");
+
+    var loadModuls = function () {
+        _loadProgressBar();
+        lpLoaded = true;
+
+        var modules = ["o2.xDesktop.$all"];
+        o2.require(modules, {
+            "onSuccess": function () {
+                commonLoaded = true;
+                if (configLoaded && commonLoaded && lpLoaded) _getDistribute(function () { _load(); });
+            },
+            "onEvery": function () {
+                _loadProgressBar();
+            }
+        });
+    }
+
+    if (!o2.LP){
+        o2.load(lp, loadModuls);
+    }else{
+        loadModuls();
+    }
+
+    o2.getJSON("../x_desktop/res/config/config.json", function (config) {
+        _loadProgressBar();
+        layout.config = config;
+        configLoaded = true;
+        if (configLoaded && commonLoaded && lpLoaded) _getDistribute(function () { _load(); });
+    });
 });

+ 2 - 3
o2web/source/x_desktop/js/base_work_end.js

@@ -2,9 +2,8 @@ o2.xDesktop.$all=true;
 o2.xDesktop.Common=true;
 MWF.xApplication.Selector.package = MWF.O2Selector;
 
-layout.addReady(function(){
+//layout.addReady(function(){
     MWF.Actions.actions["x_organization_assemble_authentication"] = new MWF.xAction.RestActions.Action["x_organization_assemble_authentication"]("x_organization_assemble_authentication", orgActins);
     MWF.Actions.actions["x_processplatform_assemble_surface"] = new MWF.xAction.RestActions.Action["x_processplatform_assemble_surface"]("x_processplatform_assemble_surface", processActins);
     MWF.Actions.actions["x_cms_assemble_control"] = new MWF.xAction.RestActions.Action["x_cms_assemble_control"]("x_cms_assemble_control", cmsActins);
-});
-
+//});