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

Merge branch 'feature/form_submit_event' into 'develop'

Merge of feature/form_submit_event to develop 流转后重定向功能

See merge request o2oa/o2oa!1021
胡起 5 лет назад
Родитель
Сommit
b6173cc661

+ 16 - 0
o2web/source/x_component_process_FormDesigner/Module/Form/form.html

@@ -159,6 +159,22 @@
                     秒后自动关闭</b></td>
             </tr>
         </table>
+
+        <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+            <tr>
+                <td class="editTableTitle">流转后:</td>
+                <td class="editTableValue">
+                    <input class="editTableRadio" onclick="if (this.checked){ $('text{$.pid}afterProcessActionArea').setStyle('display', 'none');}" name="afterProcessAction" text{($.afterProcessAction!=='redirect')?'checked':''} type="radio" value="close"/>关闭窗口
+                    <input class="editTableRadio" onclick="if (this.checked){ $('text{$.pid}afterProcessActionArea').setStyle('display', 'block'); }" name="afterProcessAction" text{($.afterProcessAction==='redirect')?'checked':''} type="radio" value="redirect"/>重定向
+                    <div>(仅用于新浏览器窗口打开时)</div>
+                </td>
+            </tr>
+        </table>
+        <div style="display: text{($.afterProcessAction=='redirect')?'block':'none'}" id="text{$.pid}afterProcessActionArea">
+            <div class="MWFScriptArea" name="afterProcessRedirectScript" title="重定向地址脚本"></div>
+            <span>(返回一个URL用于重定向)</span>
+        </div>
+
     </div>
     <div title="操作"  class="MWFTab" style="overflow: hidden; display: text{($.mode=='Mobile')?'block':'none'}">
         <div class="MWFDefaultActionArea" name="defaultTools" data-target="mobileForm"></div>

+ 23 - 4
o2web/source/x_component_process_Xform/Form.js

@@ -1506,7 +1506,12 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
                             if (this.json.isPrompt !== false) {
                                 this.showSubmitedDialog(json.data);
                             } else {
-                                this.app.close();
+                                if (this.json.afterProcessAction=="redirect" && this.json.afterProcessRedirectScript.code){
+                                    var url = this.Macro.exec(this.json.afterProcessRedirectScript.code, this);
+                                    (new URI(url)).go();
+                                }else{
+                                    this.app.close();
+                                }
                             }
                             //}
 
@@ -1591,7 +1596,7 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
         }
         var _work = this;
         options.onPostLoad = function () {
-
+            debugger;
             var dialog = this;
             dialog.node.setStyle("display", "block");
             var nodeSize = div.getSize();
@@ -1615,12 +1620,26 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
                             t = t - 1000;
                             window.setTimeout(countDown, 1000);
                         } else {
-                            dlg.close(); _work.app.close();
+                            dlg.close();
+
+                            if (_work.json.afterProcessAction=="redirect" && _work.json.afterProcessRedirectScript.code){
+                                var url = _work.Macro.exec(_work.json.afterProcessRedirectScript.code, _work);
+                                (new URI(url)).go();
+                            }else{
+                                _work.app.close();
+                            }
                         }
                     };
                     window.setTimeout(countDown, 1000);
                 } else {
-                    window.setTimeout(function () { dlg.close(); _work.app.close(); }, t);
+                    window.setTimeout(function () {
+                        if (_work.json.afterProcessAction=="redirect" && _work.json.afterProcessRedirectScript.code){
+                            var url = _work.Macro.exec(_work.json.afterProcessRedirectScript.code, _work);
+                            (new URI(url)).go();
+                        }else{
+                            _work.app.close();
+                        }
+                    }, t);
                 }
             }
         };