Przeglądaj źródła

Merge branch 'feature/Process.sumbit_custom' into 'develop'

Merge of feature/[流程管理]新增流程自定义提交 to develop

See merge request o2oa/o2oa!540
蔡祥熠 5 lat temu
rodzic
commit
be3a80ac6f

+ 27 - 7
o2web/source/o2_core/o2/xDesktop/Dialog.js

@@ -268,7 +268,14 @@ o2.xDesktop.Dialog = o2.DDL = new Class({
         this.fireEvent("restore");
     },
     reCenter: function(){
-        var size = this.node.getSize();
+	    var size;
+	    if( this.node.offsetParent === null ){ //如果是隐藏的
+            size = this.node.measure(function(){
+                return this.getSize();
+            });
+        }else{
+            size = this.node.getSize();
+        }
 
         if( this.options.positionWidth ){
             size.x = parseInt(this.options.positionWidth);
@@ -317,6 +324,14 @@ o2.xDesktop.Dialog = o2.DDL = new Class({
             (node.getStyle("border-left-width").toInt() || 0 ) +
             (node.getStyle("border-right-width").toInt() || 0 );
     },
+    getMarginY : function(node){
+        return (node.getStyle("margin-top").toInt() || 0 ) +
+            (node.getStyle("margin-bottom").toInt() || 0 );
+    },
+    getMarginX : function(node){
+        return (node.getStyle("margin-left").toInt() || 0 ) +
+            (node.getStyle("margin-right").toInt() || 0 );
+    },
     setContentHeightAuto : function(){
         var maxHeight = this.getMaxHeight();
 
@@ -327,7 +342,7 @@ o2.xDesktop.Dialog = o2.DDL = new Class({
         if( this.bottom )offsetY = offsetY + this.getOffsetY( this.bottom ) + this.bottom.getSize().y;
         if( this.button && !this.buttonDisable )offsetY = offsetY + this.getOffsetY( this.button ) + this.button.getSize().y;
         if( this.content ){
-            offsetY = offsetY + this.getOffsetY( this.content );
+            offsetY = offsetY + this.getMarginY( this.content );
             y = offsetY + this.content.getSize().y;
         }else{
             y = offsetY;
@@ -379,6 +394,10 @@ o2.xDesktop.Dialog = o2.DDL = new Class({
             if( typeOf(maxHeightPercent) === "string" && maxHeightPercent.substr(maxHeightPercent.length - 1, 1) === "%" ) {
                 var containerHeight = ( this.options.positionNode || this.options.container || $(document.body)).getSize().y;
                 maxHeightPercent = parseInt(containerHeight * parseInt(maxHeightPercent) / 100);
+
+                if( maxHeightPercent + (this.options.minTop || 0) > containerHeight ){
+                    maxHeightPercent = containerHeight - (this.options.minTop)
+                }
             }
         }
 
@@ -644,7 +663,7 @@ o2.xDesktop.Dialog = o2.DDL = new Class({
         var offsetX = 0;
         var x = 0;
         if( this.content ){
-            offsetX = offsetX + this.getOffsetX( this.content );
+            offsetX = offsetX + this.getMarginX( this.content );
             x = offsetX + this.content.getSize().x;
         }else{
             x = offsetX;
@@ -663,10 +682,11 @@ o2.xDesktop.Dialog = o2.DDL = new Class({
             this.node.setStyles({
                 "width": maxWidth
             });
-            this.contentWidth = maxWidth - offsetX;
+
+            this.contentWidth = maxWidth - this.getOffsetX(this.content);
             if (this.content) {
                 this.content.setStyles({
-                    "width" : maxWidth - offsetX,
+                    "width" : this.contentWidth,
                     "overflow-x": "auto"
                 })
             }
@@ -682,10 +702,10 @@ o2.xDesktop.Dialog = o2.DDL = new Class({
             this.node.setStyles({
                 "width": x
             });
-            this.contentWidth = x - offsetX;
+            this.contentWidth = x - this.getOffsetX(this.content);
             if (this.content) {
                 this.content.setStyles({
-                    "width" : x - offsetX,
+                    "width" : this.contentWidth,
                     "overflow-x": "hidden"
                 })
             }

+ 84 - 35
o2web/source/x_component_process_FormDesigner/Module/Form/form.html

@@ -40,6 +40,89 @@
                 </td>
             </tr>
         </table>
+
+		<!--<div class="MWFArraylist" name="cssLinks" title="CSS引用"></div>-->
+		<!--<div class="MWFArraylist" name="scriptSrc" title="JS引用"></div>-->
+
+		<div class="MWFMaplist" name="styles" title="样式"></div>
+		<div class="MWFMaplist" name="properties" title="属性"></div>
+
+        <div class="MWFCssArea" name="css" title="CSS"></div>
+		<!--<div class="MWFScriptArea" name="jsheader" title="JS Header"></div>-->
+
+        <div class="MWFScriptArea" name="validationOpinion" title="校验意见 (S)"></div>
+        <div class="MWFScriptArea" name="validationRoute" title="校验路由 (S)"></div>
+        <div class="MWFScriptArea" name="validationFormCustom" title="流转校验 (S)"></div>
+
+	</div>
+	<div title="提交" class="MWFTab">
+
+        <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="editTableValue" colspan="2">
+                    <input type="radio" onclick="if (this.checked) {
+                        $('text{$.pid}selectSubmitForm').setStyle('display', 'none');
+                        $('text{$.pid}scriptSubmitForm').setStyle('display', 'none');
+                        $('text{$.pid}submitScript').setStyle('display', 'none');
+                    }" name="submitFormType" value="default" text{($.submitFormType!='script' && $.submitFormType!='select' )?'checked':''}/>系统默认
+                    <input type="radio" onclick="if (this.checked) {
+                        $('text{$.pid}selectSubmitForm').setStyle('display', 'block');
+                        $('text{$.pid}scriptSubmitForm').setStyle('display', 'none');
+                        $('text{$.pid}submitScript').setStyle('display', 'block');
+                    }" name="submitFormType" value="select" text{($.submitFormType=='select')?'checked':''}/>选择表单
+                    <input type="radio" onclick="if (this.checked) {
+                        $('text{$.pid}selectSubmitForm').setStyle('display', 'none');
+                        $('text{$.pid}scriptSubmitForm').setStyle('display', 'block');}
+                        $('text{$.pid}submitScript').setStyle('display', 'block');
+                    " name="submitFormType" value="script" text{($.submitFormType=='script')?'checked':''}/>计算表单<br/>
+                </td>
+            </tr>
+        </table>
+
+        <div id="text{$.pid}selectSubmitForm" class="MWFSubFormSelectContainer" style="display: text{($.submitFormType=='select')?'block':'none'}">
+            <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+                <tr>
+                    <td class="editTableTitle">应用:</td>
+                    <td class="editTableValue">
+                        <div class="MWFSubformAppSelect" name="submitFormAppSelected"></div>
+                    </td>
+                </tr>
+                <tr>
+                    <td class="editTableTitle">表单:</td>
+                    <td class="editTableValue">
+                        <div class="MWFSubformSelect" name="submitFormSelected"></div>
+                    </td>
+                </tr>
+            </table>
+        </div>
+        <div id="text{$.pid}scriptSubmitForm" style="display: text{($.submitFormType=='script')?'block':'none'}">
+            <div style="padding: 5px;">跨应用:<br/>return { <br/>
+                &nbsp;&nbsp;"application" : "应用名称", //应用名称、别名、id <br/>
+                &nbsp;&nbsp;"form" : "表单名称" //表单、id<br/>
+                }; <br/> 本应用:<br/>return "表单名称"; </div>
+            <div class="MWFScriptArea" name="submitFormScript" title="提交表单脚本 (S)"></div>
+        </div>
+        <div id="text{$.pid}submitScript" style="display: text{($.submitFormType=='script' || $.submitFormType=='select')?'block':'none'}">
+            <div class="MWFScriptArea" name="submitScript" title="提交(继续流转)操作脚本"></div>
+        </div>
+
+        <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+            <tr>
+                <td colspan="2" class="editTableValue"><b>提交意见手写板宽度:</b>
+                    <input type="text" name="tabletWidth" value="text{$.tabletWidth}" class="editTableInputNoWidth" style="width: 50px;margin-right:3px;" />px
+                    <span>&nbsp;&nbsp;&nbsp;&nbsp;(pc端有效)</span>
+                </td>
+            </tr>
+            <tr>
+                <td colspan="2" class="editTableValue"><b>提交意见手写板高度:</b>
+                    <input type="text" name="tabletHeight" value="text{$.tabletHeight}" class="editTableInputNoWidth" style="width: 50px;;margin-right:3px;" />px
+                    <span>&nbsp;&nbsp;&nbsp;&nbsp;(pc端有效)</span>
+                </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>
         <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
             <tr>
                 <td colspan="2" class="editTableValue"><b>流转后提示框:</b>
@@ -76,41 +159,7 @@
                     秒后自动关闭</b></td>
             </tr>
         </table>
-
-        <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
-<!--            <tr>-->
-<!--                <td colspan="2" class="editTableValue"><b>提交表单:</b>-->
-<!--                    <div class="MWFFormSelect" name="submitForm"></div>-->
-<!--                </td>-->
-<!--            </tr>-->
-            <tr>
-                <td colspan="2" class="editTableValue"><b>提交意见手写板宽度:</b>
-                    <input type="text" name="tabletWidth" value="text{$.tabletWidth}" class="editTableInputNoWidth" style="width: 50px;margin-right:3px;" />px
-                    <span>&nbsp;&nbsp;&nbsp;&nbsp;(pc端有效)</span>
-                </td>
-            </tr>
-            <tr>
-                <td colspan="2" class="editTableValue"><b>提交意见手写板高度:</b>
-                    <input type="text" name="tabletHeight" value="text{$.tabletHeight}" class="editTableInputNoWidth" style="width: 50px;;margin-right:3px;" />px
-                    <span>&nbsp;&nbsp;&nbsp;&nbsp;(pc端有效)</span>
-                </td>
-            </tr>
-        </table>
-		
-		<!--<div class="MWFArraylist" name="cssLinks" title="CSS引用"></div>-->
-		<!--<div class="MWFArraylist" name="scriptSrc" title="JS引用"></div>-->
-		
-		<div class="MWFMaplist" name="styles" title="样式"></div>
-		<div class="MWFMaplist" name="properties" title="属性"></div>
-
-        <div class="MWFCssArea" name="css" title="CSS"></div>
-		<!--<div class="MWFScriptArea" name="jsheader" title="JS Header"></div>-->
-
-        <div class="MWFScriptArea" name="validationOpinion" title="校验意见 (S)"></div>
-        <div class="MWFScriptArea" name="validationRoute" title="校验路由 (S)"></div>
-        <div class="MWFScriptArea" name="validationFormCustom" title="流转校验 (S)"></div>
-
-	</div>
+    </div>
     <div title="操作"  class="MWFTab" style="overflow: hidden; display: text{($.mode=='Mobile')?'block':'none'}">
         <div class="MWFDefaultActionArea" name="defaultTools" data-target="mobileForm"></div>
         <div class="MWFActionArea" name="tools"></div>

+ 5 - 3
o2web/source/x_component_process_FormDesigner/Property.js

@@ -13,7 +13,7 @@ MWF.xApplication.process.FormDesigner.Property = MWF.FCProperty = new Class({
 		this.module = module;
 		this.form = module.form;
 		this.data = module.json;
-		this.data.pid = this.form.json.id+this.data.id;
+		this.data.pid = this.form.options.mode+this.form.json.id+this.data.id;
 		this.htmlPath = this.options.path;
 		this.designer = designer;
 		this.maplists = {};
@@ -1723,7 +1723,8 @@ debugger;
             if (this.module){
                 var id = this.data.pid;
                 //var id = this.form.json.id;
-                input.set("name", this.form.options.mode+id+jsondata);
+                // input.set("name", this.form.options.mode+id+jsondata);
+                input.set("name", id+jsondata);
             }
 
 			if (jsondata){
@@ -1849,7 +1850,8 @@ debugger;
         //var id = this.form.json.id;
         var id = this.data.pid;
 
-		var checkboxList = $$("input[name='"+this.form.options.mode+id+name+"']");
+		// var checkboxList = $$("input[name='"+this.form.options.mode+id+name+"']");
+        var checkboxList = $$("input[name='"+id+name+"']");
 		var values = [];
 		checkboxList.each(function(checkbox){
 			if (checkbox.get("checked")){

+ 2 - 1
o2web/source/x_component_process_Work/$Processor/mobile/css.wcss

@@ -84,7 +84,8 @@
         "height": "129px",
         "border-left": "0px solid #6681a5",
         "border-right": "0px solid #6681a5",
-        "background-color": "#EEE"
+        "background-color": "#EEE",
+        "overflow" : "hidden"
     },
     "selectIdeaNode": {
         "background-color": "#eee",

+ 119 - 27
o2web/source/x_component_process_Work/Processor.js

@@ -36,16 +36,21 @@ MWF.xApplication.process.Work.Processor = new Class({
         this.load();
     },
     load: function(){
+        if( layout.mobile ){
+            this.content = new Element("div").inject(this.node);
+        }else{
+            this.content = this.node;
+        }
         if( !this.form && this.options.isManagerProcess ){
-            this.managerProcessNoticeNode = new Element("div", {"styles": this.css.managerProcessNoticeNode, "html": MWF.xApplication.process.Work.LP.managerProcessNotice}).inject(this.node);
-            this.managerLoginNode = new Element("div", {"styles": this.css.managerLoginNode, "text": MWF.xApplication.process.Work.LP.managerLogin }).inject(this.node);
+            this.managerProcessNoticeNode = new Element("div", {"styles": this.css.managerProcessNoticeNode, "html": MWF.xApplication.process.Work.LP.managerProcessNotice}).inject(this.content);
+            this.managerLoginNode = new Element("div", {"styles": this.css.managerLoginNode, "text": MWF.xApplication.process.Work.LP.managerLogin }).inject(this.content);
 
             this.managerLoginNode.addEvent("click", function(ev){
                 this.managerLogin(ev);
             }.bind(this));
 
             //var text = MWF.xApplication.process.Work.LP.managerLoginReturn.replace( "{user}", layout.session.user.name );
-            //this.managerLoginReturnNode = new Element("div", {"styles": this.css.managerLoginNode, "text": text }).inject(this.node);
+            //this.managerLoginReturnNode = new Element("div", {"styles": this.css.managerLoginNode, "text": text }).inject(this.content);
             //this.managerLoginReturnNode.hide();
             //this.managerPerson = layout.session.user.distinguishedName;
             //this.managerLoginReturnNode.addEvent("click", function(ev){
@@ -53,23 +58,27 @@ MWF.xApplication.process.Work.Processor = new Class({
             //}.bind(this))
         }
 
-        this.routeOpinionTile = new Element("div", {"styles": this.css.routeOpinionTile, "text": MWF.xApplication.process.Work.LP.inputOpinion}).inject(this.node);
-        this.routeOpinionArea = new Element("div", {"styles": this.css.routeOpinionArea}).inject(this.node);
+        this.routeOpinionTile = new Element("div", {"styles": this.css.routeOpinionTile, "text": MWF.xApplication.process.Work.LP.inputOpinion}).inject(this.content);
+        this.routeOpinionArea = new Element("div", {"styles": this.css.routeOpinionArea}).inject(this.content);
 
         this.setOpinion();
 
         if( this.form ){
             if( layout.mobile ){
-                this.orgsArea = new Element("div", {"styles": this.css.orgsArea}).inject(this.node);
+                this.orgsArea = new Element("div", {"styles": this.css.orgsArea}).inject(this.content);
                 this.orgsTile = new Element("div", {"styles": this.css.orgsTitle, "text": MWF.xApplication.process.Work.LP.selectPerson}).inject(this.orgsArea);
                 this.orgsArea.hide();
             }else{
-                this.orgsArea = new Element("div", {"styles": this.css.orgsArea}).inject(this.node);
+                this.orgsArea = new Element("div", {"styles": this.css.orgsArea}).inject(this.content);
                 this.orgsTile = new Element("div", {"styles": this.css.orgsTitle, "text": MWF.xApplication.process.Work.LP.selectPerson}).inject(this.orgsArea);
             }
         }
 
-        this.buttonsArea = new Element("div", {"styles": this.css.buttonsArea}).inject(this.node);
+        if( layout.mobile ){
+            this.buttonsArea = new Element("div", {"styles": this.css.buttonsArea}).inject(this.node);
+        }else{
+            this.buttonsArea = new Element("div", {"styles": this.css.buttonsArea}).inject(this.content);
+        }
         this.setButtons();
 
         if( this.form ){
@@ -207,7 +216,7 @@ MWF.xApplication.process.Work.Processor = new Class({
             list.push( this.splitByStartNumber( k).name )
         }.bind(this));
 
-        var flag = true;
+        var flag = false;
         list.each( function( routeGroupName ){
             var routeList = this.routeGroupObject[routeGroupName];
             var routeGroupNode = new Element("div", {"styles": this.css.routeGroupNode, "text": routeGroupName}).inject(this.routeGroupArea);
@@ -224,10 +233,12 @@ MWF.xApplication.process.Work.Processor = new Class({
                 this.selectRouteGroup(routeGroupNode);
                 flag = false;
             }else{
-                // this.setSize(0);
+                flag = true;
             }
         }.bind(this))
-        if( flag )this.setSize(0);
+        if( flag ){
+            this.setSize(0);
+        }
     },
     overRouteGroup: function(node){
         if (this.selectedRouteGroup){
@@ -317,6 +328,7 @@ MWF.xApplication.process.Work.Processor = new Class({
         //this.task.routeNameList = ["送审核", "送办理", "送公司领导阅"];
         if( !routeList )routeList = this.getRouteDataList();
         //this.task.routeNameList.each(function(route, i){
+        var flag = false;
         routeList.each(function(route, i){
             if( route.hiddenScriptText && this.form && this.form.Macro ){
                 if( this.form.Macro.exec(route.hiddenScriptText, this).toString() === "true" )return;
@@ -341,11 +353,13 @@ MWF.xApplication.process.Work.Processor = new Class({
                 this.selectRoute(routeNode);
                 flag = false;
             }else{
-                // this.setSize(0);
+                flag = true;
             }
 
         }.bind(this));
-        if(flag)this.setSize(0);
+        if( flag ){
+            this.setSize(0);
+        }
     },
     overRoute: function(node){
         if (this.selectedRoute){
@@ -406,8 +420,8 @@ MWF.xApplication.process.Work.Processor = new Class({
 
             }else{
                 this.selectedRoute.setStyles(this.css.routeNode);
-                this.selectedRoute.addClass("mainColor_bg");
-                this.selectedRoute.removeClass("lightColor_bg");
+                this.selectedRoute.addClass("lightColor_bg");
+                this.selectedRoute.removeClass("mainColor_bg");
                 //this.selectedRoute.getFirst().setStyles(this.css.routeIconNode);
                 //this.selectedRoute.getLast().setStyles(this.css.routeTextNode);
 
@@ -1119,6 +1133,7 @@ MWF.xApplication.process.Work.Processor = new Class({
         var data = this.getOrgData( route );
         var routeConfig = this.getRouteData( route );
         var ignoreFirstOrgOldData = false; //(routeConfig.type === "appendTask" && routeConfig.appendTaskIdentityType === "select");
+        this.setSize( data.length );
         if( data.length  ){
             this.orgsArea.show();
 
@@ -1351,8 +1366,31 @@ MWF.xApplication.process.Work.Processor = new Class({
         this.fireEvent("resize");
     },
     setSize : function( currentOrgLength ){
-        if( layout.mobile )return;
-
+        if( layout.mobile ){
+            this.setSize_mobile();
+        }else{
+            this.setSize_pc( currentOrgLength );
+        }
+        //this.node.store("width", this.node.getStyle("width").toInt() + ( flag ? 20 : 0 ));
+        this.fireEvent("resize");
+    },
+    setSize_mobile : function(){
+        if( this.buttonsArea ){
+            debugger;
+            var bodySize = $(document.body).getSize();
+            var nodeHeight = bodySize.y - this.getOffsetY(this.node);
+            this.node.setStyles({
+                "overflow-y": "hidden",
+                "height" : nodeHeight
+            });
+            var buttonsAreaSize = this.buttonsArea.getSize();
+            this.content.setStyles({
+                "height" : nodeHeight - buttonsAreaSize.y - this.getOffsetY(this.buttonsArea) - this.getOffsetY(this.content),
+                "overflow-y" : "auto"
+            })
+        }
+    },
+    setSize_pc : function( currentOrgLength ){
         var lines = ((currentOrgLength+1)/2).toInt();
         var flag = false;
 
@@ -1364,6 +1402,7 @@ MWF.xApplication.process.Work.Processor = new Class({
         //if( this.buttonsArea )height = height + this.getOffsetY(this.buttonsArea) +  this.buttonsArea.getStyle("height").toInt();
 
         if( lines > 0 ){
+            if(this.orgsArea)this.orgsArea.show();
             if( this.orgsTile )height = height + this.getOffsetY(this.orgsTile) +  this.orgsTile.getStyle("height").toInt();
             height = height + lines*this.options.orgHeight + this.getOffsetY(this.orgsArea);
             this.node.setStyle( "height", height );
@@ -1371,10 +1410,11 @@ MWF.xApplication.process.Work.Processor = new Class({
             //flag = (lines*this.options.orgHeight + 431) > Math.floor( this.form.app.content.getSize().y * 0.9);
             //this.node.store("height", Math.min( Math.floor( this.form.app.content.getSize().y * 0.9) , lines*this.options.orgHeight + 431 ));
         }else{
-            this.orgsArea.hide();
+            if(this.orgsArea)this.orgsArea.hide();
             this.node.setStyle( "height", height );
             //this.node.store("height", 401 );
         }
+        debugger;
         if( this.getMaxOrgLength() > 1 ){
             this.node.setStyles( this.css.node_wide );
             this.inputOpinionNode.setStyles( this.css.inputOpinionNode_wide );
@@ -1389,8 +1429,6 @@ MWF.xApplication.process.Work.Processor = new Class({
             this.inputTextareaStyle = this.css.inputTextarea;
             this.selectIdeaNode.setStyles( this.css.selectIdeaNode );
         }
-        //this.node.store("width", this.node.getStyle("width").toInt() + ( flag ? 20 : 0 ));
-        this.fireEvent("resize");
     },
     validationOrgs : function(){
         if( !this.orgItems || !this.orgItems.length )return true;
@@ -1427,12 +1465,17 @@ MWF.xApplication.process.Work.Processor = new Class({
             return true;
         }
         if( !this.validationOrgs() )return false;
-        if( !this.isOrgsHasEmpower() ){
+        if( layout.mobile ){
             if( callback )callback();
             return true;
+        }else{
+            if( !this.isOrgsHasEmpower() ){
+                if( callback )callback();
+                return true;
+            }
+            //this.checkEmpowerMode = true;
+            this.showEmpowerDlg( callback );
         }
-        //this.checkEmpowerMode = true;
-        this.showEmpowerDlg( callback );
     },
     showEmpowerDlg : function( callback ){
         //this.empowerMask = new Element("div", {"styles": this.css.handwritingMask}).inject(this.node);
@@ -1505,7 +1548,7 @@ MWF.xApplication.process.Work.Processor = new Class({
 
         //var width = this.node.retrieve("width");
         //empowerNode.setStyle( "width", width );
-        var width = "880";
+        var width = 840;
         //if( len > 1 ){
         //    width = "840"
         //}else{
@@ -1522,9 +1565,17 @@ MWF.xApplication.process.Work.Processor = new Class({
             "isResize": false,
             "content": empowerNode,
             //"container" : this.node,
-            "width": width, //600,
+            "width": width + 40, //600,
             "height": "auto", //dlgHeight,
             "mark" : false,
+            "onPostLoad" : function () {
+                if( this.nodeWidth ){
+                    this.node.setStyle("width", this.nodeWidth+"px" );
+                }
+                if( this.nodeHeight ){
+                    this.node.setStyle("height", this.nodeHeight+"px" );
+                }
+            },
             "buttonList": [
                 {
                     "type" : "ok",
@@ -2394,6 +2445,47 @@ if( MWF.xApplication.process.Xform && MWF.xApplication.process.Xform.Form ){
             this.css = this.processor.css;
             this.checkedAllItems = true;
         },
+        load : function( data, callback, container ){
+            if( typeOf(data)==="array" && this.json.isCheckEmpower && this.json.identityResultType === "identity" ){
+                var array = [];
+                data.each( function( d ){
+                    if( d.distinguishedName ){
+                        var flag = d.distinguishedName.substr(d.distinguishedName.length-1, 1).toLowerCase();
+                        if( flag === "i" ){
+                            array.push( d.distinguishedName )
+                        }
+                    }
+                }.bind(this));
+                if( array.length > 0 ){
+                    o2.Actions.get("x_organization_assemble_express").listEmpowerWithIdentity({
+                        "application" : (this.form.businessData.work || this.form.businessData.workCompleted).application,
+                        "process" : (this.form.businessData.work || this.form.businessData.workCompleted).process,
+                        "work" : (this.form.businessData.work || this.form.businessData.workCompleted).id,
+                        "identityList" : array
+                    }, function( json ){
+                        var arr = [];
+                        json.data.each( function(d){
+                            if(d.fromIdentity !== d.toIdentity )arr.push(d);
+                        });
+                        if( arr.length > 0 ){
+                            if( layout.mobile ){
+                                this.openSelectEmpowerDlg( arr, data, callback, container );
+                            }else{
+                                this.openSelectEmpowerDlg_embedded( arr, data, callback, container );
+                            }
+                        }else{
+                            if( callback )callback( data );
+                        }
+                    }.bind(this), function(){
+                        if( callback )callback( data );
+                    }.bind(this))
+                }else{
+                    if( callback )callback( data );
+                }
+            }else{
+                if( callback )callback( data );
+            }
+        },
         hasEmpowerIdentity: function( data ){
             var flag = false;
             if( typeOf(data)==="array" && this.json.isCheckEmpower && this.json.identityResultType === "identity" ) {
@@ -2424,14 +2516,14 @@ if( MWF.xApplication.process.Xform && MWF.xApplication.process.Xform.Form ){
             }
             return flag;
         },
-        openSelectEmpowerDlg : function( data, orgData, callback, container ){
+        openSelectEmpowerDlg_embedded : function( data, orgData, callback, container ){
             var node = new Element("div", {"styles": this.css.empowerAreaNode});
             //var html = "<div style=\"line-height: 30px; color: #333333; overflow: hidden\">"+MWF.xApplication.process.Xform.LP.empowerDlgText+"</div>";
             var html = "<div style=\"margin-bottom:10px; margin-top:10px; overflow-y:auto;\"></div>";
             node.set("html", html);
             var itemNode = node.getLast();
             this.getEmpowerItems(itemNode, data);
-            node.inject( container || this.container );
+            node.inject( container || this.form.app.content );
 
             if( this.selectAllNode ){
                 var selectNode = this.createSelectAllEmpowerNode();

+ 141 - 92
o2web/source/x_component_process_Xform/Form.js

@@ -54,6 +54,7 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
         this.sectionListObj = {};
         this.modules = [];
         this.all = {};
+        this.allForName = {};
         this.forms = {};
 
         //if (!this.personActions) this.personActions = new MWF.xAction.org.express.RestActions();
@@ -230,19 +231,19 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
         }
         var stylesUrl = "/x_component_process_FormDesigner/Module/Form/skin/" + this.json.styleConfig.extendFile;
         MWF.getJSON(stylesUrl, {
-            "onSuccess": function (responseJSON) {
-                if (responseJSON && responseJSON.form) {
-                    this.json = Object.merge(this.json, responseJSON.form);
-                }
-                if (callback) callback();
-            }.bind(this),
-            "onRequestFailure": function () {
-                if (callback) callback();
-            }.bind(this),
-            "onError": function () {
-                if (callback) callback();
-            }.bind(this)
-        }
+                "onSuccess": function (responseJSON) {
+                    if (responseJSON && responseJSON.form) {
+                        this.json = Object.merge(this.json, responseJSON.form);
+                    }
+                    if (callback) callback();
+                }.bind(this),
+                "onRequestFailure": function () {
+                    if (callback) callback();
+                }.bind(this),
+                "onError": function () {
+                    if (callback) callback();
+                }.bind(this)
+            }
         );
     },
     loadMacro: function (callback) {
@@ -828,6 +829,16 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
         var module = new MWF["APP" + json.type](node, json, this);
         if (beforeLoad) beforeLoad.apply(module);
         if (!this.all[json.id]) this.all[json.id] = module;
+
+        if ( json.name ){
+            if( this.allForName[json.name] ){
+                var item = this.allForName[json.name];
+                typeOf(item) === "array" ? item.push( module ) : this.allForName[json.name] = [item, module];
+            }else{
+                this.allForName[json.name] = module;
+            }
+        }
+
         if (module.field) {
             if (!this.forms[json.id]) this.forms[json.id] = module;
         }
@@ -1681,96 +1692,134 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
         var _self = this;
         if (!this.businessData.work.startTime) {
             this.startDraftProcess();
+        } else if( this.json.submitFormType === "select" ){
+            this.processWork_custom();
+        } else if( this.json.submitFormType === "script" ){
+            this.processWork_custom();
         } else {
             if (this.json.mode == "Mobile") {
                 setTimeout(function () {
                     this.processWork_mobile();
                 }.bind(this), 100);
-
             } else {
-                this.fireEvent("beforeProcessWork");
-                if (this.app && this.app.fireEvent) this.app.fireEvent("beforeProcessWork");
+                this.processWork_pc();
+            }
+        }
+    },
+    processWork_custom : function(){
+        this.fireEvent("beforeProcessWork");
+        if (this.app && this.app.fireEvent) this.app.fireEvent("beforeProcessWork");
 
-                if (!this.formCustomValidation("", "")) {
-                    this.app.content.unmask();
-                    //    if (callback) callback();
-                    return false;
-                }
-                // MWF.require("MWF.widget.Mask", function() {
-                //     this.mask = new MWF.widget.Mask({"style": "desktop", "zIndex": 50000});
-                //     this.mask.loadNode(this.app.content);
-
-                if (!this.formValidation("", "")) {
-                    this.app.content.unmask();
-                    //    if (callback) callback();
-                    return false;
-                }
+        if (!this.formCustomValidation("", "")) {
+            this.app.content.unmask();
+            //    if (callback) callback();
+            return false;
+        }
 
-                var setSize = function (notRecenter) {
-                    debugger;
-                    var dlg = this;
-                    if (!dlg || !dlg.node) return;
-                    dlg.node.setStyle("display", "block");
-                    var size = processNode.getSize();
-                    dlg.content.setStyles({
-                        "height": size.y,
-                        "width": size.x
-                    });
-                    var s = dlg.setContentSize();
-                    if (dlg.content.getStyle("overflow-y") === "auto" && dlg.content.getStyle("overflow-x") !== "auto") {
-                        var paddingRight = (dlg.content.getStyle("padding-right").toInt() || 0);
-                        if (paddingRight < 20) {
-                            dlg.node.setStyle("width", dlg.node.getStyle("width").toInt() + 20 + "px");
-                            dlg.content.setStyle("width", dlg.content.getStyle("width").toInt() + 20 + "px");
-                        }
-                    }
-                    if (!notRecenter) dlg.reCenter();
-                }
+        if (!this.formValidation("", "")) {
+            this.app.content.unmask();
+            //    if (callback) callback();
+            return false;
+        }
 
-                //var node = new Element("div", {"styles": this.css.rollbackAreaNode});
-                var processNode = new Element("div", { "styles": this.app.css.processNode_Area }).inject(this.node);
-                this.setProcessNode(processNode, "process", function (processor) {
-                    this.processDlg = o2.DL.open({
-                        "title": this.app.lp.process,
-                        "style": this.json.dialogStyle || "user",
-                        "isResize": false,
-                        "content": processNode,
-                        "maskNode": this.app.content,
-                        "positionHeight": 800,
-                        "maxHeight": 800,
-                        "maxHeightPercent": "98%",
-                        "minTop": 5,
-                        "width": "auto", //processNode.retrieve("width") || 1000, //600,
-                        "height": "auto", //processNode.retrieve("height") || 401,
-                        "buttonList": [
-                            {
-                                "type": "ok",
-                                "text": MWF.LP.process.button.ok,
-                                "action": function (d, e) {
-                                    if (this.processor) this.processor.okButton.click();
-                                }.bind(this)
-                            },
-                            {
-                                "type": "cancel",
-                                "text": MWF.LP.process.button.cancel,
-                                "action": function () {
-                                    this.processDlg.close();
-                                    if (this.processor) this.processor.destroy();
-                                }.bind(this)
-                            }
-                        ],
-                        "onPostLoad": function () {
-                            processor.options.mediaNode = this.content;
-                            setSize.call(this)
-                        }
-                    });
+        debugger;
+        if( !this.submitFormModule ){
+            if (!MWF["APPSubmitform"]) {
+                MWF.xDesktop.requireApp("process.Xform", "Subform", null, false);
+            }
+            var submitFormContainer = new Element("div").inject( layout.mobile ? $(document.body) : this.app.content );
+            this.submitFormModule = new MWF["APPSubmitform"]( submitFormContainer , this.json, this);
+            this.submitFormModule.addEvent("load", function () {
+                this.submitFormModule.show();
+            }.bind(this))
+            this.submitFormModule.load();
+        }else{
+            this.submitFormModule.show();
+        }
+    },
+    processWork_pc: function(){
+        var _self = this;
+        this.fireEvent("beforeProcessWork");
+        if (this.app && this.app.fireEvent) this.app.fireEvent("beforeProcessWork");
 
-                }.bind(this), function () {
-                    if (this.processDlg) setSize.call(this.processDlg, true)
-                }.bind(this));
+        if (!this.formCustomValidation("", "")) {
+            this.app.content.unmask();
+            //    if (callback) callback();
+            return false;
+        }
+        // MWF.require("MWF.widget.Mask", function() {
+        //     this.mask = new MWF.widget.Mask({"style": "desktop", "zIndex": 50000});
+        //     this.mask.loadNode(this.app.content);
 
-            }
+        if (!this.formValidation("", "")) {
+            this.app.content.unmask();
+            //    if (callback) callback();
+            return false;
         }
+
+        var setSize = function (notRecenter) {
+            debugger;
+            var dlg = this;
+            if (!dlg || !dlg.node) return;
+            dlg.node.setStyle("display", "block");
+            var size = processNode.getSize();
+            dlg.content.setStyles({
+                "height": size.y,
+                "width": size.x
+            });
+            debugger;
+            var s = dlg.setContentSize();
+            // if ( dlg.content.getStyle("overflow-y") === "auto" && dlg.content.getStyle("overflow-x") !== "auto" ) {
+            //     var paddingRight = (dlg.content.getStyle("padding-right").toInt() || 0 );
+            //     if( paddingRight < 20 ){
+            //         dlg.node.setStyle("width", dlg.node.getStyle("width").toInt() + 20 + "px");
+            //         dlg.content.setStyle("width", dlg.content.getStyle("width").toInt() + 20 + "px");
+            //     }
+            // }
+            if (!notRecenter) dlg.reCenter();
+        }
+
+        //var node = new Element("div", {"styles": this.css.rollbackAreaNode});
+        var processNode = new Element("div", { "styles": this.app.css.processNode_Area }).inject(this.node);
+        this.setProcessNode(processNode, "process", function ( processor ){
+            this.processDlg = o2.DL.open({
+                "title": this.app.lp.process,
+                "style": this.json.dialogStyle || "user",
+                "isResize": false,
+                "content": processNode,
+                "maskNode": this.app.content,
+                "positionHeight": 800,
+                "maxHeight": 800,
+                "maxHeightPercent": "98%",
+                "minTop": 5,
+                "width": "auto", //processNode.retrieve("width") || 1000, //600,
+                "height": "auto", //processNode.retrieve("height") || 401,
+                "buttonList": [
+                    {
+                        "type": "ok",
+                        "text": MWF.LP.process.button.ok,
+                        "action": function (d, e) {
+                            if (this.processor) this.processor.okButton.click();
+                        }.bind(this)
+                    },
+                    {
+                        "type": "cancel",
+                        "text": MWF.LP.process.button.cancel,
+                        "action": function () {
+                            this.processDlg.close();
+                            if (this.processor) this.processor.destroy();
+                        }.bind(this)
+                    }
+                ],
+                "onPostLoad": function () {
+                    processor.options.mediaNode = this.content;
+                    setSize.call(this)
+                }
+            });
+
+        }.bind(this), function () {
+            if (this.processDlg) setSize.call(this.processDlg, true)
+        }.bind(this));
     },
     processWork_mobile: function () {
         if (this.app.inBrowser) {
@@ -1878,7 +1927,7 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
                 "tabletWidth": this.json.tabletWidth || 0,
                 "tabletHeight": this.json.tabletHeight || 0,
                 "onPostLoad": function () {
-                    if (postLoadFun) postLoadFun(this);
+                    if (postLoadFun) postLoadFun( this );
                 },
                 "onResize": function () {
                     if (resizeFun) resizeFun();

+ 128 - 0
o2web/source/x_component_process_Xform/Org.js

@@ -1050,6 +1050,134 @@ MWF.APPOrg.EmpowerChecker = new Class({
         }
     },
     openSelectEmpowerDlg : function( data, orginData, callback, container ){
+        if( layout.mobile ){
+            this.openSelectEmpowerDlg_mobile(data, orginData, callback, container);
+        }else{
+            this.openSelectEmpowerDlg_pc(data, orginData, callback, container);
+        }
+    },
+    openSelectEmpowerDlg_mobile : function( data, orginData, callback, container ){
+
+        debugger;
+
+        var that = this;
+
+        //处理json
+        var subItemList = [];
+        // var empowerMap = {};
+
+        // var selectableItems = [];
+        var valueList = [];
+
+        data.each( function( d ){
+            subItemList.push({
+                "name" : d.fromIdentity.split("@")[0] + " 授权给 " + d.toIdentity.split("@")[0],
+                "id" : d.fromIdentity + "#" + d.toIdentity
+            })
+            valueList.push({
+                "name" : d.fromIdentity.split("@")[0] + " 授权给 " + d.toIdentity.split("@")[0],
+                "id" : d.fromIdentity + "#" + d.toIdentity
+            })
+            // empowerMap[ d.fromIdentity ] = d.toIdentity;
+        }.bind(this));
+
+        if( subItemList.length === 0 ){
+            callback();
+            return;
+        }
+        var empowerList = Array.clone(subItemList);
+
+        // selectableItems.push({
+        //     "empowerMap" : empowerMap,
+        //     "subItemList" : subItemList
+        // });
+
+        // if( selectableItems.length === 0 ){
+        //     callback();
+        //     return;
+        // }
+        // var empowerList = Array.clone(selectableItems);
+        o2.xDesktop.requireApp("Template", "Selector.Custom", function () {
+            var options = {
+                "count": 0,
+                "title": MWF.xApplication.process.Xform.LP.selectEmpower,
+                "selectAllEnable" : true,
+                "selectableItems": subItemList,
+                "expand": false,
+                "category": false,
+                "values": valueList,
+                "zIndex" : 3001,
+                "closeOnclickOk" : true,
+                "onComplete": function (items) {
+                    debugger;
+                    var arr = [];
+                    items.each(function (item) {
+                        arr.push( item.data.id )
+                    }.bind(this));
+
+                    var ignoreList = [];
+                    empowerList.each( function (obj) {
+                        if( arr.indexOf( obj.id ) === -1 )ignoreList.push( obj.id.split("#")[0] )
+                    });
+
+                    for( var i=0; i<orginData.length; i++ ){
+                        var d = orginData[i];
+                        if( ignoreList.indexOf( d.distinguishedName ) > -1 ){
+                            d.ignoreEmpower = true;
+                        }else if( d.ignoreEmpower ){
+                            delete  d.ignoreEmpower;
+                        }
+                    }
+                    if( callback )callback( orginData );
+
+                    // empowerList.each( function(obj){
+                    // var list = obj.subItemList.filter(function(item, index){
+                    //     return !arr.contains( item.id );
+                    // }.bind(this));
+                    // ignoreList = ignoreList.map(function(item,index){
+                    //     return item.id.split("#")[1];
+                    // })
+                    // });
+
+                    // empowerList.each( function(obj){
+                    //     var org = that.orgItemsObject[obj.orgId];
+                    //     // if( obj.ignoreList.length > 0 ){
+                    //     var data = org.getData();
+                    //     for( var i=0; i<data.length; i++ ){
+                    //         var d = data[i];
+                    //         if( obj.ignoreList.indexOf( d.distinguishedName ) > -1 ){
+                    //             d.ignoreEmpower = true;
+                    //         }else if( d.ignoreEmpower ){
+                    //             delete d.ignoreEmpower;
+                    //         }
+                    //     }
+                    //     org.setData( data );
+                        // }
+
+                        // if( obj.empowerMap ){
+                        //     var data = org.getValue();
+                        //     for( var i=0; i<data.length; i++ ){
+                        //         var d = data[i];
+                        //         if( obj.empowerMap[ d.distinguishedName ] ){
+                        //             d.empowerToIdentity = obj.empowerMap[ d.distinguishedName ];
+                        //         }
+                        //     }
+                        //     org.empowerData = Array.clone(data);
+                        // }
+
+                        // if(callback)callback();
+                    // })
+                }.bind(this)
+            };
+            if( this.form.json.selectorStyle ){
+                Object.merge(options, this.form.json.selectorStyle );
+            }
+            options.flatCategory = false;
+            var selector = new o2.xApplication.Template.Selector.Custom($(document.body), options);
+            selector.load();
+        }.bind(this))
+    },
+    openSelectEmpowerDlg_pc : function( data, orginData, callback, container ){
         var node = new Element("div", {"styles": this.css.empowerAreaNode});
         var html = "<div style=\"line-height: 20px; color: #333333; overflow: hidden\">"+MWF.xApplication.process.Xform.LP.empowerDlgText+"</div>";
         html += "<div style=\"margin-bottom:10px; margin-top:10px; overflow-y:auto;\"></div>";

+ 123 - 0
o2web/source/x_component_process_Xform/Subform.js

@@ -179,4 +179,127 @@ MWF.xApplication.process.Xform.Subform = MWF.APPSubform =  new Class({
             this.subformData.updateTime = data.updateTime;
         }
     }
+});
+
+
+MWF.xApplication.process.Xform.SubmitForm = MWF.APPSubmitform = new Class({
+    Extends: MWF.APPSubform,
+    _loadUserInterface: function(){
+        // this.node.empty();
+        this.getSubform(function(){
+            this.loadSubform();
+        }.bind(this));
+    },
+    reload: function(){
+        // this.node.empty();
+        this.getSubform(function(){
+            this.loadSubform();
+        }.bind(this));
+    },
+    show : function(){
+        if (this.json.submitScript.code) {
+            this.form.Macro.exec(this.json.submitScript.code, this);
+        }
+        // this.fireSubFormEvent("load");
+    },
+    // fireSubFormEvent : function( name ){
+    //     var events = this.subformData.json.events;
+    //     if( events && events[name] && events[name]["code"] ){
+    //         this.form.Macro.exec(events[name]["code"], this);
+    //     }
+    // },
+    loadSubform: function(){
+        if (this.subformData){
+            if( !this.checkSubformUnique( this.subformData.json.id ) ){ //如果提交表单已经嵌入到表单中,那么把这个表单弹出来
+                // this.form.notice(MWF.xApplication.process.Xform.LP.subformUniqueError, "error");
+                this.isEmbedded = true;
+            }else if( !this.checkSubformNested( this.subformData.json.id ) ){
+                this.form.notice(MWF.xApplication.process.Xform.LP.subformNestedError, "error");
+            }else{
+                //this.form.addEvent("postLoad", function(){
+
+                // this.fireSubFormEvent("queryLoad");
+                this.loadCss();
+
+                this.node.set("html", this.subformData.html);
+                Object.each(this.subformData.json.moduleList, function (module, key) {
+                    var formKey = key;
+                    if (this.form.json.moduleList[key]) {
+                        formKey = this.json.id + "_" + key;
+                        var moduleNode = this.node.getElement("#" + key);
+                        if (moduleNode) moduleNode.set("id", formKey);
+                        module.id = formKey;
+                    }
+                    this.form.json.moduleList[formKey] = module;
+                }.bind(this));
+
+                var moduleNodes = this.form._getModuleNodes(this.node);
+                moduleNodes.each(function (node) {
+                    if (node.get("MWFtype") !== "form") {
+                        var _self = this;
+                        var json = this.form._getDomjson(node);
+                        //if( json.type === "Subform" || json.moduleName === "subform" )this.form.subformCount++;
+                        var module = this.form._loadModule(json, node, function(){
+                            this.parentformIdList = _self.getParentformIdList();
+                        });
+                        this.form.modules.push(module);
+                    }
+                }.bind(this));
+
+                this.form.subformLoaded.push( this.subformData.json.id );
+                // this.fireSubFormEvent("postLoad");
+                // this.fireSubFormEvent("load");
+                // this.fireSubFormEvent("afterLoad");
+            }
+        }
+        // if( this.form.subformLoadedCount ){
+        //     this.form.subformLoadedCount++;
+        // }else{
+        //     this.form.subformLoadedCount = 1
+        // }
+        // this.form.checkSubformLoaded();
+    },
+    getSubform: function(callback){
+        var method = (this.form.json.mode !== "Mobile" && !layout.mobile) ? "getForm": "getFormMobile";
+        if (this.json.submitFormType==="script"){
+            if (this.json.submitFormScript.code){
+                var data = this.form.Macro.exec(this.json.submitFormScript.code, this);
+                if (data){
+                    var formName, app;
+                    if( typeOf( data ) === "string" ){
+                        formName = data;
+                    }else{
+                        if( data.application )app = data.application;
+                        if( data.subform )formName = data.subform;
+                    }
+                    if( formName ){
+                        if( !app )app = (this.form.businessData.work || this.form.businessData.workCompleted).application;
+                        MWF.Actions.get("x_processplatform_assemble_surface")[method](formName, app, function(json){
+                            this.getSubformData(json.data);
+                            if (callback) callback();
+                        }.bind(this));
+                    }else{
+                        if (callback) callback();
+                    }
+                }else{
+                    if (callback) callback();
+                }
+            }
+        }else{
+            if (this.json.submitFormSelected && this.json.submitFormSelected!=="none"){
+                var app;
+                if( this.json.submitFormAppSelected ){
+                    app = this.json.submitFormAppSelected;
+                }else{
+                    app = (this.form.businessData.work || this.form.businessData.workCompleted).application;
+                }
+                MWF.Actions.get("x_processplatform_assemble_surface")[method](this.json.submitFormSelected, app, function(json){
+                    this.getSubformData(json.data);
+                    if (callback) callback();
+                }.bind(this));
+            }else{
+                if (callback) callback();
+            }
+        }
+    }
 });