formbuilder_view.html 4.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <!DOCTYPE html>
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  6. <meta http-equiv="Pragma" content="no-cache" />
  7. <meta http-equiv="Cache-Control" content="no-cache" />
  8. <meta http-equiv="Expires" content="0" />
  9. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  10. <title>设计预览</title>
  11. <link href="../../AFrontEnd/css/animate.css" rel="stylesheet" />
  12. <link href="../../AFrontEnd/css/fontawesome/css/font-awesome.css" rel="stylesheet" />
  13. <link href="../../AFrontEnd/css/bootstrap.css" rel="stylesheet" />
  14. <link href="../../AFrontEnd/css/style.css" rel="stylesheet" />
  15. <script>document.write("<link href='../../AFrontEnd/css/special.css?time=" + new Date().getTime() + "' rel='stylesheet'>");</script>
  16. <script>document.write("<link href='css/formbuilder.css?time=" + new Date().getTime() + "' rel='stylesheet'>");</script>
  17. </head>
  18. <body class="sp-bg-white">
  19. <div class="sp-page" id="disignHtmlViewPart"></div>
  20. <script src="../../AFrontEnd/js/jquery/jquery-1.8.3.min.js"></script>
  21. <script src="../../AFrontEnd/js/laydate/laydate.js"></script>
  22. <script>document.write('<scri' + 'pt src="../../AFrontEnd/js/special/special.js?time=' + new Date().getTime() + '" type="text/javascript"></s' + 'cript>');;</script>
  23. <script src="../../AFrontEnd/plugins/spvld/spvld.js"></script>
  24. <script>document.write('<scri' + 'pt src="js/spbld.js?time=' + new Date().getTime() + '" type="text/javascript"></s' + 'cript>');;</script>
  25. <script type="text/javascript">
  26. window.addEventListener('message', function (event) {
  27. //通过origin属性判断消息来源地址
  28. if (event.data.name == "formBuilderHtml") {
  29. //jzsetLat(event.data.arg);
  30. if (event.data.arg!=0) {
  31. $("#disignHtmlViewPart").html(event.data.arg);
  32. sp.radio();///单选
  33. sp.checkbox();///多选
  34. spvld.getValidate();///开始正则校验组件
  35. spbld.laydate();////操作日期控件组件
  36. spbld.subtable();///操作子表按钮组件
  37. $("input[type='file']").attr("disabled", "disabled");///file上传控件先禁用,防止预览时乱上传文件
  38. //sp.uploadimg("http://103.233.7.57:8080/GoldFile/image/upload");////图片上传组件,先注释防止乱上传文件
  39. //sp.uploadfile("http://103.233.7.57:8080/GoldFile/stream/upload");///附件上传组件,先注释防止乱上传文件
  40. } else {
  41. var tip = "<div class='sp-table-tip' style='margin-top:-10px;'>您好,暂无表单设计</div>";
  42. $("#disignHtmlViewPart").html(tip);
  43. }
  44. }
  45. //alert(event.data.name); // 弹出"I was there!"
  46. //alert(event.source); // 对a.com、index.html中window对象的引用
  47. // 但由于同源策略,这里event.source不可以访问window对象
  48. }, false);
  49. //子表提交按钮事件,模拟
  50. function fbSubTableSubmitData(obj) {
  51. ///预览模拟
  52. var $currentTr = $(obj).closest("tr");
  53. setTimeout(function () {
  54. $(obj).hide();
  55. $currentTr.find('.fb-edit-data').css('display', 'inline-block');
  56. $currentTr.find('input').attr('disabled', 'disabled');
  57. $currentTr.find('select').attr('disabled', 'disabled');
  58. $currentTr.find('textarea').attr('disabled', 'disabled');
  59. //显示当前子表添加行按钮
  60. }, 100);
  61. $(obj).closest('table').find('.fb-add-data').removeAttr('disabled');
  62. $(obj).closest('table').find('.fb-edit-data').removeAttr('disabled');
  63. $(obj).closest('table').find('.fb-delete-data').removeAttr('disabled');
  64. }
  65. //子表删除按钮,模拟
  66. function fbSubTableDelData(obj) {
  67. // 先查找并隐藏当前点击行
  68. if ($(obj).closest('tr').index() == 0) {
  69. alert("您好,为了保证预览效果,第一行禁止删除");
  70. } else {
  71. if (confirm("您好,删除后不可恢复,您确认要删除吗")) {
  72. $(obj).closest('tr').hide();
  73. }
  74. else {
  75. return;
  76. }
  77. }
  78. //模拟移除当前行
  79. ///$(obj).closest('tr').remove();
  80. };
  81. </script>
  82. </body>
  83. </html>